Learn R Programming

DECIPHER (version 1.12.0)

Seqs2DB: Add Sequences from Text File to Database

Description

Adds sequences to a database.

Usage

Seqs2DB(seqs, type, dbFile, identifier, tblName = "DNA", chunkSize = 1e5, replaceTbl = FALSE, verbose = TRUE)

Arguments

seqs
A connection object or a character string specifying the file path to the file containing the sequences, an XStringSet object if type is XStringSet, or a QualityScaledXStringSet object if type is QualityScaledXStringSet.
type
The type of the sequences (seqs) being imported. This should be (an unambiguous abbreviation of) one of "FASTA", "FASTQ", "GenBank", "XStringSet", or "QualityScaledXStringSet".
dbFile
A SQLite connection object or a character string specifying the path to the database file. If the dbFile does not exist then a new database is created at this location.
identifier
Character string specifying the "id" to give the imported sequences in the database.
tblName
Character string specifying the table in which to add the sequences.
chunkSize
Number of lines of the seqs to read at a time.
replaceTbl
Logical. If FALSE (the default) then the sequences are appended to any already existing in the table. If TRUE then any sequences already in the table are overwritten.
verbose
Logical indicating whether to display each query as it is sent to the database.

Value

The total number of sequences in the database table is returned after import.

Details

Sequences are imported into the database in chunks of lines specified by chunkSize. The sequences can then be identified by searching the database for the identifier provided. Sequences are added to the database verbatim, so that no sequence information is lost when the sequences are exported from the database. The sequence names are recorded into a column named ``description'' in the database.

See Also

SearchDB, DB2Seqs

Examples

Run this code
gen <- system.file("extdata", "Bacteria_175seqs.gen", package="DECIPHER")
dbConn <- dbConnect(SQLite(), ":memory:")
Seqs2DB(gen, "GenBank", dbConn, "Bacteria")
BrowseDB(dbConn)
dna <- SearchDB(dbConn, nameBy="description")
dbDisconnect(dbConn)

Run the code above in your browser using DataLab