Skip to content

Commit

Permalink
In process
Browse files Browse the repository at this point in the history
  • Loading branch information
dprada committed Apr 15, 2024
1 parent 2f49dc2 commit e017f09
Show file tree
Hide file tree
Showing 168 changed files with 956 additions and 51,471 deletions.
41 changes: 26 additions & 15 deletions molsysmt/_private/conversion_shortcuts/to_molsysmt_MolSys.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
def molsysmt_Topology_and_molsysmt_Structures_to_molsysmt_MolSys(molecular_system, atom_indices='all', structure_indices='all'):
def molsysmt_Topology_and_molsysmt_Structures_to_molsysmt_MolSys(molecular_system, atom_indices='all',
structure_indices='all', skip_digestion=False):

from molsysmt.basic import get_form
from molsysmt.native.molsys import MolSys
Expand All @@ -18,13 +19,14 @@ def molsysmt_Topology_and_molsysmt_Structures_to_molsysmt_MolSys(molecular_syste

tmp_item = MolSys()

tmp_item.topology = extract_topology(topology, atom_indices=atom_indices, copy_if_all=True)
tmp_item.topology = extract_topology(topology, atom_indices=atom_indices, copy_if_all=True, skip_digestion=True)
tmp_item.structures = extract_structures(structures, atom_indices=atom_indices,
structure_indices=structure_indices, copy_if_all=True)
structure_indices=structure_indices, copy_if_all=True, skip_digestion=True)

return tmp_item

def file_prmtop_and_file_inpcrd_to_molsysmt_MolSys(molecular_system, atom_indices='all', structure_indices='all'):
def file_prmtop_and_file_inpcrd_to_molsysmt_MolSys(molecular_system, atom_indices='all',
structure_indices='all', skip_digestion=False):

