You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was writing some tests for restriction which should return some single stranded products. To compare one of them, I wanted to create a Dseq object without a watson but with a crick strand (and without setting ovhg).
Dseq(watson="", crick="TAATTAAGCC")
This gave the following error:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[100], line 1
----> 1 Dseq(watson=\"\", crick=\"TAATTAAGCC\")
File ~/dev/learn/Genestorian/pydna/src/pydna/dseq.py:338, in Dseq.__init__(self, watson, crick, ovhg, circular, pos)
333 else: # crick strand given
334 if ovhg is None: # ovhg not given
335 olaps = _common_sub_strings(
336 str(watson).lower(),
337 str(_rc(crick).lower()),
--> 338 int(_math.log(len(watson)) / _math.log(4)),
339 )
340 if len(olaps) == 0:
341 raise ValueError(\"Could not anneal the two strands.\" \" Please provide ovhg value\")
ValueError: math domain error"
Which makes sense, and is fixed by passing whatever value to ovhg. However, it may be better to catch this case and automatically set ovhg to the length of the sequence. What do you think?
For the record, passing a watson strand while in purpose leaving crick empty (Dseq(watson="TAATTAAGCC", crick="")) gives the following (also fixed by passing ovhg):
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[101], line 1
----> 1 Dseq(watson=\"TAATTAAGCC\", crick=\"\")
File ~/dev/learn/Genestorian/pydna/src/pydna/dseq.py:335, in Dseq.__init__(self, watson, crick, ovhg, circular, pos)
333 else: # crick strand given
334 if ovhg is None: # ovhg not given
--> 335 olaps = _common_sub_strings(
336 str(watson).lower(),
337 str(_rc(crick).lower()),
338 int(_math.log(len(watson)) / _math.log(4)),
339 )
340 if len(olaps) == 0:
341 raise ValueError(\"Could not anneal the two strands.\" \" Please provide ovhg value\")
File ~/dev/learn/Genestorian/pydna/src/pydna/common_sub_strings.py:341, in common_sub_strings(stringx, stringy, limit)
318 \"\"\"
319 Finds all common substrings between stringx and stringy, and returns
320 them sorted by length.
(...)
337 length1 = lenght of substring
338 \"\"\"
339 from pydivsufsort import common_substrings
--> 341 matches = common_substrings(stringx, stringy, limit=limit)
342 matches.sort()
343 matches.sort(key=_itemgetter(2), reverse=True)
File ~/dev/learn/Genestorian/pydna/.venv/lib/python3.10/site-packages/pydivsufsort/wonderstring.py:148, in common_substrings(s1, s2, limit)
146 s1 = cast_to_numpy(s1)
147 s2 = cast_to_numpy(s2)
--> 148 sep = max(s1.max(), s2.max()) + 1
149 s = np.empty(len(s1) + len(s2) + 1, dtype=np.result_type(s1[0], s2[0], sep))
150 s[: len(s1)] = s1
File ~/dev/learn/Genestorian/pydna/.venv/lib/python3.10/site-packages/numpy/core/_methods.py:41, in _amax(a, axis, out, keepdims, initial, where)
39 def _amax(a, axis=None, out=None, keepdims=False,
40 initial=_NoValue, where=True):
---> 41 return umr_maximum(a, axis, None, out, keepdims, initial, where)
ValueError: zero-size array to reduction operation maximum which has no identity"
```
The text was updated successfully, but these errors were encountered:
I was writing some tests for restriction which should return some single stranded products. To compare one of them, I wanted to create a
Dseq
object without awatson
but with acrick
strand (and without settingovhg
).Dseq(watson="", crick="TAATTAAGCC")
This gave the following error:
Which makes sense, and is fixed by passing whatever value to
ovhg
. However, it may be better to catch this case and automatically setovhg
to the length of the sequence. What do you think?For the record, passing a
watson
strand while in purpose leavingcrick
empty (Dseq(watson="TAATTAAGCC", crick="")
) gives the following (also fixed by passingovhg
):The text was updated successfully, but these errors were encountered: