Skip to content

Commit

Permalink
FIX: docs build
Browse files Browse the repository at this point in the history
  • Loading branch information
tcztzy committed Feb 21, 2024
1 parent e9a11d8 commit 5175834
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
1 change: 1 addition & 0 deletions argweaver/io/bed.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def subset_bed(data, region):
----------
bedfile : {py:obj}`str`
Path to the bed file.
region : {py:obj}`str`
Subset of the file, in format {chrom}:{start}-{end}
Expand Down
21 changes: 21 additions & 0 deletions argweaver/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,29 @@
if typing.TYPE_CHECKING:
from typing import Tuple

__all__ = ["parse_region"]


def parse_region(region: str) -> "Tuple[str, int, int]":
"""Parse a region string.
Start and end are 1-based and inclusive. End must be greater than or equal to start.
Parameters
----------
region : str
A string in the format {chrom}:{start}-{end}
Returns
-------
Tuple[str, int, int]
A tuple of (chrom, start, end)
Raises
------
ValueError
If the region string is invalid.
"""
mo = re.match(r"(\w+):(\d+)-(\d+)", region)
if mo is None:
raise ValueError(f"Invalid region string: {region}")
Expand Down

0 comments on commit 5175834

Please sign in to comment.