code: def get_reference_end_from_cigar(reference_start, cigar):
          '''
          This returns the coordinate just past the last aligned base.
          This matches the behavior of pysam's reference_end method
          '''
          reference_end = reference_start
          
          # iterate through cigartuple
          for i in xrange(len(cigar)):
              k, n = cigar[i]
              if k in (0,2,3,7,8): # M, D, N, =, X
                  reference_end += n
          return reference_enf get_reference_end_from_cigar(reference_start, cigar):
          '''
          This returns the coordinate just past the last aligned base.
          This matches the behavior of pysam's reference_end method
          '''
          reference_end = reference_start
          
          # iterate through cigartuple
          for i in xrange(len(cigar)):
              k, n = cigar[i]
              if k in (0,2,3,7,8): # M, D, N, =, X
                  reference_end += n
          return reference_end
docs: This returns the coordinate just past the last aligned base.
          This matches the behavior of pysam's reference_end method