pplace_to_matrix {BoSSA} | R Documentation |
Pplace to contingency matrix
Description
Convert the pplace object into a contingency matrix OTUs / sample
Usage
pplace_to_matrix(pplace, sample_info, N = NULL, tax_name = FALSE
,run_id=NULL,round_type=NULL)
Arguments
pplace |
A pplace object |
sample_info |
A vector or list specifying the association between placement (in the multiclass table) and sample. In the case of a list, multiple sample can be associated with a single placement. |
N |
An optionnal vector or list with a number of occurence (or weight) associated to each placed sequence. If "sample_info" is a list, "N" must also be a list. Note that the placement mass (potentially) available from the original files are imported into R but aren't use in the analysis. The N parameter should be used instead. |
tax_name |
Either the tax ids (when set to FALSE, default) or the tax names (when set to TRUE) are used as column names. The tax names are obtained form the "taxo" table of the pplace object. |
run_id |
A vector of run_id to subset |
round_type |
The name of the rounding fonction to apply to the product of the number of individuals classified in a given category and the likelihood ratio of this classification. Should be set to NULL (no rounding) or one of "trunc", "round", "ceiling" or "floor". |
Value
A contingency matrix with OTUs / species in rows and samples in columns.
Author(s)
pierre lefeuvre
Examples
data(pplace)
### simple example
pplace_to_matrix(pplace,c(rep("sample1",27),rep("sample2",50),rep("sample3",23)))
### using the N option to specify the number of sequence each placement represents
Npplace <- sample(1:20,100,replace=TRUE)
pplace_to_matrix(pplace,c(rep("sample1",27),rep("sample2",50),rep("sample3",23)),N=Npplace)
### with tax_name=TRUE
pplace_to_matrix(pplace,c(rep("sample1",27),rep("sample2",50),rep("sample3",23)),tax_name=TRUE)