Example #1
0
def make_range(chrom, start, end):
    """Returns a nucleus.genomics.v1.Range.

  Args:
    chrom: str. The chromosome name.
    start: int. The start position (0-based, inclusive) of this range.
    end: int. The end position (0-based, exclusive) of this range.

  Returns:
    A nucleus.genomics.v1.Range.
  """
    return range_pb2.Range(reference_name=chrom, start=start, end=end)
Example #2
0
def make_range(chrom, start, end):
    """Creates a genomics.Range object chr:start-end.

  Args:
    chrom: The chromosome name as a string.
    start: The start position (0-based, inclusive, integer) of this range.
    end: The end position (0-based, exclusive, integer) of this range.

  Returns:
    A third_party.nucleus.protos.Range.
  """
    return range_pb2.Range(reference_name=chrom, start=start, end=end)
Example #3
0
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.
  """
    range_pb = range_pb2.Range()
    utils_cpp.read_range(read, range_pb)
    return range_pb
Example #4
0
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 range_pb2.Range(
        reference_name=read.alignment.position.reference_name,
        start=start,
        end=end)
Example #5
0
def read_range(read, use_cached_read_end=True):
    """Creates a Range proto from the alignment of Read.

  Args:
    read: nucleus.genomics.v1.Read. The read to calculate the range for.
    use_cached_read_end: If True, use the `cached_end` stored in Read instead of
                         recalculating.

  Returns:
    A nucleus.genomics.v1.Range for read.
  """
    range_pb = range_pb2.Range()
    utils_cpp.read_range(read,
                         range_pb,
                         use_cached_read_end=use_cached_read_end)
    return range_pb