diff --git a/Data_submission/build_file_dicts.py b/Data_submission/build_file_dicts.py index 6e99e67808cbb3fd6373a3bdaa9c801ba3fd31e0..9ba1093cf7cce84b68ab5d26c3512def0f9b994a 100755 --- a/Data_submission/build_file_dicts.py +++ b/Data_submission/build_file_dicts.py @@ -229,10 +229,14 @@ def main(): assert not common_vars, f"Variable overwriting hazard!\n{common_vars}" vars_from_analyses |= set(analysis_config.keys()) # This may be needed for analysis types with configurable genome - genome = analysis_config.get( + genome_dict = analysis_config.get( "genome_dict", # default genome name will be "C_elegans" - {"name": "C_elegans"})["name"] + {"name": "C_elegans"}) + if isinstance(genome_dict, (str, bytes)): + with open(analysis_config["genome_dict"]) as gendict_fh: + genome_dict = yload(gendict_fh) + genome = genome_dict["name"] # Load the snakefile to get information # about the rule making bigwig files # Based on snakemake/__init__.py and snakemake/workflow.py @@ -253,7 +257,16 @@ def main(): #after_loading_vars = list(recdir()) # Use pattern matching so that it fails if we have not exactly # one bigwig file in the output of the rule - [bw_pattern] = sf._rules[bw_rulename].output + try: + [bw_pattern] = sf._rules[bw_rulename].output + except ValueError: + try: + # Sometimes, a rule may also output a "methods" file + [bw_pattern, methods_pattern] = sf._rules[bw_rulename].output + assert methods_pattern.endswith("_methods.txt") + except ValueError: + print(analysis_snakefile, bw_rulename, file=sys.stderr) + raise #for varname in set(after_loading_vars) - set(before_loading_vars): # # https://stackoverflow.com/a/26545111/1878788 # del globals()[varname]