in reply to Re: match two files
in thread match two files
#!/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;
|
|---|