Skip to content

Commit

Permalink
Merge pull request #110 from SMD-Bioinformatics-Lund/fix-rerun-bonsai…
Browse files Browse the repository at this point in the history
…-input

Fix rerun-bonsai-input
  • Loading branch information
ryanjameskennedy authored Jan 14, 2025
2 parents 9d7ca4f + 16b6405 commit e93c72e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

### Fixed

- Fixed `bonsai-prp rerun-bonsai-input`
- Fixed `.rstrip()` erroneous removal of "nln" suffix from end of sample id string (as it interprets it as a new line).
- Fixed search for postalignqc files as suffix has changed from `_bwa.qc` to `_qc.json`.
- Removed the inclusion Serotypefinder for saureus samples.

### Changed

## [0.11.4]
Expand Down
24 changes: 13 additions & 11 deletions prp/parse/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ def parse_input_dir(
analysis_results_dir = os.path.join(input_dir, "analysis_result")
for filename in os.listdir(analysis_results_dir):
if filename.endswith(".json"):
sample_id = filename.rstrip("_result.json")
sample_id = filename.removesuffix("_result.json")
sample_array = create_sample_array(
species, input_dir, jasen_dir, sample_id, symlink_dir, output_dir
)
Expand Down Expand Up @@ -174,7 +174,7 @@ def create_sample_array(
bam = os.path.abspath(os.path.join(input_dir, f"bam/{sample_id}.bam"))
kraken = os.path.abspath(os.path.join(input_dir, f"kraken/{sample_id}_bracken.out"))
quality = os.path.abspath(
os.path.join(input_dir, f"postalignqc/{sample_id}_bwa.qc")
os.path.join(input_dir, f"postalignqc/{sample_id}_qc.json")
)
quast = os.path.abspath(os.path.join(input_dir, f"quast/{sample_id}_quast.tsv"))
run_metadata = os.path.abspath(
Expand Down Expand Up @@ -241,14 +241,6 @@ def create_sample_array(
resfinder_meta = os.path.abspath(
os.path.join(input_dir, f"resfinder/{sample_id}_resfinder_meta.json")
)
serotypefinder = os.path.abspath(
os.path.join(input_dir, f"serotypefinder/{sample_id}_serotypefinder.json")
)
serotypefinder_meta = os.path.abspath(
os.path.join(
input_dir, f"serotypefinder/{sample_id}_serotypefinder_meta.json"
)
)
virulencefinder = os.path.abspath(
os.path.join(input_dir, f"virulencefinder/{sample_id}_virulencefinder.json")
)
Expand All @@ -258,8 +250,17 @@ def create_sample_array(
)
)
process_metadata.append(resfinder_meta)
process_metadata.append(serotypefinder_meta)
process_metadata.append(virulencefinder_meta)
if species in ("ecoli", "kpneumoniae"):
serotypefinder = os.path.abspath(
os.path.join(input_dir, f"serotypefinder/{sample_id}_serotypefinder.json")
)
serotypefinder_meta = os.path.abspath(
os.path.join(
input_dir, f"serotypefinder/{sample_id}_serotypefinder_meta.json"
)
)
process_metadata.append(serotypefinder_meta)
if species == "saureus":
reference_genome_fasta = os.path.abspath(
os.path.join(
Expand All @@ -273,6 +274,7 @@ def create_sample_array(
"assets/genomes/staphylococcus_aureus/GCF_000012045.1.gff",
)
)
serotypefinder = None
if species == "ecoli":
reference_genome_fasta = os.path.abspath(
os.path.join(
Expand Down

0 comments on commit e93c72e

Please sign in to comment.