Skip to contents

Convert a microbiome_dataset into a long table that combines abundance, sample_info, and variable_info.

Usage

psmelt_microbiome_dataset(object, relative = FALSE, value_name = "abundance")

Arguments

object

A microbiome_dataset object.

relative

Should abundance be converted to relative abundance before melting?

value_name

Name of the abundance column in the output.

Value

A data frame in long format.

Examples

data("global_patterns", package = "microbiomedataset")

x <- psmelt_microbiome_dataset(global_patterns)
head(x[, 1:8])
#>   variable_id sample_id abundance  Primer Final_Barcode
#> 1      549322       CL3         0 ILBC_01        AACGCA
#> 2      549322       CC1         0 ILBC_02        AACTCG
#> 3      549322       SV1         0 ILBC_03        AACTGT
#> 4      549322   M31Fcsw         0 ILBC_04        AAGAGA
#> 5      549322   M11Fcsw         0 ILBC_05        AAGCTG
#> 6      549322   M31Plmr         0 ILBC_07        AATCGT
#>   Barcode_truncated_plus_T Barcode_full_length SampleType
#> 1                   TGCGTT         CTAGCGTGCGT       Soil
#> 2                   CGAGTT         CATCGACGAGT       Soil
#> 3                   ACAGTT         GTACGCACAGT       Soil
#> 4                   TCTCTT         TCGACATCTCT      Feces
#> 5                   CAGCTT         CGACTGCAGCT      Feces
#> 6                   ACGATT         CGAGTCACGAT       Skin

y <- psmelt_microbiome_dataset(global_patterns, relative = TRUE)
head(y[, c("sample_id", "variable_id", "abundance")])
#>   sample_id variable_id abundance
#> 1       CL3      549322         0
#> 2       CC1      549322         0
#> 3       SV1      549322         0
#> 4   M31Fcsw      549322         0
#> 5   M11Fcsw      549322         0
#> 6   M31Plmr      549322         0