R/process_trim_prevalence.R
trim_prevalence.Rd
trim samples or features in profile
by Prevalence,
which means the samples or features will be discarded if they could not pass the cutoff.
(Required). a matrix
, otu_table
,
phyloseq::phyloseq
or SummarizedExperiment
(Optional). character. taxonomic level to summarize,
default the top level rank of the ps
. taxonomic level(Kingdom, Phylum,
Class, Order, Family, Genus, Species, Strains; default: NULL).
(Optional). Numeric. the Prevalence threshold (default: 0.1).
(Optional). character. filtering features or samples by group (default: NULL).
(Optional). Character. trimming to apply, the options include:
"none", return the original data without any actions.
"both", prevalence of features and samples more than cutoff.
"feature", prevalence of features more than cutoff.
"feature_group", prevalence of features more than cutoff by groups.
"sample", prevalence of samples more than cutoff.
(Optional). Logical. prevalence of at least one group meets cutoff (FALSE means all groups meet cutoff, default: FALSE).
A trimed object
whose prevalence of features or samples more than cutoff.
# \donttest{
# phyloseq object
data("Zeybel_2022_gut")
trim_prevalence(
Zeybel_2022_gut,
level = "Phylum",
cutoff = 0.1,
trim = "feature")
#> phyloseq-class experiment-level object
#> otu_table() OTU Table: [ 6 taxa and 42 samples ]
#> sample_data() Sample Data: [ 42 samples by 46 sample variables ]
#> tax_table() Taxonomy Table: [ 6 taxa by 3 taxonomic ranks ]
# SummarizedExperiment object
data("Zeybel_2022_protein")
trim_prevalence(
Zeybel_2022_protein,
level = NULL,
cutoff = 0.1,
trim = "feature")
#> class: SummarizedExperiment
#> dim: 72 54
#> metadata(0):
#> assays(1): ''
#> rownames(72): IL8 VEGFA ... TNFB CSF_1
#> rowData names(3): ProteinID LOD prop
#> colnames(54): P101001 P101003 ... P101095 P101096
#> colData names(47): PatientID Gender ... Right_leg_fat_free_mass
#> Right_leg_total_body_water
# }