Skip to content

Commit

Permalink
change to normal strings instead of raw strings
Browse files Browse the repository at this point in the history
  • Loading branch information
BjornFJohansson committed Jan 26, 2025
1 parent 4740475 commit 7dad56b
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 36 deletions.
34 changes: 17 additions & 17 deletions src/pydna/tm.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
from Bio.SeqUtils import MeltingTemp as _mt
from Bio.SeqUtils import gc_fraction as _GC

import textwrap as _textwrap
from textwrap import dedent as _dedent
from pydna._pretty import pretty_str as _pretty_str

# See the documentation for Bio.SeqUtils.MeltingTemp for more details
Expand Down Expand Up @@ -160,12 +160,12 @@ def program(amplicon, tm=tm_default, ta=ta_default):
extension_time_taq = max(30, int(taq_extension_rate * len(amplicon) / 1000))
# seconds

f = _textwrap.dedent(
r"""
f = _dedent(
"""\
|95°C|95°C | |tmf:{tmf:.1f}
|____|_____ 72°C|72°C|tmr:{tmr:.1f}
|3min|30s \ {ta:.1f}°C _____|____|{rate}s/kb
| | \______/{0:2}:{1:0>2}|5min|GC {GC}%
|3min|30s \\ {ta:.1f}°C _____|____|{rate}s/kb
| | \\______/{0:2}:{1:0>2}|5min|GC {GC}%
| | 30s | |{size}bp
""".format(
rate=taq_extension_rate,
Expand Down Expand Up @@ -226,14 +226,14 @@ def dbd_program(amplicon, tm=tm_dbd, ta=ta_dbd):
tmr = tm(amplicon.reverse_primer.footprint)

if tmf >= 69.0 and tmr >= 69.0:
f = _textwrap.dedent(
r"""
|98°C|98°C | |tmf:{tmf:.1f}
|____|____ | |tmr:{tmr:.1f}
|30s |10s \ 72°C|72°C|{rate}s/kb
| | \____|____|GC {GC_prod}%
| | {0:2}:{1:0>2}|5min|{size}bp
""".format(
f = _dedent(
"""\
|98°C|98°C | |tmf:{tmf:.1f}
|____|____ | |tmr:{tmr:.1f}
|30s |10s \\ 72°C|72°C|{rate}s/kb
| | \\____|____|GC {GC_prod}%
| | {0:2}:{1:0>2}|5min|{size}bp
""".format(
rate=PfuSso7d_extension_rate,
tmf=tmf,
tmr=tmr,
Expand All @@ -243,12 +243,12 @@ def dbd_program(amplicon, tm=tm_dbd, ta=ta_dbd):
)
).strip()
else:
f = _textwrap.dedent(
r"""
f = _dedent(
"""\
|98°C|98°C | |tmf:{tmf:.1f}
|____|_____ 72°C|72°C|tmr:{tmr:.1f}
|30s |10s \ {ta:.1f}°C _____|____|{rate}s/kb
| | \______/{0:2}:{1:0>2}|5min|GC {GC}%
|30s |10s \\ {ta:.1f}°C _____|____|{rate}s/kb
| | \\______/{0:2}:{1:0>2}|5min|GC {GC}%
| | 10s | |{size}bp
""".format(
rate=PfuSso7d_extension_rate,
Expand Down
40 changes: 21 additions & 19 deletions tests/test_module_amplicon.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,25 +86,27 @@ def test_amplicon_dbd():

assert repr(prod) == "Amplicon(1505)"

fig = r"""
|95°C|95°C | |tmf:77.1
|____|_____ 72°C|72°C|tmr:80.9
|3min|30s \ 64.6°C _____|____|45s/kb
| | \______/ 1:07|5min|GC 51%
| | 30s | |1505bp
"""
fig = dedent(fig).strip()
assert str(prod.program()) == fig

fig = r"""
|98°C|98°C | |tmf:71.6
|____|____ | |tmr:75.3
|30s |10s \ 72°C|72°C|15s/kb
| | \____|____|GC 51%
| | 0:22|5min|1505bp
"""
fig = dedent(fig).strip()
assert str(prod.dbd_program()) == fig
fig = dedent(
"""\
|95°C|95°C | |tmf:77.1
|____|_____ 72°C|72°C|tmr:80.9
|3min|30s \\ 64.6°C _____|____|45s/kb
| | \\______/ 1:07|5min|GC 51%
| | 30s | |1505bp"""
)

assert str(prod.program()) == fig.strip()

fig = dedent(
"""\
|98°C|98°C | |tmf:71.6
|____|____ | |tmr:75.3
|30s |10s \\ 72°C|72°C|15s/kb
| | \\____|____|GC 51%
| | 0:22|5min|1505bp"""
)

assert str(prod.dbd_program()) == fig.strip()


def test_amplicon_dbd_low_gc():
Expand Down

0 comments on commit 7dad56b

Please sign in to comment.