phyloseq is a set of classes, wrappers, and tools (in R) to make it easier to import, store, and analyze phylogenetic sequencing data; and to reproducibly share that data and analysis with others. See the phyloseq front page:
I'm trying to transform sample counts by a scaling factor that is present in the sample_data. This scaling factor represents an independent estimate of total microbial biomass and is specific to each sample. As a rough approximation of absolute abundance, I'm multiplying relative abundance by the total cell biomass to get taxon-specific absolute abundance.
So, I think the best candidate for doing this would be transform_sample_counts(), (documentation) but I'm having trouble accessing data from within the sample data portion of the PS object.
ps.samples.abs <- ps.samples.PLFA |>
transform_sample_counts(
function(x) (x/sum(x)) * biomass_mg
)
# Error in fun(1:10) : object 'biomass_mg' not found
If this function is inappropriate for the task at hand, is there a possible workaround?
Any help or ideas are appreciated!
I'm trying to transform sample counts by a scaling factor that is present in the sample_data. This scaling factor represents an independent estimate of total microbial biomass and is specific to each sample. As a rough approximation of absolute abundance, I'm multiplying relative abundance by the total cell biomass to get taxon-specific absolute abundance.
absolute_abundance = relative_abundance * biomass_quantity
So, I think the best candidate for doing this would be
transform_sample_counts()
, (documentation) but I'm having trouble accessing data from within the sample data portion of the PS object.If this function is inappropriate for the task at hand, is there a possible workaround? Any help or ideas are appreciated!