README.md

taxFun

License: GPL v3 Github Build

taxFun is an R package that provides functions for working with NCBI taxonomy IDs and names.

Table of Contents

Installation & Usage

taxFun requires the latest version of R. Please install or update R on your computer before continue.

Install using devtools

taxFun can be installed from this github repository using devtools:

if (!requireNamespace("devtools"))
    install.packages("devtools")
devtools::install_github("trvinh/taxFun", INSTALL_opts = c('--no-lock'), build_vignettes = TRUE)

Usage

From the R terminal, enter:

library(taxFun)

to load taxFun package.

taxFun command has this structure

taxFun(function_name, input, options, output)

To learn about the options for each taxFun function, please use this command

?taxFun::function_name()

Functions

These are the list of available functions in taxFun and their parameters

| Function name | Main input | Output | Other options | |---|---|---|---| | getAllTaxonomyRanks | None | A list of all available NCBI taxonomy ranks | None | | id2name | List of taxon IDs | A table containing input taxon IDs and their scientific names | None | | name2id | List of taxon names | A table containing input taxon names and their taxon IDs | None | | getRank | List of taxon IDs or/and names | A table containing input taxa and their taxonomy ranks | None | | getRanks | List of taxon IDs or/and names | A table containing input taxon IDs, their scientific names and the names of selected taxonomy ranks | ranks = list of selected taxonomy ranks (Optional: if not given, all possible taxonomy ranks will be considered) | | sortTaxonomyMatrix | List of taxon IDs or/and names | A clustered taxonomy matrix, shorted by a selected reference species | refspec = specified reference species | | createTree | List of taxon IDs or/and names | Tree file in newick format | outgroup = outgroup species for rooting (Optional) | | getRepresentative | List of taxon IDs or/and names | A table containing list of sub-selected taxa and their taxonomy info | rank = selected rank used for sub-sampling. Each supertaxon of this rank will have one representative | | getClade | List of taxon IDs or/and names | Subset of taxa that belong to a specified taxonomy clade | supertaxon = clade ID or name | | getLCA | List of taxon IDs or/and names | Last common ancestor name and ID | None |

If not specified, output file will be saved as input.*.

For example:

# specify list of taxon IDs and names
idFile <- "inst/ids.txt"
nameFile <- "inst/names.txt"

# convert IDs to names
taxFun("id2name", idFile)

# get names of class, family and phylum for a list of given taxon names
taxFun("getRanks", nameFile, ranks = c("class", "family", "phylum"))

# create an aligned taxonomy hierarchies for a list of taxon IDs
taxFun("sortTaxonomyMatrix", idFile, refspec = "Homo sapiens")

# create taxonomy tree rooted by an outgroup species
taxFun("createTree", nameFile, outgroup = "Homo sapiens")

# sub-sample taxa on phylum level
taxFun("getRepresentative", idFile, rank = "phylum")

# get all metazoa species
taxFun("getClade", idFile, supertaxon = "metazoa")

# get last common ancestor
taxFun("getLCA", nameFile)

Bugs

Any bug reports or comments, suggestions are highly appreciated. Please open an issue on GitHub or be in touch via email.

License

This tool is released under MIT license.

How-To Cite

Use the citation function in R CMD to have it directly in BibTex or LaTeX format

citation("taxFun")

Contact

Vinh Tran tran@bio.uni-frankfurt.de



trvinh/taxFun documentation built on July 3, 2023, 8:55 p.m.