[Biopython-dev] Re: Blast parser

Brad Chapman chapmanb at arches.uga.edu
Thu Sep 27 17:02:33 EDT 2001


Hi Jeong;
I'm ccing this message to biopython-dev at biopython.org. By the way,
asking your questions there is probably a better place than asking
me directly, as there are lots of people there to help.

> Hello, I would like to know if the blast standalone parser supports parsing
> of the BLASTX results. When I use blast standalone parser to parse BLASTX
> results, I get an error message of the following:
[...]
> SyntaxError: Line does not start with 'length of query':
> length of database: 27,975,647

Yup, it looks like the blastx output format has changed somewhat
since the last time it was used/tested with blastx. The specific
things that have changed are the lack of the following lines in
blastx output:

'length of query'
'effective length of query'
'effective search space:'
'S2'

I've fixed Bio/Blast/NCBIStandalone.py so that it works again on
blastx. The diff to this file is attached. Jeff, if you have a
chance could you give me the okay on this before I check it in? The
current regression tests all pass with these changes. When I check
it in, I can also add the blastx example file I used to fix this.

Jeong, thanks for the bug report! Please let us know if this fix
doesn't get things working again for you.

Brad
-- 
PGP public key available from http://pgp.mit.edu/
-------------- next part --------------
*** NCBIStandalone.py.orig	Wed Sep  5 17:22:14 2001
--- NCBIStandalone.py	Thu Sep 27 17:01:34 2001
***************
*** 462,481 ****
                            start="Number of HSP's that")
              read_and_call(uhandle, consumer.hsps_gapped,
                            start="Number of HSP's gapped")
! 
!         read_and_call(uhandle, consumer.query_length,
!                       start='length of query')
          read_and_call(uhandle, consumer.database_length,
                        start='length of database')
  
          read_and_call(uhandle, consumer.effective_hsp_length,
                        start='effective HSP')
!         read_and_call(uhandle, consumer.effective_query_length,
!                       start='effective length of query')
          read_and_call(uhandle, consumer.effective_database_length,
                        start='effective length of database')
!         read_and_call(uhandle, consumer.effective_search_space,
!                       start='effective search space')
          # Does not appear in BLASTP 2.0.5
          attempt_read_and_call(uhandle, consumer.effective_search_space_used,
                                start='effective search space used')
--- 462,484 ----
                            start="Number of HSP's that")
              read_and_call(uhandle, consumer.hsps_gapped,
                            start="Number of HSP's gapped")
!         # not in blastx 2.2.1
!         attempt_read_and_call(uhandle, consumer.query_length,
!                               start='length of query')
          read_and_call(uhandle, consumer.database_length,
                        start='length of database')
  
          read_and_call(uhandle, consumer.effective_hsp_length,
                        start='effective HSP')
!         # Not in blastx 2.2.1
!         attempt_read_and_call(uhandle, consumer.effective_query_length,
!                               start='effective length of query')
          read_and_call(uhandle, consumer.effective_database_length,
                        start='effective length of database')
!         # Not in blastx 2.2.1, added a ':' to distinguish between
!         # this and the 'effective search space used' line
!         attempt_read_and_call(uhandle, consumer.effective_search_space,
!                               start='effective search space:')
          # Does not appear in BLASTP 2.0.5
          attempt_read_and_call(uhandle, consumer.effective_search_space_used,
                                start='effective search space used')
***************
*** 490,496 ****
          attempt_read_and_call(uhandle, consumer.gap_x_dropoff_final,
                                start='X3')
          read_and_call(uhandle, consumer.gap_trigger, start='S1')
!         read_and_call(uhandle, consumer.blast_cutoff, start='S2')
  
          consumer.end_parameters()
  
--- 493,507 ----
          attempt_read_and_call(uhandle, consumer.gap_x_dropoff_final,
                                start='X3')
          read_and_call(uhandle, consumer.gap_trigger, start='S1')
!         # not in blastx 2.2.1
!         # need to enclose this inside a try/except because 
!         # attempt_read_and_call will still complain about end of stream.
!         # All attempts are made to be sure we've got the expected error
!         try:
!             read_and_call(uhandle, consumer.blast_cutoff, start='S2')
!         except SyntaxError, reason:
!             assert str(reason) == "Unexpected end of stream.", \
!               "Unexpected reason: '%s'" % reason
  
          consumer.end_parameters()
  


More information about the Biopython-dev mailing list