THANK U ALL FOR THE HELP...Am learning a lot :)#!/usr/bin/perl open FILE,"seq.txt"; open OUT1,">seq.out"; open OUT2,">num.out"; $seq = "";$num = ""; while(<FILE>) { if($_ =~ /^>/) { push(@seq,$seq) if $seq; $seq=''; push(@seq,"\n$_"); } else { $_ =~ s/\s*$//; $seq = $seq.$_; } } push(@seq,$seq); close(FILE); open FILE,"num.txt"; while(<FILE>) { if($_ =~ /^>/) { push(@num,$num) if $num; $num=''; push(@num,"\n$_"); } else { $_ =~ s/\s*$/ /; $num = $num."$_"; } } push(@num,$num); close(FILE); while($_ = shift @seq) { my @marker; if( $_ =~ />/ ) { $shead = $_; $nhead = shift @num; $seq = shift @seq; $num = shift @num; #print $seq,"\n"; #print $num,"\n"; @s = split (//,$seq); @n = split (/ /,$num); $pre = "null"; $cnt = 1; $arrcnt = -1; foreach(@s) { if($_ eq $pre) { $cnt++; } else { if ($cnt >= 3 && $n[$arrcnt] < 10) { push(@marker,$arrcnt); } $cnt = 1; } $pre = $_; $arrcnt++; } $exp = 0; foreach(@marker) { $_ = $_ - $exp; splice(@n,$_,1); splice(@s,$_,1); $exp++; } $seq = join(" ",@s); $num = join(" ",@n); print OUT1 $shead; print OUT1 $seq,"\n"; print OUT2 $shead; print OUT2 $num,"\n"; } else { print "give proper input file"; exit; } }
In reply to Re^2: deleting a particular character and its coresponding score in 2 different files!!!
by Anonymous Monk
in thread deleting a particular character and its coresponding score in 2 different files!!!
by heidi
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |