Skip to content

Commit

Permalink
Merge pull request #267 from hydra-genetics/Smeds-patch-2
Browse files Browse the repository at this point in the history
fix: minor bug fixes
  • Loading branch information
Smeds committed Jun 2, 2023
2 parents 386c961 + 6ff2d9c commit 9d8dc59
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
8 changes: 4 additions & 4 deletions hydra_genetics/commands/prep_pipeline_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def container_path_update(configfile, new_configfile, singularity_cache_path):
help="path to update config file",
)
@click.option(
"--reference-paths",
"--reference-path",
multiple=True,
prompt="path",
required=True,
Expand All @@ -87,7 +87,7 @@ def container_path_update(configfile, new_configfile, singularity_cache_path):
" file and replace all occurrences of oldpath with new path"
),
)
def reference_path_update(configfile, new_configfile, reference_paths):
def reference_path_update(configfile, new_configfile, reference_path):
def process_yaml_data(yaml_data, reference_path):
for key in yaml_data:
if isinstance(yaml_data[key], dict):
Expand All @@ -98,15 +98,15 @@ def process_yaml_data(yaml_data, reference_path):
if old_path in yaml_data[key]:
yaml_data[key] = yaml_data[key].replace(old_path, new_path)
return yaml_data
reference_paths = [r.split(":") for r in reference_paths]
reference_paths = [r.split(":") for r in reference_path]
with open(configfile, "r") as stream:
try:
yaml_data = yaml.safe_load(stream)
except yaml.YAMLError as exc:
print(exc)
exit(1)

yaml_data = process_yaml_data(yaml_data, reference_path)
yaml_data = process_yaml_data(yaml_data, reference_paths)

with open(new_configfile, 'w') as file:
for key, value in yaml_data.items():
Expand Down
5 changes: 3 additions & 2 deletions hydra_genetics/commands/references.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,15 @@ def is_file_or_folder(possible_file):

extension = pathlib.Path(possible_file)
# docker container aren't files
if ":" in possible_file:
if ":" in possible_file or possible_file.endswith(".sif"):
return False
# Skip files that are configured per analysis/site
if possible_file.endswith("samples.tsv") \
or possible_file.endswith("resources.yaml") \
or possible_file.endswith("units.tsv") \
or possible_file.endswith("output_list.yaml") \
or possible_file.endswith("output_list.json"):
or possible_file.endswith("output_list.json") \
or possible_file.endswith("snakemake-wrappers"):
logging.debug(f"Ignore: {possible_file}")
return False
# If a extension can be found we consider it as a file
Expand Down
2 changes: 1 addition & 1 deletion hydra_genetics/utils/io/reference.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ def track_files(path, file_list=[], not_found_in_config=[], found=[]):
else:
if 'checksum' not in item:
counter_pass += 1
logging.debug(f"{item[path]} found, no checksum validation!")
logging.debug(f"{item['path']} found, no checksum validation!")
else:
calculated_md5 = hashlib.md5(open(file_path, 'rb').read()).hexdigest()
if not calculated_md5 == item['checksum']:
Expand Down

0 comments on commit 9d8dc59

Please sign in to comment.