Main Content

blastplus

Search local BLAST+ database

Since R2024a

    Description

    example

    blastplus(queryProgram,queryFile,inputDatabase,reportFilename) searches a local BLAST+ [1][2] database inputDatabase using the specified program queryProgram and query sequence file queryFile and saves the results in reportFilename.

    blastplus 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.

    example

    blastplus(queryProgram,queryFile,inputDatabase,reportFilename,queryOptions) uses additional options specified by queryOptions, a query options object.

    example

    blastplus(queryProgram,queryFile,inputDatabase,reportFilename,Name=Value) specifies additional options using one or more name-value arguments. Name is the property name and Value is the property value of queryOptions, a query options object. For example, set ExpectValue=0.01 to use the expect value of 0.01.

    Examples

    collapse all

    Download some paired-end sequencing data in the FASTA format using the accession run number SRR26273031.

    databaseFasta = srafasterqdump("SRR26273031",FastaOutput=true)

    Create a local nucleotide database using the downloaded FASTA file. Specify "SRR26273031_nucl_db" as the base name of the output database. When creating the database, the function also generates multiple index files with the same base name. The blastplus function uses these index files automatically when you search the database later in this example.

    blastplusdatabase("nucleotide","SRR26273031.fasta","SRR26273031_nucl_db");

    You can also specify additional database creation options using a MakeDatabaseOptions object. For instance, specify the title of the database.

    dbopts = bioinfo.blastplus.MakeDatabaseOptions;
    dbopts.Title = "SRR26273031_Nucleotide_DB"
    dbopts = 
      MakeDatabaseOptions with properties:
    
       Default properties:
            ExtraCommand: ""
              IncludeAll: 0
               InputType: "fasta"
        ParseSequenceIDs: 0
                 Version: "2.14.0"
    
       Modified properties:
                   Title: "SRR26273031_Nucleotide_DB"
    
    

    You can then use the options object to make the database.

    blastplusdatabase("nucleotide","SRR26273031.fasta","SRR26273031_nucl_db",dbopts);
    

    Alternatively, you can use specify options, such as the title of the database, by using name-value arguments. For example:

    blastplusdatabase("nucleotide","SRR26273031.fasta","SRR26273031_nucl_db",Title="SRR26273031_Nucleotide_DB");
    

    To reset the property values to their default values, use the reset function.

    dopts2 = reset(dbopts)
    dopts2 = 
      MakeDatabaseOptions with properties:
    
       Default properties:
            ExtraCommand: ""
              IncludeAll: 0
               InputType: "fasta"
        ParseSequenceIDs: 0
                   Title: [1×0 string]
                 Version: "2.14.0"
    
       Modified properties:
        No properties.
    
    

    Search the database using the FASTA file queryFile.fasta containing two nucleotide query sequences. This file is provided with the toolbox. Use the blastn query program which lets you search nucleotide queries against a nucleotide database. Specify "search1" as the name of the output report file. By default, the report file format is the traditional BLAST pairwise format. This format presents each query-subject pair alignment in detail.

    blastplus("blastn","queryFile.fasta","SRR26273031_nucl_db","search1");

    Open the file to review the search results. The first query sequence returns no hits, while the second query sequence returns multiple hits.

    open search1;

    You can also modify search options by creating a corresponding options object for the blastn query program. Use blastplusoptions or bioinfo.blastplus.*Options to create the options object. For instance, change the report format to an XML format.

    bnopts = blastplusoptions("blastn"); % Or use bioinfo.blastplus.BLASTNOptions
    bnopts.ReportFormat = "BLASTXML";
    blastplus("blastn","queryFile.fasta","SRR26273031_nucl_db","search2_xml",bnopts);
    open search2_xml;

    Alternatively, you can set the value of a property of the options object, such as ReportFormat, using name-value argument syntax. For example:

    blastplus("blastn","queryFile.fasta","SRR26273031_nucl_db","search2_xml",ReportFormat="BLASTXML");
    

    You can use other query programs to search the database. For instance, use tblastx to search translated nucleotide queries against a translated nucleotide database. Both query sequences return hits for this search. Use the compact tabular format for the report. For details about the generated columns and other report formats, see ReportFormat.

    blastplus("tblastx","queryFile.fasta","SRR26273031_nucl_db","search3_tab",ReportFormat="Tabular");
    open search3_tab;

    Delete the reports and downloaded FASTA file.

    delete search1 search2_xml search3_tab SRR26273031.fasta

    Input Arguments

    collapse all

    Search query program, specified as one of the following:

    • "blastn" — Search a nucleotide query against a nucleotide database.

    • "blastp" — Search a protein query against a protein database.

    • "blastx" — Translate a nucleotide query and search it against a protein database.

    • "tblastn" — Search a protein query against a translated nucleotide database.

    • "tblastx" — Search a translated nucleotide query against a translated nucleotide database.

    Data Types: char | string

    Name of a FASTA file with query sequences to search, specified as a string scalar or character vector. Specify a filename or a full file path and filename.

    Ensure that the file path and filename contain no spaces.

    Data Types: char | string

    Name of a local BLAST database, specified as a string scalar or character vector. Use the blastplusdatabase function to create the database.

    Data Types: char | string

    Name of a file to save the BLAST report, specified as a string scalar or character vector. Use the ReportFormat option to specify the output format of the report, such as XML, CSV, and so on.

    Data Types: char | string

    Search query options, specified as one of the following objects. The object type depends on the query program.

    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