Ps-plot Tutorials - Multiple Interface Edition¶
Introduction¶
In this tutorial you’ll use QIIME 2 to perform an analysis of some data.
Typical Run Time: 1 Minute 30 Seconds
Description¶
This guide is a preview of how you can use some of q2-ps-plot’s individual modules.
Protein Alignment¶
Here we will test q2-ps-plot’s proteinHeatmap module by running the following command:
import qiime2.plugins.ps_plot.actions as ps_plot_actions
protein_heat_map_viz, = ps_plot_actions.proteinHeatmap_dir(
enriched_dir_filepath='source/data/peptide_enrichment',
protein_alignment_filepath='source/data/prot_align/manifest.tsv',
enriched_suffix='_enriched.txt',
align_header='AlignPos',
align_delim='~',
color_scheme='viridis',
)
library(reticulate)
ps_plot_actions <- import("qiime2.plugins.ps_plot.actions")
action_results <- ps_plot_actions$proteinHeatmap_dir(
enriched_dir_filepath='source/data/peptide_enrichment',
protein_alignment_filepath='source/data/prot_align/manifest.tsv',
enriched_suffix='_enriched.txt',
align_header='AlignPos',
align_delim='~',
color_scheme='viridis',
)
protein_heat_map_viz <- action_results$protein_heatmap_vis
qiime ps-plot proteinHeatmap-dir \
--p-enriched-dir-filepath source/data/peptide_enrichment \
--p-protein-alignment-filepath source/data/prot_align/manifest.tsv \
--p-enriched-suffix _enriched.txt \
--p-align-header AlignPos \
--p-align-delim '~' \
--p-color-scheme viridis \
--o-protein-heatmap-vis protein-heat-map.qzv
protHeatMap, = use.action(
use.UsageAction(plugin_id="ps_plot", action_id="proteinHeatmap_dir"),
use.UsageInputs(
enriched_dir_filepath = "source/data/peptide_enrichment",
protein_alignment_filepath = "source/data/prot_align/manifest.tsv",
enriched_suffix = "_enriched.txt",
align_header = "AlignPos",
align_delim = "~",
color_scheme = "viridis"
),
use.UsageOutputNames(
protein_heatmap_vis = "protein_heat_map"
)
)
- Using the
qiime2 ps-plot proteinHeatmap-dir
tool: Set “enriched_dir_filepath” to
source/data/peptide_enrichment
Set “protein_alignment_filepath” to
source/data/prot_align/manifest.tsv
Expand the
additional options
sectionLeave “enriched_suffix” as its default value of
_enriched.txt
Leave “align_header” as its default value of
AlignPos
Leave “align_delim” as its default value of
~
Leave “color_scheme” as its default value of
viridis
Press the
Execute
button.
- Once completed, for the new entry in your history, use the
Edit
button 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 ps-plot proteinHeatmap-dir [...] : protein_heatmap_vis.qzv
protein-heat-map.qzv
Mutant Scatters¶
Here we will test q2-ps-plot’s mutantScatters module by running the following command:
from qiime2 import Artifact
from qiime2 import Metadata
from urllib import request
url = 'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/metadata.tsv'
fn = 'metadata.tsv'
request.urlretrieve(url, fn)
metadata_md = Metadata.load(fn)
url = 'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/samples.tsv'
fn = 'samples.tsv'
request.urlretrieve(url, fn)
samples_md = Metadata.load(fn)
url = 'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/zscore.qza'
fn = 'zscore.qza'
request.urlretrieve(url, fn)
zscore = Artifact.load(fn)
url = 'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/reference.qza'
fn = 'reference.qza'
request.urlretrieve(url, fn)
reference = Artifact.load(fn)
Artifact <- import("qiime2")$Artifact
Metadata <- import("qiime2")$Metadata
request <- import("urllib")$request
url <- 'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/metadata.tsv'
fn <- 'metadata.tsv'
request$urlretrieve(url, fn)
metadata_md <- Metadata$load(fn)
url <- 'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/samples.tsv'
fn <- 'samples.tsv'
request$urlretrieve(url, fn)
samples_md <- Metadata$load(fn)
url <- 'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/zscore.qza'
fn <- 'zscore.qza'
request$urlretrieve(url, fn)
zscore <- Artifact$load(fn)
url <- 'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/reference.qza'
fn <- 'reference.qza'
request$urlretrieve(url, fn)
reference <- Artifact$load(fn)
wget \
-O 'metadata.tsv' \
'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/metadata.tsv'
wget \
-O 'samples.tsv' \
'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/samples.tsv'
wget \
-O 'zscore.qza' \
'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/zscore.qza'
wget \
-O 'reference.qza' \
'https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/reference.qza'
def metadata_factory():
import qiime2
return qiime2.Metadata.load("source/data/metadata.tsv")
metadata = use.init_metadata('metadata', metadata_factory)
def samples_factory():
import qiime2
return qiime2.Metadata.load("source/data/sample_source.tsv")
samples = use.init_metadata('samples', samples_factory)
def zscore_factory():
import qiime2
return qiime2.Artifact.load("source/data/zscores.qza")
zscore = use.init_artifact("zscore", zscore_factory)
def reference_factory():
import qiime2
return qiime2.Artifact.load("source/data/references.qza")
reference = use.init_artifact("reference", reference_factory)
- Using the
Upload Data
tool: On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.Set “Name” (first text-field) to:
metadata.tsv
In the larger text-area, copy-and-paste: https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/metadata.tsv
(“Type”, “Genome”, and “Settings” can be ignored)
Press the
Start
button at the bottom.
- Using the
Upload Data
tool: On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.Set “Name” (first text-field) to:
samples.tsv
In the larger text-area, copy-and-paste: https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/samples.tsv
(“Type”, “Genome”, and “Settings” can be ignored)
Press the
Start
button at the bottom.
- Using the
Upload Data
tool: On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.Set “Name” (first text-field) to:
zscore.qza
In the larger text-area, copy-and-paste: https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/zscore.qza
(“Type”, “Genome”, and “Settings” can be ignored)
Press the
Start
button at the bottom.
- Using the
Upload Data
tool: On the first tab (Regular), press the
Paste/Fetch
data button at the bottom.Set “Name” (first text-field) to:
reference.qza
In the larger text-area, copy-and-paste: https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/reference.qza
(“Type”, “Genome”, and “Settings” can be ignored)
Press the
Start
button at the bottom.
samples_col_mdc = samples_md.get_column('Source')
mutant_scatter_viz, = ps_plot_actions.mutantScatters(
source=samples_col_mdc,
metadata=metadata_md,
zscore=zscore,
reference_file=reference,
peptide_header='SampleID',
reference_header='Reference',
x_axis_header='Position',
category_header='Category1',
label_header='Label',
wobble=True,
scatter_boxplot=True,
)
samples_col_mdc <- samples_md$get_column('Source')
action_results <- ps_plot_actions$mutantScatters(
source=samples_col_mdc,
metadata=metadata_md,
zscore=zscore,
reference_file=reference,
peptide_header='SampleID',
reference_header='Reference',
x_axis_header='Position',
category_header='Category1',
label_header='Label',
wobble=TRUE,
scatter_boxplot=TRUE,
)
mutant_scatter_viz <- action_results$visualization
qiime ps-plot mutantScatters \
--m-source-file samples.tsv \
--m-source-column Source \
--m-metadata-file metadata.tsv \
--i-zscore zscore.qza \
--i-reference-file reference.qza \
--p-peptide-header SampleID \
--p-reference-header Reference \
--p-x-axis-header Position \
--p-category-header Category1 \
--p-label-header Label \
--p-wobble \
--p-scatter-boxplot \
--o-visualization mutant-scatter.qzv
samples_col = use.get_metadata_column('samples_col', 'Source', samples)
mutantScatter, = use.action(
use.UsageAction(plugin_id='ps_plot', action_id='mutantScatters'),
use.UsageInputs(
source = samples_col,
metadata = metadata,
zscore = zscore,
reference_file = reference,
peptide_header = "SampleID",
reference_header = "Reference",
x_axis_header = "Position",
category_header = "Category1",
label_header = "Label",
wobble = True,
scatter_boxplot = True
),
use.UsageOutputNames(
visualization = "mutant_scatter"
)
)
- Using the
qiime2 ps-plot mutantScatters
tool: Set “zscore” to
#: zscore.qza
For “source”:
Leave as
Metadata from TSV
Set “Metadata Source” to
samples.tsv
Set “Column Name” to
Source
For “metadata”:
Perform the following steps.
Leave as
Metadata from TSV
Set “Metadata Source” to
metadata.tsv
Expand the
additional options
sectionSet “reference_file” to
#: reference.qza
Set “peptide_header” to
SampleID
Leave “reference_header” as its default value of
Reference
Leave “x_axis_header” as its default value of
Position
Set “category_header” to
Category1
Leave “label_header” as its default value of
Label
Set “wobble” to
Yes
Set “scatter_boxplot” to
Yes
Press the
Execute
button.
- Once completed, for the new entry in your history, use the
Edit
button 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 ps-plot mutantScatters [...] : visualization.qzv
mutant-scatter.qzv