i have just given the same values as example. my program follows:read.txt >s1 A G C T G G G G A C T T T A G C >s2 A G C T G G G G A C T T T A G C >s3 A G C T G G G G A C T T T A G C and num.txt is >s1 34 23 43 45 34 43 45 7 45 43 12 34 32 56 43 >s2 34 23 43 45 34 43 45 7 45 43 12 34 32 56 43 >s3 34 23 43 45 34 43 45 7 45 43 12 34 32 56 43
#!/usr/bin/perl open(FH1,"read.txt"); open(FH2,"num.txt"); @arr1=<FH1>; @arr2=<FH2>; $joi1=join('',@arr1); $joi2=join('',@arr2); @new=split('>',$joi1); @numbers=split('>',$joi2); foreach(@new){ ($seq_id,$seq)=split(/\n/,$_); push(@alp,split('',$seq)); push(@seqid,$seq_id); } foreach(@numbers){ ($num_id,$numb)=split(/\n/,$_); push(@num,split(' ',$numb)); push(@numid,$num_id) } #my @alp=split(' ','A G G G G T C A A A T C'); #my @num=split(' ','23 34 54 23 2 43 54 56 23 5 76 34'); my @keep= grep {$_ < 1 || $num[$_]>=10 || $alp[$_-1] ne $alp[$_-0]} 0. +.$#num; foreach(@seqid){ print "$_\n"; print (join(' ',@alp[@keep]),"\n"); } foreach(@numid){ print "$_\n"; print (join(' ',@num[@keep]),"\n"); }
In reply to Re^4: finding position
by heidi
in thread finding position
by heidi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |