Skip to content

Commit

Permalink
Add the other export options to the interoperability tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
misialq committed Dec 16, 2024
1 parent 208706e commit f316c0e
Showing 1 changed file with 58 additions and 8 deletions.
66 changes: 58 additions & 8 deletions moshpit_docs/chapters/05_interoperability/export.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ artifacts will contain data in the original format that the underlying tool uses
export data from QIIME 2 and connect it with other tools.

```{warning}
QIIME 2 does not yet support exporting data from the cache. This means that you will need to manually copy the data from the
QIIME 2 does not yet support exporting data from the cache (see below). This means that you will need to manually copy the data from the
cache directory to a location where you can access it with other tools. In our examples, the cache directory is located directly
in the working directory and that is where we will copy the data from. Keep in mind that you should never temper with the files
in the cache directory directly, as this may lead to broken artifacts and failed analyses.
Expand All @@ -31,23 +31,73 @@ in the cache directory directly, as this may lead to broken artifacts and failed
If you have used Kraken 2 to [classify your reads](kraken-reads), you can export the resulting reports from the corresponding
QIIME 2 artifact and visualize them with [Pavian](https://github.com/fbreitwieser/pavian) which will allow you to explore the
taxonomic composition of your samples in an interactive way. To export the Kraken 2 reports, you can use the following commands:

`````{tab-set}
````{tab-item} Direct export
Support for extracting data out of the cache is not yet available but is coming soon! You can track the progress of
the issue [here](https://github.com/qiime2/qiime2/issues/822).
````
````{tab-item} Workaround 1: without using QIIME
```bash
UUID=$(cat ./cache/keys/kraken_reports_reads | grep 'data' | awk '{print $2}')
mkdir exported_reports
cp -r ./cache/data/$UUID/data/* exported_reports/
mkdir ./exported_reports
cp -r ./cache/data/$UUID/data/* ./exported_reports/
```
This will find the UUID of the reports artifact, use it to locate the data within the cache directory, create a directory
for the exported data and copy the files from the cache into it. You can then use those files (within the `exported_reports`
directory) with Pavian. To give it a quick try, navigate to [Pavian's demo site](https://fbreitwieser.shinyapps.io/pavian/)
and upload the exported files.
for the exported data and copy the files from the cache into it.
````
````{tab-item} Workaround 2: with QIIME
```bash
qiime tools cache-fetch \
--cache ./cache \
--key kraken_reports_reads \
--output-path ./kraken_reports_reads.qza
qiime tools export \
--input-path ./kraken_reports_reads.qza \
--output-path ./exported_reports
```
This will first fetch the reports artifact from the cache and then export it to the `exported_reports` directory.
````
`````

Once you got the data into the `exported_reports` directory, you can then use those with Pavian.
To give it a quick try, navigate to [Pavian's demo site](https://fbreitwieser.shinyapps.io/pavian/) and upload the exported files.

## Microbial pangenomics with Anvi'o
Another suite of tools you may be familiar with is the [Anvi'o](http://anvio.org/) platform. One of the workflows that Anvi'o
provides is the microbial pangenomics analysis, which can be used to explore the gene clusters within your samples. You
could export the MAGs obtained from the [binning step](mag-recovery) and use them as input to the `anvi-pan-genome` workflow, as
described [here](https://merenlab.org/2016/11/08/pangenomics-v2/). To export the MAGs, you can use the following command:
`````{tab-set}
````{tab-item} Direct export
Support for extracting data out of the cache is not yet available but is coming soon! You can track the progress of
the issue [here](https://github.com/qiime2/qiime2/issues/822).
````
````{tab-item} Workaround 1: without using QIIME
```bash
UUID=$(cat ./cache/keys/mags | grep 'data' | awk '{print $2}')
mkdir exported_mags
cp -r ./cache/data/$UUID/data/* exported_mags/
mkdir ./exported_mags
cp -r ./cache/data/$UUID/data/* ./exported_mags/
```
This will find the UUID of the MAGs artifact, use it to locate the data within the cache directory, create a directory
for the exported data and copy the files from the cache into it.
````
````{tab-item} Workaround 2: with QIIME
```bash
qiime tools cache-fetch \
--cache ./cache \
--key mags \
--output-path ./mags.qza
qiime tools export \
--input-path ./mags.qza \
--output-path ./exported_mags
```
This will first fetch the MAGs artifact from the cache and then export it to the `exported_mags` directory.
````
`````

0 comments on commit f316c0e

Please sign in to comment.