Skip to contents

This function takes an animalcules-formatted MultiAssayExperiment object and parses it to extract a named assay alongside the taxonomy and metadata.

Usage

parse_MAE_SE(dat, which_assay = NULL, type = "MAE")

Arguments

dat

Either a MultiAssayExperiment or a SummarizedExperiment object.

which_assay

Character string. This refers to the assay to be extracted from the MultiAssayExperiment object if type = "MAE". Does not need to be specified if type = "SE". Default is NULL.

type

One of "MAE" denoting a MultiAssayExperiment or "SE" denoting a SummarizedExperiment.

Value

Returns a list of 3 named data.frame elements, `counts`, `sam`, and `tax` denoting the counts data, sample metadata table, and taxonomy table, respectively.

Examples

in_dat <- system.file("extdata/MAE_small.RDS", package = "LegATo") |> readRDS()
out <- parse_MAE_SE(in_dat)
head(out$tax)
#>                            superkingdom         phylum               class
#> Acinetobacter_beijerinckii     Bacteria Proteobacteria Gammaproteobacteria
#> Acinetobacter_bouvetii         Bacteria Proteobacteria Gammaproteobacteria
#> Acinetobacter_guillouiae       Bacteria Proteobacteria Gammaproteobacteria
#> Acinetobacter_gyllenbergii     Bacteria Proteobacteria Gammaproteobacteria
#> Acinetobacter_indicus          Bacteria Proteobacteria Gammaproteobacteria
#> Acinetobacter_johnsonii        Bacteria Proteobacteria Gammaproteobacteria
#>                                   order        family         genus
#> Acinetobacter_beijerinckii Moraxellales Moraxellaceae Acinetobacter
#> Acinetobacter_bouvetii     Moraxellales Moraxellaceae Acinetobacter
#> Acinetobacter_guillouiae   Moraxellales Moraxellaceae Acinetobacter
#> Acinetobacter_gyllenbergii Moraxellales Moraxellaceae Acinetobacter
#> Acinetobacter_indicus      Moraxellales Moraxellaceae Acinetobacter
#> Acinetobacter_johnsonii    Moraxellales Moraxellaceae Acinetobacter
#>                                               species
#> Acinetobacter_beijerinckii Acinetobacter_beijerinckii
#> Acinetobacter_bouvetii         Acinetobacter_bouvetii
#> Acinetobacter_guillouiae     Acinetobacter_guillouiae
#> Acinetobacter_gyllenbergii Acinetobacter_gyllenbergii
#> Acinetobacter_indicus           Acinetobacter_indicus
#> Acinetobacter_johnsonii       Acinetobacter_johnsonii
head(out$sam)
#>     Sample Subject    Sex Month Group Pairing HairLength  Age
#> X-1    X-1      S1   Male     1     A       1   48.62753 21.9
#> X-2    X-2      S2   Male     1     B       1   53.53195 67.7
#> X-3    X-3      S3 Female     1     A       2   47.61090 78.9
#> X-4    X-4      S4 Female     1     B       2   49.72870 48.6
#> X-5    X-5      S5 Female     1     A       3   59.04509 48.4
#> X-6    X-6      S6 Female     1     B       3   27.82404 29.6
head(out$counts)
#>                            X-1   X-2 X-3 X-4 X-5 X-6 X-7 X-8 X-9 X-10 X-11 X-12
#> Acinetobacter_beijerinckii 430 18103 810 103  74 503   6 482 264   56  123    0
#> Acinetobacter_bouvetii       0     0   0   0   0  36   0   0  48    0    0    0
#> Acinetobacter_guillouiae     0     5   0   0   0   5   5   7  28    3    0    0
#> Acinetobacter_gyllenbergii   6     1   1   1  11   5  11   0   2    3    4    6
#> Acinetobacter_indicus        0     0   9   0   0   0   0   0  27    0    0    0
#> Acinetobacter_johnsonii      1     0   0   2   0   0   0   0   0    0    1    0
#>                            X-13 X-14 X-15 X-16 X-17 X-18 X-19 X-20 X-21 X-22
#> Acinetobacter_beijerinckii    0    0  432    0    0    0    0    0    0  424
#> Acinetobacter_bouvetii        0    0    0    0    0   11    0    0    0   47
#> Acinetobacter_guillouiae      0    0    0    0    0    0    0   38    0    0
#> Acinetobacter_gyllenbergii    0    1    0    0   17    0    8   13   10    2
#> Acinetobacter_indicus         0    2    0    0    0    0    0    0    0    0
#> Acinetobacter_johnsonii      10    0    0    0   71   60   11    6    8    0
#>                            X-23 X-24 X-25 X-26 X-27 X-28 X-29 X-30 X-31 X-32
#> Acinetobacter_beijerinckii   23    0   31   18   12   19  900   85   13    4
#> Acinetobacter_bouvetii        0    0    2    5    2    8    2    0    0    0
#> Acinetobacter_guillouiae      0    0   21    0    0    0    0 3299    0    0
#> Acinetobacter_gyllenbergii    2    3    2    8    0   15    2    6    5   17
#> Acinetobacter_indicus         0    0    0    0  813    0    0    4    0    0
#> Acinetobacter_johnsonii     272    0    0    6    1    0    0    0    0    0
#>                            X-33 X-34 X-35 X-36 X-37 X-38 X-39 X-40 X-41 X-42
#> Acinetobacter_beijerinckii    0  113  179    1  146    0    0    0    0    0
#> Acinetobacter_bouvetii        0    0    0    0    0    0    0    0    0    0
#> Acinetobacter_guillouiae      0    0    0    0    0    0    0    0    0    0
#> Acinetobacter_gyllenbergii    5    0    2    3    6    5    1    2    0    0
#> Acinetobacter_indicus         0    0    0    0    0    0    0    0    0    0
#> Acinetobacter_johnsonii       0    0    0   11    0    0    2    0    2    0
#>                            X-43 X-44 X-45 X-46 X-47 X-48 X-49 X-50
#> Acinetobacter_beijerinckii    0   10   10    0   46    0   44    1
#> Acinetobacter_bouvetii        7    0    0    0    9    0    0    0
#> Acinetobacter_guillouiae      0    7   12    2    0   13 1779    0
#> Acinetobacter_gyllenbergii    2    7    4    1    0    2    0    1
#> Acinetobacter_indicus         0    0    0    0    0    0    0    0
#> Acinetobacter_johnsonii       0    0   24    0    0    0    0    0

out2 <- parse_MAE_SE(in_dat[["MicrobeGenetics"]],
                     which_assay = "MGX", type = "SE")