here is what i've been trying to do. i have two arrays (@arr1 and @arr2) which i compare and get the difference in them, which work fine. but now i'm trying to get the info (ie, the id of the sequence) from the file that has the difference ('diff_file'),and compare it with the id in the sequence itself (starts with '>') from the 'mySeqFile', and get just that sequece. i'm stucked at this point. i hope i'm clear. following is the sample of the mySeqFile and the script:
any help would be really appreciated.
--------mySeqFile---------
>ebA1155
MRMKACFNLFRVRDRFVLLAKDILPEDAKDILPEDAKDILP
QSQKMLADPLMQNDEVRAACDAPKVGIDDMLATIFRH
>ebA5 ebA5
MSVIAIHAAIVGVTVVVAYVLHMRTVAKDILPEDSRVFVHY
YGRINKLLCDAPKVGIDDMLATIFRHVPNGEFDQALERARS
------theScript----------------
Expand|Select|Wrap|Line Numbers
- #!/urs/bin/perl -w
- my @arr2 = (ebA1135, ebA1158, ebA1251, ebA150);
- my $differ = 'diff_file';
- open(OF1, ">$differ");
- my $fasta = './mySeqFile';
- open(FH3, "<$fasta");
- my $file1 = '2tmsNabove.tab';
- open(FH1,"<$file1");
- while (<FH1>) {
- if ($_ =~ /(\S+)\t(\S+)\t(\S+)/) {
- push(@arr1, $1); next;
- }
- }
- my %arr1 = map{$_ => 1} @arr1;
- my %arr2 = map{$_ => 1} @arr2;
- my @diff = grep(!defined $arr2{$_}, @arr1);
- foreach $diff (@diff) {
- my $num = $diff;
- while (<FH3>) {
- if ($_ =~ /^\>(\S+).+/) {
- if ($num eq $1) {
- # print $_; next;
- do {
- push(@seq, $_);
- next;
- } until ($_ =~ /^\>/);
- next;
- }
- }
- }
- }