1515)
1616
1717
18- def get_fasta_dirs (config ):
18+ def fasta_path (config ):
1919 if os .path .isfile (config ["args" ]["input" ]):
2020 files = [config ["args" ]["input" ]]
2121 else :
@@ -27,6 +27,15 @@ def get_fasta_dirs(config):
2727 return False
2828
2929
30+ def custom_taxonkit_dir (config ):
31+ if config ["args" ]["taxonkit" ] == os .path .join (os .getcwd (), ".taxonkit" ):
32+ return False
33+ else :
34+ return os .path .dirname (
35+ os .path .realpath (os .path .join (config ["args" ]["taxonkit" ], "names.dmp" ))
36+ )
37+
38+
3039def snake_base (rel_path ):
3140 """Get the filepath to a Snaketool system file (relative to __main__.py)"""
3241 return os .path .join (os .path .dirname (os .path .realpath (__file__ )), rel_path )
@@ -124,16 +133,10 @@ def run_snakemake(
124133 os .path .join (os .path .dirname (os .path .realpath (__file__ ))),
125134 os .path .abspath (snake_config ["args" ]["output" ]),
126135 ]
127- if get_fasta_dirs (snake_config ):
128- paths .append (get_fasta_dirs (snake_config ))
129- if snake_config ["args" ]["taxonkit" ]:
130- paths .append (
131- os .path .dirname (
132- os .path .realpath (
133- os .path .join (snake_config ["args" ]["taxonkit" ], "names.dmp" )
134- )
135- )
136- )
136+ if fasta_path (snake_config ):
137+ paths .append (fasta_path (snake_config ))
138+ if custom_taxonkit_dir (snake_config ):
139+ paths .append (custom_taxonkit_dir (snake_config ))
137140
138141 sdm_args = " " .join ([f"-B { path } :{ path } " for path in paths ])
139142
0 commit comments