Qiime2 - Michael-D-Preston/PrestonLab GitHub Wiki

By Angus ball

Introduction

Oh it'd be so nice to just be able to do everything in R and phyloseq but alas no, we can't have nice things and sometimes we have to do work in Qiime2. Despite my despondence, Qiime2 is actually a well supported and commonly used program. In short Qiime2 is R ONLY for microbiome data sets, and for the most part Qiime2 and R are functionally identical (for example you could run all of DADA2 in Qiime2 instead of R if you'd prefer, but don't do this because it won't work); however, since people writing packages on more specific programs have to choose which language to write their program in sometimes you have to use one over the other. This page aims to be an introduction for how to install Qiime2, and import your data from R into Qiime2.

quick reference to how I'll format this document

  • This is the step
This is the code you'll run, note the copy button --->

This is the output

  • Step 2
    • These are bonus facts that I want to say,
    • or sub steps

Installation

The first thing to know about Qiime2 is that is a linux program and thus you'll either need a computer running linux (like the HPC) or you'll have to create a linux subsystem on your windows computer. But that sounds scary and complicated so I'm just going to be using a linux computer I have access to because my parents are cool.

Eitherway, go to the Qiime2 install docs (This also has information on installing on different systems), and lets do a native conda installation.

Conda

What is conda? conda is a method of downloading packages off the web, BUT it's specialty case is running different versions of the same program is special conda environments. This is useful because certain programs need other programs at specific versions to run, or you might want to use a consistent version across your data analysis. Conda is very explicit about what version you are running and allows you to run complicated arrays of programs at different versions.

Eitherway we need to download it so go to this conda download page but oh my so many different versions!

  • in your linux box type
uname -a

linux blah blah blah x86_64 blah blah blah

  • therefore I need the x86 64-bit version of linux (which is just called 64 bit because thats the norm) if you have special ARM, aarch64 or s390 processors then you care about the different programs
  • Fun fact conda3 is built for python3, if you have python2 then you need to use miniconda2
python3 --version

-Bash: python version 3.9

python --version

Python 2.7.18

I have python 3 and 2 installed installed so use python3

  • Then download miniconda using wget
    • make sure this is the right version of miniconda for you
mkdir anaconda &&
cd anaconda &&
wget https://repo.anaconda.com/archive/Anaconda3-2023.09-0-Linux-x86_64.sh &&
bash Anaconda3-2023.09-0-Linux-x86_64.sh &&
rm -rf ~/anaconda/Anaconda3-2023.09-0-Linux-x86_64.sh 
  • click through the prompts as you wish
  • note: whats the deal with the &&? thats a logical prompt in bash meaning perform the next command if the last one was successful. This is just there so you can copy and paste easily while not exploding if i spelt something ect

Now we have mini conda installed, time to initialize it

~/anaconda/bin/conda init bash &&
~/anaconda/bin/conda init zsh

if that doesn't do things try

cd ~/anaconda/bin &&
conda init bash &&
cd ~/anaconda/bin &&
conda init zsh

now you have to fully exit out of your terminal and restart it (because you edited the .bashrc file in the initialization (this is like changing how you turn on a computer thus the restart))

lets check if it worked!

conda --version

if this didnt work type

bash &&
conda --version

conda 23.7.4

now we can get started!!!

conda install wget

click through the prompts

Then we can install conda, but this is chunky and will take awhile, tell conda to use multiple core if you need (I have ten : -P)

conda config --set default_threads 10

Make sure you get the newest distribution!

wget https://data.qiime2.org/distro/amplicon/qiime2-amplicon-2023.9-py38-linux-conda.yml &&
conda env create -n qiime2-amplicon-2023.9 --file qiime2-amplicon-2023.9-py38-linux-conda.yml &&
rm qiime2-amplicon-2023.9-py38-linux-conda.yml
  • make sure this is the newest version of qiime2!!!

  • also we are using the amplicon version because we are working with barcoding data (the other options are shotgun (for metagenomics) and tiny (for developing packages)

  • enter qiime through conda

conda activate qiime2-amplicon-2024.2

Or depending on version

conda activate qiime2-amplicon-2023.9
  • test to see if it worked
qiime --help

so much help info

So Hey you made it into qiime2 congrats! Now you can do all your qiime2 needs if only you had some data...

Importing Data

Since we did our data analysis in R we have a phyloseq object with our data, unfortunately qiime doesnt support this kind of object so we need a .BIOM file and more. To start export your data using this tutorial (Yes its a bad sign I decided to make a separate page for this):

Exporting your data to QIIME2

This next step will depend on how you are running qiime, if you are using the HPC use the previously described ways to move data into the HPC: The High Profile Computer at UNBC

But since Im using a home telnet connection (fun fact the HPC uses ssh) I must go to windows cmd prompt.

ftp servername

then fill in your username and password

and you should be able to see your files!

To add a file

go to the file location

lcd "C:\user\ect\ect\ect" 

Then add your file

put filename.biom

To take a file off

get filename.txt

Eitherway your ready to go! see you in the specific Qiime2 tutorials