This function converts a phyloseq object to a tibble, while taking into account the treatment groups found in the sample metadata.

phyloseq_to_tibble(phyloseq_obj, treatment_groups)

Arguments

phyloseq_obj

A phyloseq object.

treatment_groups

A list of the treatment groups in the sample metadata.

Value

A list of tibbles containing all of the phyloseq data in a tidy format.

Details

MicrobiomeR was developed for processing Qiime data delivered by the NIH's Nephele pipeline (https://nephele.niaid.nih.gov/). MicrobiomeR was also written using the tidyverse in order to make the workflow reproducible. This function was written with that data in mind. In the future this function can be expanded to accept other data models. The returned list will contain a tax tibble, an otu tibble, a sample data tibble, a full data tibble, a vector of otu names, and a vectors containing the names of treatment group samples.

See also

Examples

# NOT RUN {
> phy_obj <- get_phyloseq_object(...)
> phy_tibble <- phyloseq_to_tibble(phy_obj, treatment_groups = list("Stressed", "Control"))
> phy_tibble
$tax
# A tibble: 3 x 8
  Kingdom Phylum       Class         Order            Family           Genus           Species          OTU
                                                                     
1 Archaea Euryarchaeo~ Methanobacte~ Methanobacteria~ Methanobacteria~ Methanobreviba~ uncultured arch~ JX522720.1.1265
2 Archaea Euryarchaeo~ Methanobacte~ Methanobacteria~ Methanobacteria~ Methanobreviba~ uncultured arch~ ADJS01014867.75~
3 Archaea Euryarchaeo~ Methanobacte~ Methanobacteria~ Methanobacteria~ Methanobreviba~ Ambiguous_taxa   AB906006.1.1368

$otu
# A tibble: 3 x 49
  Sample_1 Sample_2 Sample_3 Sample_6 Sample_9 Sample_10 Sample_13 Sample_14 Sample_17 Sample_21 Sample_22 Sample_24
                                                        
1  0.             0  0.             0  0.       0          8.92e-6         0 0.0000154 0.0000268 0.0000851 0
2  0.             0  1.99e-5        0  0.       0          2.68e-5         0 0.0000154 0.0000625 0.0000638 0.000121
3  8.14e-5        0  1.15e-3        0  1.11e-5  0.000137   1.78e-5         0 0.0000154 0.0000179 0.000106  0.0000404
#   Sample_56 , Sample_58 , Sample_8 , Sample_4 , Sample_52 , Sample_36 , OTU 

$sam
# A tibble: 48 x 8
   X.SampleID BarcodeSequence LinkerPrimerSequ~ ForwardFastqFile  ReverseFastqFile TreatmentGroup SampleName Description
 *                                                                        
 1 Sample_1   NA              NA                33749_S1_L001_R1~ 33749_S1_L001_R~ Stressed            33749 Fecal
 2 Sample_2   NA              NA                33739_S2_L001_R1~ 33739_S2_L001_R~ Stressed            33739 Fecal
 3 Sample_3   NA              NA                33737_S3_L001_R1~ 33737_S3_L001_R~ Stressed            33737 Fecal
# ... with 38 more rows

$stressed_samples
 [1] "Sample_1"  "Sample_2"  "Sample_3"  "Sample_6"  "Sample_9"  "Sample_10" "Sample_13" "Sample_14" "Sample_17"
[10] "Sample_21" "Sample_22" "Sample_24" "Sample_25" "Sample_26" "Sample_30" "Sample_59" "Sample_7"  "Sample_27"
[19] "Sample_5"  "Sample_20" "Sample_29" "Sample_11" "Sample_12" "Sample_15" "Sample_16" "Sample_18" "Sample_19"
[28] "Sample_23" "Sample_28" "Sample_31" "Sample_8"  "Sample_4"

$control_samples
 [1] "Sample_50" "Sample_60" "Sample_61" "Sample_45" "Sample_57" "Sample_35" "Sample_40" "Sample_41" "Sample_46"
[10] "Sample_47" "Sample_51" "Sample_55" "Sample_56" "Sample_58" "Sample_52" "Sample_36"

$otu_names
[1] "JX522720.1.1265"      "ADJS01014867.75.1537" "AB906006.1.1368"

$data
# A tibble: 3 x 56
  Sample_1 Sample_2 Sample_3 Sample_6 Sample_9 Sample_10 Sample_13 Sample_14 Sample_17 Sample_21 Sample_22 Sample_24
                                                        
1  0.             0  0.             0  0.       0          8.92e-6         0 0.0000154 0.0000268 0.0000851 0
2  0.             0  1.99e-5        0  0.       0          2.68e-5         0 0.0000154 0.0000625 0.0000638 0.000121
3  8.14e-5        0  1.15e-3        0  1.11e-5  0.000137   1.78e-5         0 0.0000154 0.0000179 0.000106  0.0000404
# ... with 44 more variables: Sample_25 , Sample_26 , Sample_30 , Sample_50 , Sample_59 ,
#   Sample_56 , Sample_58 , Sample_8 , Sample_4 , Sample_52 , Sample_36 , OTU ,
#   Kingdom , Phylum , Class , Order , Family , Genus , Species 

 
# }