Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-organizing key dataclasses into a single model.py and then exposing those for import from prymer. #109

Merged
merged 3 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions prymer/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
from prymer.model import MinOptMax
from prymer.model import Oligo
from prymer.model import PrimerPair
from prymer.model import Span
from prymer.model import Strand

__all__ = ["Strand", "Span", "Oligo", "PrimerPair", "MinOptMax"]
12 changes: 0 additions & 12 deletions prymer/api/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
from prymer.api.minoptmax import MinOptMax
from prymer.api.oligo import Oligo
from prymer.api.picking import build_primer_pairs
from prymer.api.primer_pair import PrimerPair
from prymer.api.span import BedLikeCoords
from prymer.api.span import Span
from prymer.api.span import Strand
from prymer.api.variant_lookup import FileBasedVariantLookup
from prymer.api.variant_lookup import SimpleVariant
from prymer.api.variant_lookup import VariantLookup
Expand All @@ -14,13 +8,7 @@
from prymer.api.variant_lookup import disk_based

__all__ = [
"MinOptMax",
"build_primer_pairs",
"Oligo",
"PrimerPair",
"Span",
"Strand",
"BedLikeCoords",
"VariantType",
"SimpleVariant",
"VariantLookup",
Expand Down
46 changes: 1 addition & 45 deletions prymer/api/coordmath.py
Original file line number Diff line number Diff line change
@@ -1,51 +1,7 @@
"""
# Methods for coordinate-based math and interval manipulation.

Contains the following public methods:

- [`require_same_refname()`][prymer.api.coordmath.require_same_refname] -- ensures that all
provided intervals have the same reference name.
- [`get_locus_string()`][prymer.api.coordmath.get_locus_string] -- returns a formatted
string for an interval (`<refname>:<start>-<end>`).
- [`get_closed_end()`][prymer.api.coordmath.get_closed_end] -- gets the closed end of an
interval given its start and length.
Comment on lines -10 to -11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we keep this doc?


# Methods for coordinate-based math.
"""

from pybedlite.overlap_detector import Interval


def require_same_refname(*intervals: Interval) -> None:
"""
Require that the input intervals all have the same refname.

Args:
intervals: one or more intervals

Raises:
ValueError: if the intervals do not all have the same refname.
"""

refnames = set(i.refname for i in intervals)
if len(refnames) != 1:
raise ValueError(f"`intervals` must have exactly one refname\n Found {sorted(refnames)}")


def get_locus_string(record: Interval) -> str:
"""
Get the locus-string for an interval.

The output string will have the format `<refname>:<start>-<end>`
No conversion on coordinates is performed, so the output is 0-based, open-ended.

Args:
record: The interval to get the locus-string for.

Returns:
A locus-string for the interval.
"""
return f"{record.refname}:{record.start}-{record.end}"


def get_closed_end(start: int, length: int) -> int:
"""
Expand Down
80 changes: 0 additions & 80 deletions prymer/api/minoptmax.py

This file was deleted.

225 changes: 0 additions & 225 deletions prymer/api/oligo.py

This file was deleted.

Loading
Loading