# Copyright 1999 by Jeffrey Chang. All rights reserved. # This code is part of the Biopython distribution and governed by its # license. Please see the LICENSE file that should have been included # as part of this package. # Patched by Brad Chapman. # Chris Wroe added modifications for work in myGrid """ This module provides code to work with the WWW version of BLAST provided by the NCBI. http://www.ncbi.nlm.nih.gov/BLAST/ Classes: BlastParser Parses output from WWW blast. _Scanner Scans output from NCBI's BLAST WWW server. Functions: blast Do a BLAST search against the WWW page. (Deprecated) blasturl Do a BLAST search against the stable blasturl. (Deprecated) qblast Do a BLAST search using the QBLAST API. """ import string import re import sgmllib try: import cStringIO as StringIO except ImportError: import StringIO from Bio.ParserSupport import * class BlastParser(AbstractParser): """Parses WWW BLAST data into a Record.Blast object. """ def __init__(self): """__init__(self)""" import NCBIStandalone self._scanner = _Scanner() self._consumer = SGMLStrippingConsumer(NCBIStandalone._BlastConsumer()) def parse(self, handle): """parse(self, handle)""" self._scanner.feed(handle, self._consumer) return self._consumer.data class _Scanner: """Scan BLAST output from NCBI's web server at: http://www.ncbi.nlm.nih.gov/BLAST/ Tested with BLAST v2.0.10 Methods: feed Feed data into the scanner. """ def feed(self, handle, consumer): """S.feed(handle, consumer) Feed in a BLAST report for scanning. handle is a file-like object that contains the BLAST report. consumer is a Consumer object that will receive events as the report is scanned. """ from Bio import File # This stuff appears in 2.0.12. #
# #
#
# BLAST Formatted information
#
#
#
#