Skip to content

Commit

Permalink
log: add progress tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
maxibor committed Jul 23, 2024
1 parent 97ba7a4 commit f165c2e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions pydamage/damage.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def compute_damage(self):
)


@jit
@jit(parallel=True)
def avg_coverage_contig(pysam_cov):
"""Computes average coverage of a reference
Expand Down Expand Up @@ -201,18 +201,20 @@ def test_damage(ref, bam, mode, wlen, g2a, subsample, show_al, process, verbose)
try:
if ref is None:
all_references = al_handle.references
print("Computing coverage")
cov = avg_coverage_contig(
np.concatenate(
[np.array(al_handle.count_coverage(contig=ref), dtype="uint16") for ref in all_references],
[np.array(al_handle.count_coverage(contig=ref), dtype="uint16") for ref in tqdm(all_references)],
axis=1
)
)

print("Getting number of reads aligned")
nb_reads_aligned = np.sum(
[al_handle.count(contig=ref) for ref in all_references]
[al_handle.count(contig=ref) for ref in tqdm(all_references)]
)
print("Getting reference length")
reflen = np.sum(
[al_handle.get_reference_length(ref) for ref in all_references]
[al_handle.get_reference_length(ref) for ref in tqdm(all_references)]
)
refname = "reference"
else:
Expand Down

0 comments on commit f165c2e

Please sign in to comment.