def read_range(read): """Creates a Range proto from the alignment of Read. Args: read: nucleus.genomics.v1.Read. The read to calculate the range for. Returns: A nucleus.genomics.v1.Range for read. """ start = read.alignment.position.position end = start + cigar.alignment_length(read.alignment.cigar) return ranges.make_range(read.alignment.position.reference_name, start, end)
def read_range(read): """Creates a Range proto from the alignment of Read. Args: read: the read to calculate range Returns: A third_party.nucleus.protos.Range for read. """ start = read.alignment.position.position end = start + cigar.alignment_length(read.alignment.cigar) return ranges.make_range(read.alignment.position.reference_name, start, end)
def test_alignment_length(self, cigar_str, expected): cigar_units = cigar.parse_cigar_string(cigar_str) self.assertEqual(cigar.alignment_length(cigar_units), expected)