-
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
122 changed files
with
234 additions
and
5,437 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
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,81 @@ | ||
# 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() | ||
|
||
types_dict = {} | ||
|
||
for ii in cif_entries: | ||
jj = cif_entries[ii]['_chem_comp']['type'] | ||
if jj in types_dict: | ||
types_dict[jj].append(ii) | ||
else: | ||
types_dict[jj] = [ii] | ||
|
||
types = ['NON-POLYMER', 'non-polymer', 'other'] | ||
data = [] | ||
for ii in types: | ||
data += types_dict[ii] | ||
data.remove('UNL') | ||
|
||
# quito iones | ||
ions = [] | ||
for value in data: | ||
key = cif_entries[value] | ||
if key['_chem_comp']['name'].endswith(' ION"') or key['_chem_comp']['name'].endswith(' ion"'): | ||
ions.append(value) | ||
|
||
for ion in ions: | ||
data.remove(ion) | ||
|
||
output = {} | ||
|
||
for value in data: | ||
|
||
key = cif_entries[value] | ||
|
||
aux_dict={} | ||
|
||
aux_dict['name']=key['_chem_comp']['name'] | ||
aux_dict['three_letter_code']=key['_chem_comp']['three_letter_code'] | ||
aux_dict['formal_charge']=float(key['_chem_comp']['pdbx_formal_charge']) | ||
aux_dict['atom_name']=key['_chem_comp_atom']['atom_id'] | ||
aux_dict['alt_atom_name']=key['_chem_comp_atom']['alt_atom_id'] | ||
aux_dict['atom_type']=key['_chem_comp_atom']['type_symbol'] | ||
try: | ||
charge = [] | ||
for ii in key['_chem_comp_atom']['charge']: | ||
charge.append(float(ii)) | ||
aux_dict['charge']=charge | ||
except: | ||
aux_dict['charge']=[] | ||
if '_chem_comp_bond' in key: | ||
aux_dict['bonds']=[[ii,jj] for ii,jj in zip(key['_chem_comp_bond']['atom_id_1'], | ||
key['_chem_comp_bond']['atom_id_2'])] | ||
else: | ||
aux_dict['bonds']=[] | ||
|
||
output[value]=aux_dict | ||
|
||
#with open('small_molecules_db.pkl', 'wb') as fff: | ||
# pickle.dump(output, fff) | ||
|
||
split_output = {} | ||
for name,value in output.items(): | ||
if name[0] not in split_output: | ||
split_output[name[0]]={} | ||
split_output[name[0]][name]=value | ||
|
||
import gzip | ||
|
||
for file_name, aux_output in split_output.items(): | ||
with gzip.open('small_molecules/'+file_name+'.pkl.gz', 'wb', compresslevel=9) as fff: | ||
pickle.dump(aux_output, fff) | ||
|
||
with gzip.open('small_molecules/group_names.pkl.gz', 'wb', compresslevel=9) as fff: | ||
pickle.dump(list(output.keys()), fff) | ||
|
||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
from .names import names | ||
from .get_amino_acid_type_from_name import get_amino_acid_type_from_name | ||
from .get_1_letter_code_from_name import get_1_letter_code_from_name | ||
from .is_amino_acid import is_amino_acid | ||
from .group_names import group_names | ||
|
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,19 @@ | ||
import pickle | ||
import sys | ||
import gzip | ||
|
||
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 gzip.open(path('molsysmt.data.databases.amino_acids','group_names.pkl.gz'), 'rb') as fff: | ||
group_names = pickle.load(fff) | ||
|
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,8 +1,8 @@ | ||
from .get_amino_acid_type_from_name import name_to_type | ||
from .group_names import group_names | ||
|
||
def is_amino_acid(name): | ||
""" | ||
To be written soon... | ||
""" | ||
return (name in name_to_type) | ||
return (name in group_names) | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
from .ion_names import ion_names | ||
from .is_ion import is_ion | ||
from .group_names import group_names |
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 |
---|---|---|
@@ -1,9 +1,9 @@ | ||
from .ion_names import ion_names | ||
from .group_names import group_names | ||
|
||
def is_ion(name): | ||
""" | ||
To be written soon... | ||
""" | ||
|
||
return (name in ion_names) | ||
return (name in group_names) | ||
|
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,2 +1,3 @@ | ||
from .small_molecule_names import small_molecule_names | ||
from .is_small_molecule import is_small_molecule | ||
from .group_names import group_names | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import pickle | ||
import sys | ||
import gzip | ||
|
||
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 gzip.open(path('molsysmt.data.databases.small_molecules','group_names.pkl.gz'), 'rb') as fff: | ||
group_names = pickle.load(fff) | ||
|
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,9 +1,9 @@ | ||
from .small_molecule_names import small_molecule_names | ||
from .group_names import group_names | ||
|
||
def is_small_molecule(name): | ||
""" | ||
To be written soon... | ||
""" | ||
|
||
return (name in small_molecule_names) | ||
return (name in group_names) | ||
|
Binary file not shown.
Oops, something went wrong.