def CreateReadObject(read, newseq, newqual, newcigar, startread, basetag=[]) :
a = pysam.AlignedSegment()
a.query_name = read.query_name
a.query_sequence = newseq
a.query_qualities = pysam.qualitystring_to_array(newqual)
a.cigar = newcigar
a.reference_start = startread
# If (Star) mapper has assigned a value of 255 to mapping quality,
# change it to 50
mapqual = read.mapping_quality
if mapqual == 255 :
a.mapping_quality = 50
else :
a.mapping_quality = mapqual
a.reference_id = read.reference_id
# If read has RG read group tag, keep it
try :
r_RG = read.get_tag('RG')
a.tags = ()
a.set_tag('RG', r_RG)
except :
a.tags = ()
a.next_reference_id = -1
a.next_reference_start = -1
a.template_length = 0
a.flag = UpdateFlag(read.flag)
return a
# Goes through the given cigar list and reports how many times cigarType is equal to 3
# Optional field is finalpos, which is cutoff position for counting the splits (relative to start pos)
# Default value for finalpos is something very large
评论列表
文章目录