Skip to content

Commit

Permalink
Merge pull request #173 from rhysnewell/add-singlem-metapackage-downl…
Browse files Browse the repository at this point in the history
…oading

Add SingleM metapackage downloading
  • Loading branch information
AroneyS authored Dec 1, 2023
2 parents e23ca39 + 22ce73a commit a341fe4
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 7 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ These environment variables can also be configured manually, just set the follow
```
export GTDBTK_DATA_PATH=/path/to/gtdb/gtdb_release207/db/ # https://gtdb.ecogenomic.org/downloads
export EGGNOG_DATA_DIR=/path/to/eggnog-mapper/2.1.8/ # https://github.com/eggnogdb/eggnog-mapper/wiki/eggNOG-mapper-v2.1.5-to-v2.1.8#setup
export SINGLEM_METAPACKAGE_PATH=/path/to/singlem_metapackage.smpkg/
export CHECKM2DB=/path/to/checkm2db/
export CONDA_ENV_PATH=/path/to/conda/envs/
```
Expand Down
8 changes: 4 additions & 4 deletions aviary/aviary.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ def main():

base_group.add_argument(
'--download', '--download',
help='Downloads the required GTDB, EggNOG, & CheckM2 databases if required',
type=str2bool,
nargs='?',
const=True,
help='Downloads the requested GTDB, EggNOG, SingleM, & CheckM2 databases',
dest='download',
default=[],
nargs="*",
choices=["gtdb", "eggnog", "singlem", "checkm2"]
)

base_group.add_argument(
Expand Down
19 changes: 16 additions & 3 deletions aviary/modules/annotation/annotation.smk
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,10 @@ if config['mag_extension'] == 'none':

rule download_databases:
input:
'logs/download_gtdb.log',
'logs/download_eggnog.log',
'logs/download_checkm2.log'
'logs/download_gtdb.log' if "gtdb" in config["download"] else [],
'logs/download_eggnog.log' if "eggnog" in config["download"] else [],
'logs/download_singlem.log' if "singlem" in config["download"] else [],
'logs/download_checkm2.log' if "checkm2" in config["download"] else [],
threads: 1
log:
temp("logs/download.log")
Expand Down Expand Up @@ -111,6 +112,18 @@ rule download_gtdb:
' echo "[INFO] - Conda not found in PATH, please be sure to set the TARGET_DIR envrionment variable"; '
'fi; '

rule download_singlem_metapackage:
params:
metapackage_folder = os.path.expanduser(config['singlem_metapackage'])
conda:
"../../envs/singlem.yaml"
threads: 1
log:
'logs/download_singlem.log'
shell:
'singlem data --output-directory {params.metapackage_folder}_tmp 2> {log} && '
'mv {params.metapackage_folder}_tmp/*.smpkg.zb/payload_directory {params.metapackage_folder}'

rule download_checkm2:
params:
checkm2_folder = os.path.expanduser(config['checkm2_db_folder'])
Expand Down
3 changes: 3 additions & 0 deletions aviary/modules/processor.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ def __init__(self,
except AttributeError:
self.mag_directory = 'none'

self.download = args.download

try:
if args.gtdb_path is not None:
self.gtdbtk = args.gtdb_path
Expand Down Expand Up @@ -374,6 +376,7 @@ def make_config(self):
conf["long_contig_size"] = self.long_contig_size
conf["min_contig_size"] = int(self.min_contig_size)
conf["min_bin_size"] = int(self.min_bin_size)
conf["download"] = self.download
conf["gtdbtk_folder"] = self.gtdbtk
conf["eggnog_folder"] = self.eggnog
conf["singlem_metapackage"] = self.singlem
Expand Down
3 changes: 3 additions & 0 deletions docs/examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,9 @@ use the the `aviary configure` module to update the environment variables used b
These environment variables can also be configured manually, just set the following variables in your `.bashrc` file:
```
GTDBTK_DATA_PATH
EGGNOG_DATA_DIR
SINGLEM_METAPACKAGE_PATH
CHECKM2DB
CONDA_ENV_PATH
```

Expand Down
2 changes: 2 additions & 0 deletions docs/faqs.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ the `activate.d/aviary.sh` or `.bashrc` files changing the specific paths:
```
export GTDBTK_DATA_PATH=/path/to/gtdb/gtdb_release207/db/ # https://gtdb.ecogenomic.org/downloads
export EGGNOG_DATA_DIR=/path/to/eggnog-mapper/2.1.7/ # https://github.com/eggnogdb/eggnog-mapper/wiki/eggNOG-mapper-v2.1.5-to-v2.1.7#setup
export SINGLEM_METAPACKAGE_PATH=/path/to/singlem_metapackage.smpkg/
export CHECKM2DB=/path/to/checkm2db/
export CONDA_ENV_PATH=/path/to/conda/envs/
```

Expand Down
2 changes: 2 additions & 0 deletions docs/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,5 +128,7 @@ These environment variables can also be configured manually, just set the follow
```
export GTDBTK_DATA_PATH=/path/to/gtdb/gtdb_release207/db/ # https://gtdb.ecogenomic.org/downloads
export EGGNOG_DATA_DIR=/path/to/eggnog-mapper/2.1.7/ # https://github.com/eggnogdb/eggnog-mapper/wiki/eggNOG-mapper-v2.1.5-to-v2.1.7#setup
export SINGLEM_METAPACKAGE_PATH=/path/to/singlem_metapackage.smpkg/
export CHECKM2DB=/path/to/checkm2db/
export CONDA_ENV_PATH=/path/to/conda/envs/
```

0 comments on commit a341fe4

Please sign in to comment.