-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
437 additions
and
427 deletions.
There are no files selected for viewing
Binary file not shown.
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
15 changes: 15 additions & 0 deletions
15
molsysmt/element/group/small_molecule/make_components_pkl.py
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,15 @@ | ||
# wget https://files.wwpdb.org/pub/pdb/data/monomers/components.cif | ||
|
||
from molsysmt.native import CIFFileHandler | ||
import pickle | ||
|
||
handler = CIFFileHandler('components.cif') | ||
cif_entries = handler.parse() | ||
output = {} | ||
|
||
for value, key in cif_entries.items(): | ||
output[key['_chem_comp']['three_letter_code']]=key['_chem_comp']['name'] | ||
|
||
with open('components.pkl', 'wb') as fp: | ||
pickle.dump(output, fp) | ||
|
21 changes: 17 additions & 4 deletions
21
molsysmt/element/group/small_molecule/small_molecule_names.py
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 |
---|---|---|
@@ -1,5 +1,18 @@ | ||
small_molecule_names = [ | ||
'HED', # PDBID 181L | ||
'BNZ', # PDBID 181L | ||
] | ||
import pickle | ||
import sys | ||
|
||
if sys.version_info[1]==10: | ||
from importlib.resources import files | ||
def path(package, file): | ||
return files(package).joinpath(file) | ||
elif sys.version_info[1] in (8,9): | ||
from pathlib import PurePath | ||
parent = PurePath(__file__).parent | ||
def path(package, file): | ||
data_dir = package.split('.')[-1] | ||
return parent.joinpath('../data/'+data_dir+'/'+file).__str__() | ||
|
||
|
||
with open(path('molsysmt.data.databases','components.pkl'), 'rb') as fff: | ||
small_molecule_names = pickle.load(fff) | ||
|
This file was deleted.
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from molsysmt._private.digestion import digest | ||
|
||
@digest(form='file:pdb') | ||
def to_molsysmt_MolSys(item, atom_indices='all', structure_indices='all', skip_digestion=False): | ||
|
||
from molsysmt.native import MolSys | ||
from . import to_molsysmt_Topology | ||
from . import to_molsysmt_Structures | ||
|
||
tmp_item = MolSys() | ||
tmp_item.topology = to_molsysmt_Topology(item, atom_indices=atom_indices, skip_digestion=True) | ||
tmp_item.structures = to_molsysmt_Structures(item, atom_indices=atom_indices, | ||
structure_indices=structure_indices, skip_digestion=True) | ||
|
||
return tmp_item | ||
|
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,18 @@ | ||
from molsysmt._private.digestion import digest | ||
|
||
@digest(form='file:pdb') | ||
def to_molsysmt_Structures(item, atom_indices='all', structure_indices='all', skip_digestion=False): | ||
|
||
from molsysmt.native.structures import Structures | ||
from . import get_coordinates_from_atom, get_box_from_system | ||
|
||
tmp_item = Structures() | ||
|
||
coordinates = get_coordinates_from_atom(item, indices=atom_indices, structure_indices=structure_indices, | ||
skip_digestion=True) | ||
box = get_box_from_system(item, structure_indices=structure_indices, skip_digestion=True) | ||
|
||
tmp_item.append_structures(coordinates=coordinates, box=box) | ||
|
||
return tmp_item | ||
|
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,13 @@ | ||
from molsysmt._private.digestion import digest | ||
|
||
@digest(form='file:pdb') | ||
def to_molsysmt_Topology(item, atom_indices='all', skip_digestion=False): | ||
|
||
from . import to_openmm_PDBFile | ||
from ..openmm_PDBFile import to_molsysmt_Topology as openmm_PDBFile_to_molsysmt_Topology | ||
|
||
tmp_item = to_openmm_PDBFile(item, skip_digestion=True) | ||
tmp_item = openmm_PDBFile_to_molsysmt_Topology(tmp_item, atom_indices=atom_indices, skip_digestion=True) | ||
|
||
return tmp_item | ||
|
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
Oops, something went wrong.