Skip to content

Commit

Permalink
Fixed bug in validate config #8
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-Hades committed Jun 28, 2024
1 parent a2edf30 commit 7361ce0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"esbonio.sphinx.confDir": ""
"esbonio.sphinx.confDir": "",
"autoDocstring.customTemplatePath": "./dev/docstring-format.mustache"
}
16 changes: 13 additions & 3 deletions src/specimen/util/set_up.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@

# config keys
# -----------

# config keys for pipeline files
HQTB_CONFIG_PATH_OPTIONAL = ['media_gap', 'ncbi_map', 'ncbi_dat','biocyc','universal','pan-core'] #: :meta:
HQTB_CONFIG_PATH_REQUIRED = ['annotated_genome','full_sequence','model','diamond',
'mnx_chem_prop', 'mnx_chem_xref','mnx_reac_prop','mnx_reac_xref',
'media_analysis'] #: :meta:
CMPB_CONFIG_PATHS = ['annotated_genome','mediapath','modelpath','dir','refseq_gff','protein_fasta',
CMPB_CONFIG_PATHS = ['annotated_genome','mediapath','modelpath','refseq_gff','protein_fasta',
'biocyc_files','full_genome_sequence'] #: :meta:
PIPELINE_PATHS = {'hqtb':HQTB_CONFIG_PATH_OPTIONAL+HQTB_CONFIG_PATH_REQUIRED,
'cmpb':CMPB_CONFIG_PATHS} #: :meta:
# config keys for pipelines directories
PIPELINE_DIR_PATHS = ['dir']


# external databases
Expand Down Expand Up @@ -259,7 +263,8 @@ def dict_recursive_check(dictA:dict, key:str=None,
mes = 'Keyword USER detected in config. Either due to skipped options or missing required information.\nReminder: this may lead to downstream problems.'
logging.warning(mes)

# check paths
# check paths (files)
# @TODO : difference requird and optional?
elif key in PIPELINE_PATHS[pipeline] and dictA:
if isinstance(dictA,str) and os.path.isfile(dictA):
return
Expand All @@ -271,7 +276,12 @@ def dict_recursive_check(dictA:dict, key:str=None,
raise FileNotFoundError(F'Path does not exist: {f}')
else:
raise FileNotFoundError(F'Path does not exist: {dictA}')

# check paths (directories)
elif key in PIPELINE_DIR_PATHS and dictA:
if isinstance(dictA,str) and os.path.exists(dictA):
return
else:
raise FileNotFoundError(F'Path does not exist: {dictA}')
else:
pass
# @TODO
Expand Down

0 comments on commit 7361ce0

Please sign in to comment.