From 9bb785f066595076d4bf412bb7ff4566d616b4fb Mon Sep 17 00:00:00 2001 From: Nils Homer Date: Mon, 16 Dec 2024 10:43:49 -0700 Subject: [PATCH] debug --- bwapy/libbwapy.pyx | 43 +++++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 22 deletions(-) diff --git a/bwapy/libbwapy.pyx b/bwapy/libbwapy.pyx index 82aa64e..3f13018 100644 --- a/bwapy/libbwapy.pyx +++ b/bwapy/libbwapy.pyx @@ -265,27 +265,27 @@ cdef class BwaAln: if seq.type == BWA_TYPE_NO_MATCH: # unmapped read # TODO: custom bwa tags: RG, BC, XC return rec - # - # ref_len_in_alignment = pos_end(seq) - seq.pos - # - # # if on the reverse strand, reverse the query sequence and qualities - # rec.query_sequence = query.sequence[::-1] - # if query.quality is not None: - # rec.query_qualities = query.quality[::-1] - # - # # reference id - # nn = bns_cnt_ambi(self._index._bns, seq.pos, ref_len_in_alignment, &reference_id) - # rec.reference_id = reference_id - # - # # make this unmapped if we map off the end of the contig - # rec.is_unmapped = seq.pos + ref_len_in_alignment - self._index._bns.anns[ - # rec.reference_id].offset > self._index._bns.anns[rec.reference_id].len - # - # # strand, reference start, and mapping quality - # if seq.strand: - # rec.is_reverse = True - # rec.reference_start = seq.pos - self._index._bns.anns[rec.reference_id].offset + 1 - # rec.mapping_quality = seq.mapQ + + ref_len_in_alignment = pos_end(seq) - seq.pos + + # if on the reverse strand, reverse the query sequence and qualities + rec.query_sequence = query.sequence[::-1] + if query.quality is not None: + rec.query_qualities = query.quality[::-1] + + # reference id + nn = bns_cnt_ambi(self._index._bns, seq.pos, ref_len_in_alignment, &reference_id) + rec.reference_id = reference_id + + # make this unmapped if we map off the end of the contig + rec.is_unmapped = seq.pos + ref_len_in_alignment - self._index._bns.anns[ + rec.reference_id].offset > self._index._bns.anns[rec.reference_id].len + + # strand, reference start, and mapping quality + if seq.strand: + rec.is_reverse = True + rec.reference_start = seq.pos - self._index._bns.anns[rec.reference_id].offset + 1 + rec.mapping_quality = seq.mapQ # # # cigar # cigar = "" @@ -346,7 +346,6 @@ cdef class BwaAln: self._build_alignment(query=queries[i], seq=&seqs[i], kstr=kstr) for i in range(num_seqs) ] - recs = [] bwa_free_read_seq(num_seqs, seqs) free(kstr)