in reply to sorting and other problems in hash
Output will be like thisopen(FILE1,"file1.txt") or die $!;@file1=<FILE1>;close(FILE1); open(FILE2,"file2.txt") or die $!;@file2=<FILE2>;close(FILE2); foreach $file2(@file2){ if($file2=~/(\w+)(_)(\w+)\s(\w+)(=)(\d+)/) { $id=$1; if($3 eq 'right'){$value=$6."r#";} if($3 eq 'left'){$value=$6."l";} push(@array,"$value"); push(@id,"$id"); } } push(@newid,grep {!$ss{$_}++} @id); @arraysplit=@array2=$ss=(); $ss=join('',@array); @arraysplit=split(/\s+|\n/,$ss); @array2=split('#',$arraysplit[0]); foreach $f1(0 .. $file1[$#fiel1]) { if($file1[$f1] =~/>/){ $firstline=$file1[$f1]; chomp($firstli +ne); } if($file1[$f1] =~/^>/) { $secondline=$file1[$f1+1]; $secondlinej=join('',split(/\n/,$secondline)); foreach $vv(0 .. scalar @array2) { if($newid[$vv] eq substr($firstline,1,6)) { ($left,$right)=split(/r|l/,$array2[$vv +]); print "\n".substr($firstline,0,7)."_le +ft"." length=$left \n"; @secondlinejj=split('\s',$secondlinej) +; for ($l=0;$l < $left;$l++){print "$sec +ondlinejj[$l] ";} print "\n"; print "\n".substr($firstline,0,7)."_ri +ght"." length=$right \n"; $len=scalar @secondlinejj."\n"; $right=$len-$right; for ($m=$right;$m <= scalar @secondlin +ejj;$m++){print "$secondlinejj[$m] ";}print "\n" } } } }
>AAAT3R_left length=6 40 40 40 40 40 40 >AAAT3R_right length=62 40 40 40 40 40 38 38 37 39 36 36 40 36 35 35 35 38 40 35 35 33 35 35 3 +5 40 40 40 40 37 37 38 38 38 40 40 40 40 40 40 40 40 40 40 40 40 40 4 +0 40 40 37 36 36 31 22 22 22 20 20 20 20 20 14 >AAA2OJ_left length=14 18 18 18 21 35 35 35 32 32 32 33 35 38 39 >AAA2OJ_right length=14 37 37 37 37 3737 33 32 32 30 20 17 17 17 0
|
|---|