-
Notifications
You must be signed in to change notification settings - Fork 23
TorchProteinLibrary 0.2 Nucleic Acid Extension #39
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
base: master
Are you sure you want to change the base?
Changes from all commits
cc66377
4aa229d
815efcc
16d0af5
e7e69f1
180468c
ca80801
d2ba39b
db20cba
ecd639a
31be54a
bb77dcd
d74a584
67634de
e28b2cb
88a6392
a690ec4
d114d4f
deb2697
f621ce0
8fde8a2
19eeb09
3d01fc0
db61bea
f8f6d68
4c07845
a7dd4c5
cfdc0f3
489dbab
af7d684
52ac4ea
0c30558
aa2a6c5
729f832
2119094
116e915
9f9f1a2
3e5123a
fdb65dd
30393e7
954338e
00d0edf
bce45f3
70ed719
3f49736
c7b92ab
04a9692
31075b2
965406f
9c994c1
46fa78c
2ab5655
d31268a
108c2d4
ac20ac5
1164fac
9a0f2e4
60dacd8
3b2be2d
0cf8019
22e65b2
88f2b4f
594bbd6
9a0e859
7d153c1
a150189
c90e505
babaa30
41551a6
5e60db0
b06d5f0
90f63f5
4998cde
b924391
4bb46e6
bc93e1c
815503e
3447d41
4785b0d
e651a7a
ddb70c7
75d4ad3
8760b6e
d9cc9b6
551fa42
abaceb8
772fa5f
42cd22a
6b29a51
4830c5c
984df92
e172f3d
643c8fb
5fd3ddd
4d83013
ebaf4c3
20816d7
2311b10
207ffb9
feb4a9b
3a4389f
e4ee2a7
ef3ea76
a19d87e
fac18fc
6302c4f
12f80d0
27ba0e5
c15bc3a
e410d1d
9b59ad0
77a7870
9e4077a
028a450
24b11d7
697f2a8
fe4de46
c778a94
0a68d0d
41832db
a80523c
4874d25
48790b3
f77b944
826a557
2d1fb5f
a742d39
4c23b01
2c33bf9
41b041d
c3a371c
01f7725
2dbe19e
54b569b
bdccf44
70ae828
0517375
ac41953
b03f826
2eeaf4c
dfa81c8
3f666c3
dca6aee
e8a4d7d
baf0979
1d37b4f
fbef4b3
f0481dc
a9ff06c
6b89445
f302796
1e6f3bc
5be97ff
b14b711
3efbb44
357cf47
ad3587a
0891453
298b667
1d21d17
7aab440
d17fff2
52316b3
59b8956
78eb88a
3c54a1e
dbc83b4
db93e51
7fa1c7b
6c693a1
f25debd
c148429
48bdca2
0420d47
1b5f32c
6637122
4c36152
de11b82
6a7e462
0004f56
b941c26
d80746c
04855d4
e1dec82
5d0779d
fd4ad7e
1c2dc07
ad3ec46
52ad974
62b4417
1786cb7
7f3dd35
20754c0
012843d
37dd2e9
c2ff830
36a551a
12dd9b6
c4e2bef
bca7d6d
dfbc047
7e3e650
8ebf85f
a614cf1
194909d
7c5bb3e
4f84324
88f914d
f10b089
15dabb3
c5de12e
5c60396
3adc58c
6fa21da
9f1d3eb
68af3f5
ec97ae7
a046100
28f4d41
e1f726d
ef7c0a2
abc7d85
561865d
6630c51
efb2a6e
4ea9970
0372e23
ca125ee
1b4b6f1
e10c8a2
63181b3
5782bec
22df1c0
9a27f6d
270af11
5ea5d96
8a4c59e
cb85868
c76a526
f06a152
28623f2
70e99a9
c7527ea
f20467d
9b1b007
7e73d9b
6db5bec
384bac4
fddcd34
8819d48
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,6 +14,14 @@ | |
| *.sty | ||
| *.gif | ||
| *.txt | ||
| *.crg | ||
| *.siz | ||
| *.cube | ||
| *.vscode | ||
| build/* | ||
| dist/* | ||
| */talled | ||
| *.mp4 | ||
|
|
||
| #Python | ||
| *.pyc | ||
|
|
||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lupoglaz Is this a fix for the "master" branch or something you needed for the "dev branch? In other words, is it going to break the "master" code if we don't use your local version of CUSP?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe we just need a version of CUSP in the TPL directory when it's compiled locally. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| [submodule "cusplibrary"] | ||
| path = cusplibrary | ||
| url = https://github.com/lupoglaz/cusplibrary.git | ||
| branch = develop |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This looks like a benchmark for code that's already in TPL, so it can be merged. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| from core import ModuleBenchmark | ||
| import torch | ||
| from torch.autograd import profiler | ||
| from TorchProteinLibrary import VolumeMul | ||
|
|
||
| import numpy as np | ||
| import seaborn as sea | ||
| from matplotlib import pylab as plt | ||
| import pandas as pd | ||
| from tqdm import tqdm | ||
| import pickle as pkl | ||
|
|
||
| class VolumeMulBenchmark(ModuleBenchmark): | ||
| def __init__(self, device='gpu', num_sequences=32, seq_length=350): | ||
| super().__init__(device) | ||
| self.vol1 = | ||
|
|
||
| def prepare(self): | ||
| self.angles.requires_grad_() | ||
| self.coords = self.module(self.angles, self.length) | ||
| self.grad_coords = torch.ones(self.coords.size(), dtype=torch.float, device='cuda') | ||
|
|
||
| def run_forward(self): | ||
| self.angles.detach() | ||
| self.coords = self.module(self.angles, self.length) | ||
|
|
||
| def run_backward(self): | ||
| self.coords.backward(self.grad_coords) | ||
|
|
||
| def test_length( interval=(60, 20, 300), num_measurements=1, output_filename='length.dat'): | ||
| time = [] | ||
| direction = [] | ||
| length = [] | ||
| for n in range(num_measurements): | ||
| for i in tqdm(range(interval[0], interval[2], interval[1])): | ||
| mb = Angles2BackboneBenchmark(seq_length=i) | ||
| dur_fwd = mb.measure_forward() | ||
| time.append(dur_fwd/1000.0) | ||
| direction.append('Forward') | ||
| length.append(i) | ||
| dur_bwd = mb.measure_backward() | ||
| time.append(dur_bwd/1000.0) | ||
| direction.append('Backward') | ||
| length.append(i) | ||
|
|
||
| data = pd.DataFrame({ 'Time': time, | ||
| 'Direction': direction, | ||
| 'Length': length | ||
| }) | ||
| data.to_pickle(output_filename) | ||
|
|
||
| if __name__=='__main__': | ||
|
|
||
| test_length(interval=(60, 20, 700), output_filename='Data/ReducedModelTime.pkl', num_measurements=10) | ||
|
|
||
| data = pd.read_pickle('Data/ReducedModelTime.pkl') | ||
| sea.set_style("whitegrid") | ||
| sea.set_context("paper", font_scale=1.5, rc={"lines.linewidth": 1.5}) | ||
| g1 = sea.relplot(x="Length", y="Time", hue='Direction', kind="line", style="Direction", height=6, aspect=1.3, markers=True, data=data) | ||
| plt.ylabel("Time, ms") | ||
| plt.xlabel("Sequence length, amino-acids") | ||
| sea.despine() | ||
| # plt.show() | ||
| plt.savefig("Fig/ReducedModelTime.png") |
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In function "Angles2Coords_forward", you have two "if" blocks (polymer_type 0 and polymer_type 1 or 2) but it seems the code is identical except for "<8" for proteins and "<10" for nucleic acids. So you can use the "if" clause for that little piece of code only: if(polymer_type == 0){ That way, no need to duplicate the code. As far as I can see, the call to function "ProtUtil::getNumAtoms(seq, add_terminal)" for proteins can be replaced by the version you have for nucleic acids: "ProtUtil::getNumAtoms(seq, add_terminal, polymer_type, chain_names)". |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For this PR, let's revert to the original version