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

TypeError: __init__() missing 1 required positional argument: 's1b' #54

Closed
N-damo opened this issue Oct 29, 2020 · 3 comments
Closed

TypeError: __init__() missing 1 required positional argument: 's1b' #54

N-damo opened this issue Oct 29, 2020 · 3 comments

Comments

@N-damo
Copy link

N-damo commented Oct 29, 2020

SSW Library Emulation
import parasail
score_size = 1 # 0, use 8-bit align; 1, use 16-bit; 2, try both
profile = parasail.ssw_init("asdf", parasail.blosum62, score_size)
result = parasail.ssw_profile(profile, "asdf", 10, 1)
print(result.score1)
print(result.cigar)
print(result.ref_begin1)
print(result.ref_end1)
print(result.read_begin1)
print(result.read_end1)

error output:
TypeError: init() missing 1 required positional argument: 's1b'

possible solution:
class Profile:
#def init(self, pointer, matrix,s1b):
def init(self, pointer, matrix):
self.pointer = pointer
self.matrix_ = matrix
self.as_parameter = pointer
#self.s1b = s1b

is it right?

@jeffdaily
Copy link
Owner

Bug in ssw_init. This is the correct fix. Will push this.

diff --git a/parasail/bindings_v2.py b/parasail/bindings_v2.py
index 5994d70..b43867f 100644
--- a/parasail/bindings_v2.py
+++ b/parasail/bindings_v2.py
@@ -973,7 +973,8 @@ def ssw_profile(profile, s2, open, extend):
         return None

 def ssw_init(s1, matrix, score_size):
-    return Profile(_lib.parasail_ssw_init(b(s1), len(s1), matrix, score_size), matrix)
+    s1b = b(s1)
+    return Profile(_lib.parasail_ssw_init(s1b, len(s1), matrix, score_size), matrix, s1b)

 _lib.parasail_sequences_from_file.argtype = [ctypes.c_char_p]
 _lib.parasail_sequences_from_file.restype = c_sequences_p

@jeffdaily
Copy link
Owner

It's been a long time since I pushed a tagged release. Not sure how well CI will go, creating a new pypi etc, but at least if you grab the latest sources it will have this fix.

@jeffdaily
Copy link
Owner

Release 1.2.1 is now available with this fixed. Thanks for reporting.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants