• ps_get returns phyloseq

  • info_get returns psExtraInfo object

  • dist_get returns distance matrix (or NULL)

  • ord_get returns ordination object (or NULL)

  • perm_get returns adonis2() permanova model (or NULL)

  • bdisp_get returns results of betadisper() (or NULL)

  • otu_get returns phyloseq otu_table matrix with taxa as columns

  • tt_get returns phyloseq tax_table

  • tax_models_get returns list generated by tax_model or NULL

  • tax_stats_get returns dataframe generated by tax_models2stats or NULL

  • taxatree_models_get returns list generated by taxatree_models or NULL

  • taxatree_stats_get returns dataframe generated by taxatree_models2stats or NULL

  • samdat_tbl returns phyloseq sample_data as a tibble with sample_names as new first column called .sample_name

ps_get(psExtra, ps_extra, counts = FALSE, warn = TRUE)

dist_get(psExtra, ps_extra)

ord_get(psExtra, ps_extra)

info_get(psExtra, ps_extra)

perm_get(psExtra, ps_extra)

bdisp_get(psExtra, ps_extra)

tax_models_get(psExtra)

tax_stats_get(psExtra)

taxatree_models_get(psExtra)

taxatree_stats_get(psExtra)

otu_get(data, taxa = NA, samples = NA, counts = FALSE, warn = TRUE)

tt_get(data)

samdat_tbl(data, sample_names_col = ".sample_name")

Arguments

psExtra

psExtra S4 class object

ps_extra

deprecated! don't use this

counts

should ps_get or otu_get attempt to return counts? if present in object

warn

if counts = TRUE, should a warning be emitted if counts are not available? set warn = "error" to stop if counts are not available

data

phyloseq or psExtra

taxa

subset of taxa to return, NA for all (default)

samples

subset of samples to return, NA for all (default)

sample_names_col

name of column where sample_names are put. if NA, return data.frame with rownames (sample_names)

Value

element(s) from psExtra object (or NULL)

Examples

data("dietswap", package = "microbiome")

psx <- tax_transform(dietswap, "compositional", rank = "Genus")

psx
#> psExtra object - a phyloseq object with extra slots:
#> 
#> phyloseq-class experiment-level object
#> otu_table()   OTU Table:         [ 130 taxa and 222 samples ]
#> sample_data() Sample Data:       [ 222 samples by 8 sample variables ]
#> tax_table()   Taxonomy Table:    [ 130 taxa by 3 taxonomic ranks ]
#> 
#> otu_get(counts = TRUE)		 [ 130 taxa and 222 samples ]
#> 
#> psExtra info:
#> tax_agg = "Genus" tax_trans = "compositional" 

ps_get(psx)
#> phyloseq-class experiment-level object
#> otu_table()   OTU Table:         [ 130 taxa and 222 samples ]
#> sample_data() Sample Data:       [ 222 samples by 8 sample variables ]
#> tax_table()   Taxonomy Table:    [ 130 taxa by 3 taxonomic ranks ]

ps_get(psx, counts = TRUE)
#> phyloseq-class experiment-level object
#> otu_table()   OTU Table:         [ 130 taxa and 222 samples ]
#> sample_data() Sample Data:       [ 222 samples by 8 sample variables ]
#> tax_table()   Taxonomy Table:    [ 130 taxa by 3 taxonomic ranks ]

info_get(psx)
#> psExtra info:
#> tax_agg = "Genus" tax_trans = "compositional" 

dist_get(psx) # this psExtra has no dist_calc result
#> NULL

ord_get(psx) # this psExtra has no ord_calc result
#> NULL

perm_get(psx) # this psExtra has no dist_permanova result
#> NULL

bdisp_get(psx) # this psExtra has no dist_bdisp result
#> NULL

# these can be returned from phyloseq objects too
otu_get(psx, taxa = 6:9, samples = c("Sample-9", "Sample-1", "Sample-6"))
#> OTU Table:          [4 taxa and 3 samples]
#>                      taxa are columns
#>          Allistipes et rel. Anaerobiospirillum Anaerofustis
#> Sample-9       0.0016615239                  0            0
#> Sample-1       0.0397210072                  0            0
#> Sample-6       0.0008609339                  0            0
#>          Anaerostipes caccae et rel.
#> Sample-9                 0.002729646
#> Sample-1                 0.028845017
#> Sample-6                 0.001468652

