Skip to content

Commit

Permalink
add get_blocks to Alignment
Browse files Browse the repository at this point in the history
  • Loading branch information
pfh committed May 7, 2020
1 parent fc6cc73 commit 2a9b6fa
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions nesoni/sam.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,22 @@ def next_reference_name(self): return self.mrnm
@property
def next_reference_start(self): return self.mpos

def get_blocks(self):
pos = self.reference_start

blocks = [ ]
n = 0
for char in self.cigar:
if '0' <= char <= '9':
n = n*10+(ord(char)-48)
else:
if char == 'M':
blocks.append((pos,pos+n))
if char in ('M','D','N','P','=','X'): #'MDNP=X':
pos += n
n = 0

return blocks



Expand Down

0 comments on commit 2a9b6fa

Please sign in to comment.