[BioRuby] More Bl2seq questions
GOTO Naohisa
ngoto at gen-info.osaka-u.ac.jp
Sun Sep 11 09:41:08 EDT 2005
Hi,
On Thu, 08 Sep 2005 17:05:13 -0500
Trevor Wennblom <trevor at corevx.com> wrote:
> Another question regarding Bl2seq.
>
> This works:
> Bio::FlatFile.open(Bio::Blast::Bl2seq::Report, filename_bl2seq_output)
> do |ff|
> ff.each do |rep|
> rep.iterations.each do |itr|
> itr.hits.each do |hit|
> a = hit.identity
> end
> end
> end
> end
>
> But this doesn't:
> Bio::FlatFile.open(Bio::Blast::Bl2seq::Report, filename_bl2seq_output)
> do |ff|
> ff.each do |rep|
> rep.iterations.each do |itr|
> itr.hits.each do |hit|
> a = hit.percent_identity
> end
> end
> end
> end
>
> To make it work I have to go down to the HSP level:
> Bio::FlatFile.open(Bio::Blast::Bl2seq::Report, filename_bl2seq_output)
> do |ff|
> ff.each do |rep|
> rep.iterations.each do |itr|
> itr.hits.each do |hit|
> hit.hsps.each do |hsp|
> a = hsp.percent_identity
> end
> end
> end
> end
> end
>
>
> Shouldn't we be able to see percent_identity, percent_positive,
> positive, etc. on the hit level?
This is because bl2seq (and BLAST) reports percent_identity on every
Hsp and does not report percent_identity for Hit. Hit#identity is only
a shortcut method of hsps[0].identity. It is prepared because of keeping
compatibility(polymorphism) with Fasta::Hit class which doesn't have Hsp.
percent_identity is not prepared for Hit object because Fasta::Hit does
not have it. Please use hsps[0].percent_identity instead. Note that
percent identity of each Hsp means identity / alignment length of Hsp
and cannot always be applyed to hit.
--
Naohisa GOTO
ngoto at gen-info.osaka-u.ac.jp
Department of Genome Informatics, Genome Information Research Center,
Research Institute for Microbial Diseases, Osaka University, Japan
More information about the BioRuby
mailing list