Learn R Programming

DECIPHER (version 2.0.2)

SearchDB: Obtain Specific Sequences from a Database

Description

Returns the set of sequences meeting the search criteria.

Usage

SearchDB(dbFile, tblName = "Seqs", identifier = "", type = "XStringSet", limit = -1, replaceChar = "-", nameBy = "row_names", orderBy = "row_names", countOnly = FALSE, removeGaps = "none", clause = "", processors = 1, verbose = TRUE)

Arguments

dbFile
A SQLite connection object or a character string specifying the path to the database file.
tblName
Character string specifying the table where the sequences are located.
identifier
Optional character string used to narrow the search results to those matching a specific identifier. If "" (the default) then all identifiers are selected.
type
The type of XStringSet (sequences) to return. This should be (an unambiguous abbreviation of) one of "XStringSet", "DNAStringSet", "RNAStringSet", "AAStringSet", "BStringSet", "QualityScaledXStringSet", "QualityScaledDNAStringSet", "QualityScaledRNAStringSet", "QualityScaledAAStringSet", or "QualityScaledBStringSet". If type is "XStringSet" or "QualityScaledXStringSet" then an attempt is made to guess the type of sequences based on their composition.
limit
Number of results to display. The default (-1) does not limit the number of results.
replaceChar
Optional character used to replace any characters of the sequence that are not present in the XStringSet's alphabet. Not applicable if type=="BStringSet". (See details section below.)
nameBy
Character string giving the column name for naming the XStringSet.
orderBy
Character string giving the column name for sorting the results. Defaults to the order of entries in the database. Optionally can be followed by " ASC" or " DESC" to specify ascending (the default) or descending order.
countOnly
Logical specifying whether to return only the number of sequences.
removeGaps
Determines how gaps ("-" or "." characters) are removed in the sequences. This should be (an unambiguous abbreviation of) one of "none", "all" or "common".
clause
An optional character string to append to the query as part of a ``where clause''.
processors
The number of processors to use, or NULL to automatically detect and use all available processors.
verbose
Logical indicating whether to display queries as they are sent to the database.

Value

An XStringSet or QualityScaledXStringSet with the sequences that meet the specified criteria. The names of the object correspond to the value in the nameBy column of the database.

Details

If type is "DNAStringSet" then all U's are converted to T's before creating the DNAStringSet, and vise-versa if type is "RNAStringSet". All remaining characters not in the XStringSet's alphabet are converted to replaceChar. Quality information is interpreted as PredQuality scores.

See Also

Seqs2DB, DB2Seqs

Examples

Run this code
db <- system.file("extdata", "Bacteria_175seqs.sqlite", package="DECIPHER")
# get all sequences in the default table:
dna <- SearchDB(db)
# select a random sequence:
dna <- SearchDB(db, orderBy="random()", limit=1)
# remove gaps from "Mycobacterium" sequences:
dna <- SearchDB(db, identifier="Mycobacterium", removeGaps="all")
# provide a more complex query:
dna <- SearchDB(db, nameBy="description", orderBy="bases", removeGaps="common",
                clause="nonbases is 0")

Run the code above in your browser using DataLab