biotite.application.blast.BlastWebApp¶
- class biotite.application.blast.BlastWebApp(program, query, database='nr', app_url='https://blast.ncbi.nlm.nih.gov/Blast.cgi', obey_rules=True, mail='padix.key@gmail.com')[source]¶
Bases:
WebApp
Perform a local alignment against a large sequence database using using the web-based BLAST application (by default NCBI BLAST).
- Parameters:
- programstr
The specific BLAST program. One of ‘blastn’, ‘megablast’, ‘blastp’, ‘blastx’, ‘tblastn’ and ‘tblastx’.
- querySequence or str
The query sequence. If a string is provided, it is interpreted as path to a FASTA file, if the string contains a valid FASTA file extension, otherwise it is interpreted as a single letter string representation of a sequence.
- databasestr, optional
The NCBI sequence database to blast against. By default it contains all sequences (database`=’nr’).
- app_urlstr, optional
URL of the BLAST web app. By default NCBI BLAST is used. This can be changed to a private server or another cloud provider.
- obey_rulesbool, optional
If true, the application raises an
RuleViolationError
, if the server is contacted too often, based on the NCBI BLAST usage rules. (Default: True)- mailstr, optional
If a mail address is provided, it will be appended in the HTTP request. This allows the NCBI to contact you in case your application sends too many requests.
- app_url()¶
Get the URL of the web app.
- Returns:
- urlstr
URL of the web app.
- cancel()¶
Cancel the application when in RUNNING or FINISHED state.
- clean_up()¶
Do clean up work after the application terminates.
PROTECTED: Optionally override when inheriting.
- get_alignments()¶
Get the resulting local sequence alignments.
- Returns:
- alignmentlist of BlastAlignment
The local sequence alignments.
- get_app_state()¶
Get the current app state.
- Returns:
- app_stateAppState
The current app state.
- get_xml_response()¶
Get the raw XML response.
- Returns:
- responsestr
The raw XML response.
- is_finished()¶
Check if the application has finished.
PROTECTED: Override when inheriting.
- Returns:
- finishedbool
True of the application has finished, false otherwise
- join(timeout=None)¶
Conclude the application run and set its state to JOINED. This can only be done from the RUNNING or FINISHED state.
If the application is FINISHED the joining process happens immediately, if otherwise the application is RUNNING, this method waits until the application is FINISHED.
- Parameters:
- timeoutfloat, optional
If this parameter is specified, the
Application
only waits for finishing until this value (in seconds) runs out. After this time is exceeded aTimeoutError
is raised and the application is cancelled.
- Raises:
- TimeoutError
If the joining process exceeds the timeout value.
- set_entrez_query(query)¶
Limit the size of the database. Only sequences that match the query are searched.
- Parameters:
- queryQuery
An NCBI Entrez query.
- set_gap_penalty(opening, extension)¶
Set the affine gap penalty for the alignment.
- Parameters:
- openingfloat
The penalty for gap opening.
- extensionfloat
The penalty for gap extension.
- set_match_reward(reward)¶
Set the score of a symbol match in the alignment.
Used only in ‘blastn’ and ‘megablast’.
- Parameters:
- rewardint
Match reward. Must be positive.
- set_max_expect_value(value)¶
Set the threshold expectation value (E-value). No alignments with an E-value above this threshold will be considered.
The E-Value is the expectation value for the number of random sequences of a similar sized database getting an equal or higher score by change when aligned with the query sequence.
- Parameters:
- valuefloat
The threshold E-value.
- set_max_results(number)¶
Limit the maximum number of results.
- Parameters:
- numberint
The maximum number of results.
- set_mismatch_penalty(penalty)¶
Set the penalty of a symbol mismatch in the alignment.
Used only in ‘blastn’ and ‘megablast’.
- Parameters:
- penaltyint
Mismatch penalty. Must be negative.
- set_substitution_matrix(matrix_name)¶
Set the penalty of a symbol mismatch in the alignment.
Used only in ‘blastp’, “blastx’, ‘tblastn’ and ‘tblastx’.
- Parameters:
- matrix_namestr
Name of the substitution matrix. Default is ‘BLOSUM62’.
- set_threshold(threshold)¶
Set the threshold neighboring score for initial words.
Used only in ‘blastp’, “blastx’, ‘tblastn’ and ‘tblastx’.
- Parameters:
- thresholdint
Threshold value. Must be positve.
- set_word_size(size)¶
Set the word size for alignment seeds.
- Parameters:
- sizeint
Word size.
- start()¶
Start the application run and set its state to RUNNING. This can only be done from the CREATED state.
- violate_rule(msg=None)¶
Indicate that a server rule was violated, i.e. this raises a
RuleViolationError
unless obey_rules is false.PROTECTED: Do not call from outside.
- Parameters:
- msgstr, optional
A custom message for the
RuleViolationError
.
- wait_interval()¶
The time interval of
is_finished()
calls in the joining process.PROTECTED: Override when inheriting.
- Returns:
- intervalfloat
Time (in seconds) between calls of
is_finished()
injoin()
Gallery¶

Mutual information as measure for coevolution of residues