MitoBee 1.0.post0__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.
- mitobee-1.0.post0/LICENSE +21 -0
- mitobee-1.0.post0/MitoBee.egg-info/PKG-INFO +118 -0
- mitobee-1.0.post0/MitoBee.egg-info/SOURCES.txt +12 -0
- mitobee-1.0.post0/MitoBee.egg-info/dependency_links.txt +1 -0
- mitobee-1.0.post0/MitoBee.egg-info/entry_points.txt +2 -0
- mitobee-1.0.post0/MitoBee.egg-info/requires.txt +11 -0
- mitobee-1.0.post0/MitoBee.egg-info/top_level.txt +1 -0
- mitobee-1.0.post0/PKG-INFO +118 -0
- mitobee-1.0.post0/README.md +87 -0
- mitobee-1.0.post0/mitobee/__init__.py +0 -0
- mitobee-1.0.post0/mitobee/__main__.py +240 -0
- mitobee-1.0.post0/mitobee/_version.py +34 -0
- mitobee-1.0.post0/pyproject.toml +53 -0
- mitobee-1.0.post0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Bhavya Papudeshi
|
|
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,118 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: MitoBee
|
|
3
|
+
Version: 1.0.post0
|
|
4
|
+
Summary: Build mitogenomes from WGS metagenomes
|
|
5
|
+
Author-email: Bhavya Papudeshi <bnalaga1@unil.ch>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Environment :: Console
|
|
8
|
+
Classifier: Environment :: MacOS X
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: snaketool-utils>=0.0.5
|
|
20
|
+
Requires-Dist: snakemake>=8.28.0
|
|
21
|
+
Requires-Dist: snakemake-executor-plugin-slurm
|
|
22
|
+
Requires-Dist: pyyaml>=6.0
|
|
23
|
+
Requires-Dist: Click>=8.1.3
|
|
24
|
+
Requires-Dist: metasnek>=0.0.8
|
|
25
|
+
Requires-Dist: attrmap>=0.0.7
|
|
26
|
+
Requires-Dist: biopython>=1.8.1
|
|
27
|
+
Requires-Dist: pandas
|
|
28
|
+
Requires-Dist: matplotlib
|
|
29
|
+
Requires-Dist: snakemake-executor-plugin-slurm>=0.5.1
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
[](https://opensource.org/licenses/MIT)
|
|
33
|
+
|
|
34
|
+
[](https://github.com/beardymcjohnface/Snaketool)
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
<img src="test-files/mitobeelogo.png" width="200" alt="MitoBee logo">
|
|
38
|
+
|
|
39
|
+
# MitoBee
|
|
40
|
+
|
|
41
|
+
## Snakemake workflow to get mitogenomes from metagenomic data
|
|
42
|
+
Still under development! Stable release out as a version, but only if there is a closely related mitogenome available.
|
|
43
|
+
|
|
44
|
+
Documentation: [Wiki](https://github.com/npbhavya/Mitobee/wiki/Home)
|
|
45
|
+
|
|
46
|
+
### Install
|
|
47
|
+
|
|
48
|
+
**Source install**
|
|
49
|
+
Run the below commands:
|
|
50
|
+
|
|
51
|
+
git clone https://github.com/npbhavya/MitoBee.git
|
|
52
|
+
cd MitBee
|
|
53
|
+
mamba create -y -n mitobee python=3.13
|
|
54
|
+
conda activate mitobee
|
|
55
|
+
pip install -e .
|
|
56
|
+
|
|
57
|
+
**Once I have a stable version release, I will upload them to conda and pip as well**
|
|
58
|
+
|
|
59
|
+
### Running the code
|
|
60
|
+
Note: This code works only on paired end metagenomes for now.
|
|
61
|
+
|
|
62
|
+
This workflow is made modular;
|
|
63
|
+
|
|
64
|
+
1. `mitobee run`
|
|
65
|
+
If there is a representative closely related genome mitogenome, provide that as the host seq and get started
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
#Running mitobee with test files available in the repo
|
|
69
|
+
mitobee run --input test-files/metagenomes --extn fastq.gz \
|
|
70
|
+
--pattern_r1 _R1 --pattern_r2 _R2 \
|
|
71
|
+
--host_seq test-files/am-dh4.fasta \
|
|
72
|
+
--output output
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
2. `mitobee tree`
|
|
76
|
+
Once the mitochondrial genomes are built from each metagenome sample, run this module to build a tree with these mitogenomes and other references
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
#After the mitogenomes are made from the mitobee run results. Add other references to build a tree
|
|
80
|
+
#Once again example with test files
|
|
81
|
+
mitobee tree --input test-files/mitogenomes --extn fasta --output output -k all
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
3. `mitobee search`
|
|
86
|
+
If there is a no closely related mitogenome available, then this step can be run first to search against a set of mitogenomes or mito genes
|
|
87
|
+
This module will provide an overview of which reference to use
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
#If a closely related mitochondrial genome is not available, but a gene is, like cox or rRNA genes
|
|
91
|
+
#Download the reference genes you would like to use of the closely related genomes
|
|
92
|
+
|
|
93
|
+
#to search against mitogenomes refernece set
|
|
94
|
+
mitobee search --input test-files/mitogenomes --extn fastq.gz \
|
|
95
|
+
--pattern_r1 _R1 --pattern_r2 _R2 \
|
|
96
|
+
--ref_seq test-files/ref-set-genome --output output \
|
|
97
|
+
-k all --mode mitogenome
|
|
98
|
+
|
|
99
|
+
#to search against mitogenomes refernece gene set
|
|
100
|
+
mitobee search --input test-files/mitogenomes --extn fastq.gz \
|
|
101
|
+
--pattern_r1 _R1 --pattern_r2 _R2 \
|
|
102
|
+
--ref_seq test-files/ref-set-genes --output output \
|
|
103
|
+
-k all --mode genes
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Input files
|
|
108
|
+
Input files:
|
|
109
|
+
- Input directory with metagenomes
|
|
110
|
+
- Reference directory
|
|
111
|
+
- If running `run` or `tree` module, provide a **(one)** reference genome.
|
|
112
|
+
- If running `gene` module, provide a reference gene set
|
|
113
|
+
|
|
114
|
+
### Output files
|
|
115
|
+
Output files: Provide the output folder, contains subdirectories
|
|
116
|
+
- PROCESSING: Folder containing intermediate files
|
|
117
|
+
- REPORTS: Final results including the mitogenome fasta files from (hopefully) each metagenome sample \
|
|
118
|
+
Also inlcudes the QC reports, to include stats on how many reads were processed, and not
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
MitoBee.egg-info/PKG-INFO
|
|
5
|
+
MitoBee.egg-info/SOURCES.txt
|
|
6
|
+
MitoBee.egg-info/dependency_links.txt
|
|
7
|
+
MitoBee.egg-info/entry_points.txt
|
|
8
|
+
MitoBee.egg-info/requires.txt
|
|
9
|
+
MitoBee.egg-info/top_level.txt
|
|
10
|
+
mitobee/__init__.py
|
|
11
|
+
mitobee/__main__.py
|
|
12
|
+
mitobee/_version.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
mitobee
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: MitoBee
|
|
3
|
+
Version: 1.0.post0
|
|
4
|
+
Summary: Build mitogenomes from WGS metagenomes
|
|
5
|
+
Author-email: Bhavya Papudeshi <bnalaga1@unil.ch>
|
|
6
|
+
License: MIT
|
|
7
|
+
Classifier: Environment :: Console
|
|
8
|
+
Classifier: Environment :: MacOS X
|
|
9
|
+
Classifier: Intended Audience :: Science/Research
|
|
10
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
11
|
+
Classifier: Natural Language :: English
|
|
12
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
|
|
16
|
+
Requires-Python: >=3.9
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: snaketool-utils>=0.0.5
|
|
20
|
+
Requires-Dist: snakemake>=8.28.0
|
|
21
|
+
Requires-Dist: snakemake-executor-plugin-slurm
|
|
22
|
+
Requires-Dist: pyyaml>=6.0
|
|
23
|
+
Requires-Dist: Click>=8.1.3
|
|
24
|
+
Requires-Dist: metasnek>=0.0.8
|
|
25
|
+
Requires-Dist: attrmap>=0.0.7
|
|
26
|
+
Requires-Dist: biopython>=1.8.1
|
|
27
|
+
Requires-Dist: pandas
|
|
28
|
+
Requires-Dist: matplotlib
|
|
29
|
+
Requires-Dist: snakemake-executor-plugin-slurm>=0.5.1
|
|
30
|
+
Dynamic: license-file
|
|
31
|
+
|
|
32
|
+
[](https://opensource.org/licenses/MIT)
|
|
33
|
+
|
|
34
|
+
[](https://github.com/beardymcjohnface/Snaketool)
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
<img src="test-files/mitobeelogo.png" width="200" alt="MitoBee logo">
|
|
38
|
+
|
|
39
|
+
# MitoBee
|
|
40
|
+
|
|
41
|
+
## Snakemake workflow to get mitogenomes from metagenomic data
|
|
42
|
+
Still under development! Stable release out as a version, but only if there is a closely related mitogenome available.
|
|
43
|
+
|
|
44
|
+
Documentation: [Wiki](https://github.com/npbhavya/Mitobee/wiki/Home)
|
|
45
|
+
|
|
46
|
+
### Install
|
|
47
|
+
|
|
48
|
+
**Source install**
|
|
49
|
+
Run the below commands:
|
|
50
|
+
|
|
51
|
+
git clone https://github.com/npbhavya/MitoBee.git
|
|
52
|
+
cd MitBee
|
|
53
|
+
mamba create -y -n mitobee python=3.13
|
|
54
|
+
conda activate mitobee
|
|
55
|
+
pip install -e .
|
|
56
|
+
|
|
57
|
+
**Once I have a stable version release, I will upload them to conda and pip as well**
|
|
58
|
+
|
|
59
|
+
### Running the code
|
|
60
|
+
Note: This code works only on paired end metagenomes for now.
|
|
61
|
+
|
|
62
|
+
This workflow is made modular;
|
|
63
|
+
|
|
64
|
+
1. `mitobee run`
|
|
65
|
+
If there is a representative closely related genome mitogenome, provide that as the host seq and get started
|
|
66
|
+
|
|
67
|
+
```
|
|
68
|
+
#Running mitobee with test files available in the repo
|
|
69
|
+
mitobee run --input test-files/metagenomes --extn fastq.gz \
|
|
70
|
+
--pattern_r1 _R1 --pattern_r2 _R2 \
|
|
71
|
+
--host_seq test-files/am-dh4.fasta \
|
|
72
|
+
--output output
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
2. `mitobee tree`
|
|
76
|
+
Once the mitochondrial genomes are built from each metagenome sample, run this module to build a tree with these mitogenomes and other references
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
#After the mitogenomes are made from the mitobee run results. Add other references to build a tree
|
|
80
|
+
#Once again example with test files
|
|
81
|
+
mitobee tree --input test-files/mitogenomes --extn fasta --output output -k all
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
3. `mitobee search`
|
|
86
|
+
If there is a no closely related mitogenome available, then this step can be run first to search against a set of mitogenomes or mito genes
|
|
87
|
+
This module will provide an overview of which reference to use
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
#If a closely related mitochondrial genome is not available, but a gene is, like cox or rRNA genes
|
|
91
|
+
#Download the reference genes you would like to use of the closely related genomes
|
|
92
|
+
|
|
93
|
+
#to search against mitogenomes refernece set
|
|
94
|
+
mitobee search --input test-files/mitogenomes --extn fastq.gz \
|
|
95
|
+
--pattern_r1 _R1 --pattern_r2 _R2 \
|
|
96
|
+
--ref_seq test-files/ref-set-genome --output output \
|
|
97
|
+
-k all --mode mitogenome
|
|
98
|
+
|
|
99
|
+
#to search against mitogenomes refernece gene set
|
|
100
|
+
mitobee search --input test-files/mitogenomes --extn fastq.gz \
|
|
101
|
+
--pattern_r1 _R1 --pattern_r2 _R2 \
|
|
102
|
+
--ref_seq test-files/ref-set-genes --output output \
|
|
103
|
+
-k all --mode genes
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
### Input files
|
|
108
|
+
Input files:
|
|
109
|
+
- Input directory with metagenomes
|
|
110
|
+
- Reference directory
|
|
111
|
+
- If running `run` or `tree` module, provide a **(one)** reference genome.
|
|
112
|
+
- If running `gene` module, provide a reference gene set
|
|
113
|
+
|
|
114
|
+
### Output files
|
|
115
|
+
Output files: Provide the output folder, contains subdirectories
|
|
116
|
+
- PROCESSING: Folder containing intermediate files
|
|
117
|
+
- REPORTS: Final results including the mitogenome fasta files from (hopefully) each metagenome sample \
|
|
118
|
+
Also inlcudes the QC reports, to include stats on how many reads were processed, and not
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
[](https://opensource.org/licenses/MIT)
|
|
2
|
+
|
|
3
|
+
[](https://github.com/beardymcjohnface/Snaketool)
|
|
4
|
+

|
|
5
|
+
|
|
6
|
+
<img src="test-files/mitobeelogo.png" width="200" alt="MitoBee logo">
|
|
7
|
+
|
|
8
|
+
# MitoBee
|
|
9
|
+
|
|
10
|
+
## Snakemake workflow to get mitogenomes from metagenomic data
|
|
11
|
+
Still under development! Stable release out as a version, but only if there is a closely related mitogenome available.
|
|
12
|
+
|
|
13
|
+
Documentation: [Wiki](https://github.com/npbhavya/Mitobee/wiki/Home)
|
|
14
|
+
|
|
15
|
+
### Install
|
|
16
|
+
|
|
17
|
+
**Source install**
|
|
18
|
+
Run the below commands:
|
|
19
|
+
|
|
20
|
+
git clone https://github.com/npbhavya/MitoBee.git
|
|
21
|
+
cd MitBee
|
|
22
|
+
mamba create -y -n mitobee python=3.13
|
|
23
|
+
conda activate mitobee
|
|
24
|
+
pip install -e .
|
|
25
|
+
|
|
26
|
+
**Once I have a stable version release, I will upload them to conda and pip as well**
|
|
27
|
+
|
|
28
|
+
### Running the code
|
|
29
|
+
Note: This code works only on paired end metagenomes for now.
|
|
30
|
+
|
|
31
|
+
This workflow is made modular;
|
|
32
|
+
|
|
33
|
+
1. `mitobee run`
|
|
34
|
+
If there is a representative closely related genome mitogenome, provide that as the host seq and get started
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
#Running mitobee with test files available in the repo
|
|
38
|
+
mitobee run --input test-files/metagenomes --extn fastq.gz \
|
|
39
|
+
--pattern_r1 _R1 --pattern_r2 _R2 \
|
|
40
|
+
--host_seq test-files/am-dh4.fasta \
|
|
41
|
+
--output output
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
2. `mitobee tree`
|
|
45
|
+
Once the mitochondrial genomes are built from each metagenome sample, run this module to build a tree with these mitogenomes and other references
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
#After the mitogenomes are made from the mitobee run results. Add other references to build a tree
|
|
49
|
+
#Once again example with test files
|
|
50
|
+
mitobee tree --input test-files/mitogenomes --extn fasta --output output -k all
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
3. `mitobee search`
|
|
55
|
+
If there is a no closely related mitogenome available, then this step can be run first to search against a set of mitogenomes or mito genes
|
|
56
|
+
This module will provide an overview of which reference to use
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
#If a closely related mitochondrial genome is not available, but a gene is, like cox or rRNA genes
|
|
60
|
+
#Download the reference genes you would like to use of the closely related genomes
|
|
61
|
+
|
|
62
|
+
#to search against mitogenomes refernece set
|
|
63
|
+
mitobee search --input test-files/mitogenomes --extn fastq.gz \
|
|
64
|
+
--pattern_r1 _R1 --pattern_r2 _R2 \
|
|
65
|
+
--ref_seq test-files/ref-set-genome --output output \
|
|
66
|
+
-k all --mode mitogenome
|
|
67
|
+
|
|
68
|
+
#to search against mitogenomes refernece gene set
|
|
69
|
+
mitobee search --input test-files/mitogenomes --extn fastq.gz \
|
|
70
|
+
--pattern_r1 _R1 --pattern_r2 _R2 \
|
|
71
|
+
--ref_seq test-files/ref-set-genes --output output \
|
|
72
|
+
-k all --mode genes
|
|
73
|
+
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### Input files
|
|
77
|
+
Input files:
|
|
78
|
+
- Input directory with metagenomes
|
|
79
|
+
- Reference directory
|
|
80
|
+
- If running `run` or `tree` module, provide a **(one)** reference genome.
|
|
81
|
+
- If running `gene` module, provide a reference gene set
|
|
82
|
+
|
|
83
|
+
### Output files
|
|
84
|
+
Output files: Provide the output folder, contains subdirectories
|
|
85
|
+
- PROCESSING: Folder containing intermediate files
|
|
86
|
+
- REPORTS: Final results including the mitogenome fasta files from (hopefully) each metagenome sample \
|
|
87
|
+
Also inlcudes the QC reports, to include stats on how many reads were processed, and not
|
|
File without changes
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Entrypoint for this workflow
|
|
3
|
+
|
|
4
|
+
Check out the wiki for a detailed look at customising this file:
|
|
5
|
+
https://github.com/beardymcjohnface/Snaketool/wiki/Customising-your-Snaketool
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
import os
|
|
9
|
+
import click
|
|
10
|
+
from shutil import copyfile
|
|
11
|
+
from snaketool_utils.cli_utils import OrderedCommands, run_snakemake, copy_config, echo_click
|
|
12
|
+
|
|
13
|
+
"""Get the filepath to a Snaketool system file (relative to __main__.py)"""
|
|
14
|
+
PACKAGE_DIR = os.path.dirname(os.path.realpath(__file__))
|
|
15
|
+
PROJECT_ROOT = os.path.dirname(PACKAGE_DIR) # one level up
|
|
16
|
+
|
|
17
|
+
def snake_base(rel_path):
|
|
18
|
+
"""Get the filepath to a project file relative to the repo root."""
|
|
19
|
+
return os.path.join(PROJECT_ROOT, rel_path)
|
|
20
|
+
|
|
21
|
+
def get_version():
|
|
22
|
+
try:
|
|
23
|
+
from mitobee._version import version
|
|
24
|
+
except Exception:
|
|
25
|
+
version = "0.1.0"
|
|
26
|
+
return version
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def print_citation():
|
|
30
|
+
with open(snake_base("../MitoBee.CITATION"), "r") as f:
|
|
31
|
+
for line in f:
|
|
32
|
+
echo_click(line)
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def default_to_output(ctx, param, value):
|
|
36
|
+
"""Callback for click options; places value in output directory unless specified"""
|
|
37
|
+
if param.default == value:
|
|
38
|
+
return os.path.join(ctx.params["output"], value)
|
|
39
|
+
return value
|
|
40
|
+
|
|
41
|
+
# This is to ensure that the output directory gets generated if it hasnt already been generated
|
|
42
|
+
def ensure_directory_exists(directory):
|
|
43
|
+
if not os.path.exists(directory):
|
|
44
|
+
os.makedirs(directory)
|
|
45
|
+
|
|
46
|
+
def common_options(func):
|
|
47
|
+
"""Common command line args
|
|
48
|
+
Define common command line args here, and include them with the @common_options decorator below.
|
|
49
|
+
"""
|
|
50
|
+
options = [
|
|
51
|
+
click.option('--input', '_input', help='Directory of reads', type=click.Path(), required=False, default='testReads/paired', show_default=True),
|
|
52
|
+
click.option('--extn', 'extn', help='Reads extension; fastq, fq, fastq.gz', type=click.Path(), required=False, default='fastq', show_default=True),
|
|
53
|
+
click.option('--pattern_r1', 'r1', help='Pattern to identify R1 reads (for paired-end data)', default='_R1', show_default=True),
|
|
54
|
+
click.option('--pattern_r2', 'r2', help='Pattern to identify R2 reads (for paired-end data)', default='_R2', show_default=True),
|
|
55
|
+
click.option('--host_seq', 'host_seq', help='Path to host genome index for host read removal', type=click.Path(), show_default=True),
|
|
56
|
+
click.option('--mode', type=click.Choice(['mitogenome', 'gene'], case_sensitive=False), help='Reference search mode either gene or mitochondrial genome', required=False),
|
|
57
|
+
click.option('--ref_set', 'refdb', help='Path to reference database of mitochondrial genomes or mitochondrial genes', type=click.Path(), required=False, show_default=True),
|
|
58
|
+
click.option('--output', 'output', help='Output directory', type=click.Path(),
|
|
59
|
+
default='output', show_default=True),
|
|
60
|
+
click.option("--configfile", default="config.yaml", show_default=False, callback=default_to_output,
|
|
61
|
+
help="Custom config file [default: config.yaml]"),
|
|
62
|
+
click.option('--threads', help='Number of threads to use', default=1, show_default=True),
|
|
63
|
+
click.option('--profile', help='Snakemake profile', default=None, show_default=False),
|
|
64
|
+
click.option('--db_dir', 'db_dir', help='Custom database directory', type=click.Path(), required=False),
|
|
65
|
+
click.option('--temp-dir', help='Temp directory', required=False),
|
|
66
|
+
click.option('--snake-default', multiple=True,
|
|
67
|
+
default=['--rerun-incomplete', '--printshellcmds', '--nolock', '--show-failed-logs'],
|
|
68
|
+
help="Customise Snakemake runtime args", show_default=True),
|
|
69
|
+
click.option("--log", default="mitobee.log", callback=default_to_output, hidden=True,),
|
|
70
|
+
click.option('--use-conda', default=True, help='Use conda for Snakemake rules',
|
|
71
|
+
show_default=True),
|
|
72
|
+
click.option('--conda-frontend', default='mamba', help='Use mamba for Snakemake rules',
|
|
73
|
+
show_default=True),
|
|
74
|
+
click.option('--conda-prefix', default=snake_base(os.path.join('workflow', 'conda')),
|
|
75
|
+
help='Custom conda env directory', type=click.Path(), show_default=True),
|
|
76
|
+
click.option("--system-config", default=snake_base(os.path.join("..","config", "config.yaml")),hidden=True,),
|
|
77
|
+
click.argument("snake_args", nargs=-1),
|
|
78
|
+
]
|
|
79
|
+
for option in reversed(options):
|
|
80
|
+
func = option(func)
|
|
81
|
+
return func
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
@click.group(cls=OrderedCommands, context_settings=dict(help_option_names=["-h", "--help"]))
|
|
85
|
+
@click.version_option(get_version(), "-v", "--version", is_flag=True)
|
|
86
|
+
def cli():
|
|
87
|
+
""" Extract and assemble host mitochondrial genomes from metagenomic sequencing data.
|
|
88
|
+
\b
|
|
89
|
+
For more options, run:
|
|
90
|
+
mitobee --help"""
|
|
91
|
+
pass
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
help_msg_run = """
|
|
95
|
+
\b
|
|
96
|
+
RUN EXAMPLES
|
|
97
|
+
mitobee run --input <input directory with metagenome reads> --pattern_r1 R1 --patern_r2 R2 --extn fq --host_seq <path to host mitochondrial genome> --sequencing paired --output <output directory> -k
|
|
98
|
+
"""
|
|
99
|
+
@click.command(epilog=help_msg_run,
|
|
100
|
+
context_settings=dict(help_option_names=["-h", "--help"], ignore_unknown_options=True)
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
@common_options
|
|
104
|
+
def run(_input, extn, r1, r2, host_seq, output, temp_dir, configfile, conda_frontend, **kwargs):
|
|
105
|
+
"""Run mitobee workflow"""
|
|
106
|
+
copy_config(configfile, system_config=snake_base(os.path.join('config', 'config.yaml')))
|
|
107
|
+
|
|
108
|
+
if not host_seq:
|
|
109
|
+
raise click.UsageError("Option --host_seq is required for 'mitobee run'.")
|
|
110
|
+
|
|
111
|
+
merge_config = {
|
|
112
|
+
"args": {
|
|
113
|
+
"input": _input,
|
|
114
|
+
"output": output,
|
|
115
|
+
"extn": extn,
|
|
116
|
+
"pattern_r1": r1,
|
|
117
|
+
"pattern_r2": r2,
|
|
118
|
+
"host_seq": host_seq,
|
|
119
|
+
"configfile": configfile,
|
|
120
|
+
"temp_dir": temp_dir,
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
snake_default = list(kwargs.get('snake_default', []))
|
|
125
|
+
if conda_frontend and not any('--conda-frontend' in str(arg) for arg in snake_default):
|
|
126
|
+
snake_default.extend(['--conda-frontend', conda_frontend])
|
|
127
|
+
kwargs['snake_default'] = tuple(snake_default)
|
|
128
|
+
|
|
129
|
+
# run!
|
|
130
|
+
run_snakemake(
|
|
131
|
+
snakefile_path=snake_base(os.path.join('workflow', 'Snakefile')),
|
|
132
|
+
configfile=configfile,
|
|
133
|
+
merge_config=merge_config,
|
|
134
|
+
**kwargs
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
help_msg_run = """
|
|
138
|
+
\b
|
|
139
|
+
TREE EXAMPLES
|
|
140
|
+
mitobee tree --input output/REPORTS/mitogenome --extn fasta --host_seq test-files/am-dh4.fasta --output output -k
|
|
141
|
+
"""
|
|
142
|
+
@click.command(epilog=help_msg_run,
|
|
143
|
+
context_settings=dict(help_option_names=["-h", "--help"], ignore_unknown_options=True)
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
@common_options
|
|
147
|
+
def tree(_input, extn, output, temp_dir, configfile, conda_frontend, **kwargs):
|
|
148
|
+
"""Run mitobee workflow"""
|
|
149
|
+
copy_config(configfile, system_config=snake_base(os.path.join('config', 'config.yaml')))
|
|
150
|
+
|
|
151
|
+
merge_config = {
|
|
152
|
+
"args": {
|
|
153
|
+
"input": _input,
|
|
154
|
+
"output": output,
|
|
155
|
+
"extn": extn,
|
|
156
|
+
"configfile": configfile,
|
|
157
|
+
"temp_dir": temp_dir,
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
snake_default = list(kwargs.get('snake_default', []))
|
|
162
|
+
if conda_frontend and not any('--conda-frontend' in str(arg) for arg in snake_default):
|
|
163
|
+
snake_default.extend(['--conda-frontend', conda_frontend])
|
|
164
|
+
kwargs['snake_default'] = tuple(snake_default)
|
|
165
|
+
|
|
166
|
+
# run!
|
|
167
|
+
run_snakemake(
|
|
168
|
+
snakefile_path=snake_base(os.path.join('workflow', 'TreeBuild.Snakefile')),
|
|
169
|
+
configfile=configfile,
|
|
170
|
+
merge_config=merge_config,
|
|
171
|
+
targets=["all"],
|
|
172
|
+
**kwargs
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
help_msg_run = """
|
|
176
|
+
\b
|
|
177
|
+
SEARCH EXAMPLES
|
|
178
|
+
mitobee search --input <input directory with metagenome reads> --extn fastq.gz --pattern_r1 R1 --patern_r2 R2 --ref_set test-files/ref-db --output output -k
|
|
179
|
+
"""
|
|
180
|
+
@click.command(epilog=help_msg_run,
|
|
181
|
+
context_settings=dict(help_option_names=["-h", "--help"], ignore_unknown_options=True)
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
@common_options
|
|
185
|
+
def search(_input, extn, r1, r2, refdb, mode, output, temp_dir, configfile, conda_frontend, **kwargs):
|
|
186
|
+
"""Run mitobee workflow"""
|
|
187
|
+
copy_config(configfile, system_config=snake_base(os.path.join('config', 'config.yaml')))
|
|
188
|
+
|
|
189
|
+
merge_config = {
|
|
190
|
+
"args": {
|
|
191
|
+
"input": _input,
|
|
192
|
+
"output": output,
|
|
193
|
+
"extn": extn,
|
|
194
|
+
"pattern_r1": r1,
|
|
195
|
+
"pattern_r2": r2,
|
|
196
|
+
"ref_set": refdb,
|
|
197
|
+
"configfile": configfile,
|
|
198
|
+
"temp_dir": temp_dir,
|
|
199
|
+
"mode": mode,
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
snake_default = list(kwargs.get('snake_default', []))
|
|
204
|
+
if conda_frontend and not any('--conda-frontend' in str(arg) for arg in snake_default):
|
|
205
|
+
snake_default.extend(['--conda-frontend', conda_frontend])
|
|
206
|
+
kwargs['snake_default'] = tuple(snake_default)
|
|
207
|
+
|
|
208
|
+
# run!
|
|
209
|
+
run_snakemake(
|
|
210
|
+
snakefile_path=snake_base(os.path.join('workflow', 'Search.Snakefile')),
|
|
211
|
+
configfile=configfile,
|
|
212
|
+
merge_config=merge_config,
|
|
213
|
+
targets=["all"],
|
|
214
|
+
**kwargs
|
|
215
|
+
)
|
|
216
|
+
|
|
217
|
+
@click.command()
|
|
218
|
+
@click.option('--configfile', default='config.yaml', help='Copy template config to file', show_default=True)
|
|
219
|
+
def config(configfile, **kwargs):
|
|
220
|
+
"""Copy the system default config file"""
|
|
221
|
+
copy_config(configfile, system_config=snake_base(os.path.join('config', 'config.yaml')))
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
@click.command()
|
|
225
|
+
def citation(**kwargs):
|
|
226
|
+
"""Print the citation(s) for this tool"""
|
|
227
|
+
print_citation()
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
cli.add_command(run)
|
|
231
|
+
cli.add_command(tree)
|
|
232
|
+
cli.add_command(search)
|
|
233
|
+
cli.add_command(config)
|
|
234
|
+
cli.add_command(citation)
|
|
235
|
+
|
|
236
|
+
def main():
|
|
237
|
+
cli()
|
|
238
|
+
|
|
239
|
+
if __name__ == '__main__':
|
|
240
|
+
main()
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '1.0.post0'
|
|
32
|
+
__version_tuple__ = version_tuple = (1, 0, 'post0')
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = 'g7609bb359'
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69", "setuptools_scm", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "MitoBee"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "Build mitogenomes from WGS metagenomes"
|
|
9
|
+
readme = { file = "README.md", content-type = "text/markdown" }
|
|
10
|
+
authors = [
|
|
11
|
+
{ name = "Bhavya Papudeshi", email = "bnalaga1@unil.ch" }
|
|
12
|
+
]
|
|
13
|
+
|
|
14
|
+
license = { text = "MIT" }
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Environment :: MacOS X",
|
|
18
|
+
"Intended Audience :: Science/Research",
|
|
19
|
+
"License :: OSI Approved :: MIT License",
|
|
20
|
+
"Natural Language :: English",
|
|
21
|
+
"Operating System :: POSIX :: Linux",
|
|
22
|
+
"Programming Language :: Python :: 3.12",
|
|
23
|
+
"Programming Language :: Python :: 3.13",
|
|
24
|
+
"Topic :: Scientific/Engineering :: Bio-Informatics"
|
|
25
|
+
]
|
|
26
|
+
requires-python = ">=3.9"
|
|
27
|
+
dependencies = [
|
|
28
|
+
"snaketool-utils>=0.0.5",
|
|
29
|
+
"snakemake>=8.28.0",
|
|
30
|
+
"snakemake-executor-plugin-slurm",
|
|
31
|
+
"pyyaml>=6.0",
|
|
32
|
+
"Click>=8.1.3",
|
|
33
|
+
"metasnek>=0.0.8",
|
|
34
|
+
"attrmap>=0.0.7",
|
|
35
|
+
"biopython>=1.8.1",
|
|
36
|
+
"pandas",
|
|
37
|
+
"matplotlib",
|
|
38
|
+
"snakemake-executor-plugin-slurm>=0.5.1"
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.scripts]
|
|
42
|
+
mitobee = "mitobee.__main__:main"
|
|
43
|
+
|
|
44
|
+
[tool.setuptools.packages.find]
|
|
45
|
+
where = ["."]
|
|
46
|
+
include = ["mitobee*"]
|
|
47
|
+
|
|
48
|
+
# Configure setuptools_scm (reads version from your Git tags)
|
|
49
|
+
[tool.setuptools_scm]
|
|
50
|
+
write_to = "mitobee/_version.py"
|
|
51
|
+
fallback_version = "0.1.0"
|
|
52
|
+
version_scheme = "post-release"
|
|
53
|
+
local_scheme = "no-local-version"
|