Exploring the data with Galaxy#
Access Galaxy#
We’ll start working with QIIME 2 through the Galaxy graphical user interface. This is a convenient way to use QIIME 2 as it’s fully graphical - no command line or coding is needed! However, as of now, Galaxy environments tend to have slightly older versions of QIIME 2 installed on them, and the installations are harder for you to customize (e.g., to install plugins you’re interested in that aren’t included in QIIME 2). For this reason, in this workshop we’re going to teach you how to use QIIME 2 both through Galaxy and on the command line.
To access the Galaxy server we’ll be using for this class, go to the Galaxy server. You will need to create an account the first time you use this server. This server is free to use, and you can feel free to continue using the account you create after the workshop has ended.
Access and summarize the study metadata#
To begin our work with QIIME 2 and the tutorial data we will start by downloading the metadata, generating a summary, and exploring that summary.
First, download the metadata.
from qiime2 import Metadata
from urllib import request
url = 'https://202408-q2-itn-workshop.readthedocs.io/en/latest/data/01-exploring-the-data/sample-metadata.tsv'
fn = 'sample-metadata.tsv'
request.urlretrieve(url, fn)
sample_metadata_md = Metadata.load(fn)
library(reticulate)
Metadata <- import("qiime2")$Metadata
request <- import("urllib")$request
url <- 'https://202408-q2-itn-workshop.readthedocs.io/en/latest/data/01-exploring-the-data/sample-metadata.tsv'
fn <- 'sample-metadata.tsv'
request$urlretrieve(url, fn)
sample_metadata_md <- Metadata$load(fn)
wget \
-O 'sample-metadata.tsv' \
'https://202408-q2-itn-workshop.readthedocs.io/en/latest/data/01-exploring-the-data/sample-metadata.tsv'
md_url = 'https://qiime2-workshops.s3.us-west-2.amazonaws.com/itn-aug2024/sample-metadata-v3-q2-fmt.tsv'
sample_metadata = use.init_metadata_from_url('sample_metadata', md_url)
- Using the
Upload Datatool: On the first tab (Regular), press the
Paste/Fetchdata button at the bottom.Set “Name” (first text-field) to:
sample-metadata.tsvIn the larger text-area, copy-and-paste: https://202408-q2-itn-workshop.readthedocs.io/en/latest/data/01-exploring-the-data/sample-metadata.tsv
(“Type”, “Genome”, and “Settings” can be ignored)
Press the
Startbutton at the bottom.
sample-metadata.tsv| download
Next, we’ll get a view of the study metadata using QIIME 2. This will allow you to assess whether the metadata that QIIME 2 is using is as you expect. You can do this using the tabulate action in QIIME 2’s q2-metadata plugin as follows.
import qiime2.plugins.metadata.actions as metadata_actions
metadata_summ_1_viz, = metadata_actions.tabulate(
input=sample_metadata_md,
)
metadata_actions <- import("qiime2.plugins.metadata.actions")
action_results <- metadata_actions$tabulate(
input=sample_metadata_md,
)
metadata_summ_1_viz <- action_results$visualization
qiime metadata tabulate \
--m-input-file sample-metadata.tsv \
--o-visualization metadata-summ-1.qzv
use.action(
use.UsageAction(plugin_id='metadata', action_id='tabulate'),
use.UsageInputs(input=sample_metadata),
use.UsageOutputNames(visualization='metadata_summ_1')
)
- Using the
qiime2 metadata tabulatetool: For “input”:
Perform the following steps.
Leave as
Metadata from TSVSet “Metadata Source” to
sample-metadata.tsv
Press the
Executebutton.
- Once completed, for the new entry in your history, use the
Editbutton to set the name as follows: (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name
“Name” to set (be sure to press
Save)#: qiime2 metadata tabulate [...] : visualization.qzvmetadata-summ-1.qzv
Access and summarize the feature table#
The feature table will describe the amplicon sequence variants (ASVs) observed in each sample, and how many times each ASV was observed in each sample. The feature data in this case is the sequence that defines each ASV.
In this tutorial, we’re going to work specifically with samples that were included in the autoFMT randomized trial.
Lets generate and explore a summary of the feature table we will be using.
from qiime2 import Artifact
url = 'https://202408-q2-itn-workshop.readthedocs.io/en/latest/data/01-exploring-the-data/feature-table.qza'
fn = 'feature-table.qza'
request.urlretrieve(url, fn)
feature_table = Artifact.load(fn)
Artifact <- import("qiime2")$Artifact
url <- 'https://202408-q2-itn-workshop.readthedocs.io/en/latest/data/01-exploring-the-data/feature-table.qza'
fn <- 'feature-table.qza'
request$urlretrieve(url, fn)
feature_table <- Artifact$load(fn)
wget \
-O 'feature-table.qza' \
'https://202408-q2-itn-workshop.readthedocs.io/en/latest/data/01-exploring-the-data/feature-table.qza'
feature_table_url = 'https://qiime2-workshops.s3.us-west-2.amazonaws.com/itn-aug2024/autofmt-table.qza'
autofmt_table = use.init_artifact_from_url('feature-table', feature_table_url)
- Using the
Upload Datatool: On the first tab (Regular), press the
Paste/Fetchdata button at the bottom.Set “Name” (first text-field) to:
feature-table.qzaIn the larger text-area, copy-and-paste: https://202408-q2-itn-workshop.readthedocs.io/en/latest/data/01-exploring-the-data/feature-table.qza
(“Type”, “Genome”, and “Settings” can be ignored)
Press the
Startbutton at the bottom.
import qiime2.plugins.feature_table.actions as feature_table_actions
autofmt_table_summ_viz, = feature_table_actions.summarize(
table=feature_table,
sample_metadata=sample_metadata_md,
)
feature_table_actions <- import("qiime2.plugins.feature_table.actions")
action_results <- feature_table_actions$summarize(
table=feature_table,
sample_metadata=sample_metadata_md,
)
autofmt_table_summ_viz <- action_results$visualization
qiime feature-table summarize \
--i-table feature-table.qza \
--m-sample-metadata-file sample-metadata.tsv \
--o-visualization autofmt-table-summ.qzv
use.action(
use.UsageAction(plugin_id='feature_table', action_id='summarize'),
use.UsageInputs(table=autofmt_table, sample_metadata=sample_metadata),
use.UsageOutputNames(visualization='autofmt_table_summ'),
)
- Using the
qiime2 feature-table summarizetool: Set “table” to
#: feature-table.qzaExpand the
additional optionssectionFor “sample_metadata”:
Press the
+ Insert sample_metadatabutton to set up the next steps.Leave as
Metadata from TSVSet “Metadata Source” to
sample-metadata.tsv
Press the
Executebutton.
- Once completed, for the new entry in your history, use the
Editbutton to set the name as follows: (Renaming is optional, but it will make any subsequent steps easier to complete.)
History Name
“Name” to set (be sure to press
Save)#: qiime2 feature-table summarize [...] : visualization.qzvautofmt-table-summ.qzv