NCBIWWW.py
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.
blasturl Do a BLAST search against the stable blasturl.
Imported modules
|
|
from Bio import File
from Bio.ParserSupport import *
from Bio.WWW import NCBI
import NCBIStandalone
import cStringIO
import re
import sgmllib
import socket
import string
import time
import urlparse
|
Functions
|
|
_parse_blast_ref_page
_parse_blast_results_page
_send_to_blasturl
blast
blasturl
|
|
_parse_blast_ref_page
|
_parse_blast_ref_page ( handle )
_parse_blast_ref_page(handle, base_cgi) -> cgi, parameters
Exceptions
|
|
SyntaxError, "Error getting BLAST results: RID not found"
SyntaxError, "Form broken in BLAST reference page"
|
|
|
_parse_blast_results_page
|
_parse_blast_results_page ( handle )
_parse_blast_results_page(handle) -> ready, cgi, params
Exceptions
|
|
SyntaxError, "I expected 2 forms in the results page."
|
|
|
_send_to_blasturl
|
_send_to_blasturl ( query, outhandle )
_send_to_blasturl(query, outhandle)
Send a BLAST request to the stable blasturl server at the NCBI.
ftp://ncbi.nlm.nih.gov/blast/blasturl/
The results are written to outhandle.
|
|
blast
|
blast (
program,
database,
query,
query_from='',
query_to='',
entrez_query='(none)',
filter='L',
expect='10',
word_size=None,
ungapped_alignment='no',
other_advanced=None,
cdd_search='on',
composition_based_statistics=None,
matrix_name=None,
run_psiblast=None,
i_thresh='0.001',
genetic_code='1',
show_overview='on',
ncbi_gi='on',
format_object='alignment',
format_type='html',
descriptions='100',
alignments='50',
alignment_view='Pairwise',
auto_format='on',
cgi='http://www.ncbi.nlm.nih.gov/blast/Blast.cgi',
timeout=20,
output_fn=None,
)
blast(program, database, query[, query_from][, query_to]
[, entrez_query][, filter][, expect]
[, word_size][, other_advanced][, cdd_search]
[, composition_based_statistics][, matrix_name][, run_psiblast]
[, i_thresh][, genetic_code][, show_overview][, ncbi_gi]
[, format_object][, format_type][, descriptions][, alignments]
[, alignment_view][, auto_format][, cgi][, timeout]) -> handle Blast against the NCBI Blast web page. This uses the NCBI web
page cgi script to BLAST, and returns a handle to the
results. See:
http://www.ncbi.nlm.nih.gov/blast/html/blastcgihelp.html
for more descriptions about the options.
Required Inputs:
o program - The name of the blast program to run (ie. blastn, blastx...)
o database - The database to search against (ie. nr, dbest...)
o query - The input for the search, which NCBI tries to autodetermine
the type of. Ideally, this would be a sequence in FASTA format.
General Options:
filter, expect, word_size, other_advanced
Formatting Options:
show_overview, ncbi_gi, format_object, format_type, descriptions,
alignments, alignment_view, auto_format
Protein specific options:
cdd_search, composition_based_statistics, matrix_name, run_psiblast,
i_thresh
Translated specific options:
genetic code
Exceptions
|
|
IOError, "timed out after %d minutes" % timeout
ValueError( "Unexpected program name %s" % program )
|
|
|
blasturl
|
blasturl (
program,
datalib,
sequence,
ncbi_gi=None,
descriptions=None,
alignments=None,
expect=None,
matrix=None,
gap_existence=None,
gap_extend=None,
gapped=None,
filter=None,
html=None,
gcode=None,
path=None,
)
blasturl(program, datalib, sequence[, ncbi_gi][, descriptions]
[, alignments][, expect][, matrix][, gap_existence][, gap_extend]
[, gapped][, filter][, html][, gcode]) -> handle Do a BLAST search using the stable URL provided by NCBI.
program BLASTP, BLASTN, BLASTX, TBLASTN, or TBLASTX.
datalib Which database to search against.
sequence The sequence to search.
ncbi_gi TRUE/FALSE whether to give gi identifier. Def FALSE.
descriptions Number of descriptions to show. Def 100.
alignments Number of alignments to show. Def 50.
expect An expect value cutoff.
matrix Specify an alt. matrix (PAM30, PAM70, BLOSUM80, BLOSUM45).
gap_existence Give a gap open penalty.
gap_extend Give a gap extension penalty.
gapped TRUE/FALSE for giving gapped alignments. Def TRUE.
filter "none" turns off filtering. Default uses seg or dust .
html TRUE/FALSE for html output. Def FALSE.
gcode Specify an alternate genetic code for (T)BLASTX.
This function does no checking of the validity of the parameters
and passes the values to the server as is. More help is available at:
http://www.ncbi.nlm.nih.gov/BLAST/blast_overview.html
|
Classes
|
|
BlastParser |
Parses WWW BLAST data into a Record.Blast object.
|
_FormParser |
Parse a form in an HTML page.
|
_Scanner |
Scan BLAST output from NCBI's web server at:
|
|
|