from molsysmt.basic import get_form
from molsysmt.form.file_prmtop import to_molsysmt_Topology as file_prmtop_to_molsysmt_Topology
Expand All @@ -44,12 +46,16 @@ def file_prmtop_and_file_inpcrd_to_molsysmt_MolSys(molecular_system, atom_indice

output_item = MolSys()

output_item.topology = file_prmtop_to_molsysmt_Topology(item_prmtop, atom_indices=atom_indices)
output_item.structures = file_inpcrd_to_molsysmt_Structures(item_inpcrd, atom_indices=atom_indices, structure_indices=structure_indices)
output_item.topology = file_prmtop_to_molsysmt_Topology(item_prmtop, atom_indices=atom_indices,
skip_digestion=True)
output_item.structures = file_inpcrd_to_molsysmt_Structures(item_inpcrd, atom_indices=atom_indices,
structure_indices=structure_indices,
skip_digestion=True)

return output_item

def file_psf_and_file_dcd_to_molsysmt_MolSys(molecular_system, atom_indices='all', structure_indices='all'):
def file_psf_and_file_dcd_to_molsysmt_MolSys(molecular_system, atom_indices='all', structure_indices='all',
skip_digestion=False):

from molsysmt.basic import get_form
from molsysmt.form.file_psf import to_molsysmt_Topology as file_psf_to_molsysmt_Topology
Expand All @@ -69,12 +75,14 @@ def file_psf_and_file_dcd_to_molsysmt_MolSys(molecular_system, atom_indices='all

output_item = MolSys()

output_item.topology = file_psf_to_molsysmt_Topology(item_psf, atom_indices=atom_indices)
output_item.structures = file_dcd_to_molsysmt_Structures(item_dcd, atom_indices=atom_indices, structure_indices=structure_indices)
output_item.topology = file_psf_to_molsysmt_Topology(item_psf, atom_indices=atom_indices, skip_digestion=True)
output_item.structures = file_dcd_to_molsysmt_Structures(item_dcd, atom_indices=atom_indices,
structure_indices=structure_indices, skip_digestion=True)

return output_item

def file_psf_and_file_crd_to_molsysmt_MolSys(molecular_system, atom_indices='all', structure_indices='all'):
def file_psf_and_file_crd_to_molsysmt_MolSys(molecular_system, atom_indices='all', structure_indices='all',
skip_digestion=False):

from molsysmt.basic import get_form
from molsysmt.form.file_psf import to_molsysmt_Topology as file_psf_to_molsysmt_Topology
Expand All @@ -94,12 +102,14 @@ def file_psf_and_file_crd_to_molsysmt_MolSys(molecular_system, atom_indices='all

output_item = MolSys()

output_item.topology = file_psf_to_molsysmt_Topology(item_psf, atom_indices=atom_indices)
output_item.structures = file_crd_to_molsysmt_Structures(item_crd, atom_indices=atom_indices, structure_indices=structure_indices)
output_item.topology = file_psf_to_molsysmt_Topology(item_psf, atom_indices=atom_indices, skip_digestion=True)
output_item.structures = file_crd_to_molsysmt_Structures(item_crd, atom_indices=atom_indices,
structure_indices=structure_indices, skip_digestion=True)

return output_item

def file_gro_and_file_xtc_to_molsysmt_MolSys(molecular_system, atom_indices='all', structure_indices='all'):
def file_gro_and_file_xtc_to_molsysmt_MolSys(molecular_system, atom_indices='all', structure_indices='all',
skip_digestion=False):

from molsysmt.basic import get_form
from molsysmt.form.file_gro import to_molsysmt_Topology as file_gro_to_molsysmt_Topology
Expand All @@ -119,8 +129,9 @@ def file_gro_and_file_xtc_to_molsysmt_MolSys(molecular_system, atom_indices='all

output_item = MolSys()

output_item.topology = file_gro_to_molsysmt_Topology(item_gro, atom_indices=atom_indices)
output_item.structures = file_xtc_to_molsysmt_Structures(item_xtc, atom_indices=atom_indices, structure_indices=structure_indices)
output_item.topology = file_gro_to_molsysmt_Topology(item_gro, atom_indices=atom_indices, skip_digestion=True)
output_item.structures = file_xtc_to_molsysmt_Structures(item_xtc, atom_indices=atom_indices,
structure_indices=structure_indices, skip_digestion=True)

return output_item

Expand Down
14 changes: 14 additions & 0 deletions molsysmt/_private/digestion/argument/n_amino_acids.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from molsysmt._private.exceptions import ArgumentError

def digest_n_amino_acids(n_amino_acids, caller=None):

if caller=='molsysmt.basic.get.get':
if isinstance(n_amino_acids, bool):
return n_amino_acids
elif caller=='molsysmt.basic.contains.contains':
if isinstance(n_amino_acids, (bool, int)):
return n_amino_acids


raise ArgumentError('n_amino_acids', value=n_amino_acids, caller=caller, message=None)

14 changes: 0 additions & 14 deletions molsysmt/_private/digestion/argument/n_aminoacids.py

This file was deleted.

4 changes: 2 additions & 2 deletions molsysmt/attribute/attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,8 @@ def add_attribute(name, synonyms=[], depends_on=[], dependants=[], runs_on_eleme
runs_on_elements=True, topological=True, get_from=['atom', 'group', 'component',
'molecule', 'chain', 'entity', 'system'])

## n_aminoacids
add_attribute('n_aminoacids', synonyms=['n_aminoacid'], depends_on=['group_type'],
## n_amino_acids
add_attribute('n_amino_acids', synonyms=['n_amino_acid', 'n_aminoacids', 'n_aminoacid'], depends_on=['group_type'],
runs_on_elements=True, topological=True,
get_from=['atom', 'group', 'component', 'molecule', 'chain', 'entity', 'system'])

Expand Down
6 changes: 4 additions & 2 deletions molsysmt/basic/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def _convert_one_to_one(molecular_system,
missing_arguments = input_arguments - (set(conversion_arguments) | set(kwargs) | {'item',
'copy_if_all'})

if 'get_missing_bonds' in kwargs and 'get_missing_bonds' not in input_arguments:
del kwargs['get_missing_bonds']

if len(missing_arguments)>0:

missing_arguments.discard('compression')
Expand Down Expand Up @@ -521,12 +524,11 @@ def convert(molecular_system,
for item_out in to_form:
output.append(
convert(molecular_system, to_form=item_out, selection=selection, structure_indices=structure_indices,
syntax=syntax, verbose=verbose, skip_digestion=True))
syntax=syntax, verbose=verbose, skip_digestion=True, **kwargs))
return output

# If one to one
if not isinstance(from_form, (list, tuple)):

output = _convert_one_to_one(molecular_system, from_form, to_form=to_form, selection=selection, structure_indices=structure_indices,
syntax=syntax, verbose=verbose, skip_digestion=True, **kwargs)

Expand Down
10 changes: 5 additions & 5 deletions molsysmt/basic/get.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ def get(molecular_system,
all([ii is None for ii in piped_structural_attribute.values()]) & \
all([ii is None for ii in piped_any_attribute.values()])

if not_piped:
if not_piped or len(in_attributes)==1:

aux_molecular_system = molecular_system

Expand All @@ -206,15 +206,15 @@ def get(molecular_system,
skip_digestion=True)
if is_topological_attribute(in_attribute, skip_digestion=True):
_, aux_form = where_is_attribute(molecular_system, in_attribute, skip_digestion=True)
if aux_form not in aux_piped_topological_attribute:
if piped_topological_attribute[aux_form] not in aux_piped_topological_attribute:
aux_piped_topological_attribute.append(piped_topological_attribute[aux_form])
if aux_form not in aux_piped_any_attribute:
if piped_any_attribute[aux_form] not in aux_piped_any_attribute:
aux_piped_any_attribute.append(piped_any_attribute[aux_form])
elif is_structural_attribute(in_attribute, skip_digestion=True):
_, aux_form = where_is_attribute(molecular_system, in_attribute)
if aux_form not in aux_piped_structural_attribute:
if piped_structural_attribute[aux_form] not in aux_piped_structural_attribute:
aux_piped_structural_attribute.append(piped_structural_attribute[aux_form])
if aux_form not in aux_piped_any_attribute:
if piped_any_attribute[aux_form] not in aux_piped_any_attribute:
aux_piped_any_attribute.append(piped_any_attribute[aux_form])

n_top = len(aux_piped_topological_attribute)
Expand Down
19 changes: 9 additions & 10 deletions molsysmt/build/get_missing_bonds.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def get_missing_bonds(molecular_system, threshold='2 angstroms', selection='all'

if with_templates:

aux_peptidic_bonds={'C':[], 'N':[]}
aux_peptidic_bonds_C={}
aux_peptidic_bonds_N={}

form = get_form(molecular_system)

Expand Down Expand Up @@ -101,18 +102,18 @@ def get_missing_bonds(molecular_system, threshold='2 angstroms', selection='all'
aux_bonds = _bonds_in_amino_acid(group_name, atom_names, atom_indices, sorted=False)
bonds_templates += aux_bonds

aux_peptidic_bonds['C'].append([atom_indices[atom_names.index('C')], group_index])
aux_peptidic_bonds['N'].append([atom_indices[atom_names.index('N')], group_index])
aux_peptidic_bonds_C[group_index]=atom_indices[atom_names.index('C')]
aux_peptidic_bonds_N[group_index]=atom_indices[atom_names.index('N')]

elif group_type=='terminal capping':

aux_bonds = _bonds_in_terminal_capping(group_name, atom_names, atom_indices, sorted=False)
bonds_templates += aux_bonds

if is_c_terminal_capping(group_name):
aux_peptidic_bonds['C'].append([atom_indices[atom_names.index('C')], group_index])
aux_peptidic_bonds_C[group_index]=atom_indices[atom_names.index('C')]
else:
aux_peptidic_bonds['N'].append([atom_indices[atom_names.index('N')], group_index])
aux_peptidic_bonds_N[group_index]=atom_indices[atom_names.index('N')]

elif group_type=='small molecule':

Expand Down Expand Up @@ -141,11 +142,9 @@ def get_missing_bonds(molecular_system, threshold='2 angstroms', selection='all'

# peptidic bonds

for aux_1, aux_2 in zip(aux_peptidic_bonds['C'], aux_peptidic_bonds['N']):
if (aux_1[1]+1)==(aux_2[1]):
bonds_templates += [[aux_1[0], aux_2[0]]]
else:
raise ValueError
for group_index in aux_peptidic_bonds_C.keys():
if group_index+1 in aux_peptidic_bonds_N:
bonds_templates += [[aux_peptidic_bonds_C[group_index], aux_peptidic_bonds_N[group_index+1]]]

bonds += bonds_templates

Expand Down
31 changes: 31 additions & 0 deletions molsysmt/data/_make/TcTIM.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import molsysmt as msm
import numpy as np
from pathlib import Path
import os
import shutil

data_dir = Path('../.')

# Purge

files_to_be_purged = [
'pdb/1tcd.pdb',
'mmtf/1tcd.mmtf',
'h5msm/1tcd.h5msm'
]

for filename in files_to_be_purged:
filepath = Path(data_dir, filename)
if os.path.isfile(filepath):
os.remove(filepath)

# Make

msm.convert('pdb_id:1tcd', to_form='1tcd.pdb')
msm.convert('pdb_id:1tcd', to_form='1tcd.mmtf')
msm.convert('pdb_id:1tcd', to_form='1tcd.h5msm')

shutil.move('1tcd.pdb', Path(data_dir, 'pdb/1tcd.pdb'))
shutil.move('1tcd.mmtf', Path(data_dir, 'mmtf/1tcd.mmtf'))
shutil.move('1tcd.h5msm', Path(data_dir, 'h5msm/1tcd.h5msm'))

4 changes: 4 additions & 0 deletions molsysmt/data/_make/make_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,7 @@ echo -n "t4_lysozyme_L99A.py "
python t4_lysozyme_L99A.py
echo "DONE"

echo -n "TcTIM.py "
python TcTIM.py
echo "DONE"

Binary file added molsysmt/data/h5msm/1tcd.h5msm
Binary file not shown.
25 changes: 13 additions & 12 deletions molsysmt/data/pdb/1tcd.pdb
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ SOURCE 5 EXPRESSION_SYSTEM: ESCHERICHIA COLI;
SOURCE 6 EXPRESSION_SYSTEM_TAXID: 562;
SOURCE 7 EXPRESSION_SYSTEM_STRAIN: BL23 (DE3);
SOURCE 8 EXPRESSION_SYSTEM_CELLULAR_LOCATION: CYTOPLASM
KEYWDS ISOMERASE, INTRAMOLECULAR OXIDOREDUCTASE, GLYCOLYSIS,
KEYWDS 2 ISOMERIZATION BETWEEN GLYCERALDEHYDE 3-PHOSPHATE AND
KEYWDS 3 DIHYDROXYACETONE, ALPHA-BETA BARREL
KEYWDS ISOMERASE, INTRAMOLECULAR OXIDOREDUCTASE, GLYCOLYSIS, ISOMERIZATION
KEYWDS 2 BETWEEN GLYCERALDEHYDE 3-PHOSPHATE AND DIHYDROXYACETONE, ALPHA-BETA
KEYWDS 3 BARREL
EXPDTA X-RAY DIFFRACTION
AUTHOR E.MALDONADO,M.SORIANO-GARCIA,N.CABRERA,G.GARZA-RAMOS,
AUTHOR 2 M.TUENA DE GOMEZ-PUYOU,A.GOMEZ-PUYOU,R.PEREZ-MONTFORT
AUTHOR E.MALDONADO,M.SORIANO-GARCIA,N.CABRERA,G.GARZA-RAMOS,M.TUENA DE
AUTHOR 2 GOMEZ-PUYOU,A.GOMEZ-PUYOU,R.PEREZ-MONTFORT
REVDAT 4 09-AUG-23 1TCD 1 REMARK
REVDAT 3 24-FEB-09 1TCD 1 VERSN
REVDAT 2 01-APR-03 1TCD 1 JRNL
REVDAT 1 13-JAN-99 1TCD 0
JRNL AUTH E.MALDONADO,M.SORIANO-GARCIA,A.MORENO,N.CABRERA,
JRNL AUTH 2 G.GARZA-RAMOS,M.DE GOMEZ-PUYOU,A.GOMEZ-PUYOU,
JRNL AUTH 3 R.PEREZ-MONTFORT
JRNL TITL DIFFERENCES IN THE INTERSUBUNIT CONTACTS IN
JRNL TITL 2 TRIOSEPHOSPHATE ISOMERASE FROM TWO CLOSELY RELATED
JRNL TITL 3 PATHOGENIC TRYPANOSOMES.
JRNL TITL DIFFERENCES IN THE INTERSUBUNIT CONTACTS IN TRIOSEPHOSPHATE
JRNL TITL 2 ISOMERASE FROM TWO CLOSELY RELATED PATHOGENIC TRYPANOSOMES.
JRNL REF J.MOL.BIOL. V. 283 193 1998
JRNL REFN ISSN 0022-2836
JRNL PMID 9761683
Expand Down Expand Up @@ -107,9 +107,9 @@ REMARK 3 ESD FROM C-V SIGMAA (A) : 0.25
REMARK 3
REMARK 3 RMS DEVIATIONS FROM IDEAL VALUES.
REMARK 3 BOND LENGTHS (A) : 0.013
REMARK 3 BOND ANGLES (DEGREES) : 1.70
REMARK 3 BOND ANGLES (DEGREES) : 1.700
REMARK 3 DIHEDRAL ANGLES (DEGREES) : 24.70
REMARK 3 IMPROPER ANGLES (DEGREES) : 0.97
REMARK 3 IMPROPER ANGLES (DEGREES) : 0.970
REMARK 3
REMARK 3 ISOTROPIC THERMAL MODEL : RESTRAINED
REMARK 3
Expand All @@ -134,9 +134,10 @@ REMARK 3 TOPOLOGY FILE 3 : NULL
REMARK 3
REMARK 3 OTHER REFINEMENT REMARKS: BULK SOLVENT MODEL USED
REMARK 4
REMARK 4 1TCD COMPLIES WITH FORMAT V. 3.15, 01-DEC-08
REMARK 4 1TCD COMPLIES WITH FORMAT V. 3.30, 13-JUL-11
REMARK 100
REMARK 100 THIS ENTRY HAS BEEN PROCESSED BY BNL.
REMARK 100 THE DEPOSITION ID IS D_1000176610.
REMARK 200
REMARK 200 EXPERIMENTAL DETAILS
REMARK 200 EXPERIMENT TYPE : X-RAY DIFFRACTION
Expand Down Expand Up @@ -4389,5 +4390,5 @@ HETATM 3982 O HOH B 340 5.721 65.375 48.936 1.00 33.23 O
HETATM 3983 O HOH B 341 26.850 62.692 53.171 1.00 37.06 O
HETATM 3984 O HOH B 342 0.135 46.709 36.203 1.00 32.07 O
HETATM 3985 O HOH B 343 5.324 65.124 51.425 1.00 31.84 O
MASTER 274 0 0 28 16 0 0 9 3983 2 0 40
MASTER 275 0 0 28 16 0 0 9 3983 2 0 40
END
2 changes: 1 addition & 1 deletion molsysmt/element/atom/get_atom_type_from_atom_name.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ def get_atom_type_from_atom_name(atom_name):
return atom_type_from_name[atom_name]
except:
print(f'The atom_name {atom_name} was not recognized')
return 'ANK'
return 'UNK'
#raise ValueError('Atom name '+atom_name+' has not known atom type.')

24 changes: 24 additions & 0 deletions molsysmt/element/atom/names.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,25 @@
'H35' : 'H',
'H36' : 'H',
'H37' : 'H',
'H41' : 'H',
'H42' : 'H',
'H91' : 'H',
'H101' : 'H',
'H161' : 'H',
'H162' : 'H',
'H163' : 'H',
'H171' : 'H',
'H172' : 'H',
'H173' : 'H',
'H181' : 'H',
'H182' : 'H',
'H183' : 'H',
'H191' : 'H',
'H192' : 'H',
'H193' : 'H',
'H201' : 'H',
'H202' : 'H',
'H203' : 'H',
'H1A' : 'H',
'H1B' : 'H',
'H2A' : 'H',
Expand Down Expand Up @@ -357,6 +374,12 @@
'CG2' : 'C',
'CH2' : 'C',
'CH3' : 'C',
'CLB' : 'C',
'CLC' : 'C',
'CLD' : 'C',
'CLE' : 'C',
'CLF' : 'C',
'CLG' : 'C',
'CY' : 'C',
'CZ' : 'C',
'CZ2' : 'C',
Expand Down Expand Up @@ -387,6 +410,7 @@
'O4' : 'O',
'O5' : 'O',
'O6' : 'O',
'OS' : 'O',
'OS1' : 'O',
'OS2' : 'O',
'OS3' : 'O',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_1_letter_code_from_name(name):
To be written soon...
"""

aa_type = _name_to_type[name]
aa_type = name_to_type[name]

return aa3_to_aa1[aa_type]

Loading

0 comments on commit e017f09

Please sign in to comment.