Skip to content

Commit

Permalink
feat: add pydamage CLI to bam rescaled bam output
Browse files Browse the repository at this point in the history
  • Loading branch information
maxibor committed Jul 22, 2024
1 parent 8c8d312 commit 0b1b40b
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions pydamage/rescale.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
import numpy as np
from array import array
from pydamage.models import damage_model
from pydamage import __version__
from tqdm import tqdm
from numba import jit
import sys


@jit(
Expand Down Expand Up @@ -74,10 +76,19 @@ def rescale_bam(
outname (str): Path to output BAM file
threads(int): Number of threads
"""

with pysam.AlignmentFile(bam, "rb", threads=threads) as al:
hd = al.header.to_dict()
hd["PG"].append(
{
"ID": "pydamage",
"PN": "pydamage",
"VN": __version__,
"CL": " ".join(sys.argv),
}
)
print(hd)
refs = al.references
with pysam.AlignmentFile(outname, "wb", template=al, threads=threads) as out:
with pysam.AlignmentFile(outname, "wb", threads=threads, header=hd) as out:
for ref in tqdm(refs, desc="Rescaling quality scores"):
if grouped:
pydam_ref = "reference"
Expand Down

0 comments on commit 0b1b40b

Please sign in to comment.