INNER CODE UNIT · Python
aux
cbg-ethz/V-pipe · workflow/scripts/alignmentBias.py:111
aux = cigar_arr[0] + cigar_arr[1]
assert aux == read.query_alignment_length
percent_aligned = read.query_alignment_length / read.infer_read_length()
assert percent_aligned <= 1, f"{cigar_arr}"
if hapID in hap_coverage:
hap_coverage[hapID] += percent_aligned
else:
hap_coverage[hapID] = percent_aligned
for k, v in hap_cnt.items():
aux = hap_coverage[k] / v
assert aux <= 1, f"{aux}"
hap_coverage[k] = aux
# Parse FASTQ file to compute the expected number of reads per haplotype
hap_expected = {}
total = 0
for read in SeqIO.parse(args.fastq_file, "fastq"):