-
Notifications
You must be signed in to change notification settings - Fork 21
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
SW_cuda modual #155
Comments
Hi, you need a couple of intermediate steps to do end-to-end training. I'd
start with the training script
https://github.com/flatironinstitute/deepblast/blob/master/scripts/deepblast-trai
I"m not sure what you are trying to accomplish with your test. I'd
recommend looking at the unittests
https://github.com/flatironinstitute/deepblast/blob/master/deepblast/tests/test_sw.py
…On Tue, Feb 27, 2024 at 6:30 AM SorrowAir ***@***.***> wrote:
Hi,
I want to do some end-to-end training using your sw_cuda modual. But it
seems that I don't how it works. My code:
from deepblast.sw_cuda import SmithWatermanDecoder as SWDecoderCUDA
ddp = SmithWatermanDecoder(operator='softmax')
match = torch.randn(100, 120, 108).requires_grad_(True)
gap = torch.zeros(100, 120, 108).requires_grad_(True)
aln = ddp.decode(match.to(device), gap.to(device))
In my understanding, aln should return the probability of alignment.
However, the aln tensor always get 0 in the first row and column, which
means aln don't return what I want. So is my code wrong, or I just
misunderstand the output of ddp.decode?
—
Reply to this email directly, view it on GitHub
<#155>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA75VXNOAKQ7CED3WDCLRULYVW7U7AVCNFSM6AAAAABD35TC4WVHI2DSMVQWIX3LMV43ASLTON2WKOZSGE2TMMZVGI3DIOI>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Thanks for your quick reply! I have used my model to create the match and gap scoring matrices, and expect to use your differentiable_sw modual to get the alignment prediction. In other words, I have match scoring matrix Due to the lack of comments, it is a little difficult to understand the result returned by |
I see the confusion.
The `aln` matrix here is the expected traceback matrix (i.e. the e matrix
in algorithm 1 in the paper :
https://www.nature.com/articles/s41587-023-01917-2#Sec10)
Also see equation 11 here https://arxiv.org/pdf/1802.03676.pdf
…On Tue, Feb 27, 2024 at 9:15 AM SorrowAir ***@***.***> wrote:
Thanks for your quick reply!
I have used my model to create the match and gap scoring matrices, and
expect to use your differentiable_sw modual to get the alignment
prediction. In other words, I have match scoring matrix M # (size: N*M)
and gap scoring matrix G # (size: N*M), N and M are the lengths of two
sequence. Now, I want to get a align matrix A # (size: N*M) and A[i][j]
is the predicted alignment of the ith and jth residue. How can I get such a
align matrix from your differentiable_sw modual?
Due to the lack of comments, it is a little difficult to understand the
result returned by SmithWatermanDecoder. Could you explain what the aln
tensor means and add some comments in your code? Your code is elegantly
written but lacks comments, which hinders its readability XD.
—
Reply to this email directly, view it on GitHub
<#155 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AA75VXL5F72UREUNETPREGDYVXTA3AVCNFSM6AAAAABD35TC4WVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRWGY2DQNJZGQ>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
After running your test code (https://github.com/flatironinstitute/deepblast/blob/master/deepblast/tests/test_sw.py), I also get the same result. |
Hi yes this is by construction -- we zero out the first row / column to make autograd work ... |
Thanks! I understand the zeros in the first row and column. However, why is the last element always one? If so, it means that the last element is always aligned. Thanks again for your reply! I also look forward to see an example like https://github.com/spetti/SMURF/blob/main/examples/SSW_examples/sw_in_tensorflow_pytorch.ipynb. Your work is similar with it. However, without a good example file, I couldn't follow your work well :( |
Got it. Yes we generate those types of alignment visualizations as depicted in the tensorboard readouts. We are currently in the middle of doing a overhaul of the tutorials, more updates to come by July |
Hi,
I want to do some end-to-end training using your sw_cuda modual. But it seems that I don't how it works. My code:
In my understanding,
aln
should return the probability of alignment. However, thealn
tensor always get0
in the first row and column, which meansaln
don't return what I want. So is my code wrong, or I just misunderstand the output ofddp.decode
?The text was updated successfully, but these errors were encountered: