-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from Degiacomi-Lab/clustering
Clustering
- Loading branch information
Showing
10 changed files
with
132,408 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,5 @@ Data Loading | |
.. autoclass:: molearn.data.PDBData | ||
:members: | ||
|
||
.. autoclass:: molearn.data.DataAssembler | ||
:members: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,5 +19,6 @@ dependencies: | |
- plotly | ||
- nglview | ||
- openmmtorchplugin | ||
- mdtraj | ||
- pip: | ||
- geomloss |
Binary file not shown.
Binary file not shown.
62,009 changes: 62,009 additions & 0 deletions
62,009
examples/data/preparation/topo_MurDclosed1F.pdb
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.join(os.path.abspath(os.pardir), "src")) | ||
from molearn.data import DataAssembler | ||
|
||
|
||
def main(): | ||
storage_path = "./clustered" | ||
if not os.path.exists(storage_path): | ||
os.mkdir(storage_path) | ||
tm = DataAssembler( | ||
# trajectories | ||
[ | ||
"./data/preparation/MurDopen.dcd", | ||
"./data/preparation/MurDclosed.dcd", | ||
], | ||
# topologies | ||
[ | ||
"./data/preparation/topo_MurDopen1F.pdb", | ||
"./data/preparation/topo_MurDclosed1F.pdb", | ||
], | ||
test_size=0.0, | ||
n_cluster=5, | ||
outpath=storage_path, | ||
verbose=True, | ||
) | ||
# reading in the trajectories and removing of all atoms apart from protein atoms | ||
tm.read_traj() | ||
# using agglomerative clustering to sample the trajectories | ||
tm.distance_cluster() | ||
# creating the new trajectory as dcd file and a new topology as pdb file | ||
tm.create_trajectories() | ||
# using PCA and the first n components for KMeans clustering to sample the trajectories | ||
tm.pca_cluster() | ||
tm.create_trajectories() | ||
# simply striding over the trajectories with a step size computed to result in n_cluster frames | ||
tm.stride() | ||
tm.create_trajectories() | ||
""" | ||
the given example will create the following files in a new directory named 'clustered' | ||
* MurDopen_CLUSTER_aggl_train.dcd | ||
* MurDopen_CLUSTER_aggl_train_frames.txt | ||
* MurDopen_CLUSTER_pca_train.dcd | ||
* MurDopen_CLUSTER_pca_train_frames.txt | ||
* MurDopen_NEW_TOPO.pdb | ||
* MurDopen_STRIDE_5_train.dcd | ||
* MurDopen_STRIDE_5_train_frames.txt | ||
the txt files contain the indices of frames of the original trajectory | ||
the dcd files contain the new trajectory | ||
the pdb file is the new topology for the new trajectory | ||
all atoms apart from protein atoms will be removed | ||
""" | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.