Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: match two files

by yueli711 (Sexton)
on Dec 09, 2020 at 07:00 UTC ( [id://11124869]=note: print w/replies, xml ) Need Help??


in reply to Re: match two files
in thread match two files

Hello GrandFather, Thank you so much for your great help! Really appreciate your great help! Best, Yue
#!/usr/bin/perl use warnings; use strict; open my $TAB01, '<', 'tmp01_quick' or die "Cannot open 'donor_82_01.cs +v' because: $!"; open my $TAB02, '<', 'tmp02_quick' or die "Cannot open 'tmp12' because +: $!"; open my $OUT, '>', 'tmp12_01_QUICK' or die "Cannot open 'tmp12_01' bec +ause: $!"; my $tmp11_QUICK = ''; my %peptides; #open my $TAB01, '<', \$tmp01_quick; while (<$TAB01>) { chomp; my ($peptide, $protein) = split /\t+/; next if $peptide !~ /\d/; #$peptides{$peptide} //= []; push @{$peptides{$peptide}}, $protein; } #open my $TAB02, '<', \$tmp02_quick; #open my $OUT, '>', \$tmp11_QUICK; while (<$TAB02>) { chomp; my ($peptide, $spectrum, $sequence) = split /\t+/; next if $peptide !~ /\d/; print $OUT "$peptide\t$_\t$spectrum\t$sequence\n" for @{$peptides{ +$peptide}}; } close $OUT; print $tmp11_QUICK;

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11124869]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (7)
As of 2024-04-25 08:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found