Skip to content

Commit

Permalink
add example to show how to convert phyloseq to SummarizedExperiment i…
Browse files Browse the repository at this point in the history
…n the vignette, closes #16
  • Loading branch information
LiNk-NY committed Oct 20, 2023
1 parent dd93ecf commit c8f4e4f
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
1 change: 1 addition & 0 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ Suggests:
rmarkdown,
curatedMetagenomicData,
BiocStyle,
phyloseq,
testthat,
pkgdown,
covr,
Expand Down
25 changes: 25 additions & 0 deletions vignettes/lefser.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,31 @@ head(res)
lefserPlot(res)
```

# Interoperating with phyloseq

When using `phyloseq` objects, we recommend to extract the data and create a
`SummarizedExperiment` object as follows:

```{r}
library(phyloseq)
fp <- system.file(
"extdata", "study_1457_split_library_seqs_and_mapping.zip",
package = "phyloseq"
)
kostic <- suppressWarnings({
microbio_me_qiime(fp)
})
counts <- unclass(otu_table(kostic))
colData <- as(sample_data(kostic), "data.frame")
## create a SummarizedExperiment object
SummarizedExperiment(
assays = list(counts = counts), colData = colData
)
```

You may also consider using `makeTreeSummarizedExperimentFromPhyloseq` from the
`mia` package (example not shown).

## sessionInfo

<details>
Expand Down

0 comments on commit c8f4e4f

Please sign in to comment.