Skip to content

Commit

Permalink
dynamic interval calculation for accuracy
Browse files Browse the repository at this point in the history
  • Loading branch information
pdimens committed Mar 3, 2025
1 parent 3b9466d commit 17e4784
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion harpy/bin/molecule_coverage.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def which_overlap(start: int, end: int, binlist: list):
def print_depth_counts(contig, counter_obj, intervals):
"""Print the Counter object to stdout"""
for idx,int_bin in enumerate(intervals):
sys.stdout.write(f"{contig}\t{int_bin.start}\t{int_bin.stop}\t{counter_obj[idx]/args.window}\n")
sys.stdout.write(f"{contig}\t{int_bin.start}\t{int_bin.stop}\t{counter_obj[idx]/(int_bin.end - int_bin.start)}\n")

with gzip.open(args.statsfile, "rt") as statsfile:
aln_ranges = []
Expand Down
4 changes: 1 addition & 3 deletions harpy/snakefiles/align_bwa.smk
Original file line number Diff line number Diff line change
Expand Up @@ -211,12 +211,10 @@ rule alignment_coverage:
bed = outdir + "/reports/data/coverage/coverage.bed"
output:
outdir + "/reports/data/coverage/{sample}.cov.gz"
params:
windowsize
container:
None
shell:
"samtools bedcov -c {input.bed} {input.bam} | awk '{{ $5 = $5 / {params}; print }}' | gzip > {output}"
"samtools bedcov -c {input.bed} {input.bam} | awk '{{ $5 = $5 / ($3 - $2); print }}' | gzip > {output}"

rule report_config:
input:
Expand Down
4 changes: 1 addition & 3 deletions harpy/snakefiles/align_ema.smk
Original file line number Diff line number Diff line change
Expand Up @@ -279,12 +279,10 @@ rule alignment_coverage:
bed = outdir + "/reports/data/coverage/coverage.bed"
output:
outdir + "/reports/data/coverage/{sample}.cov.gz"
params:
windowsize
container:
None
shell:
"samtools bedcov -c {input.bed} {input.bam} | awk '{{ $5 = $5 / {params}; print }}' | gzip > {output}"
"samtools bedcov -c {input.bed} {input.bam} | awk '{{ $5 = $5 / ($3 - $2); print }}' | gzip > {output}"

rule barcode_stats:
input:
Expand Down
4 changes: 1 addition & 3 deletions harpy/snakefiles/align_strobealign.smk
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,10 @@ rule alignment_coverage:
bed = outdir + "/reports/data/coverage/coverage.bed"
output:
outdir + "/reports/data/coverage/{sample}.cov.gz"
params:
windowsize
container:
None
shell:
"samtools bedcov -c {input.bed} {input.bam} | awk '{{ $5 = $5 / {params}; print }}' | gzip > {output}"
"samtools bedcov -c {input.bed} {input.bam} | awk '{{ $5 = $5 / ($3 - $2); print }}' | gzip > {output}"

rule report_config:
input:
Expand Down

0 comments on commit 17e4784

Please sign in to comment.