third_party/nucleus/util/cigar.py
def parse_cigar_string(cigar_str):
  """Parse a cigar string into a list of cigar units.

  For example, if cigar_str is 150M2S, this function will return:

  [
    CigarUnit(operation=ALIGNMENT_MATCH, operation_length=150),
    CigarUnit(operation=SOFT_CLIP, operation_length=2)
  ]

  Args:
    cigar_str: str containing a valid cigar.

  Returns:
    list[cigar_pb2.CigarUnit].

  Raises:
    ValueError: If cigar_str isn't a well-formed CIGAR.
  """
  if not cigar_str:
    raise ValueError('cigar_str cannot be empty')
  if not VALID_CIGAR_RE.match(cigar_str):
    raise ValueError('Malformed CIGAR string {}'.format(cigar_str))
  parts = CIGAR_STR_SPLITTER_RE.finditer(cigar_str)
  return [to_cigar_unit(part.group(1)) for part in parts]
Parse a cigar string into a list of cigar units.

  For example, if cigar_str is 150M2S, this function will return:

  [
    CigarUnit(operation=ALIGNMENT_MATCH, operation_length=150),
    CigarUnit(operation=SOFT_CLIP, operation_length=2)
  ]

  Args:
    cigar_str: str containing a valid cigar.

  Returns:
    list[cigar_pb2.CigarUnit].

  Raises:
    ValueError: If cigar_str isn't a well-formed CIGAR.
  
Parse a cigar string into a list of cigar units.
For example, if cigar_str is 150M2S, this function will return.


Parse a cigar string into a list of cigar units . For example if cigar_str is 150M2S this function will return .
def parse_cigar_string(cigar_str):
  if not cigar_str:
    raise ValueError('cigar_str cannot be empty')
  if not VALID_CIGAR_RE.match(cigar_str):
    raise ValueError('Malformed CIGAR string {}'.format(cigar_str))
  parts = CIGAR_STR_SPLITTER_RE.finditer(cigar_str)
  return [to_cigar_unit(part.group(1)) for part in parts]
def parse_cigar_string ( cigar_str ) : if not cigar_str : raise ValueError ( 'cigar_str cannot be empty' ) if not VALID_CIGAR_RE . match ( cigar_str ) : raise ValueError ( 'Malformed CIGAR string {}' . format ( cigar_str ) ) parts = CIGAR_STR_SPLITTER_RE . finditer ( cigar_str ) return [ to_cigar_unit ( part . group ( 1 ) ) for part in parts ]
Parse a cigar string into a list of cigar units.
Parse a cigar string into a list of cigar units .
"""Parse a cigar string into a list of cigar units.

  For example, if cigar_str is 150M2S, this function will return:

  [
    CigarUnit(operation=ALIGNMENT_MATCH, operation_length=150),
    CigarUnit(operation=SOFT_CLIP, operation_length=2)
  ]

  Args:
    cigar_str: str containing a valid cigar.

  Returns:
    list[cigar_pb2.CigarUnit].

  Raises:
    ValueError: If cigar_str isn't a well-formed CIGAR.
  """
None
If cigar_str isn't a well-formed CIGAR.
If cigar_str isn ' t a well - formed CIGAR .
ValueError
cigar_str
str containing a valid cigar.
str containing a valid cigar .