IOComMA: IO functions in 'ComMA'

Description Usage Arguments Details Examples

Description

IO functions for the data defined in ComMA package, such as community matrix.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
readCommunityMatrix(file, matrix.name = NULL, minAbund = 2,
  regex1 = "(\\|[0-9]+)", regex2 = "", ignore.case = TRUE,
  col.name.decreasing = FALSE, verbose = TRUE)

writeCommunityMatrix(community.matrix, file, msg.file = "file",
  msg.col = "columns", msg.row = "rows", regex1 = NULL, regex2 = "",
  ignore.case = TRUE)

readTaxaTable(file, matrix.name = NULL, taxa.group = "assigned",
  rank = "kingdom", regex1 = "(\\|[0-9]+)", regex2 = "",
  ignore.case = TRUE, include = TRUE, sep = "\t", verbose = TRUE)

createTaxaTableMEGAN(folder.path, file.prefix, sep = "\t",
  regex1 = "(\\|[0-9]+)", regex2 = "", ignore.case = TRUE,
  col.names = c("path", "kingdom", "phylum", "class", "order", "family",
  "genus"), file.out = "taxa-table-megan.txt")

createTaxaTableRDP(file, sep = "\t", rm.rank.prefix = TRUE,
  regex1 = "(\\|[0-9]+)", regex2 = "", ignore.case = TRUE,
  file.out = "taxa-table-rdp.txt")

Arguments

file

The file to read/write.

matrix.name

The string to locate the matrix from its file name.

minAbund

The minimum abundance threshold to remove rows/columns by row/column sum of abundance. For exampe, if minAbund=2, then remove all singletons appeared in only one sample. If minAbund=1, then remove all empty rows/columns. Default to 2 (singletons). But postfix is only used for naming, no data processed.

regex1, regex2

Use for gsub(regex1, regex2, row.names) to remove or replace annotation from original labels. Default to regex1="(\|[0-9]+)", regex2="" for read??? but NULL to write???, which removes size annotation seperated by "|".

ignore.case

Refer to gsub.

col.name.decreasing

Should the sort decreasing order of colnames be TRUE? Refer to order. If NULL, do nothing. Default to FALSE.

taxa.group

The taxonomic group, the values can be 'all', 'assigned', or Group 'all' includes everything. Group 'assigned' removes all uncertain classifications including 'root', 'cellular organisms', 'No hits', 'Not assigned'. Alternatively, any high-ranking taxonomy in your taxonomy file can be used as a group or multi-groups (seperated by "|"), such as 'BACTERIA', 'Proteobacteria', etc. But they have to be in the same rank column in the file. Default to remove all uncertain classifications, even when group(s) assigned.

rank

The rank column in the file to specify where to search for taxa.group.

include

Define whether include or exclude given taxa.group. Default to TRUE.

folder.path

The folder path to contain taxa mapping files and output MEGAN taxa table.

file.prefix

The prefix to find taxa mapping files, such as "16s" for "16s-path.txt", "16s-kingdom.txt", "16s-phylum.txt".

col.names

A vector of column names of taxonomic ranks in the taxa table, and they also determine the files to be merged into columns. Default to c("path", "kingdom", "phylum", "class", "order", "family", "genus"), which indicates the list of files c("16s-path.txt", "16s-kingdom.txt", "16s-phylum.txt", "16s-class.txt", "16s-order.txt", "16s-family.txt", "16s-genus.txt") given file.prefix = "16s". "path" is optional.

file.out

The taxonomic table file name.

rm.rank.prefix

Remove rank prefix, such as 'k__'. Default to TRUE.

Details

readCommunityMatrix reads file to return a community matrix.

writeCommunityMatrix writes a community matrix to file.

readTaxaTable reads a file to return a taxa table. subsetTaxaTable can be used to takes or excludes a subset of the taxa table recursively.

createTaxaTableMEGAN reads a list of taxa mapping files exported from MEGAN to create a taxa table in folder.path.

createTaxaTableRDP reads a 3-column taxa mapping file generated from RDP to create a taxa table in folder.path. The row look like: OTU1 k__Bacteria;p__Firmicutes;c__Clostridia;o__Clostridiales;f__;g__;s__ 0.970

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
cm <- readCommunityMatrix("16S.txt", "16S")

writeCommunityMatrix(cm, "16S-new.txt", msg.file="16S")

tt.megan <- readTaxaTable("16s-megan.txt", "16S taxa table", taxa.group="Bacteria")
tt.rdp.8 <- readTaxaTable("16s-rdp.txt", "16S taxa table", taxa.group="Bacteria")

createTaxaTableMEGAN(getwd(), "16s", file.out="16s-megan.txt")

createTaxaTableRDP("otus_tax_assignments.txt", file.out="16s-rdp.txt")

walterxie/ComMA documentation built on May 3, 2019, 11:51 p.m.