in reply to parsing blast output
In my opinion when I see eight consecutive "}"'s in a row, I figure that something is wrong with the code - too many levels of indentation!if( $hsp->length('total') > 1000 ) { if ( $hsp->percent_identity >= 90 ) { if( $hsp->score ){ if( $hsp->gaps ){ if( $hsp->expect ){ print "Hit= ", $hit->name, " Length=", $hsp->length('total'), " Score=", $hsp->score,"\n"; print "Gaps=", $hsp->gaps, " Expect=", $hsp->expect, " Percent_id=", $hsp->percent_identity, "\n"; my $aln = $hsp->get_aln; my $alnIO = Bio::AlignIO->new(-format =>"clustalw", -file +=> $out); $alnIO->write_aln($aln); } } } } } ## better is to reduce the levels of "if" by using "and" or && if ( ($hsp->length('total') > 1000 ) && ($hsp->percent_identity >= 90 ) && ($hsp->score ) && ($hsp->gaps) && ($hsp->expect) ) { #do your print stuff }
I was looking at your while loop and it is hard for me to say exactly how to make that better as there can be a lot of cases here and I am unable to run your current code without installing some modules.
Can you simplify your question?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: parsing blast output
by lomSpace (Scribe) on May 04, 2009 at 17:16 UTC | |
by Marshall (Canon) on May 05, 2009 at 15:50 UTC |