Subset taxa using a taxa control or distribution based method
Source:R/controls.R
subset_taxa_tax_control.Rd
There is 3 main methods : discard taxa (i) using a control taxa (e.g. truffle root tips), (ii) using a mixture models to detect bimodality in pseudo-abundance distribution or (iii) using a minimum difference threshold pseudo-abundance. Each cutoff is defined at the sample level.
Arguments
- physeq
(required): a
phyloseq-class
object obtained using thephyloseq
package.- taxa_distri
(required) a vector of length equal to the number of samples with the number of sequences per sample for the taxa control
- method
(default: "mean") a method to calculate the cut-off value. There are 6 available methods:
cutoff_seq
: discard taxa with less than the number of sequence than taxa control,cutoff_mixt
: using mixture models,cutoff_diff
: using a minimum difference threshold (need the argument min_diff_for_cutoff)min
: the minimum of the three firsts methodsmax
: the maximum of the three firsts methodsmean
: the mean of the three firsts methods
- min_diff_for_cutoff
(int) argument for method
cutoff_diff
. Required if method iscutoff_diff
,min
,max
ormean
Value
A new phyloseq-class
object.
Examples
subset_taxa_tax_control(data_fungi,
as.numeric(data_fungi@otu_table[, 300]),
min_diff_for_cutoff = 2
)
#> number of iterations= 11
#> number of iterations= 27
#> number of iterations= 18
#> number of iterations= 15
#> number of iterations= 4
#> number of iterations= 28
#> Error in stats::uniroot(f = f, lower = 1, upper = 1000) :
#> f.upper = f(upper) is NA
#> Warning: NAs introduced by coercion
#> number of iterations= 23
#> number of iterations= 10
#> number of iterations= 10
#> number of iterations= 9
#> number of iterations= 15
#> number of iterations= 6
#> number of iterations= 13
#> number of iterations= 7
#> number of iterations= 25
#> number of iterations= 41
#> number of iterations= 4
#> number of iterations= 6
#> number of iterations= 3
#> number of iterations= 17
#> number of iterations= 12
#> number of iterations= 9
#> number of iterations= 4
#> number of iterations= 9
#> number of iterations= 20
#> number of iterations= 8
#> number of iterations= 8
#> number of iterations= 14
#> number of iterations= 8
#> number of iterations= 14
#> number of iterations= 8
#> number of iterations= 12
#> number of iterations= 18
#> number of iterations= 5
#> number of iterations= 15
#> number of iterations= 22
#> One of the variances is going to zero; trying new starting values.
#> One of the variances is going to zero; trying new starting values.
#> One of the variances is going to zero; trying new starting values.
#> One of the variances is going to zero; trying new starting values.
#> One of the variances is going to zero; trying new starting values.
#> number of iterations= 7
#> number of iterations= 11
#> number of iterations= 16
#> number of iterations= 5
#> number of iterations= 9
#> number of iterations= 22
#> number of iterations= 4
#> number of iterations= 9
#> number of iterations= 13
#> number of iterations= 8
#> number of iterations= 19
#> number of iterations= 7
#> number of iterations= 13
#> number of iterations= 14
#> number of iterations= 7
#> number of iterations= 19
#> number of iterations= 10
#> number of iterations= 13
#> number of iterations= 5
#> number of iterations= 6
#> number of iterations= 11
#> number of iterations= 14
#> number of iterations= 23
#> number of iterations= 13
#> number of iterations= 29
#> number of iterations= 20
#> number of iterations= 10
#> number of iterations= 2
#> number of iterations= 8
#> number of iterations= 13
#> number of iterations= 8
#> Error in stats::uniroot(f = f, lower = 1, upper = 1000) :
#> f.upper = f(upper) is NA
#> Warning: NAs introduced by coercion
#> number of iterations= 11
#> number of iterations= 4
#> number of iterations= 15
#> number of iterations= 8
#> number of iterations= 6
#> number of iterations= 13
#> number of iterations= 5
#> number of iterations= 15
#> number of iterations= 17
#> One of the variances is going to zero; trying new starting values.
#> number of iterations= 6
#> number of iterations= 18
#> Error in stats::uniroot(f = f, lower = 1, upper = 1000) :
#> f.upper = f(upper) is NA
#> Warning: NAs introduced by coercion
#> number of iterations= 6
#> number of iterations= 8
#> number of iterations= 11
#> number of iterations= 7
#> number of iterations= 8
#> number of iterations= 17
#> number of iterations= 10
#> number of iterations= 6
#> number of iterations= 4
#> number of iterations= 3
#> Warning: no non-missing arguments to min; returning Inf
#> number of iterations= 5
#> number of iterations= 6
#> number of iterations= 4
#> number of iterations= 22
#> number of iterations= 6
#> number of iterations= 3
#> number of iterations= 8
#> number of iterations= 9
#> One of the variances is going to zero; trying new starting values.
#> One of the variances is going to zero; trying new starting values.
#> number of iterations= 4
#> number of iterations= 13
#> One of the variances is going to zero; trying new starting values.
#> number of iterations= 14
#> number of iterations= 13
#> number of iterations= 8
#> number of iterations= 5
#> number of iterations= 4
#> number of iterations= 6
#> Error in stats::uniroot(f = f, lower = 1, upper = 1000) :
#> f.upper = f(upper) is NA
#> Warning: NAs introduced by coercion
#> number of iterations= 18
#> number of iterations= 18
#> number of iterations= 9
#> number of iterations= 8
#> number of iterations= 7
#> number of iterations= 13
#> number of iterations= 16
#> number of iterations= 15
#> number of iterations= 4
#> number of iterations= 20
#> number of iterations= 14
#> number of iterations= 27
#> number of iterations= 7
#> Warning: no non-missing arguments to min; returning Inf
#> Warning: no non-missing arguments to min; returning Inf
#> number of iterations= 8
#> Warning: no non-missing arguments to min; returning Inf
#> number of iterations= 9
#> number of iterations= 15
#> number of iterations= 3
#> number of iterations= 12
#> number of iterations= 16
#> number of iterations= 11
#> number of iterations= 11
#> number of iterations= 12
#> Warning: no non-missing arguments to min; returning Inf
#> number of iterations= 11
#> number of iterations= 23
#> number of iterations= 10
#> number of iterations= 9
#> number of iterations= 6
#> number of iterations= 36
#> number of iterations= 3
#> number of iterations= 5
#> number of iterations= 6
#> number of iterations= 5
#> number of iterations= 8
#> number of iterations= 5
#> number of iterations= 7
#> number of iterations= 5
#> One of the variances is going to zero; trying new starting values.
#> number of iterations= 3
#> number of iterations= 17
#> number of iterations= 9
#> The filtering processes discard 65 taxa and 36813 sequences
#> phyloseq-class experiment-level object
#> otu_table() OTU Table: [ 1355 taxa and 185 samples ]
#> sample_data() Sample Data: [ 185 samples by 7 sample variables ]
#> tax_table() Taxonomy Table: [ 1355 taxa by 12 taxonomic ranks ]
#> refseq() DNAStringSet: [ 1355 reference sequences ]