Skip to content

Commit

Permalink
Ran black on new_service.py
Browse files Browse the repository at this point in the history
  • Loading branch information
victor5lm committed Nov 14, 2024
1 parent 906935d commit 7492af5
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions bu_isciii/new_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,9 @@ def __init__(
def check_md5(self):
# Path to the .md5 file
project_name = self.service_samples[0]["project_name"]
md5_file_path = f'{self.conf["fastq_repo"]}/{project_name}/md5sum_{project_name}.md5'
md5_file_path = (
f'{self.conf["fastq_repo"]}/{project_name}/md5sum_{project_name}.md5'
)
if not os.path.exists(md5_file_path):
stderr.print(f"[red]ERROR: .md5 file not found at {md5_file_path}")
sys.exit(1)
Expand All @@ -103,16 +105,17 @@ def check_md5(self):

# Regex pattern to match sample names in .fastq.gz files
sample_names_pattern = "|".join(
[f"{sample['sample_name']}.*\\.fastq\\.gz" for sample in self.service_samples]
)
[
f"{sample['sample_name']}.*\\.fastq\\.gz"
for sample in self.service_samples
]
)

# md5sum command
stderr.print(f"[blue]Checking MD5 integrity for {md5_file_path}")
try:
cmd = f"grep -E '{sample_names_pattern}' {md5_file_path} | md5sum -c"
subprocess.run(
cmd, shell=True, check=True, executable='/bin/bash'
)
subprocess.run(cmd, shell=True, check=True, executable="/bin/bash")
stderr.print("[green]MD5 check passed!")
except subprocess.CalledProcessError as e:
stderr.print(f"[red]ERROR: MD5 check failed: {e.stderr}")
Expand Down

0 comments on commit 7492af5

Please sign in to comment.