otu_get(psx, taxa = 6:9, samples = c(9, 1, 6), counts = TRUE)
#> OTU Table:          [4 taxa and 3 samples]
#>                      taxa are columns
#>          Allistipes et rel. Anaerobiospirillum Anaerofustis
#> Sample-9                 14                  0            0
#> Sample-1                336                  0            0
#> Sample-6                 17                  0            0
#>          Anaerostipes caccae et rel.
#> Sample-9                          23
#> Sample-1                         244
#> Sample-6                          29

tt_get(psx) %>% head()
#> Taxonomy Table:     [6 taxa by 3 taxonomic ranks]:
#>                              Phylum            Family           
#> Actinomycetaceae             "Actinobacteria"  "Actinobacteria" 
#> Aerococcus                   "Firmicutes"      "Bacilli"        
#> Aeromonas                    "Proteobacteria"  "Proteobacteria" 
#> Akkermansia                  "Verrucomicrobia" "Verrucomicrobia"
#> Alcaligenes faecalis et rel. "Proteobacteria"  "Proteobacteria" 
#> Allistipes et rel.           "Bacteroidetes"   "Bacteroidetes"  
#>                              Genus                         
#> Actinomycetaceae             "Actinomycetaceae"            
#> Aerococcus                   "Aerococcus"                  
#> Aeromonas                    "Aeromonas"                   
#> Akkermansia                  "Akkermansia"                 
#> Alcaligenes faecalis et rel. "Alcaligenes faecalis et rel."
#> Allistipes et rel.           "Allistipes et rel."          

samdat_tbl(psx)
#> # A tibble: 222 × 9
#>    .sample_name subject sex    nationality group sample    timepoint
#>    <chr>        <fct>   <fct>  <fct>       <fct> <chr>         <int>
#>  1 Sample-1     byn     male   AAM         DI    Sample-1          4
#>  2 Sample-2     nms     male   AFR         HE    Sample-2          2
#>  3 Sample-3     olt     male   AFR         HE    Sample-3          2
#>  4 Sample-4     pku     female AFR         HE    Sample-4          2
#>  5 Sample-5     qjy     female AFR         HE    Sample-5          2
#>  6 Sample-6     riv     female AFR         HE    Sample-6          2
#>  7 Sample-7     shj     female AFR         HE    Sample-7          2
#>  8 Sample-8     tgx     male   AFR         HE    Sample-8          2
#>  9 Sample-9     ufm     male   AFR         HE    Sample-9          2
#> 10 Sample-10    nms     male   AFR         HE    Sample-10         3
#> # ℹ 212 more rows
#> # ℹ 2 more variables: timepoint.within.group <int>, bmi_group <fct>

samdat_tbl(psx, sample_names_col = "SAMPLENAME")
#> # A tibble: 222 × 9
#>    SAMPLENAME subject sex    nationality group sample    timepoint
#>    <chr>      <fct>   <fct>  <fct>       <fct> <chr>         <int>
#>  1 Sample-1   byn     male   AAM         DI    Sample-1          4
#>  2 Sample-2   nms     male   AFR         HE    Sample-2          2
#>  3 Sample-3   olt     male   AFR         HE    Sample-3          2
#>  4 Sample-4   pku     female AFR         HE    Sample-4          2
#>  5 Sample-5   qjy     female AFR         HE    Sample-5          2
#>  6 Sample-6   riv     female AFR         HE    Sample-6          2
#>  7 Sample-7   shj     female AFR         HE    Sample-7          2
#>  8 Sample-8   tgx     male   AFR         HE    Sample-8          2
#>  9 Sample-9   ufm     male   AFR         HE    Sample-9          2
#> 10 Sample-10  nms     male   AFR         HE    Sample-10         3
#> # ℹ 212 more rows
#> # ℹ 2 more variables: timepoint.within.group <int>, bmi_group <fct>