Skip to content

Commit

Permalink
correct readme and cleanup of index files
Browse files Browse the repository at this point in the history
  • Loading branch information
Gordon J. Köhn committed Jan 16, 2025
1 parent 43a9870 commit 62400a4
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 8 additions & 1 deletion src/sr2silo/process/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ def parse_cigar(cigar: str) -> list[tuple[str, int]]:
return [(op, int(length)) for length, op in parsed_cigar]


# TODO: to be removed as it is superseded by bam_to_cleartext_alignment
def normalize_reads(sam_data: str, output_fasta: Path, output_insertions: Path) -> None:
"""
Normalize (to clear text sequence using CIGAR)
Expand Down Expand Up @@ -163,6 +162,7 @@ def bam_to_cleartext_alignment(

# Ensure the BAM file is indexed
bam_path_str = str(bam_path)
sorted_bam_path_str = None
if not bam_path.with_suffix(".bai").exists():
try:
pysam.index(bam_path_str)
Expand Down Expand Up @@ -243,3 +243,10 @@ def bam_to_cleartext_alignment(

# Write the JSON object to the file
out_f.write(f"{read_json}\n")

# Cleanup generated files
if sorted_bam_path_str:
Path(sorted_bam_path_str).unlink(missing_ok=True)
Path(sorted_bam_path_str + ".bai").unlink(missing_ok=True)
else:
Path(bam_path_str + ".bai").unlink(missing_ok=True)
6 changes: 4 additions & 2 deletions tests/data/bam/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
This combined.bam contains 50 reads from
This combined.bam contains 43 reads from
real V-Pipe Sars Sequencing.

15 Reads contain insertions, and the rest 35
8 Reads contain insertions, and the rest 35
do not contain insertions.

This file was purposfully enriched with insertions
for good testing.

8 insertsion is al that was to find in an entire sequencing run.

0 comments on commit 62400a4

Please sign in to comment.