QIIME: Difference between revisions

From Alliance Doc
Jump to navigation Jump to search
No edit summary
(there was an error in the batch script example (/projects instead of /project))
 
(35 intermediate revisions by 7 users not shown)
Line 2: Line 2:
<translate>
<translate>
<!--T:1-->
<!--T:1-->
'''QIIME''' (pronounced ''chime'') stands for ''Quantitative Insights Into [https://en.wikipedia.org/wiki/Microbial_ecology Microbial Ecology]'', is an open-source [https://en.wikipedia.org/wiki/Bioinformatics bioinformatics] pipeline for performing [https://en.wikipedia.org/wiki/Microbiota microbiome] analysis from raw DNA sequencing data. QIIME is designed to take users from raw sequencing data generated on [https://www.illumina.com/ Illumina] or other platforms to publication-quality graphics and statistics. This includes demultiplexing and quality filtering, [https://en.wikipedia.org/wiki/Operational_taxonomic_unit OTU] picking, taxonomic assignment, phylogenetic reconstruction, diversity analyses and visualizations. QIIME has been applied to studies based on billions of sequences from tens of thousands of samples.
<b>QIIME</b> (pronounced <i>chime</i>) stands for <i>Quantitative Insights Into [https://en.wikipedia.org/wiki/Microbial_ecology Microbial Ecology]</i>, is an open-source [https://en.wikipedia.org/wiki/Bioinformatics bioinformatics] pipeline for performing [https://en.wikipedia.org/wiki/Microbiota microbiome] analysis from raw DNA sequencing data. QIIME is designed to take users from raw sequencing data generated on [https://www.illumina.com/ Illumina] or other platforms to publication-quality graphics and statistics. This includes demultiplexing and quality filtering, [https://en.wikipedia.org/wiki/Operational_taxonomic_unit OTU] picking, taxonomic assignment, phylogenetic reconstruction, diversity analyses and visualizations. QIIME has been applied to studies based on billions of sequences from tens of thousands of samples.


<!--T:2-->
<!--T:30-->
'''Note''': QIIME 2 has replaced QIIME 1 as of January 1, 2018; version 1 is no longer supported.
<b>Note</b>: QIIME 2 has replaced QIIME 1 as of January 1, 2018; version 1 is no longer supported.


'''Note''': As of February 18, 2020, and given the issues generated by conda environments in our HPC systems, '''installation using Ananconda or Miniconda is no longer supported'''.
<!--T:20-->
<b>Note</b>: As of February 2020, due to various issues generated by Conda environments on our HPC systems, <b>installation using Anaconda or Miniconda is no longer supported</b>.
 
== QIIME2 as a module == <!--T:31-->
QIIME2 is available in our environment via a module which wraps around a container. To know which versions are available, run
{{Command|module spider qiime2}}
 
<!--T:32-->
After loading the module, you can run
{{Command|qiime --help}}
 
<!--T:33-->
{{Callout
  |title=Note
  |content=Since the <code>qiime</code> command is in fact calling a container, you may have to define the environment variable <code>APPTAINER_BIND</code> to bind specific folders within the container to access your data. For example: <code>APPTAINER_BIND=/home qiime ...</code>
}}


==Installation == <!--T:4-->
==Installation == <!--T:4-->
QIIME 2 can be installed through a docker/singularity container or using easy build wheel. The former is strongly preferred since it does not generate thousands of files in your home directory, potentially preventing you from running your jobs.
QIIME2 can be installed using [[Apptainer]] or [[EasyBuild]]. Apptainer is strongly preferred since it does not generate many thousands of files in your /home directory, potentially causing you to exceed the disk quota limit on the number of files.
{{Outdated}}




=== Using Singularity (preferred) === <!--T:14-->
=== Using Apptainer === <!--T:14-->


<!--T:15-->
<!--T:15-->
It is possible to run QIIME2 through singularity using preexisting images. A docker image is available at [https://hub.docker.com/u/qiime2 qiime2], but first you need to build a singularity image from [[Singularity/en#Creating_an_image_using_Docker_Hub|docker]]:
The QIIME2 developers publish images on [https://quay.io/organization/qiime2 Quay.io].  In order to use one of these images on our systems, you must first build an Apptainer image:
</translate>


<!--T:16-->
{{Commands
{{Commands
|module load singularity
|module load apptainer
|singularity build qiime2-2019.10.sif docker://qiime2/core:2019.10
|apptainer build qiime2-2021.11.sif docker://quay.io/qiime2/core:2021.11
}}
}}
<translate>
<!--T:21-->
This build step may take over an hour, but you only need to do this once. Save the image file (<code>qiime2-2021.11.sif</code> in this example) for later re-use.


<!--T:17-->
<!--T:17-->
Then run your code as any other singularity [[Singularity/en|job]]. For most QIIME usage, you want to run each QIIME command within a [https://docs.computecanada.ca/wiki/Singularity/en#Running_a_single_command singularity exec statement]:
Then run your code as described in the [[Apptainer]] page. You will typically run each QIIME command in a <code>apptainer exec</code> statement:
</translate>


{{Commands
{{Commands
|singularity exec qiime2-2019.10.sif <your QIIME command>
|apptainer exec qiime2-2021.11.sif <your QIIME command>
}}
}}


So your SBATCH script might look something like this:
<translate>
<!--T:23-->
So your [[Running jobs|SBATCH]] script might look something like this:


</translate>
<pre>
<pre>
#!/bin/bash
#!/bin/bash
Line 38: Line 63:
#SBATCH --account=def-someuser
#SBATCH --account=def-someuser


singularity exec -B /home -B /project -B /scratch \
apptainer exec -B $PWD:/home -B /scratch/someuser:/outputs \
   qiime2-2019.10.sif qiime tools import \
   -B /project/def-somePI/someuser/path/to/inputs:/inputs qiime2-2021.11.sif \
  --type 'FeatureData[Sequence]' \
  qiime tools import --type 'FeatureData[Sequence]' \
   --input-path /path/to/some_fastafile.fa \
   --input-path /inputs/some_fastafile.fa \
   --output-path /path/to/some_output_feature.qza
   --output-path /outputs/some_output_feature.qza


singularity exec -B /home -B /project -B /scratch \
apptainer exec -B $PWD:/home -B /scratch/someuser:/outputs \
  -B /project/def-somePI/someuser/path/to/inputs:/inputs qiime2-2021.11.sif \
   qiime tools import \
   qiime tools import \
   --type 'FeatureData[Taxonomy]' \
   --type 'FeatureData[Taxonomy]' \
   --input-format HeaderlessTSVTaxonomyFormat \
   --input-format HeaderlessTSVTaxonomyFormat \
   --input-path /path/to/some_taxonomy_file.tax \
   --input-path /inputs/some_taxonomy_file.tax \
   --output-path /path/to/some_output_ref-taxonomy.qza
   --output-path /outputs/some_output_ref-taxonomy.qza


singularity exec -B /home -B /project -B /scratch \
apptainer exec -B $PWD:/home -B /scratch/someuser:/outputs \
  -B /project/def-somePI/someuser/path/to/inputs:/inputs qiime2-2021.11.sif \
   qiime feature-classifier fit-classifier-naive-bayes \
   qiime feature-classifier fit-classifier-naive-bayes \
   --i-reference-reads  /path/to/some_output_feature.qza \
   --i-reference-reads  /outputs/some_output_feature.qza \
   --i-reference-taxonomy /path/to/some_output_ref-taxonomy.qza \
   --i-reference-taxonomy /outputs/some_output_ref-taxonomy.qza \
   --o-classifier /path/to/some_output_classifier.qza
   --o-classifier /outputs/some_output_classifier.qza
</pre>
</pre>


Note that it is important to [https://docs.computecanada.ca/wiki/Singularity#Bind_mounts bind] the folders you want to work with to the execution of the container. For more information about singularity, you can watch the recorded [https://www.youtube.com/watch?v=kYb0aXS5DEE singularity webminar].
<translate>
<!--T:28-->
Note that it is important to use the [[Apptainer#Bind_mounts|bind]] option (<code>-B</code>) with each folder you want to work with when you run programs in your container. For more information about Apptainer, you can watch this [https://www.youtube.com/watch?v=bpmrfVqBowY Apptainer webinar].


<!--T:18-->
<!--T:18-->
On first importing data into QIIME format you may receive an error ending with a message like this:
On first importing data into QIIME format, you may receive an error ending with a message like this:
<pre>
<pre>
Timezone offset does not match system offset: 0 != -18000. Please, check your config files.
Timezone offset does not match system offset: 0 != -18000. Please, check your config files.
</pre>
</pre>
This can be worked around by setting a time zone before invoking Singularity:
This can be worked around by setting a time zone before invoking Apptainer:


<!--T:19-->
</translate>
{{Commands
{{Commands
|export TZ{{=}}'UTC'
|export TZ{{=}}'UTC'
|singularity exec qiime2-2019.10.sif qiime tools import ...
|apptainer exec qiime2-2021.11.sif qiime tools import ...
}}
}}


<!-- ===With a conda environment=== <!--T:5-->
Although we '''do not recommend''' using conda environments in an HPC environment, we provide the option to do so at your own peril.
<!--T:6-->
General installation instructions by the QIIME 2 developers are found [https://docs.qiime2.org/ here]. Instructions adapted for Compute Canada systems are given here for version 2019.7.  If a new version of the <tt>.yml</tt> file is released (check the link), use the newer version by updating the instructions below.
</translate>
<pre>
eb Miniconda3-4.5.12.eb
module load miniconda3
conda update conda
wget https://data.qiime2.org/distro/core/qiime2-2019.7-py36-linux-conda.yml
conda env create -n qiime2-2019.7 --file qiime2-2019.7-py36-linux-conda.yml
conda init bash
conda activate qiime2-2019.7
</pre>
<translate>
<translate>
<!--T:7-->
Remember to log out and log back in after the "conda init bash" step.
<!--T:8-->
To run QIIME 2, use
</translate>
<pre>
module load miniconda3
conda activate qiime2-2019.7
</pre>
<translate> -->
=== With the EasyBuild wheel === <!--T:9-->
In case the singularity solution isn't working for you, we also provide an EasyBuild package that can be used with the <tt>eb</tt> command. To install version 2019.7, use
</translate>
{{Commands
|eb --rebuild Miniconda3-4.7.10.eb QIIME2-2019.7.eb
}}
<translate>
<!--T:10-->
This takes a while, but will provide you with the qiime/2019.7 module that you need to load before using QIIME 2.
</translate>
{{Commands
|module load qiime2/2019.7
}}
<translate>
Because this creates all the packages required for QIIME, it generates too many files in your home directory. We recommend that you remove those files once you are done with all computations since it uses almost half of your total allocation. Even better, we recommend you use our [https://docs.computecanada.ca/wiki/QIIME#With_singularity_.28preferred.29 singularity] solution, that creates a big file instead of thousand of smaller files.


=References = <!--T:11-->
=References = <!--T:11-->


<!--T:13-->
<!--T:13-->
[http://qiime.org/ QIIME homepage]<br>
[http://qiime.org/ QIIME home page]<br>
[https://easybuild.readthedocs.io/en/latest/ EasyBuild documentation]<br>
<!--[https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html Getting started with Conda]<br>-->
<!--[https://docs.conda.io/projects/conda/en/latest/user-guide/getting-started.html Getting started with Conda]<br>-->
</translate>
</translate>
[[Category:Bioinformatics]]
[[Category:Bioinformatics]]
[[Category:User Installed Software]]
[[Category:User Installed Software]]

Latest revision as of 16:25, 9 January 2024

Other languages:

QIIME (pronounced chime) stands for Quantitative Insights Into Microbial Ecology, is an open-source bioinformatics pipeline for performing microbiome analysis from raw DNA sequencing data. QIIME is designed to take users from raw sequencing data generated on Illumina or other platforms to publication-quality graphics and statistics. This includes demultiplexing and quality filtering, OTU picking, taxonomic assignment, phylogenetic reconstruction, diversity analyses and visualizations. QIIME has been applied to studies based on billions of sequences from tens of thousands of samples.

Note: QIIME 2 has replaced QIIME 1 as of January 1, 2018; version 1 is no longer supported.

Note: As of February 2020, due to various issues generated by Conda environments on our HPC systems, installation using Anaconda or Miniconda is no longer supported.

QIIME2 as a module

QIIME2 is available in our environment via a module which wraps around a container. To know which versions are available, run

Question.png
[name@server ~]$ module spider qiime2


After loading the module, you can run

Question.png
[name@server ~]$ qiime --help


Note

Since the qiime command is in fact calling a container, you may have to define the environment variable APPTAINER_BIND to bind specific folders within the container to access your data. For example: APPTAINER_BIND=/home qiime ...


Installation

QIIME2 can be installed using Apptainer or EasyBuild. Apptainer is strongly preferred since it does not generate many thousands of files in your /home directory, potentially causing you to exceed the disk quota limit on the number of files.


Outdated

This page or section contains obsolete information and some statements may not be valid. The technical documentation is currently being updated by our support team.




Using Apptainer

The QIIME2 developers publish images on Quay.io. In order to use one of these images on our systems, you must first build an Apptainer image:

[name@server ~]$ module load apptainer
[name@server ~]$ apptainer build qiime2-2021.11.sif docker://quay.io/qiime2/core:2021.11


This build step may take over an hour, but you only need to do this once. Save the image file (qiime2-2021.11.sif in this example) for later re-use.

Then run your code as described in the Apptainer page. You will typically run each QIIME command in a apptainer exec statement:

[name@server ~]$ apptainer exec qiime2-2021.11.sif <your QIIME command>


So your SBATCH script might look something like this:

#!/bin/bash
#SBATCH --time=15:00:00
#SBATCH --account=def-someuser

apptainer exec -B $PWD:/home -B /scratch/someuser:/outputs \
  -B /project/def-somePI/someuser/path/to/inputs:/inputs qiime2-2021.11.sif \
  qiime tools import --type 'FeatureData[Sequence]' \
  --input-path /inputs/some_fastafile.fa \
  --output-path /outputs/some_output_feature.qza

apptainer exec -B $PWD:/home -B /scratch/someuser:/outputs \
  -B /project/def-somePI/someuser/path/to/inputs:/inputs qiime2-2021.11.sif \
  qiime tools import \
  --type 'FeatureData[Taxonomy]' \
  --input-format HeaderlessTSVTaxonomyFormat \
  --input-path /inputs/some_taxonomy_file.tax \
  --output-path /outputs/some_output_ref-taxonomy.qza

apptainer exec -B $PWD:/home -B /scratch/someuser:/outputs \
  -B /project/def-somePI/someuser/path/to/inputs:/inputs qiime2-2021.11.sif \
  qiime feature-classifier fit-classifier-naive-bayes \
  --i-reference-reads  /outputs/some_output_feature.qza \
  --i-reference-taxonomy /outputs/some_output_ref-taxonomy.qza \
  --o-classifier /outputs/some_output_classifier.qza

Note that it is important to use the bind option (-B) with each folder you want to work with when you run programs in your container. For more information about Apptainer, you can watch this Apptainer webinar.

On first importing data into QIIME format, you may receive an error ending with a message like this:

Timezone offset does not match system offset: 0 != -18000. Please, check your config files.

This can be worked around by setting a time zone before invoking Apptainer:

[name@server ~]$ export TZ='UTC'
[name@server ~]$ apptainer exec qiime2-2021.11.sif qiime tools import ...


References

QIIME home page