modernatx / seqlike

Unified biological sequence manipulation in Python
https://modernatx.github.io/seqlike
Apache License 2.0
207 stars 21 forks source link

Dispatch based on SeqLikeType.__args__ #42

Closed ericmjl closed 2 years ago

ericmjl commented 2 years ago

Also a quick note: when dispatching for SeqLike, I guess we can use SeqLikeType.__args__ as the type instead of hardcoding a list of potential types, otherwise it's hard to keep them consistent (since I saw there's a plan to include torch.tensor)

Originally posted by @pagpires in https://github.com/modernatx/seqlike/issues/41#issuecomment-1000942209

ericmjl commented 2 years ago

@pagpires do let us know if you'd like to make this happen! Happy to assign it to you.

pagpires commented 2 years ago

sure! happy to

pagpires commented 2 years ago

PR: https://github.com/modernatx/seqlike/pull/46 Note that the forward-ref should be removed or replaced (e.g. "torch.tensor" removed, "np.ndarray" replaced with the np.ndarray) to be compatible with dispatch. I also found the circular dependency of SeqLike and SeqLikeType a bit confusing. Let me know if I missed the context for this design or there's a better way.