Main Content

bioinfo.pipeline.block.BLASTN

Create BLASTN query block

Since R2024a

  • blastn block icon

Description

A BLASTN block enables you to search a local BLAST+ database using the blastn query program [1][2], which searches a nucleotide query against a nucleotide database.

bioinfo.pipeline.block.BLASTN requires the BLAST+ Support Package for Bioinformatics Toolbox™. If this support package is not installed, then the function provides a download link. For details, see Bioinformatics Toolbox Software Support Packages.

Creation

Description

b = bioinfo.pipeline.block.BLASTN creates a BLASTN block.

example

b = bioinfo.pipeline.block.BLASTN(options) uses additional options specified by options.

b = bioinfo.pipeline.block.BLASTN(Name=Value) specifies additional options using one or more name-value arguments. The name-value arguments set the property names and values of a bioinfo.blastplus.BLASTNOptions object. These property values are assigned to the Options property of the block.

Input Arguments

expand all

blastn query options, specified as a bioinfo.blastplus.BLASTNOptions object, string scalar, or character vector.

If you specify a string scalar or character vector, it must be in the native syntax (prefixed by a dash).

Data Types: char | string

Properties

expand all

Function to handle errors from the run method of the block, specified as a function handle. The handle specifies the function to call if the run method encounters an error within a pipeline. For the pipeline to continue after a block fails, ErrorHandler must return a structure that is compatible with the output ports of the block. The error handling function is called with the following two inputs:

  • Structure with these fields:

    FieldDescription
    identifierIdentifier of the error that occurred
    messageText of the error message
    indexLinear index indicating which block process failed in the parallel run. By default, the index is 1 because there is only one run per block. For details on how block inputs can be split across different dimensions for multiple run calls, see Bioinformatics Pipeline SplitDimension.

  • Input structure passed to the run method when it fails

Data Types: function_handle

This property is read-only.

Input ports of the block, specified as a structure. The field names of the structure are the names of the block input ports, and the field values are bioinfo.pipeline.Input objects. These objects describe the input port behaviors. The input port names are the expected field names of the input structure that you pass to the block run method.

The BLASTN block Inputs structure has the following fields:

  • QueryFile — Name of a file containing query sequences. This input is required and must be satisfied.

  • BlastDatabase — Name of a BLAST+ database to search. This input is required and must be satisfied.

Data Types: struct

This property is read-only.

Output ports of the block, specified as a structure. The field names of the structure are the names of the block output ports, and the field values are bioinfo.pipeline.Output objects. These objects describe the output port behaviors. The field names of the output structure returned by the block run method are the same as the output port names.

The BLASTN block Outputs structure has a field named BlastReport, which contains the full path to the report file with the BLAST search results.

Data Types: struct

blastn query options, specified as a bioinfo.blastplus.BLASTNOptions object. The default value is a default bioinfo.blastplus.BLASTNOptions object.

Name of the report file with the search results, specified as a string scalar or character vector.

Data Types: char | string

Object Functions

compilePerform block-specific additional checks and validations
copyCopy array of handle objects
emptyInputsCreate input structure for use with run method
evalEvaluate block object
runRun block object

Examples

collapse all

Import the pipeline and blocks needed for the pipeline so that you can create these objects without specifying the entire namespace.

import bioinfo.pipeline.Pipeline
import bioinfo.pipeline.block.*

Create a pipeline.

P = Pipeline;

Create an SRAFasterqDump block to download some paired-end sequencing data in the FASTA format using the accession run number SRR26273031.

sraBlock                     = SRAFasterqDump;
sraBlock.Inputs.SRRID.Value  = "SRR26273031";
sraBlock.Options.FastaOutput = true;
addBlock(P,sraBlock);

Create a local nucleotide BLAST+ database.

bpDatabase                  = MakeBlastDatabase;
bpDatabase.DatabaseFilename = "SRR26273031_nucl_db";
bpDatabase.Type             = "nucleotide";
bpDatabase.Options.Title    = "SRR26273031_Nucleotide_DB";
addBlock(P,bpDatabase);

Connect sraBlock and bpDatabase.

connect(P,sraBlock,bpDatabase,["Reads","InputFile"]);

Create a BLASTN block to search the created BLAST+ nucleotide database using the blastn query program. One of the required block inputs is the name of the FASTA file that contains the nucleotide query sequences.

bnBlock                             = BLASTN;
queryFile                           = which("queryFile.fasta");
bnBlock.Inputs.QueryFile.Value      = queryFile;

Connect bpDatabase and bnBlock.

addBlock(P,bnBlock);
connect(P,bpDatabase,bnBlock,["BlastDatabase","BlastDatabase"]);

Perform the blastn search by running the pipeline.

run(P);

The BLAST report is saved in the results folder of the BLASTN block.

blastnResults = results(P,bnBlock)
blastnResults = struct with fields:
    BlastReport: [1×1 bioinfo.pipeline.datatype.File]

Display the location of the file using the unwrap function.

unwrap(blastnResults.BlastReport)

You can also run other query programs by creating the corresponding query block. For example, create a TBLASTX block, which searches translated nucleotide queries against a translated nucleotide database.

tbxBlock                         = TBLASTX;
tbxBlock.Inputs.QueryFile.Value  = queryFile;
addBlock(P,tbxBlock);
connect(P,bpDatabase,tbxBlock,["BlastDatabase","BlastDatabase"]);

Perform the tblastx search by running the pipeline.

run(P);

The BLAST report is saved in the results folder of the TBLASTX block.

tblastxResults = results(P,tbxBlock)
tblastxResults = struct with fields:
    BlastReport: [1×1 bioinfo.pipeline.datatype.File]

Display the location of the file using the unwrap function.

unwrap(tblastxResults.BlastReport)

References

[1] Camacho, Christiam, George Coulouris, Vahram Avagyan, Ning Ma, Jason Papadopoulos, Kevin Bealer, and Thomas L Madden. “BLAST+: Architecture and Applications.” BMC Bioinformatics 10, no. 1 (December 2009): 421.

[2] “BLAST: Basic Local Alignment Search Tool.” https://blast.ncbi.nlm.nih.gov/Blast.cgi.

Version History

Introduced in R2024a