taxonomyFromRefpkg: Extract taxonomic information from a refpkg.

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

View source: R/taxTools.R

Description

Construct a data.frame providing the lineage of each sequence represented in the reference package.

Usage

1
taxonomyFromRefpkg(path, seqnames, lowest_rank = NA)

Arguments

path

path to a refpkg directory

seqnames

optional character vector of sequence names. If provided, determines the order of rows in $taxTab

lowest_rank

name of the most specific (ie, rightmost) rank to include. Default is the name of the rightmost column in refpkg_contents$taxonomy

Value

A list with the following elements:

taxNames

a named character vector of taxonomic names (names are tax_ids)

taxTab

a data.frame in which each row corresponds to a reference sequence and contains a tax_id followed by the corresponding lineage (columns are "root"...lowest_rank)

Author(s)

Noah Hoffman

References

The decsription and specification for a reference package can be found in the project repository in github: https://github.com/fhcrc/taxtastic

Scripts and tools for creating reference packages are provided in the python package taxonomy, also available from the taxtastic project site.

See Also

refpkgContents

Examples

1
2
3
4
5
6
7
8
archive <- 'vaginal_16s.refpkg.tar.gz'
destdir <- tempdir()
system(gettextf('tar -xzf %s --directory="%s"',
                system.file('extdata',archive,package='clstutils'),
                destdir))
refpkg <- file.path(destdir, sub('.tar.gz','',archive))
reftax <- taxonomyFromRefpkg(refpkg)
str(reftax)

Example output

Loading required package: clst
Loading required package: rjson
Loading required package: ape
List of 2
 $ taxNames: Named chr [1:281] "root" "cellular organisms" "Bacteria" "unclassified Bacteria" ...
  ..- attr(*, "names")= chr [1:281] "1" "131567" "2" "2323" ...
 $ taxTab  :'data.frame':	652 obs. of  22 variables:
  ..$ tax_id                  : chr [1:652] "103621" "103621" "103621" "109790" ...
  ..$ root                    : chr [1:652] "1" "1" "1" "1" ...
  ..$ below_root              : chr [1:652] "131567" "131567" "131567" "131567" ...
  ..$ superkingdom            : chr [1:652] "2" "2" "2" "2" ...
  ..$ below_superkingdom      : chr [1:652] NA NA NA NA ...
  ..$ below_below_superkingdom: chr [1:652] NA NA NA NA ...
  ..$ superphylum             : chr [1:652] NA NA NA NA ...
  ..$ phylum                  : chr [1:652] "201174" "201174" "201174" "1239" ...
  ..$ subphylum               : chr [1:652] NA NA NA NA ...
  ..$ class                   : chr [1:652] "1760" "1760" "1760" "91061" ...
  ..$ subclass                : chr [1:652] "85003" "85003" "85003" NA ...
  ..$ order                   : chr [1:652] "2037" "2037" "2037" "186826" ...
  ..$ below_order             : chr [1:652] NA NA NA NA ...
  ..$ below_below_order       : chr [1:652] NA NA NA NA ...
  ..$ suborder                : chr [1:652] "85005" "85005" "85005" NA ...
  ..$ family                  : chr [1:652] "2049" "2049" "2049" "33958" ...
  ..$ below_family            : chr [1:652] NA NA NA NA ...
  ..$ genus                   : chr [1:652] "1654" "1654" "1654" "1578" ...
  ..$ species_group           : chr [1:652] NA NA NA NA ...
  ..$ species_subgroup        : chr [1:652] NA NA NA NA ...
  ..$ species                 : chr [1:652] "103621" "103621" "103621" "109790" ...
  ..$ below_species           : chr [1:652] NA NA NA NA ...

clstutils documentation built on Nov. 8, 2020, 5:23 p.m.