Skip to content

Commit

Permalink
docs: fix #104
Browse files Browse the repository at this point in the history
  • Loading branch information
nh13 committed Jan 15, 2025
1 parent a40056b commit 0e50aec
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 21 deletions.
2 changes: 2 additions & 0 deletions prymer/api/coordmath.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def get_closed_end(start: int, length: int) -> int:
The closed end of the interval.
Example:
```python
>>> get_closed_end(start=10, length=5)
14
```
"""
return start + length - 1
50 changes: 30 additions & 20 deletions prymer/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,25 @@ class Span(Metric["Span"]):
strand: the strand of the Span (POSITIVE by default)
Examples:
>>> span_string = "chr1:1-10:+"
>>> span = Span.from_string(span_string)
>>> span
Span(refname='chr1', start=1, end=10, strand=<Strand.POSITIVE: '+'>)
>>> print(span.start)
1
>>> # get 0-based position within span at position 10
>>> span.get_offset(position=10)
9
>>> # create a new subspan derived from the source map
>>> new_subspan = span.get_subspan(offset=5, subspan_length=5)
>>> new_subspan
Span(refname='chr1', start=6, end=10, strand=<Strand.POSITIVE: '+'>)
>>> print(span.length)
10
```python
>>> span_string = "chr1:1-10:+"
>>> span = Span.from_string(span_string)
>>> span
Span(refname='chr1', start=1, end=10, strand=<Strand.POSITIVE: '+'>)
>>> print(span.start)
1
>>> # get 0-based position within span at position 10
>>> span.get_offset(position=10)
9
>>> # create a new subspan derived from the source map
>>> new_subspan = span.get_subspan(offset=5, subspan_length=5)
>>> new_subspan
Span(refname='chr1', start=6, end=10, strand=<Strand.POSITIVE: '+'>)
>>> print(span.length)
10
```
"""

refname: str
Expand Down Expand Up @@ -149,9 +153,13 @@ def from_string(cls, line: str) -> "Span":
ValueError: if there are not at least 2 colon-delimited fields in string
Example:
>>> span_string = "chr1:1-10:+"
>>> Span.from_string(span_string)
Span(refname='chr1', start=1, end=10, strand=<Strand.POSITIVE: '+'>)
```python
>>> span_string = "chr1:1-10:+"
>>> Span.from_string(span_string)
Span(refname='chr1', start=1, end=10, strand=<Strand.POSITIVE: '+'>)
```
"""
parts = line.strip().split(":")
if len(parts) == 3:
Expand Down Expand Up @@ -346,7 +354,7 @@ class Oligo(Metric["Oligo"]):
than the intended melting temperature for target binding indicates the primer or probe is
likely to form stable hairpins or dimers, leading to reduced efficiency of the reaction.
## Examples of interacting with the `Oligo` class
Examples of interacting with the `Oligo` class
```python
>>> from prymer import Span, Strand
Expand Down Expand Up @@ -537,6 +545,7 @@ class PrimerPair:
ValueError: if the chromosomes of the left and right primers are not the same
Examples:
```python
>>> from prymer import Strand
>>> left_span = Span(refname="chr1", start=1, end=20)
>>> left_primer = Oligo(tm=70.0, penalty=-123.0, span=left_span, bases="G"*20)
Expand All @@ -554,9 +563,10 @@ class PrimerPair:
Span(refname='chr1', start=1, end=120, strand=<Strand.POSITIVE: '+'>)
>>> primer_pair.span
Span(refname='chr1', start=1, end=120, strand=<Strand.POSITIVE: '+'>)
>>> list(primer_pair)
[Oligo(bases='GGGGGGGGGGGGGGGGGGGG', tm=70.0, span=Span(refname='chr1', start=1, end=20, strand=<Strand.POSITIVE: '+'>), penalty=-123.0, name=None, tm_homodimer=None, tm_3p_anchored_homodimer=None, tm_secondary_structure=None, tail=None), Oligo(bases='TTTTTTTTTTTTTTTTTTTT', tm=70.0, span=Span(refname='chr1', start=101, end=120, strand=<Strand.NEGATIVE: '-'>), penalty=-123.0, name=None, tm_homodimer=None, tm_3p_anchored_homodimer=None, tm_secondary_structure=None, tail=None)]
```
""" # noqa: E501

left_primer: Oligo
Expand Down
2 changes: 2 additions & 0 deletions prymer/ntthal/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,11 @@ def duplex_tm(self, s1: str, s2: str) -> float:
s2: the sequence of oligo 2 (5'->3' orientation)
Example:
```python
>>> t = NtThermoAlign()
>>> t.duplex_tm(s1 = "ACGT", s2 = "ACGT")
-46.542706
```
Returns:
result: ntthal-calculated melting temperature
Expand Down
2 changes: 2 additions & 0 deletions prymer/primer3/primer3_input.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@
PRIMER_WT_SELF_ANY_TH -> 0.0
PRIMER_WT_SELF_END_TH -> 0.0
PRIMER_WT_HAIRPIN_TH -> 0.0
```
"""

from dataclasses import MISSING
Expand Down
7 changes: 6 additions & 1 deletion prymer/primer3/primer3_weights.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,18 @@
By modifying these weights, users can prioritize specific primer design characteristics. Each of
the defaults provided here are derived from the Primer3 manual: https://primer3.org/manual.html
## Examples of interacting with the `PrimerAndAmpliconWeights` class
## Examples of interacting with the PrimerAndAmpliconWeights class
Example:
```python
>>> PrimerAndAmpliconWeights() # default implementation
PrimerAndAmpliconWeights(product_size_lt=1.0, product_size_gt=1.0, product_tm_lt=0.0, product_tm_gt=0.0, primer_end_stability=0.25, primer_gc_lt=0.25, primer_gc_gt=0.25, primer_self_any=0.1, primer_self_end=0.1, primer_size_lt=0.5, primer_size_gt=0.1, primer_tm_lt=1.0, primer_tm_gt=1.0, primer_homodimer_wt=0.0, primer_3p_homodimer_wt=0.0, primer_secondary_structure_wt=0.0)
>>> PrimerAndAmpliconWeights(product_size_lt=5.0)
PrimerAndAmpliconWeights(product_size_lt=5.0, product_size_gt=1.0, product_tm_lt=0.0, product_tm_gt=0.0, primer_end_stability=0.25, primer_gc_lt=0.25, primer_gc_gt=0.25, primer_self_any=0.1, primer_self_end=0.1, primer_size_lt=0.5, primer_size_gt=0.1, primer_tm_lt=1.0, primer_tm_gt=1.0, primer_homodimer_wt=0.0, primer_3p_homodimer_wt=0.0, primer_secondary_structure_wt=0.0)
```
""" # noqa: E501

from dataclasses import dataclass
Expand Down

0 comments on commit 0e50aec

Please sign in to comment.