qiime2-its 0.3.2__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. qiime2_its-0.3.2/LICENSE +21 -0
  2. qiime2_its-0.3.2/PKG-INFO +88 -0
  3. qiime2_its-0.3.2/README.md +52 -0
  4. qiime2_its-0.3.2/pyproject.toml +71 -0
  5. qiime2_its-0.3.2/setup.cfg +4 -0
  6. qiime2_its-0.3.2/src/qiime2_its/__init__.py +3 -0
  7. qiime2_its-0.3.2/src/qiime2_its/_version.py +1 -0
  8. qiime2_its-0.3.2/src/qiime2_its/assets/logo.png +0 -0
  9. qiime2_its-0.3.2/src/qiime2_its/biom_utils.py +37 -0
  10. qiime2_its-0.3.2/src/qiime2_its/cli/__init__.py +0 -0
  11. qiime2_its-0.3.2/src/qiime2_its/cli/fastq_rc.py +50 -0
  12. qiime2_its-0.3.2/src/qiime2_its/cli/pipeline.py +603 -0
  13. qiime2_its-0.3.2/src/qiime2_its/cli/train_fasta.py +97 -0
  14. qiime2_its-0.3.2/src/qiime2_its/cli/train_ncbi.py +233 -0
  15. qiime2_its-0.3.2/src/qiime2_its/cli/train_unite.py +118 -0
  16. qiime2_its-0.3.2/src/qiime2_its/downloader.py +46 -0
  17. qiime2_its-0.3.2/src/qiime2_its/env_checks.py +53 -0
  18. qiime2_its-0.3.2/src/qiime2_its/fastq_utils.py +249 -0
  19. qiime2_its-0.3.2/src/qiime2_its/itsxpress_wrapper.py +65 -0
  20. qiime2_its-0.3.2/src/qiime2_its/metadata_utils.py +222 -0
  21. qiime2_its-0.3.2/src/qiime2_its/provenance.py +155 -0
  22. qiime2_its-0.3.2/src/qiime2_its/qiime_wrapper.py +277 -0
  23. qiime2_its-0.3.2/src/qiime2_its/report.py +981 -0
  24. qiime2_its-0.3.2/src/qiime2_its/report_data.py +337 -0
  25. qiime2_its-0.3.2/src/qiime2_its/size_filter.py +61 -0
  26. qiime2_its-0.3.2/src/qiime2_its/taxonomy.py +190 -0
  27. qiime2_its-0.3.2/src/qiime2_its/timing.py +9 -0
  28. qiime2_its-0.3.2/src/qiime2_its.egg-info/PKG-INFO +88 -0
  29. qiime2_its-0.3.2/src/qiime2_its.egg-info/SOURCES.txt +49 -0
  30. qiime2_its-0.3.2/src/qiime2_its.egg-info/dependency_links.txt +1 -0
  31. qiime2_its-0.3.2/src/qiime2_its.egg-info/entry_points.txt +6 -0
  32. qiime2_its-0.3.2/src/qiime2_its.egg-info/requires.txt +10 -0
  33. qiime2_its-0.3.2/src/qiime2_its.egg-info/top_level.txt +1 -0
  34. qiime2_its-0.3.2/tests/test_biom_utils.py +39 -0
  35. qiime2_its-0.3.2/tests/test_cli_fastq_rc.py +48 -0
  36. qiime2_its-0.3.2/tests/test_cli_pipeline.py +395 -0
  37. qiime2_its-0.3.2/tests/test_cli_train_fasta.py +99 -0
  38. qiime2_its-0.3.2/tests/test_cli_train_ncbi.py +189 -0
  39. qiime2_its-0.3.2/tests/test_cli_train_unite.py +174 -0
  40. qiime2_its-0.3.2/tests/test_downloader.py +117 -0
  41. qiime2_its-0.3.2/tests/test_env_checks.py +70 -0
  42. qiime2_its-0.3.2/tests/test_fastq_utils.py +290 -0
  43. qiime2_its-0.3.2/tests/test_itsxpress_wrapper.py +32 -0
  44. qiime2_its-0.3.2/tests/test_metadata_utils.py +314 -0
  45. qiime2_its-0.3.2/tests/test_provenance.py +181 -0
  46. qiime2_its-0.3.2/tests/test_qiime_wrapper.py +259 -0
  47. qiime2_its-0.3.2/tests/test_report.py +855 -0
  48. qiime2_its-0.3.2/tests/test_report_data.py +402 -0
  49. qiime2_its-0.3.2/tests/test_size_filter.py +58 -0
  50. qiime2_its-0.3.2/tests/test_taxonomy.py +196 -0
  51. qiime2_its-0.3.2/tests/test_timing.py +21 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2021 Marc-Olivier Duceppe
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: qiime2-its
3
+ Version: 0.3.2
4
+ Summary: QIIME2 ITS metabarcoding pipeline for single-end (IonTorrent) and paired-end (Illumina) data
5
+ Author: duceppemo
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/duceppemo/QIIME2_ITS
8
+ Project-URL: Repository, https://github.com/duceppemo/QIIME2_ITS
9
+ Project-URL: Documentation, https://github.com/duceppemo/QIIME2_ITS/wiki
10
+ Project-URL: Issues, https://github.com/duceppemo/QIIME2_ITS/issues
11
+ Project-URL: Changelog, https://github.com/duceppemo/QIIME2_ITS/releases
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Science/Research
14
+ Classifier: Operating System :: POSIX :: Linux
15
+ Classifier: Operating System :: MacOS
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.9
18
+ Classifier: Programming Language :: Python :: 3.10
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Programming Language :: Python :: 3.13
22
+ Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
23
+ Requires-Python: >=3.9
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: biopython>=1.81
27
+ Requires-Dist: matplotlib>=3.7
28
+ Requires-Dist: pandas>=2.0
29
+ Requires-Dist: fpdf2>=2.7
30
+ Requires-Dist: scipy>=1.10
31
+ Provides-Extra: dev
32
+ Requires-Dist: pytest>=7.4; extra == "dev"
33
+ Requires-Dist: pytest-mock>=3.12; extra == "dev"
34
+ Requires-Dist: pytest-cov>=4.1; extra == "dev"
35
+ Dynamic: license-file
36
+
37
+ <p align="center">
38
+ <img src="https://raw.githubusercontent.com/duceppemo/QIIME2_ITS/master/docs/QIIME2_ITS_logo.png" alt="QIIME2_ITS logo" width="280">
39
+ </p>
40
+
41
+ <h1 align="center">QIIME2_ITS</h1>
42
+
43
+ <p align="center">
44
+ <a href="https://github.com/duceppemo/QIIME2_ITS/actions/workflows/tests.yml"><img src="https://github.com/duceppemo/QIIME2_ITS/actions/workflows/tests.yml/badge.svg" alt="tests"></a>
45
+ <a href="https://github.com/duceppemo/QIIME2_ITS/blob/master/LICENSE"><img src="https://img.shields.io/github/license/duceppemo/QIIME2_ITS" alt="license"></a>
46
+ <img src="https://img.shields.io/badge/python-3.9%2B-blue" alt="python 3.9+">
47
+ <img src="https://img.shields.io/badge/QIIME2-2026.x-blue" alt="QIIME2 2026.x">
48
+ </p>
49
+
50
+ <p align="center">
51
+ QIIME2 pipeline for single-end (IonTorrent) and paired-end (Illumina) ITS metabarcoding data.
52
+ ITSxpress for ITS region extraction, DADA2 for denoising, plus diversity statistics,
53
+ classification, and a PDF summary report.
54
+ </p>
55
+
56
+ ## Quick start
57
+
58
+ ```bash
59
+ # 1. Install QIIME2 (see the wiki for details/troubleshooting):
60
+ VERSION=2026.7 # check https://library.qiime2.org/quickstart/qiime2 for the current release
61
+ conda env create -n rachis-qiime2-$VERSION \
62
+ --file https://raw.githubusercontent.com/qiime2/distributions/dev/$VERSION/qiime2/released/rachis-qiime2-linux-64-conda.yml
63
+ conda activate rachis-qiime2-$VERSION
64
+
65
+ # 2. Install ITSxpress + BBMap into it, and this package:
66
+ conda install -c bioconda -c conda-forge itsxpress bbmap
67
+ qiime dev refresh-cache
68
+
69
+ git clone https://github.com/duceppemo/QIIME2_ITS
70
+ cd QIIME2_ITS
71
+ pip install -e .
72
+
73
+ # 3. Run it:
74
+ qiime2-its \
75
+ -q rachis-qiime2-$VERSION \
76
+ -i /input_folder/ -o /output_folder/ \
77
+ -m qiime2_metadata.tsv -c classifier.qza \
78
+ -pe --extract-its2 --taxa Fungi
79
+ ```
80
+
81
+ That's the short version. **[See the wiki](https://github.com/duceppemo/QIIME2_ITS/wiki) for:**
82
+ full installation, building a classifier (UNITE/NCBI/your own fasta), the complete flag reference,
83
+ fastq/metadata requirements, the diversity-stats-and-PDF-report feature, the real-data validation
84
+ suite, and troubleshooting.
85
+
86
+ ## License
87
+
88
+ [MIT](https://github.com/duceppemo/QIIME2_ITS/blob/master/LICENSE)
@@ -0,0 +1,52 @@
1
+ <p align="center">
2
+ <img src="https://raw.githubusercontent.com/duceppemo/QIIME2_ITS/master/docs/QIIME2_ITS_logo.png" alt="QIIME2_ITS logo" width="280">
3
+ </p>
4
+
5
+ <h1 align="center">QIIME2_ITS</h1>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/duceppemo/QIIME2_ITS/actions/workflows/tests.yml"><img src="https://github.com/duceppemo/QIIME2_ITS/actions/workflows/tests.yml/badge.svg" alt="tests"></a>
9
+ <a href="https://github.com/duceppemo/QIIME2_ITS/blob/master/LICENSE"><img src="https://img.shields.io/github/license/duceppemo/QIIME2_ITS" alt="license"></a>
10
+ <img src="https://img.shields.io/badge/python-3.9%2B-blue" alt="python 3.9+">
11
+ <img src="https://img.shields.io/badge/QIIME2-2026.x-blue" alt="QIIME2 2026.x">
12
+ </p>
13
+
14
+ <p align="center">
15
+ QIIME2 pipeline for single-end (IonTorrent) and paired-end (Illumina) ITS metabarcoding data.
16
+ ITSxpress for ITS region extraction, DADA2 for denoising, plus diversity statistics,
17
+ classification, and a PDF summary report.
18
+ </p>
19
+
20
+ ## Quick start
21
+
22
+ ```bash
23
+ # 1. Install QIIME2 (see the wiki for details/troubleshooting):
24
+ VERSION=2026.7 # check https://library.qiime2.org/quickstart/qiime2 for the current release
25
+ conda env create -n rachis-qiime2-$VERSION \
26
+ --file https://raw.githubusercontent.com/qiime2/distributions/dev/$VERSION/qiime2/released/rachis-qiime2-linux-64-conda.yml
27
+ conda activate rachis-qiime2-$VERSION
28
+
29
+ # 2. Install ITSxpress + BBMap into it, and this package:
30
+ conda install -c bioconda -c conda-forge itsxpress bbmap
31
+ qiime dev refresh-cache
32
+
33
+ git clone https://github.com/duceppemo/QIIME2_ITS
34
+ cd QIIME2_ITS
35
+ pip install -e .
36
+
37
+ # 3. Run it:
38
+ qiime2-its \
39
+ -q rachis-qiime2-$VERSION \
40
+ -i /input_folder/ -o /output_folder/ \
41
+ -m qiime2_metadata.tsv -c classifier.qza \
42
+ -pe --extract-its2 --taxa Fungi
43
+ ```
44
+
45
+ That's the short version. **[See the wiki](https://github.com/duceppemo/QIIME2_ITS/wiki) for:**
46
+ full installation, building a classifier (UNITE/NCBI/your own fasta), the complete flag reference,
47
+ fastq/metadata requirements, the diversity-stats-and-PDF-report feature, the real-data validation
48
+ suite, and troubleshooting.
49
+
50
+ ## License
51
+
52
+ [MIT](https://github.com/duceppemo/QIIME2_ITS/blob/master/LICENSE)
@@ -0,0 +1,71 @@
1
+ [build-system]
2
+ # >=77 (not the previous >=68): this file's PEP 639 license metadata below
3
+ # (license = "MIT" as a plain string, plus license-files) only validates on
4
+ # setuptools 77+ -- confirmed empirically, 76.1.0 fails the build outright
5
+ # with "project.license must be valid exactly by one definition". Only bites
6
+ # --no-build-isolation installs or an env with an older setuptools already
7
+ # present; a normal `pip install` pulls a current setuptools into its build
8
+ # environment regardless of this floor.
9
+ requires = ["setuptools>=77"]
10
+ build-backend = "setuptools.build_meta"
11
+
12
+ [project]
13
+ name = "qiime2-its"
14
+ version = "0.3.2"
15
+ description = "QIIME2 ITS metabarcoding pipeline for single-end (IonTorrent) and paired-end (Illumina) data"
16
+ readme = "README.md"
17
+ requires-python = ">=3.9"
18
+ license = "MIT"
19
+ license-files = ["LICENSE"]
20
+ authors = [{ name = "duceppemo" }]
21
+ classifiers = [
22
+ "Development Status :: 4 - Beta",
23
+ "Intended Audience :: Science/Research",
24
+ "Operating System :: POSIX :: Linux",
25
+ "Operating System :: MacOS",
26
+ "Programming Language :: Python :: 3",
27
+ "Programming Language :: Python :: 3.9",
28
+ "Programming Language :: Python :: 3.10",
29
+ "Programming Language :: Python :: 3.11",
30
+ "Programming Language :: Python :: 3.12",
31
+ "Programming Language :: Python :: 3.13",
32
+ "Topic :: Scientific/Engineering :: Bio-Informatics",
33
+ ]
34
+ dependencies = [
35
+ "biopython>=1.81",
36
+ "matplotlib>=3.7",
37
+ "pandas>=2.0",
38
+ "fpdf2>=2.7",
39
+ "scipy>=1.10",
40
+ ]
41
+
42
+ [project.urls]
43
+ Homepage = "https://github.com/duceppemo/QIIME2_ITS"
44
+ Repository = "https://github.com/duceppemo/QIIME2_ITS"
45
+ Documentation = "https://github.com/duceppemo/QIIME2_ITS/wiki"
46
+ Issues = "https://github.com/duceppemo/QIIME2_ITS/issues"
47
+ Changelog = "https://github.com/duceppemo/QIIME2_ITS/releases"
48
+
49
+ [project.optional-dependencies]
50
+ dev = [
51
+ "pytest>=7.4",
52
+ "pytest-mock>=3.12",
53
+ "pytest-cov>=4.1",
54
+ ]
55
+
56
+ [project.scripts]
57
+ qiime2-its = "qiime2_its.cli.pipeline:main"
58
+ qiime2-its-rc = "qiime2_its.cli.fastq_rc:main"
59
+ qiime2-its-train-unite = "qiime2_its.cli.train_unite:main"
60
+ qiime2-its-train-ncbi = "qiime2_its.cli.train_ncbi:main"
61
+ qiime2-its-train-fasta = "qiime2_its.cli.train_fasta:main"
62
+
63
+ [tool.setuptools.packages.find]
64
+ where = ["src"]
65
+
66
+ [tool.setuptools.package-data]
67
+ qiime2_its = ["assets/*.png"]
68
+
69
+ [tool.pytest.ini_options]
70
+ testpaths = ["tests"]
71
+ addopts = "-ra"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,3 @@
1
+ from qiime2_its._version import __version__
2
+
3
+ __all__ = ["__version__"]
@@ -0,0 +1 @@
1
+ __version__ = "0.3.2"
@@ -0,0 +1,37 @@
1
+ """Helpers for merging QIIME2 taxonomy assignments into a biom feature table."""
2
+ import subprocess
3
+ from pathlib import Path
4
+
5
+ TAXONOMY_HEADER = '#OTUID\ttaxonomy\tconfidence\n'
6
+
7
+
8
+ def rewrite_taxonomy_header(taxonomy_tsv):
9
+ """Replace the first line of a QIIME2-exported taxonomy.tsv with the header
10
+ biom's `add-metadata` expects (#OTUID / taxonomy / confidence).
11
+ """
12
+ taxonomy_tsv = Path(taxonomy_tsv)
13
+ tmp_path = taxonomy_tsv.with_name(taxonomy_tsv.name + '.tmp')
14
+ with open(taxonomy_tsv) as in_f, open(tmp_path, 'w') as out_f:
15
+ out_f.write(TAXONOMY_HEADER)
16
+ next(in_f, None) # skip original header
17
+ out_f.writelines(in_f)
18
+ tmp_path.replace(taxonomy_tsv)
19
+
20
+
21
+ def add_metadata(input_biom, taxonomy_tsv, output_biom):
22
+ cmd = ['biom', 'add-metadata',
23
+ '--sc-separated', 'taxonomy',
24
+ '-i', str(input_biom),
25
+ '--observation-metadata-fp', str(taxonomy_tsv),
26
+ '-o', str(output_biom)]
27
+ subprocess.run(cmd, check=True)
28
+
29
+
30
+ def convert_to_tsv(input_biom, taxonomy_tsv, output_tsv):
31
+ cmd = ['biom', 'convert',
32
+ '--to-tsv',
33
+ '--header-key', 'taxonomy',
34
+ '-i', str(input_biom),
35
+ '--observation-metadata-fp', str(taxonomy_tsv),
36
+ '-o', str(output_tsv)]
37
+ subprocess.run(cmd, check=True)
File without changes
@@ -0,0 +1,50 @@
1
+ """Standalone utility: reverse-complement every fastq file in a folder."""
2
+ import argparse
3
+ from multiprocessing import cpu_count
4
+ from pathlib import Path
5
+
6
+ from qiime2_its import env_checks, fastq_utils
7
+ from qiime2_its._version import __version__
8
+
9
+
10
+ def run(input_folder, output_folder, threads):
11
+ input_folder = Path(input_folder)
12
+ output_folder = Path(output_folder)
13
+
14
+ if not input_folder.exists() or not input_folder.is_dir():
15
+ raise ValueError('Input folder does not exist or is not a directory.')
16
+ # Not inside it either: the fastq search below is recursive, so a second
17
+ # run would find (and try to re-process) the first run's own output.
18
+ if output_folder.resolve() == input_folder.resolve() or input_folder.resolve() in output_folder.resolve().parents:
19
+ raise ValueError('Please choose an output folder different from (and not inside) the input folder.')
20
+ output_folder.mkdir(parents=True, exist_ok=True)
21
+
22
+ fastq_list = fastq_utils.list_fastq(input_folder)
23
+ if not fastq_list:
24
+ raise ValueError('No fastq files found in the input folder.')
25
+
26
+ print('Processing:')
27
+ fastq_utils.rc_fastq_parallel(fastq_list, output_folder, env_checks.clamp_cpu(threads))
28
+
29
+
30
+ def build_parser():
31
+ cpu = cpu_count()
32
+ parser = argparse.ArgumentParser(description='Reverse complement all entries in fastq file(s).')
33
+ parser.add_argument('-i', '--input', metavar='/input_folder/', required=True, type=str,
34
+ help='Input folder with fastq file(s), gzipped or not. Accepted extensions are '
35
+ '".fastq", ".fastq.gz", ".fq" and ".fq.gz". Searched recursively. Mandatory.')
36
+ parser.add_argument('-o', '--output', metavar='/modified_fastq/', required=True, type=str,
37
+ help='Output folder. Must be different from (and not inside) the input folder. Mandatory.')
38
+ parser.add_argument('-t', '--threads', metavar=str(cpu), default=cpu, type=int,
39
+ help=f'Number of CPUs. Default is {cpu}.')
40
+ parser.add_argument('--version', action='version', version=f'%(prog)s {__version__}')
41
+ return parser
42
+
43
+
44
+ def main():
45
+ args = build_parser().parse_args()
46
+ run(args.input, args.output, args.threads)
47
+
48
+
49
+ if __name__ == '__main__':
50
+ main()