#!/usr/bin/env python # coding: utf-8 # This notebook is not currently set up to work standalone. See [@gregcaporaso](http://github.com/gregcaporaso)'s [slides from SciPy 2016](http://bit.ly/qiime2-scipy2016) for more information. See http://2.qiime.org if you'd like to try QIIME 2. # # Installation steps prior to demo: # ```bash # conda create -n q2-scipy2016 python=3.5 q2-diversity q2cli -c qiime2 -c biocore -c bioconda # source activate q2-scipy2016 # ``` # # Download example Artifacts (QIIME 1 data files can be imported as QIIME 2 Artifacts, see [Importing data](https://github.com/qiime2/qiime2/wiki/Importing-data)): # In[1]: get_ipython().system('rm -rf *.qza *.qzv feature-table-frequency q2-demo-sample-md.tsv') get_ipython().system('curl -sO https://raw.githubusercontent.com/qiime2/q2-types/master/q2_types/tests/data/feature-table-frequency.qza') get_ipython().system('curl -sO https://raw.githubusercontent.com/qiime2/q2-types/master/q2_types/tests/data/phylogeny.qza') get_ipython().system('curl -sO https://dl.dropboxusercontent.com/u/2868868/q2-demo-sample-md.tsv') # # Artifacts # In[2]: from qiime import Artifact # In[3]: table = Artifact.load('./feature-table-frequency.qza') table # In[4]: tree = Artifact.load('./phylogeny.qza') # In[5]: import biom biom_table = table.view(biom.Table) biom_table # In[6]: import pandas as pd table.view(pd.DataFrame)[:5] # In[7]: get_ipython().system('unzip feature-table-frequency.qza') # # Executing actions defined by plugins # In[8]: import qiime.plugins import pprint pprint.pprint(qiime.plugins.available_plugins()) # In[9]: import qiime.plugins.feature_table import qiime.plugins.diversity # In[10]: table100 = qiime.plugins.feature_table.actions.rarefy(table, counts_per_sample=100) dm = qiime.plugins.diversity.actions.beta_phylogenetic(table100, tree, metric='unweighted_unifrac') # (Note: alternatives to rarefaction, such as those discussed in [McMurdie *et al.* (2014)](http://journals.plos.org/ploscompbiol/article?id=10.1371/journal.pcbi.1003531), are planned for addition as a plugin.) # In[11]: dm # Provenance is very basic at this stage, but it is being improved in alpha ([qiime2/qiime2#88](https://github.com/qiime2/qiime2/issues/88)). # In[12]: dm.provenance # In[13]: table100.save('table100.qza') dm.save('dm.qza') # # Types help users use QIIME correctly # Passing an incorrect type results in a ``TypeError``: # In[14]: qiime.plugins.diversity.actions.beta_phylogenetic(table, tree, 'unweighted_unifrac') # # Command line interface (``q2cli``) demo commands # # ```bash # qiime # qiime info # qiime diversity --help # qiime diversity beta_phylogenetic --help # qiime diversity pcoa --help # qiime diversity pcoa --distance-matrix dm.qza --pcoa pc # conda install q2-emperor -c qiime2 -c biocore -c bioconda # qiime info # ``` # # See [Installing and using QIIME 2](http://2.qiime.org/Installing-and-using-QIIME-2) documentation. # # QIIME Studio demo # # ``` # cd qiime-studio-0.0.1 # npm start # ``` # # Then, through the UI, change to the directory where the previous demos were run. (During alpha, we will transition so this can be started as a normal desktop application, e.g., with a QIIME icon.) # # See [QIIME Studio](http://2.qiime.org/QIIME-studio) documentation. # In[ ]: