IdentifyByRank: Identify By Taxonomic Rank

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/IdentifyByRank.R

Description

Identifies sequences by a specific level of their taxonomic rank.

Usage

1
2
3
4
5
IdentifyByRank(dbFile,
               tblName = "Seqs",
               level = 0,
               add2tbl = FALSE,
               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 rank information is located.

level

Level of the taxonomic rank. (See details section below.)

add2tbl

Logical or a character string specifying the table name in which to add the result.

verbose

Logical indicating whether to print database queries and other information.

Details

IdentifyByRank simply identifies a sequence by a specific level of its taxonomic rank. Requires that rank information be present in the tblName, such as that created by default when importing sequences from a GenBank formatted file.

The input parameter level should be an integer giving the “level” of the taxonomic rank to choose as the identifier. Negative levels are interpreted as being that many levels from the last level in each rank. The level zero selects the base level (see below).

If the specified level of rank does not exist then the closest rank is chosen. Therefore, setting level to Inf will always select the last taxonomic level (i.e., genus).

For example, a representative “rank” imported from a GenBank file is:
Saccharomyces cerevisiae
Eukaryota; Fungi; Ascomycota; Saccharomycotina; Saccharomycetes;
Saccharomycetales; Saccharomycetaceae; Saccharomyces.

Setting level to 0 would result in an identifier of “Saccharomyces cerevisiae”, because it is on the first line. A level of 2 would return “Fungi”, and -2 (second to last) would return “Saccharomycetaceae”. A level of Inf would find the nearest level to the end, “Saccharomyces”.

Value

A data.frame with the rank and corresponding identifier as identifier. Note that quotes are stripped from identifiers to prevent problems that they may cause. The origin gives the rank preceding the identifier. If add2tbl is not FALSE then the “identifier” column is updated in dbFile.

Author(s)

Erik Wright eswright@pitt.edu

See Also

FormGroups

Examples

1
2
3
db <- system.file("extdata", "Bacteria_175seqs.sqlite", package="DECIPHER")
ids <- IdentifyByRank(db, level=Inf)
head(ids)

Example output

Loading required package: Biostrings
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package: 'BiocGenerics'

The following objects are masked from 'package:parallel':

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked from 'package:stats':

    IQR, mad, sd, var, xtabs

The following objects are masked from 'package:base':

    Filter, Find, Map, Position, Reduce, anyDuplicated, append,
    as.data.frame, basename, cbind, colMeans, colSums, colnames,
    dirname, do.call, duplicated, eval, evalq, get, grep, grepl,
    intersect, is.unsorted, lapply, lengths, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, rank, rbind,
    rowMeans, rowSums, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which, which.max, which.min

Loading required package: S4Vectors
Loading required package: stats4

Attaching package: 'S4Vectors'

The following object is masked from 'package:base':

    expand.grid

Loading required package: IRanges
Loading required package: XVector

Attaching package: 'Biostrings'

The following object is masked from 'package:base':

    strsplit

Loading required package: RSQLite

Formed 72 distinct groups.
Time difference of 0.07 secs

                                                                                                                                                     rank
1                                               uncultured bacterium\nRoot; Bacteria; "Firmicutes"; "Bacilli"; Bacillales; Bacillaceae; \nLysinibacillus.
2                                       uncultured bacterium\nRoot; Bacteria; "Firmicutes"; "Bacilli"; Bacillales; \n"Staphylococcaceae"; Staphylococcus.
3                                uncultured bacterium\nRoot; Bacteria; "Firmicutes"; "Bacilli"; "Lactobacillales"; \n"Carnobacteriaceae"; Dolosigranulum.
4                 uncultured bacterium\nRoot; Bacteria; "Firmicutes"; "Clostridia"; Clostridiales; \nPeptococcaceae; Peptococcaceae 1; Desulfosporosinus.
5 uncultured bacterium\nRoot; Bacteria; "Firmicutes"; "Erysipelotrichi"; \n"Erysipelotrichales"; Erysipelotrichaceae; \nunclassified_Erysipelotrichaceae.
6                            uncultured bacterium\nRoot; Bacteria; "Bacteroidetes"; "Bacteroidia"; "Bacteroidales"; \n"Porphyromonadaceae"; Dysgonomonas.
                                                                                         origin
1                             Root; Bacteria; "Firmicutes"; "Bacilli"; Bacillales; Bacillaceae;
2                    Root; Bacteria; "Firmicutes"; "Bacilli"; Bacillales;  "Staphylococcaceae";
3             Root; Bacteria; "Firmicutes"; "Bacilli"; "Lactobacillales";  "Carnobacteriaceae";
4 Root; Bacteria; "Firmicutes"; "Clostridia"; Clostridiales;  Peptococcaceae; Peptococcaceae 1;
5  Root; Bacteria; "Firmicutes"; "Erysipelotrichi";  "Erysipelotrichales"; Erysipelotrichaceae;
6       Root; Bacteria; "Bacteroidetes"; "Bacteroidia"; "Bacteroidales";  "Porphyromonadaceae";
                        identifier
1                   Lysinibacillus
2                   Staphylococcus
3                   Dolosigranulum
4                Desulfosporosinus
5 unclassified_Erysipelotrichaceae
6                     Dysgonomonas

DECIPHER documentation built on Nov. 8, 2020, 8:30 p.m.