Skip to content

Commit

Permalink
trimSoftClippedReads
Browse files Browse the repository at this point in the history
  • Loading branch information
Li Tai Fang committed Nov 26, 2017
1 parent 6c2e5d4 commit 6198b63
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions utilities/trimSoftClippedReads.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

front_num = int( front_clipped.groups()[0] )
back_num = int( back_clipped.groups()[0] )

read_i.cigarstring = re.sub(r'^[0-9]+S|[0-9]+S$', '', read_i.cigarstring)

qual_i = read_i.qual[front_num::][:-back_num]

read_i.seq = read_i.seq[front_num::][:-back_num]
Expand Down Expand Up @@ -76,7 +77,7 @@
if read_i.has_tag('MC'):
mate_cigar = read_i.get_tag('MC')
if 'S' in mate_cigar:
new_cigar = re.sub(r'[0-9]+S', '', mate_cigar)
new_cigar = re.sub(r'^[0-9]+S|[0-9]+S$', '', mate_cigar)
read_i.set_tag(tag='MC', value=new_cigar, value_type='Z', replace=True)

bamout.write(read_i)

0 comments on commit 6198b63

Please # to comment.