Function parse_locus

Source
pub fn parse_locus(
    locus: &str,
    padding: u64,
) -> Result<(String, u64, u64, String)>
Expand description

Parse a locus string into a tuple of contig name, start position, stop position, and optional name. The locus string can be in the following formats:

  • chr:start-stop
  • chr:start-stop|name
  • chr start stop
  • chr start stop name

The start and stop positions are 1-based and inclusive. The optional padding parameter can be used to extend the start and stop positions by a specified amount.

§Arguments

  • locus - A string representing a locus.
  • padding - A u64 representing the amount to extend the start and stop positions by.

§Returns

A tuple containing the contig name, start position, stop position, and optional name.

§Errors

This function returns an error if the locus format is incorrect.

§Panics

This function will panic if the locus format is incorrect.