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

PSSM support in Python #69

Open
shenker opened this issue Mar 7, 2023 · 1 comment
Open

PSSM support in Python #69

shenker opened this issue Mar 7, 2023 · 1 comment

Comments

@shenker
Copy link

shenker commented Mar 7, 2023

Can you align a PSSM using parasail-python?

Thanks!

@jeffdaily
Copy link
Owner

You can with C parasail library. I hadn't updated the python bindings yet. I started toying with it, but even the C API wasn't pretty. For the C library, it was important to me to keep the function signature the same whether it was a normal substitution matrix versus pssm. Keeping the signature the same allowed me to not need to create pssm-specific APIs and essentially double the number of functions. So in the C library, you pass NULL for the first sequence since it is encapsulated by the pssm matrix. And to make it worse, if you want to use any of the "stats" functions, you still have to pass in a representative sequence for s1. It's awkward and clunky but it works.

I don't know how to make the python bindings better or more pythonic. Suddenly the first argument to the alignment functions becomes optional.

# the current alignment signature
def sw(s1, s2, open, extend, matrix):
    pass

# keeping names the same, but allowing s1 to be optional
def sw(*args):
   if len(args) == 4:
       pass  # call PSSM
   elif len(args) == 5:
       pass  # call normal
   else:
       raise TypeError("Wrong number of arguments!")

# or going the clunk way I did it in C
def sw(s1, s2, open, extend, matrix):
    # s1 is None, and make this okay
    # currently, the wrapper just passes s1 and len(s1) down to the C API, 
    # so I'd need to add a check for None

Your thoughts? Help me design the python PSSM API.

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