Skip to content
Snippets Groups Projects
Commit 08f6f523 authored by Blaise Li's avatar Blaise Li
Browse files

Accept methods outputs and genome config file.

parent 89dab599
No related branches found
No related tags found
No related merge requests found
...@@ -229,10 +229,14 @@ def main(): ...@@ -229,10 +229,14 @@ def main():
assert not common_vars, f"Variable overwriting hazard!\n{common_vars}" assert not common_vars, f"Variable overwriting hazard!\n{common_vars}"
vars_from_analyses |= set(analysis_config.keys()) vars_from_analyses |= set(analysis_config.keys())
# This may be needed for analysis types with configurable genome # This may be needed for analysis types with configurable genome
genome = analysis_config.get( genome_dict = analysis_config.get(
"genome_dict", "genome_dict",
# default genome name will be "C_elegans" # 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 # Load the snakefile to get information
# about the rule making bigwig files # about the rule making bigwig files
# Based on snakemake/__init__.py and snakemake/workflow.py # Based on snakemake/__init__.py and snakemake/workflow.py
...@@ -253,7 +257,16 @@ def main(): ...@@ -253,7 +257,16 @@ def main():
#after_loading_vars = list(recdir()) #after_loading_vars = list(recdir())
# Use pattern matching so that it fails if we have not exactly # Use pattern matching so that it fails if we have not exactly
# one bigwig file in the output of the rule # one bigwig file in the output of the rule
try:
[bw_pattern] = sf._rules[bw_rulename].output [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): #for varname in set(after_loading_vars) - set(before_loading_vars):
# # https://stackoverflow.com/a/26545111/1878788 # # https://stackoverflow.com/a/26545111/1878788
# del globals()[varname] # del globals()[varname]
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment