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:
  1. Set “enriched_dir_filepath” to source/data/peptide_enrichment

  2. Set “protein_alignment_filepath” to source/data/prot_align/manifest.tsv

  3. Expand the additional options section

    1. Leave “enriched_suffix” as its default value of _enriched.txt

    2. Leave “align_header” as its default value of AlignPos

    3. Leave “align_delim” as its default value of ~

    4. Leave “color_scheme” as its default value of viridis

  4. 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:
  1. On the first tab (Regular), press the Paste/Fetch data button at the bottom.

    1. Set “Name” (first text-field) to: metadata.tsv

    2. In the larger text-area, copy-and-paste: https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/metadata.tsv

    3. (“Type”, “Genome”, and “Settings” can be ignored)

  2. Press the Start button at the bottom.

Using the Upload Data tool:
  1. On the first tab (Regular), press the Paste/Fetch data button at the bottom.

    1. Set “Name” (first text-field) to: samples.tsv

    2. In the larger text-area, copy-and-paste: https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/samples.tsv

    3. (“Type”, “Genome”, and “Settings” can be ignored)

  2. Press the Start button at the bottom.

Using the Upload Data tool:
  1. On the first tab (Regular), press the Paste/Fetch data button at the bottom.

    1. Set “Name” (first text-field) to: zscore.qza

    2. In the larger text-area, copy-and-paste: https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/zscore.qza

    3. (“Type”, “Genome”, and “Settings” can be ignored)

  2. Press the Start button at the bottom.

Using the Upload Data tool:
  1. On the first tab (Regular), press the Paste/Fetch data button at the bottom.

    1. Set “Name” (first text-field) to: reference.qza

    2. In the larger text-area, copy-and-paste: https://ladnerlab.github.io/pepsirf-q2-plugin-docs/data/tutorials/ps-plot/reference.qza

    3. (“Type”, “Genome”, and “Settings” can be ignored)

  2. 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:
  1. Set “zscore” to #: zscore.qza

  2. For “source”:

    1. Leave as Metadata from TSV

    2. Set “Metadata Source” to samples.tsv

    3. Set “Column Name” to Source

  3. For “metadata”:

    • Perform the following steps.

      1. Leave as Metadata from TSV

      2. Set “Metadata Source” to metadata.tsv

  4. Expand the additional options section

    1. Set “reference_file” to #: reference.qza

    2. Set “peptide_header” to SampleID

    3. Leave “reference_header” as its default value of Reference

    4. Leave “x_axis_header” as its default value of Position

    5. Set “category_header” to Category1

    6. Leave “label_header” as its default value of Label

    7. Set “wobble” to Yes

    8. Set “scatter_boxplot” to Yes

  5. 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