Hello,
I am new to perl and to this forum...
I would hihly appreciate if anyone could help with the problem I encountered:
In the following script (matching a string +peptide sequence+ to a protein sequence), why at the end when I print the results I cannot see which string (peptide) matches which protein sequence. In practice, when I do: print "found '$peptide' in $test_prot_id\n"; it says : "found '' in blala" (so $peptide remain blank) in other words it reports the protein sequence ID but not the matching string. Thank you in advanvce for your help,
while(<MYFILE2>) { chomp ($_); push(@peptide, $_); #adds each line to an array print "peptides: @peptide\n"; foreach my $test_prot_id (keys %proteins) { my $test_prot_seq = $proteins{$test_prot_id}; if ($test_prot_seq =~/($peptide)/) { print "found $peptide in $test_prot_id\n"; $results{$test_prot_id} ++; } } }
In reply to matching &printing S variable of an array by Bijgom
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |