From 99c209a61f2c7ef726ef0181329bc454cfb7356b Mon Sep 17 00:00:00 2001 From: Diego Prada-Gracia Date: Thu, 2 May 2024 23:51:09 -0600 Subject: [PATCH] In process --- .../_private/conversion_shortcuts/__init__.py | 27 + .../to_molsysmt_Topology.py | 98 ++ molsysmt/basic/compare.py | 5 +- molsysmt/basic/convert.py | 2 - molsysmt/basic/get.py | 11 +- molsysmt/basic/info.py | 41 - molsysmt/basic/selector/molsysmt.py | 42 +- molsysmt/basic/selector/nglview.py | 10 +- .../databases/amino_acids/dat_to_pkl_gz.py | 11 - .../data/databases/amino_acids/extra.json | 45 + .../amino_acids/make_amino_acids_db.py | 18 +- .../databases/amino_acids/pkl_gz_to_dat.py | 11 - molsysmt/form/file_dcd/__init__.py | 2 + molsysmt/form/file_gro/__init__.py | 2 + molsysmt/form/file_h5msm/__init__.py | 26 +- .../file_h5msm/to_string_amino_acids_1.py | 13 + .../file_h5msm/to_string_amino_acids_3.py | 14 + molsysmt/form/file_pdb/__init__.py | 8 +- molsysmt/form/file_pdb/to_molsysmt_MolSys.py | 2 +- .../form/file_pdb/to_molsysmt_Structures.py | 15 +- .../form/file_pdb/to_molsysmt_Topology.py | 12 +- molsysmt/form/file_psf/__init__.py | 3 + molsysmt/form/file_psf/attributes.py | 4 +- .../form/molsysmt_GROFileHandler/__init__.py | 2 + .../molsysmt_H5MSMFileHandler/__init__.py | 2 + molsysmt/form/molsysmt_MolSys/__init__.py | 2 + .../form/molsysmt_PDBFileHandler/__init__.py | 8 +- molsysmt/form/molsysmt_Structures/__init__.py | 2 + molsysmt/form/molsysmt_Topology/__init__.py | 2 + .../get_topological_attributes.py | 341 +++-- molsysmt/form/nglview_NGLWidget/__init__.py | 2 + molsysmt/form/string_pdb_text/__init__.py | 2 + molsysmt/systems.py | 10 +- .../basic/get/test_get_nglview_NGLWidget.py | 3 +- .../basic/has_attribute/test_has_attribute.py | 4 +- .../tests/basic/iterator/test_iterator.py | 12 +- .../basic/merge/test_merge_molsysmt_MolSys.py | 8 +- .../select/test_select_molsysmt_MolSys.py | 102 +- molsysmt/tests/basic/test_copy.py | 6 +- molsysmt/tests/basic/test_extract.py | 8 +- molsysmt/tests/basic/test_get_attributes.py | 10 +- molsysmt/tests/basic/test_get_form.py | 48 +- molsysmt/tests/basic/test_get_label.py | 36 +- molsysmt/tests/basic/test_info.py | 94 +- molsysmt/tests/basic/test_is_composed_of.py | 6 +- molsysmt/tests/basic/test_remove.py | 6 +- sandbox/Tests.ipynb | 1242 +++-------------- 47 files changed, 914 insertions(+), 1466 deletions(-) create mode 100644 molsysmt/_private/conversion_shortcuts/to_molsysmt_Topology.py delete mode 100644 molsysmt/data/databases/amino_acids/dat_to_pkl_gz.py create mode 100644 molsysmt/data/databases/amino_acids/extra.json delete mode 100644 molsysmt/data/databases/amino_acids/pkl_gz_to_dat.py create mode 100644 molsysmt/form/file_h5msm/to_string_amino_acids_1.py create mode 100644 molsysmt/form/file_h5msm/to_string_amino_acids_3.py diff --git a/molsysmt/_private/conversion_shortcuts/__init__.py b/molsysmt/_private/conversion_shortcuts/__init__.py index d8e4fb1a9..5bf4d1157 100644 --- a/molsysmt/_private/conversion_shortcuts/__init__.py +++ b/molsysmt/_private/conversion_shortcuts/__init__.py @@ -26,3 +26,30 @@ _multiple_conversion_shortcuts[tuple(sorted(('file:gro','file:xtc')))]={ 'molsysmt.MolSys': file_gro_and_file_xtc_to_molsysmt_MolSys } + +from .to_molsysmt_Topology import molsysmt_Topology_and_molsysmt_Structures_to_molsysmt_Topology +from .to_molsysmt_Topology import file_prmtop_and_file_inpcrd_to_molsysmt_Topology +from .to_molsysmt_Topology import file_psf_and_file_dcd_to_molsysmt_Topology +from .to_molsysmt_Topology import file_psf_and_file_crd_to_molsysmt_Topology +from .to_molsysmt_Topology import file_gro_and_file_xtc_to_molsysmt_Topology + +_multiple_conversion_shortcuts[tuple(sorted(('molsysmt.Topology','molsysmt.Structures')))]={ + 'molsysmt.Topology': molsysmt_Topology_and_molsysmt_Structures_to_molsysmt_Topology + } + +_multiple_conversion_shortcuts[tuple(sorted(('file:prmtop','file:inpcrd')))]={ + 'molsysmt.Topology': file_prmtop_and_file_inpcrd_to_molsysmt_Topology + } + +_multiple_conversion_shortcuts[tuple(sorted(('file:psf','file:dcd')))]={ + 'molsysmt.Topology': file_psf_and_file_dcd_to_molsysmt_Topology + } + +_multiple_conversion_shortcuts[tuple(sorted(('file:psf','file:crd')))]={ + 'molsysmt.Topology': file_psf_and_file_crd_to_molsysmt_Topology + } + +_multiple_conversion_shortcuts[tuple(sorted(('file:gro','file:xtc')))]={ + 'molsysmt.Topology': file_gro_and_file_xtc_to_molsysmt_Topology + } + diff --git a/molsysmt/_private/conversion_shortcuts/to_molsysmt_Topology.py b/molsysmt/_private/conversion_shortcuts/to_molsysmt_Topology.py new file mode 100644 index 000000000..b651685b0 --- /dev/null +++ b/molsysmt/_private/conversion_shortcuts/to_molsysmt_Topology.py @@ -0,0 +1,98 @@ +def molsysmt_Topology_and_molsysmt_Structures_to_molsysmt_Topology(molecular_system, atom_indices='all', + structure_indices='all', skip_digestion=False): + + from molsysmt.basic import get_form + from molsysmt.form.molsysmt_Topology import extract as extract_topology + + forms = get_form(molecular_system) + + topology = None + + for form, item in zip(forms, molecular_system): + if form=='molsysmt.Topology': + topology = item + break + + tmp_item = extract_topology(topology, atom_indices=atom_indices, copy_if_all=True, skip_digestion=True) + + return tmp_item + +def file_prmtop_and_file_inpcrd_to_molsysmt_Topology(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 + + forms = get_form(molecular_system) + + item_prmtop = None + + for form, item in zip(forms, molecular_system): + if form=='file:prmtop': + item_prmtop = item + break + + tmp_item = file_prmtop_to_molsysmt_Topology(item_prmtop, atom_indices=atom_indices, skip_digestion=True) + + return tmp_item + +def file_psf_and_file_dcd_to_molsysmt_Topology(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 + from molsysmt.native import MolSys + + forms = get_form(molecular_system) + + item_psf = None + + for form, item in zip(forms, molecular_system): + if form=='file:psf': + item_psf = item + break + + tmp_item = file_psf_to_molsysmt_Topology(item_psf, atom_indices=atom_indices, skip_digestion=True) + + return tmp_item + +def file_psf_and_file_crd_to_molsysmt_Topology(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 + + forms = get_form(molecular_system) + + item_psf = None + + for form, item in zip(forms, molecular_system): + if form=='file:psf': + item_psf = item + break + + tmp_item = file_psf_to_molsysmt_Topology(item_psf, atom_indices=atom_indices, skip_digestion=True) + + return tmp_item + +def file_gro_and_file_xtc_to_molsysmt_Topology(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 + + forms = get_form(molecular_system) + + item_gro = None + + for form, item in zip(forms, molecular_system): + if form=='file:gro': + item_gro = item + break + + + tmp_item = file_gro_to_molsysmt_Topology(item_gro, atom_indices=atom_indices, get_missing_bonds=True, + skip_digestion=True) + + return output_item + diff --git a/molsysmt/basic/compare.py b/molsysmt/basic/compare.py index 86b750b9c..cc1e2e07a 100644 --- a/molsysmt/basic/compare.py +++ b/molsysmt/basic/compare.py @@ -161,6 +161,7 @@ def compare(molecular_system, molecular_system_2, selection='all', structure_ind from molsysmt.basic import select, get, get_form, get_attributes from molsysmt.form import _dict_modules from molsysmt.attribute import attributes, _topological_attributes, _structural_attributes, _mechanical_attributes + from molsysmt.basic.get import _piped_molecular_system output_dict = {} @@ -201,8 +202,8 @@ def compare(molecular_system, molecular_system_2, selection='all', structure_ind atts_required = set(atts_to_be_compared) & set(atts_of_A) & set(atts_of_B) - molecular_system = _piped_molecular_system(molecular_system, atts_required) - molecular_system_2 = _piped_molecular_system(molecular_system_2, atts_required) + molecular_system = _piped_molecular_system(molecular_system, 'atom', atts_required) + molecular_system_2 = _piped_molecular_system(molecular_system_2, 'atom', atts_required) ###### EQUAL ##### diff --git a/molsysmt/basic/convert.py b/molsysmt/basic/convert.py index 950eaf15c..401208bce 100644 --- a/molsysmt/basic/convert.py +++ b/molsysmt/basic/convert.py @@ -133,7 +133,6 @@ def _convert_multiple_to_one_with_shortcuts(molecular_system, sorted_forms = tuple(sorted(from_forms)) if to_form in _multiple_conversion_shortcuts[sorted_forms]: - function = _multiple_conversion_shortcuts[sorted_forms][to_form] input_arguments = set(inspect.signature(function).parameters) @@ -154,7 +153,6 @@ def _convert_multiple_to_one_with_shortcuts(molecular_system, output = function(molecular_system, **conversion_arguments, **kwargs) elif ('molsysmt.MolSys' in _multiple_conversion_shortcuts[sorted_forms]) and (to_form in _dict_modules['molsysmt.MolSys']._convert_to): - output = _convert_multiple_to_one_with_shortcuts(molecular_system, sorted_forms, to_form='molsysmt.MolSys', selection=selection, structure_indices=structure_indices, syntax=syntax, **kwargs) output = _convert_one_to_one(output, 'molsysmt.MolSys', to_form=to_form) diff --git a/molsysmt/basic/get.py b/molsysmt/basic/get.py index bd6d14df2..62175e6a5 100644 --- a/molsysmt/basic/get.py +++ b/molsysmt/basic/get.py @@ -176,7 +176,7 @@ def get(molecular_system, else: indices = select(molecular_system, element=element, selection=mask, syntax=syntax, skip_digestion=True) - aux_molecular_system = _piped_molecular_system(molecular_system, in_attributes) + aux_molecular_system = _piped_molecular_system(molecular_system, element, in_attributes) output = [] @@ -214,18 +214,23 @@ def get(molecular_system, return dict(zip(in_attributes, output)) -def _piped_molecular_system(molecular_system, in_attributes): +def _piped_molecular_system(molecular_system, element, in_attributes): from .. import select, where_is_attribute, get_form, convert from molsysmt.form import _dict_modules from molsysmt.attribute import attributes, bonds_are_required_to_get_attribute from molsysmt.attribute import is_topological_attribute, is_structural_attribute - piped_topological_attribute = {} piped_structural_attribute = {} piped_any_attribute = {} + form = get_form(molecular_system) + + if not isinstance(molecular_system, (list, tuple)): + molecular_system = [molecular_system] + form = [form] + for aux_form in form: piped_topological_attribute[aux_form] = getattr(_dict_modules[aux_form], f'piped_topological_attribute') piped_structural_attribute[aux_form] = getattr(_dict_modules[aux_form], f'piped_structural_attribute') diff --git a/molsysmt/basic/info.py b/molsysmt/basic/info.py index d17c18f93..214b2334c 100644 --- a/molsysmt/basic/info.py +++ b/molsysmt/basic/info.py @@ -236,36 +236,6 @@ def info(molecular_system, if not attributes_filter['entity_index']: entity_index=None if not attributes_filter['entity_name']: entity_name=None - if len(molecule_index.shape) > 1: - n_objects = molecule_index.shape[0] - aux_obj1_array = np.empty([n_objects], dtype='object') - aux_obj2_array = np.empty([n_objects], dtype='object') - for ii in range(n_objects): - aux_obj1_array[ii] = molecule_index[ii] - aux_obj2_array[ii] = molecule_type[ii] - molecule_index = aux_obj1_array - molecule_type = aux_obj2_array - - for ii in range(len(molecule_index)): - if len(molecule_index[ii]) == 1: - molecule_index[ii] = molecule_index[ii][0] - molecule_type[ii] = molecule_type[ii][0] - - if len(entity_index.shape) > 1: - n_objects = entity_index.shape[0] - aux_obj1_array = np.empty([n_objects], dtype='object') - aux_obj2_array = np.empty([n_objects], dtype='object') - for ii in range(n_objects): - aux_obj1_array[ii] = entity_index[ii] - aux_obj2_array[ii] = entity_name[ii] - entity_index = aux_obj1_array - entity_name = aux_obj2_array - - for ii in range(len(entity_index)): - if len(entity_index[ii]) == 1: - entity_index[ii] = entity_index[ii][0] - entity_name[ii] = entity_name[ii][0] - return df({'index': chain_index, 'id': chain_id, 'name': chain_name, 'n atoms': n_atoms, 'n groups': n_groups, 'n components': n_components, 'molecule index': molecule_index, 'molecule type': molecule_type, @@ -290,17 +260,6 @@ def info(molecular_system, if not attributes_filter['entity_index']: entity_index=None if not attributes_filter['entity_name']: entity_name=None - if len(chain_index.shape) > 1: - n_objects = chain_index.shape[0] - aux_obj_array = np.empty([n_objects], dtype='object') - for ii in range(n_objects): - aux_obj_array[ii] = chain_index[ii] - chain_index = aux_obj_array - - for ii in range(len(chain_index)): - if len(chain_index[ii]) == 1: - chain_index[ii] = chain_index[ii][0] - return df({'index': molecule_index, 'name': molecule_name, 'type': molecule_type, 'n atoms': n_atoms, 'n groups': n_groups, 'n components': n_components, 'chain index': chain_index, diff --git a/molsysmt/basic/selector/molsysmt.py b/molsysmt/basic/selector/molsysmt.py index 39adf16ab..eb182b730 100644 --- a/molsysmt/basic/selector/molsysmt.py +++ b/molsysmt/basic/selector/molsysmt.py @@ -41,7 +41,7 @@ def select_standard(item, selection): from molsysmt.basic import convert, get_form from molsysmt.config import selection_shortcuts - + from molsysmt.form import _dict_modules tmp_selection = selection @@ -59,17 +59,33 @@ def select_standard(item, selection): tmp_item = item else: - from molsysmt.attribute.bonds_are_required_to_get_attribute import bond_dependent_attributes + conversion_needs_missing_bonds=False - bonds_required_by_selection = False - for attribute in bond_dependent_attributes: - if attribute in tmp_selection: - bonds_required_by_selection = True - break + if isinstance(form_in, (list, tuple)): + for ii in form_in: + if (not _dict_modules[ii].bonds_are_explicit) and _dict_modules[ii].bonds_can_be_computed: + conversion_needs_missing_bonds=True + break + else: + if (not _dict_modules[form_in].bonds_are_explicit) and _dict_modules[form_in].bonds_can_be_computed: + conversion_needs_missing_bonds=True + + if conversion_needs_missing_bonds: + + from molsysmt.attribute.bonds_are_required_to_get_attribute import bond_dependent_attributes - tmp_item = convert(item, to_form='molsysmt.Topology', get_missing_bonds=bonds_required_by_selection, - skip_digestion=True) + bonds_required_by_selection = False + for attribute in bond_dependent_attributes: + if attribute in tmp_selection: + bonds_required_by_selection = True + break + + tmp_item = convert(item, to_form='molsysmt.Topology', get_missing_bonds=bonds_required_by_selection, + skip_digestion=True) + + else: + tmp_item = convert(item, to_form='molsysmt.Topology', skip_digestion=True) if '@' in selection: @@ -265,9 +281,9 @@ def select_within(molecular_system, selection, structure_indices): structure_indices=structure_indices, threshold=threshold, pbc=pbc) if not_within: - output = atom_indices_1[np.where(cmap.all(axis=2)[0] == False)[0]] + output = np.array(atom_indices_1)[np.where(cmap.all(axis=2)[0] == False)[0]].tolist() else: - output = atom_indices_1[np.where(cmap.any(axis=2)[0] == True)[0]] + output = np.array(atom_indices_1)[np.where(cmap.any(axis=2)[0] == True)[0]].tolist() return output @@ -289,9 +305,9 @@ def select_bonded_to(molecular_system, selection): atom_indices_2 = np.unique(np.concatenate(atom_indices_2).ravel()) if not_bonded: - output = np.setdiff1d(atom_indices_1, atom_indices_2, assume_unique=True) + output = np.setdiff1d(atom_indices_1, atom_indices_2, assume_unique=True).tolist() else: - output = np.intersect1d(atom_indices_1, atom_indices_2, assume_unique=True) + output = np.intersect1d(atom_indices_1, atom_indices_2, assume_unique=True).tolist() return output diff --git a/molsysmt/basic/selector/nglview.py b/molsysmt/basic/selector/nglview.py index 62d52824c..0a48d5f20 100644 --- a/molsysmt/basic/selector/nglview.py +++ b/molsysmt/basic/selector/nglview.py @@ -20,15 +20,15 @@ def indices_to_selection(molecular_system, indices, element='atom'): output_string = '@'+','.join([str(ii) for ii in indices]) elif element=='group': from molsysmt import get - group_ids, chain_ids = get(molecular_system, element='group', selection=indices, group_id=True, chain_id=True) - if np.all(np.isin(np.unique(chain_ids), [' ', None])): + group_ids, chain_names = get(molecular_system, element='group', selection=indices, group_id=True, chain_name=True) + if np.all(np.isin(np.unique(chain_names), [' ', None])): output_string = ','.join([str(ii) for ii in group_ids]) else: - output_string = ' '.join([str(ii)+':'+str(jj) for ii,jj in zip(group_ids, chain_ids)]) + output_string = ' '.join([str(ii)+':'+str(jj) for ii,jj in zip(group_ids, chain_names)]) elif element=='chain': from molsysmt import get - chain_ids = get(molecular_system, element='chain', selection=indices, chain_id=True) - output_string = ' '.join([':'+ii for ii in chain_ids]) + chain_names = get(molecular_system, element='chain', selection=indices, chain_id=True) + output_string = ' '.join([':'+ii for ii in chain_names]) else: raise NotImplementedMethodError diff --git a/molsysmt/data/databases/amino_acids/dat_to_pkl_gz.py b/molsysmt/data/databases/amino_acids/dat_to_pkl_gz.py deleted file mode 100644 index 6d86662ba..000000000 --- a/molsysmt/data/databases/amino_acids/dat_to_pkl_gz.py +++ /dev/null @@ -1,11 +0,0 @@ -import pickle -import gzip - -group_names = [] -with open('group_names.dat', 'r') as fff: - for line in fff: - group_names.append(line.strip()) - -with gzip.open('group_names.pkl.gz', 'wb', compresslevel=9) as fff: - pickle.dump(group_names, fff) - diff --git a/molsysmt/data/databases/amino_acids/extra.json b/molsysmt/data/databases/amino_acids/extra.json new file mode 100644 index 000000000..e5f1adccc --- /dev/null +++ b/molsysmt/data/databases/amino_acids/extra.json @@ -0,0 +1,45 @@ +{ + "ASN": { + "name": "ASN", + "topology": [ + { + "atoms": [ + "N", + "CA", + "C", + "O", + "CB", + "CG", + "OD1", + "ND2", + "H1", + "H2", + "H3", + "HA", + "HB2", + "HB3", + "HD21", + "HD22" + ], + "bonds": [ + ["N", "CA"], + ["N", "H1"], + ["N", "H2"], + ["N", "H3"], + ["CA", "C"], + ["CA", "CB"], + ["CA", "HA"], + ["C", "O"], + ["CB", "CG"], + ["CB", "HB2"], + ["CB", "HB3"], + ["CG", "OD1"], + ["CG", "ND2"], + ["ND2", "HD21"], + ["ND2", "HD22"] + ] + } + ] + } +} + diff --git a/molsysmt/data/databases/amino_acids/make_amino_acids_db.py b/molsysmt/data/databases/amino_acids/make_amino_acids_db.py index 2fabae151..b9e6d117b 100644 --- a/molsysmt/data/databases/amino_acids/make_amino_acids_db.py +++ b/molsysmt/data/databases/amino_acids/make_amino_acids_db.py @@ -72,9 +72,9 @@ def is_in(group_name, atoms, bonds, output): '"peptide linking"', '"L-peptide NH3 amino terminus"', '"L-peptide COOH carboxy terminus"', + '"D-peptide NH3 amino terminus"', '"L-PEPTIDE COOH CARBOXY TERMINUS"', - '"D-PEPTIDE NH3 AMINO TERMINUS"', - '"D-peptide NH3 amino terminus"'] + '"D-PEPTIDE NH3 AMINO TERMINUS"'] data = [] for ii in types: @@ -132,6 +132,20 @@ def is_in(group_name, atoms, bonds, output): tmp_dict['topology'].append(jj) output[ii]=tmp_dict +#### Extra #### + +import json + +with open('extra.json', 'r') as fff: + extra = json.load(fff) + +for name in extra.keys(): + if name not in output: + output[name]=extra[name] + else: + output[name]['topology']+=extra[name]['topology'] + + #### End #### split_output = {} diff --git a/molsysmt/data/databases/amino_acids/pkl_gz_to_dat.py b/molsysmt/data/databases/amino_acids/pkl_gz_to_dat.py deleted file mode 100644 index 622ea4efc..000000000 --- a/molsysmt/data/databases/amino_acids/pkl_gz_to_dat.py +++ /dev/null @@ -1,11 +0,0 @@ -import pickle -import gzip - -with gzip.open('group_names.pkl.gz', 'rb') as fff: - group_names = pickle.load(fff) - -group_names = sorted(list(group_names)) -with open('group_names.dat', 'w') as fff: - for ii in group_names: - fff.write(ii+ '\n') - diff --git a/molsysmt/form/file_dcd/__init__.py b/molsysmt/form/file_dcd/__init__.py index df967826e..0e32076eb 100644 --- a/molsysmt/form/file_dcd/__init__.py +++ b/molsysmt/form/file_dcd/__init__.py @@ -5,6 +5,8 @@ piped_topological_attribute = None piped_structural_attribute = None piped_any_attribute = None +bonds_are_explicit = False +bonds_can_be_computed = False from .is_form import is_form diff --git a/molsysmt/form/file_gro/__init__.py b/molsysmt/form/file_gro/__init__.py index ba8b47992..ecacc2967 100644 --- a/molsysmt/form/file_gro/__init__.py +++ b/molsysmt/form/file_gro/__init__.py @@ -6,6 +6,8 @@ piped_topological_attribute = 'molsysmt.MolSys' piped_structural_attribute = 'molsysmt.Structure' piped_any_attribute = 'molsysmt.MolSys' +bonds_are_explicit = False +bonds_can_be_computed = True from .is_form import is_form diff --git a/molsysmt/form/file_h5msm/__init__.py b/molsysmt/form/file_h5msm/__init__.py index db4e1fbd7..272c1b2bf 100644 --- a/molsysmt/form/file_h5msm/__init__.py +++ b/molsysmt/form/file_h5msm/__init__.py @@ -5,6 +5,8 @@ piped_topological_attribute = None piped_structural_attribute = None piped_any_attribute = None +bonds_are_explicit = True +bonds_can_be_computed = True from .is_form import is_form @@ -28,16 +30,20 @@ from .to_molsysmt_Topology import to_molsysmt_Topology from .to_molsysmt_Structures import to_molsysmt_Structures from .to_nglview_NGLWidget import to_nglview_NGLWidget +from .to_string_amino_acids_1 import to_string_amino_acids_1 +from .to_string_amino_acids_3 import to_string_amino_acids_3 _convert_to={ - 'file:h5msm': extract, - 'molsysmt.H5MSMFileHandler': to_molsysmt_H5MSMFileHandler, - 'molsysmt.MolSysOld': to_molsysmt_MolSysOld, - 'molsysmt.TopologyOld': to_molsysmt_TopologyOld, - 'molsysmt.StructuresOld': to_molsysmt_StructuresOld, - 'molsysmt.MolSys': to_molsysmt_MolSys, - 'molsysmt.Topology': to_molsysmt_Topology, - 'molsysmt.Structures': to_molsysmt_Structures, - 'nglview.NGLWidget': to_nglview_NGLWidget, - } + 'file:h5msm': extract, + 'molsysmt.H5MSMFileHandler': to_molsysmt_H5MSMFileHandler, + 'molsysmt.MolSysOld': to_molsysmt_MolSysOld, + 'molsysmt.TopologyOld': to_molsysmt_TopologyOld, + 'molsysmt.StructuresOld': to_molsysmt_StructuresOld, + 'molsysmt.MolSys': to_molsysmt_MolSys, + 'molsysmt.Topology': to_molsysmt_Topology, + 'molsysmt.Structures': to_molsysmt_Structures, + 'nglview.NGLWidget': to_nglview_NGLWidget, + 'string:amino_acids_1': to_string_amino_acids_1, + 'string:amino_acids_3': to_string_amino_acids_3, + } diff --git a/molsysmt/form/file_h5msm/to_string_amino_acids_1.py b/molsysmt/form/file_h5msm/to_string_amino_acids_1.py new file mode 100644 index 000000000..0ab148e1a --- /dev/null +++ b/molsysmt/form/file_h5msm/to_string_amino_acids_1.py @@ -0,0 +1,13 @@ +from molsysmt._private.digestion import digest + +@digest(form='file:h5msm') +def to_string_amino_acids_1(item, group_indices='all', skip_digestion=False): + + from . import to_string_amino_acids_3 + from ..string_amino_acids_3 import to_string_amino_acids_1 as string_amino_acids_3_to_string_amino_acids_1 + + tmp_item = to_string_amino_acids_3(item, group_indices=group_indices) + tmp_item = string_amino_acids_3_to_string_amino_acids_1(tmp_item) + + return tmp_item + diff --git a/molsysmt/form/file_h5msm/to_string_amino_acids_3.py b/molsysmt/form/file_h5msm/to_string_amino_acids_3.py new file mode 100644 index 000000000..cd0ef3c9b --- /dev/null +++ b/molsysmt/form/file_h5msm/to_string_amino_acids_3.py @@ -0,0 +1,14 @@ +from molsysmt._private.digestion import digest +import numpy as np + +@digest(form='file:h5msm') +def to_string_amino_acids_3(item, group_indices='all', skip_digestion=False): + + from . import get_group_name_from_group + from . import get_group_name_from_group + + group_names = get_group_name_from_group(item, indices=group_indices) + tmp_item = ''.join([ii.title() for ii in group_names]) + + return tmp_item + diff --git a/molsysmt/form/file_pdb/__init__.py b/molsysmt/form/file_pdb/__init__.py index a8cca87c4..f4ad97e70 100644 --- a/molsysmt/form/file_pdb/__init__.py +++ b/molsysmt/form/file_pdb/__init__.py @@ -2,9 +2,11 @@ form_type = 'file' form_info = ["Protein Data Bank file format", "https://www.rcsb.org/pdb/static.do?p=file_formats/pdb/index.html"] -piped_topological_attribute = None -piped_structural_attribute = None -piped_any_attribute = None +piped_topological_attribute = 'molsysmt.Topology' +piped_structural_attribute = 'molsysmt.Structures' +piped_any_attribute = 'molsysmt.MolSys' +bonds_are_explicit = False +bonds_can_be_computed = True from .is_form import is_form diff --git a/molsysmt/form/file_pdb/to_molsysmt_MolSys.py b/molsysmt/form/file_pdb/to_molsysmt_MolSys.py index 42826e4c6..8e93f2125 100644 --- a/molsysmt/form/file_pdb/to_molsysmt_MolSys.py +++ b/molsysmt/form/file_pdb/to_molsysmt_MolSys.py @@ -1,7 +1,7 @@ from molsysmt._private.digestion import digest @digest(form='file:pdb') -def to_molsysmt_MolSys(item, atom_indices='all', structure_indices='all', get_missing_bonds=False, +def to_molsysmt_MolSys(item, atom_indices='all', structure_indices='all', get_missing_bonds=True, skip_digestion=False): from . import to_molsysmt_PDBFileHandler diff --git a/molsysmt/form/file_pdb/to_molsysmt_Structures.py b/molsysmt/form/file_pdb/to_molsysmt_Structures.py index 0a442dfd5..28350184b 100644 --- a/molsysmt/form/file_pdb/to_molsysmt_Structures.py +++ b/molsysmt/form/file_pdb/to_molsysmt_Structures.py @@ -3,16 +3,13 @@ @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 + from . import to_molsysmt_PDBFileHandler + from ..molsysmt_PDBFileHandler import to_molsysmt_Structures as molsysmt_PDBFileHandler_to_molsysmt_Structures - 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(coordinates=coordinates, box=box) + tmp_item = to_molsysmt_PDBFileHandler(item, skip_digestion=True) + tmp_item = molsysmt_PDBFileHandler_to_molsysmt_Structures(tmp_item, atom_indices=atom_indices, + structure_indices=structure_indices, + skip_digestion=True) return tmp_item diff --git a/molsysmt/form/file_pdb/to_molsysmt_Topology.py b/molsysmt/form/file_pdb/to_molsysmt_Topology.py index e2547c369..ef29c8316 100644 --- a/molsysmt/form/file_pdb/to_molsysmt_Topology.py +++ b/molsysmt/form/file_pdb/to_molsysmt_Topology.py @@ -1,13 +1,15 @@ from molsysmt._private.digestion import digest @digest(form='file:pdb') -def to_molsysmt_Topology(item, atom_indices='all', skip_digestion=False): +def to_molsysmt_Topology(item, atom_indices='all', get_missing_bonds=True, skip_digestion=False): - from . import to_openmm_PDBFile - from ..openmm_PDBFile import to_molsysmt_Topology as openmm_PDBFile_to_molsysmt_Topology + from . import to_molsysmt_PDBFileHandler + from ..molsysmt_PDBFileHandler import to_molsysmt_Topology as molsysmt_PDBFileHandler_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) + tmp_item = to_molsysmt_PDBFileHandler(item, skip_digestion=True) + tmp_item = molsysmt_PDBFileHandler_to_molsysmt_Topology(tmp_item, atom_indices=atom_indices, + get_missing_bonds=get_missing_bonds, + skip_digestion=True) return tmp_item diff --git a/molsysmt/form/file_psf/__init__.py b/molsysmt/form/file_psf/__init__.py index e5e95aa3c..e9a107930 100644 --- a/molsysmt/form/file_psf/__init__.py +++ b/molsysmt/form/file_psf/__init__.py @@ -5,6 +5,9 @@ piped_topological_attribute = 'molsysmt.Topology' piped_structural_attribute = None piped_any_attribute = None +bonds_are_explicit = True +bonds_can_be_computed = False + from .is_form import is_form diff --git a/molsysmt/form/file_psf/attributes.py b/molsysmt/form/file_psf/attributes.py index 2c9018b93..d3d2f0a73 100644 --- a/molsysmt/form/file_psf/attributes.py +++ b/molsysmt/form/file_psf/attributes.py @@ -45,15 +45,17 @@ attributes['n_oligosaccharides'] = True attributes['n_saccharides'] = True - attributes['bond_index'] = True attributes['bond_id'] = False attributes['bond_type'] = True attributes['bond_order'] = True attributes['bonded_atoms'] = True +attributes['bonded_atom_pairs'] = True attributes['inner_bond_index'] = True attributes['inner_bonded_atoms'] = True +attributes['inner_bonded_atom_pairs'] = True attributes['n_bonds'] = True attributes['n_inner_bonds'] = True + del(_all_attributes) diff --git a/molsysmt/form/molsysmt_GROFileHandler/__init__.py b/molsysmt/form/molsysmt_GROFileHandler/__init__.py index 30baded9d..c3f25dc4d 100644 --- a/molsysmt/form/molsysmt_GROFileHandler/__init__.py +++ b/molsysmt/form/molsysmt_GROFileHandler/__init__.py @@ -5,6 +5,8 @@ piped_topological_attribute = 'molsysmt.Topology' piped_structural_attribute = 'molsysmt.Structures' piped_any_attribute = 'molsysmt.MolSys' +bonds_are_explicit = False +bonds_can_be_computed = True from .is_form import is_form diff --git a/molsysmt/form/molsysmt_H5MSMFileHandler/__init__.py b/molsysmt/form/molsysmt_H5MSMFileHandler/__init__.py index 2446267eb..4dfdd1390 100644 --- a/molsysmt/form/molsysmt_H5MSMFileHandler/__init__.py +++ b/molsysmt/form/molsysmt_H5MSMFileHandler/__init__.py @@ -5,6 +5,8 @@ piped_topological_attribute = None piped_structural_attribute = None piped_any_attribute = None +bonds_are_explicit = True +bonds_can_be_computed = True from .is_form import is_form diff --git a/molsysmt/form/molsysmt_MolSys/__init__.py b/molsysmt/form/molsysmt_MolSys/__init__.py index d6f95d6ee..88a4f0f80 100644 --- a/molsysmt/form/molsysmt_MolSys/__init__.py +++ b/molsysmt/form/molsysmt_MolSys/__init__.py @@ -5,6 +5,8 @@ piped_topological_attribute = None piped_structural_attribute = None piped_any_attribute = None +bonds_are_explicit = True +bonds_can_be_computed = True from .is_form import is_form diff --git a/molsysmt/form/molsysmt_PDBFileHandler/__init__.py b/molsysmt/form/molsysmt_PDBFileHandler/__init__.py index 9575ffac4..7404661fc 100644 --- a/molsysmt/form/molsysmt_PDBFileHandler/__init__.py +++ b/molsysmt/form/molsysmt_PDBFileHandler/__init__.py @@ -2,9 +2,11 @@ form_type = 'class' form_info = ["", ""] -piped_topological_attribute = None -piped_structural_attribute = None -piped_any_attribute = None +piped_topological_attribute = 'molsysmt.Topology' +piped_structural_attribute = 'molsysmt.Structures' +piped_any_attribute = 'molsysmt.MolSys' +bonds_are_explicit = False +bonds_can_be_computed = True from .is_form import is_form diff --git a/molsysmt/form/molsysmt_Structures/__init__.py b/molsysmt/form/molsysmt_Structures/__init__.py index a87a287d6..b9431ba07 100644 --- a/molsysmt/form/molsysmt_Structures/__init__.py +++ b/molsysmt/form/molsysmt_Structures/__init__.py @@ -5,6 +5,8 @@ piped_topological_attribute = None piped_structural_attribute = None piped_any_attribute = None +bonds_are_explicit = False +bonds_can_be_computed = False from .is_form import is_form diff --git a/molsysmt/form/molsysmt_Topology/__init__.py b/molsysmt/form/molsysmt_Topology/__init__.py index e51a38fcb..e9e9af58e 100644 --- a/molsysmt/form/molsysmt_Topology/__init__.py +++ b/molsysmt/form/molsysmt_Topology/__init__.py @@ -5,6 +5,8 @@ piped_topological_attribute = None piped_structural_attribute = None piped_any_attribute = None +bonds_are_explicit = True +bonds_can_be_computed = True from .is_form import is_form diff --git a/molsysmt/form/molsysmt_Topology/get_topological_attributes.py b/molsysmt/form/molsysmt_Topology/get_topological_attributes.py index 6d52e58d4..f652fc9ac 100644 --- a/molsysmt/form/molsysmt_Topology/get_topological_attributes.py +++ b/molsysmt/form/molsysmt_Topology/get_topological_attributes.py @@ -104,7 +104,7 @@ def get_group_type_from_atom(item, indices='all', skip_digestion=False): aux_indices = get_group_index_from_atom(item, indices=indices, skip_digestion=True) aux_unique_indices, aux_new_indices = np.unique(aux_indices, return_inverse=True) - aux_vals = get_group_name_from_group(item, indices=aux_unique_indices, skip_digestion=True) + aux_vals = get_group_type_from_group(item, indices=aux_unique_indices, skip_digestion=True) output = np.array(aux_vals)[aux_new_indices] del aux_indices, aux_unique_indices, aux_vals, aux_new_indices @@ -239,7 +239,7 @@ def get_entity_name_from_atom(item, indices='all', skip_digestion=False): aux_indices = get_entity_index_from_atom(item, indices=indices, skip_digestion=True) aux_unique_indices, aux_new_indices = np.unique(aux_indices, return_inverse=True) - aux_vals = get_entity_id_from_entity(item, indices=aux_unique_indices, skip_digestion=True) + aux_vals = get_entity_name_from_entity(item, indices=aux_unique_indices, skip_digestion=True) output = np.array(aux_vals)[aux_new_indices] del aux_indices, aux_unique_indices, aux_vals, aux_new_indices @@ -2807,9 +2807,9 @@ def get_entity_name_from_entity(item, indices='all', skip_digestion=False): def get_entity_type_from_entity(item, indices='all', skip_digestion=False): if is_all(indices): - output = item.entities['entity_name'].to_list() + output = item.entities['entity_type'].to_list() else: - output = item.entities['entity_name'][indices].to_list() + output = item.entities['entity_type'][indices].to_list() return output @@ -2818,10 +2818,15 @@ def get_entity_type_from_entity(item, indices='all', skip_digestion=False): def get_chain_index_from_entity(item, indices='all', skip_digestion=False): atom_index_from_target = get_atom_index_from_entity(item, indices=indices, skip_digestion=True) - first_atom_index_from_target = np.array([ii[0] for ii in atom_index_from_target]) - output = get_chain_index_from_atom(item, indices=first_atom_index_from_target, skip_digestion=True) + output = [] + for aux in atom_index_from_target: + aux2 = get_chain_index_from_atom(item, indices=aux, skip_digestion=True) + aux2 = np.unique(aux2).tolist() + if len(aux2)==1: + aux2=aux2[0] + output.append(aux2) - del atom_index_from_target, first_atom_index_from_target + del atom_index_from_target, aux return output @@ -2829,40 +2834,76 @@ def get_chain_index_from_entity(item, indices='all', skip_digestion=False): @digest(form=form) def get_chain_id_from_entity(item, indices='all', skip_digestion=False): - aux_indices = get_chain_index_from_entity(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_new_indices = np.unique(aux_indices, return_inverse=True) + target_indices = get_chain_index_from_entity(item, indices=indices, skip_digestion=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_chain_id_from_chain(item, indices=aux_unique_indices, skip_digestion=True) - output = np.array(aux_vals)[aux_new_indices] + aux_output = np.array(aux_vals)[aux_indices] + output = [] + ii = 0 + for aux in target_indices: + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError + ii = jj - del aux_indices, aux_unique_indices, aux_vals, aux_new_indices + del aux_unique_indices, aux_vals, aux_output, target_indices - return output.tolist() + return output @digest(form=form) def get_chain_name_from_entity(item, indices='all', skip_digestion=False): - aux_indices = get_chain_index_from_entity(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_new_indices = np.unique(aux_indices, return_inverse=True) + target_indices = get_chain_index_from_entity(item, indices=indices, skip_digestion=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_chain_name_from_chain(item, indices=aux_unique_indices, skip_digestion=True) - output = np.array(aux_vals)[aux_new_indices] + aux_output = np.array(aux_vals)[aux_indices] + output = [] + ii = 0 + for aux in target_indices: + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError + ii = jj - del aux_indices, aux_unique_indices, aux_vals, aux_new_indices + del aux_unique_indices, aux_vals, aux_output, target_indices - return output.tolist() + return output @digest(form=form) def get_chain_type_from_entity(item, indices='all', skip_digestion=False): - aux_indices = get_chain_index_from_entity(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_new_indices = np.unique(aux_indices, return_inverse=True) + target_indices = get_chain_index_from_entity(item, indices=indices, skip_digestion=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_chain_type_from_chain(item, indices=aux_unique_indices, skip_digestion=True) - output = np.array(aux_vals)[aux_new_indices] + aux_output = np.array(aux_vals)[aux_indices] + output = [] + ii = 0 + for aux in target_indices: + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError + ii = jj - del aux_indices, aux_unique_indices, aux_vals, aux_new_indices + del aux_unique_indices, aux_vals, aux_output, target_indices - return output.tolist() + return output @digest(form=form) @@ -2963,11 +3004,13 @@ def get_n_entities_from_entity(item, indices='all', skip_digestion=False): @digest(form=form) def get_n_chains_from_entity(item, indices='all', skip_digestion=False): - if is_all(indices): - output = get_n_chains_from_system(item, skip_digestion=True) - else: - output = get_chain_index_from_entity(item, indices=indices, skip_digestion=True) - output = np.unique(output).shape[0] + aux = get_chain_index_from_entity(item, indices=indices, skip_digestion=True) + output = [] + for ii in aux: + try: + output.append(len(ii)) + except: + output.append(1) return output @@ -3190,14 +3233,16 @@ def get_atom_type_from_chain(item, indices='all', skip_digestion=False): @digest(form=form) def get_group_index_from_chain(item, indices='all', skip_digestion=False): - target_index = get_chain_index_from_group(item, skip_digestion=True) + atom_index_from_target = get_atom_index_from_chain(item, indices=indices, skip_digestion=True) + output = [] + for aux in atom_index_from_target: + aux2 = get_group_index_from_atom(item, indices=aux, skip_digestion=True) + aux2 = np.unique(aux2).tolist() + if len(aux2)==1: + aux2=aux2[0] + output.append(aux2) - serie = pd.Series(target_index) - groups_serie = serie.groupby(serie).apply(lambda x: x.index.tolist()) - if is_all(indices): - output = [ii for ii in groups_serie] - else: - output = [groups_serie[ii] for ii in indices] + del atom_index_from_target, aux return output @@ -3206,14 +3251,20 @@ def get_group_index_from_chain(item, indices='all', skip_digestion=False): def get_group_id_from_chain(item, indices='all', skip_digestion=False): target_indices = get_group_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_group_id_from_group(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3225,14 +3276,20 @@ def get_group_id_from_chain(item, indices='all', skip_digestion=False): def get_group_name_from_chain(item, indices='all', skip_digestion=False): target_indices = get_group_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_group_name_from_group(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3244,14 +3301,20 @@ def get_group_name_from_chain(item, indices='all', skip_digestion=False): def get_group_type_from_chain(item, indices='all', skip_digestion=False): target_indices = get_group_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_group_type_from_group(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3262,14 +3325,16 @@ def get_group_type_from_chain(item, indices='all', skip_digestion=False): @digest(form=form) def get_component_index_from_chain(item, indices='all', skip_digestion=False): - target_index = get_chain_index_from_component(item, skip_digestion=True) + atom_index_from_target = get_atom_index_from_chain(item, indices=indices, skip_digestion=True) + output = [] + for aux in atom_index_from_target: + aux2 = get_component_index_from_atom(item, indices=aux, skip_digestion=True) + aux2 = np.unique(aux2).tolist() + if len(aux2)==1: + aux2=aux2[0] + output.append(aux2) - serie = pd.Series(target_index) - groups_serie = serie.groupby(serie).apply(lambda x: x.index.tolist()) - if is_all(indices): - output = [ii for ii in groups_serie] - else: - output = [groups_serie[ii] for ii in indices] + del atom_index_from_target, aux return output @@ -3278,14 +3343,20 @@ def get_component_index_from_chain(item, indices='all', skip_digestion=False): def get_component_id_from_chain(item, indices='all', skip_digestion=False): target_indices = get_component_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_component_id_from_component(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3297,14 +3368,20 @@ def get_component_id_from_chain(item, indices='all', skip_digestion=False): def get_component_name_from_chain(item, indices='all', skip_digestion=False): target_indices = get_component_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_component_name_from_component(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3316,14 +3393,20 @@ def get_component_name_from_chain(item, indices='all', skip_digestion=False): def get_component_type_from_chain(item, indices='all', skip_digestion=False): target_indices = get_component_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_component_type_from_component(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3334,14 +3417,16 @@ def get_component_type_from_chain(item, indices='all', skip_digestion=False): @digest(form=form) def get_molecule_index_from_chain(item, indices='all', skip_digestion=False): - target_index = get_chain_index_from_molecule(item, skip_digestion=True) + atom_index_from_target = get_atom_index_from_chain(item, indices=indices, skip_digestion=True) + output = [] + for aux in atom_index_from_target: + aux2 = get_molecule_index_from_atom(item, indices=aux, skip_digestion=True) + aux2 = np.unique(aux2).tolist() + if len(aux2)==1: + aux2=aux2[0] + output.append(aux2) - serie = pd.Series(target_index) - groups_serie = serie.groupby(serie).apply(lambda x: x.index.tolist()) - if is_all(indices): - output = [ii for ii in groups_serie] - else: - output = [groups_serie[ii] for ii in indices] + del atom_index_from_target, aux return output @@ -3350,14 +3435,20 @@ def get_molecule_index_from_chain(item, indices='all', skip_digestion=False): def get_molecule_id_from_chain(item, indices='all', skip_digestion=False): target_indices = get_molecule_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_molecule_id_from_molecule(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3369,14 +3460,20 @@ def get_molecule_id_from_chain(item, indices='all', skip_digestion=False): def get_molecule_name_from_chain(item, indices='all', skip_digestion=False): target_indices = get_molecule_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_molecule_name_from_molecule(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3388,14 +3485,20 @@ def get_molecule_name_from_chain(item, indices='all', skip_digestion=False): def get_molecule_type_from_chain(item, indices='all', skip_digestion=False): target_indices = get_molecule_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_molecule_type_from_molecule(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3406,14 +3509,16 @@ def get_molecule_type_from_chain(item, indices='all', skip_digestion=False): @digest(form=form) def get_entity_index_from_chain(item, indices='all', skip_digestion=False): - target_index = get_chain_index_from_entity(item, skip_digestion=True) + atom_index_from_target = get_atom_index_from_chain(item, indices=indices, skip_digestion=True) + output = [] + for aux in atom_index_from_target: + aux2 = get_entity_index_from_atom(item, indices=aux, skip_digestion=True) + aux2 = np.unique(aux2).tolist() + if len(aux2)==1: + aux2=aux2[0] + output.append(aux2) - serie = pd.Series(target_index) - groups_serie = serie.groupby(serie).apply(lambda x: x.index.tolist()) - if is_all(indices): - output = [ii for ii in groups_serie] - else: - output = [groups_serie[ii] for ii in indices] + del atom_index_from_target, aux return output @@ -3422,14 +3527,20 @@ def get_entity_index_from_chain(item, indices='all', skip_digestion=False): def get_entity_id_from_chain(item, indices='all', skip_digestion=False): target_indices = get_entity_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_entity_id_from_entity(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3441,14 +3552,20 @@ def get_entity_id_from_chain(item, indices='all', skip_digestion=False): def get_entity_name_from_chain(item, indices='all', skip_digestion=False): target_indices = get_entity_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_entity_name_from_entity(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3460,14 +3577,20 @@ def get_entity_name_from_chain(item, indices='all', skip_digestion=False): def get_entity_type_from_chain(item, indices='all', skip_digestion=False): target_indices = get_entity_index_from_chain(item, indices=indices, skip_digestion=True) - aux_unique_indices, aux_indices = np.unique(np.concatenate(target_indices), return_inverse=True) + aux_unique_indices, aux_indices = np.unique(np.hstack(target_indices), return_inverse=True) aux_vals = get_entity_type_from_entity(item, indices=aux_unique_indices, skip_digestion=True) aux_output = np.array(aux_vals)[aux_indices] output = [] ii = 0 for aux in target_indices: - jj = ii+len(aux) - output.append(aux_output[ii:jj].tolist()) + if isinstance(aux, (list, tuple)): + jj = ii+len(aux) + output.append(aux_output[ii:jj].tolist()) + elif isinstance(aux, int): + jj = ii+1 + output.append(aux_output[ii]) + else: + raise ValueError ii = jj del aux_unique_indices, aux_vals, aux_output, target_indices @@ -3580,8 +3703,13 @@ def get_n_atoms_from_chain(item, indices='all', skip_digestion=False): @digest(form=form) def get_n_groups_from_chain(item, indices='all', skip_digestion=False): - output = get_group_index_from_chain(item, indices, skip_digestion=True) - output = [len(ii) for ii in output] + aux = get_group_index_from_chain(item, indices, skip_digestion=True) + output = [] + for ii in aux: + try: + output.append(len(ii)) + except: + output.append(1) return output @@ -3589,8 +3717,13 @@ def get_n_groups_from_chain(item, indices='all', skip_digestion=False): @digest(form=form) def get_n_components_from_chain(item, indices='all', skip_digestion=False): - output = get_component_index_from_chain(item, indices, skip_digestion=True) - output = [len(ii) for ii in output] + aux = get_component_index_from_chain(item, indices, skip_digestion=True) + output = [] + for ii in aux: + try: + output.append(len(ii)) + except: + output.append(1) return output @@ -3598,8 +3731,13 @@ def get_n_components_from_chain(item, indices='all', skip_digestion=False): @digest(form=form) def get_n_molecules_from_chain(item, indices='all', skip_digestion=False): - output = get_molecule_index_from_chain(item, indices, skip_digestion=True) - output = [len(ii) for ii in output] + aux = get_molecule_index_from_chain(item, indices, skip_digestion=True) + output = [] + for ii in aux: + try: + output.append(len(ii)) + except: + output.append(1) return output @@ -3607,8 +3745,13 @@ def get_n_molecules_from_chain(item, indices='all', skip_digestion=False): @digest(form=form) def get_n_entities_from_chain(item, indices='all', skip_digestion=False): - output = get_entity_index_from_chain(item, indices, skip_digestion=True) - output = [len(ii) for ii in output] + aux = get_entity_index_from_chain(item, indices, skip_digestion=True) + output = [] + for ii in aux: + try: + output.append(len(ii)) + except: + output.append(1) return output diff --git a/molsysmt/form/nglview_NGLWidget/__init__.py b/molsysmt/form/nglview_NGLWidget/__init__.py index 95143ae74..e97e9f22b 100644 --- a/molsysmt/form/nglview_NGLWidget/__init__.py +++ b/molsysmt/form/nglview_NGLWidget/__init__.py @@ -5,6 +5,8 @@ piped_topological_attribute = 'molsysmt.Topology' piped_structural_attribute = 'molsysmt.Structures' piped_any_attribute = 'molsysmt.MolSys' +bonds_are_explicit = False +bonds_can_be_computed = True from .is_form import is_form diff --git a/molsysmt/form/string_pdb_text/__init__.py b/molsysmt/form/string_pdb_text/__init__.py index a55f62bd0..92e5a5434 100644 --- a/molsysmt/form/string_pdb_text/__init__.py +++ b/molsysmt/form/string_pdb_text/__init__.py @@ -6,6 +6,8 @@ piped_topological_attribute = 'molsysmt.Topology' piped_structural_attribute = 'molsysmt.Structures' piped_any_attribute = 'molsysmt.MolSys' +bonds_are_explicit = False +bonds_can_be_computed = True from .is_form import is_form diff --git a/molsysmt/systems.py b/molsysmt/systems.py index b4603bb74..18eaf8238 100644 --- a/molsysmt/systems.py +++ b/molsysmt/systems.py @@ -88,8 +88,8 @@ def path(package, file): # Benzamidine -#systems['benzamidine'] = {} -#systems['benzamidine']['benzamidine.pdb'] = path('molsysmt.data.pdb', 'benzamidine.pdb') +systems['benzamidine'] = {} +systems['benzamidine']['benzamidine.pdb'] = path('molsysmt.data.pdb', 'benzamidine.pdb') # NGLView @@ -113,9 +113,9 @@ def path(package, file): # Trp-Cage -#systems['Trp-Cage'] = {} -#systems['Trp-Cage']['1l2y.pdb'] = path('molsysmt.data.pdb', '1l2y.pdb') -#systems['Trp-Cage']['1l2y.mmtf'] = path('molsysmt.data.mmtf', '1l2y.mmtf') +systems['Trp-Cage'] = {} +systems['Trp-Cage']['1l2y.pdb'] = path('molsysmt.data.pdb', '1l2y.pdb') +systems['Trp-Cage']['1l2y.mmtf'] = path('molsysmt.data.mmtf', '1l2y.mmtf') # Metenkephalin diff --git a/molsysmt/tests/basic/get/test_get_nglview_NGLWidget.py b/molsysmt/tests/basic/get/test_get_nglview_NGLWidget.py index ef74a74b5..b1a67ba8b 100644 --- a/molsysmt/tests/basic/get/test_get_nglview_NGLWidget.py +++ b/molsysmt/tests/basic/get/test_get_nglview_NGLWidget.py @@ -8,11 +8,10 @@ import numpy as np - def test_get_nglview_NGLWidget_1(): molsys = msm.convert([systems['nglview']['md_1u19.gro'], systems['nglview']['md_1u19.xtc']], to_form='molsysmt.MolSys') view = msm.convert(molsys, to_form='nglview.NGLWidget') - check_comparison = msm.compare(molsys, view, comparison='info_no_form', rule='A_eq_B') + check_comparison = msm.compare(molsys, view, attribute_type='topological', rule='equal') assert check_comparison diff --git a/molsysmt/tests/basic/has_attribute/test_has_attribute.py b/molsysmt/tests/basic/has_attribute/test_has_attribute.py index dd2f50037..d952205a3 100644 --- a/molsysmt/tests/basic/has_attribute/test_has_attribute.py +++ b/molsysmt/tests/basic/has_attribute/test_has_attribute.py @@ -4,11 +4,11 @@ # Import package, test suite, and other packages as needed import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems import numpy as np def test_has_attribute_1(): - molsys = tests_systems['pentalanine']['pentalanine.inpcrd'] + molsys = systems['pentalanine']['pentalanine.inpcrd'] assert msm.has_attribute(molsys, 'box')==True assert msm.has_attribute(molsys, 'group_name')==False diff --git a/molsysmt/tests/basic/iterator/test_iterator.py b/molsysmt/tests/basic/iterator/test_iterator.py index b956e0243..b1e95e979 100644 --- a/molsysmt/tests/basic/iterator/test_iterator.py +++ b/molsysmt/tests/basic/iterator/test_iterator.py @@ -4,14 +4,14 @@ # Import package, test suite, and other packages as needed import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems from molsysmt import pyunitwizard as puw import numpy as np import os def test_iterator_1(): - psf = tests_systems['POPC membrane']['popc_membrane.psf'] - dcd = tests_systems['POPC membrane']['popc_membrane.dcd'] + psf = systems['POPC membrane']['popc_membrane.psf'] + dcd = systems['POPC membrane']['popc_membrane.dcd'] atoms_P = msm.select(psf, selection='atom_name == "P"') iterator = msm.Iterator(dcd, selection=atoms_P, coordinates=True) coordinates = [] @@ -21,8 +21,8 @@ def test_iterator_1(): assert coordinates.shape == (50, 294, 3) def test_iterator_2(): - psf = tests_systems['POPC membrane']['popc_membrane.psf'] - dcd = tests_systems['POPC membrane']['popc_membrane.dcd'] + psf = systems['POPC membrane']['popc_membrane.psf'] + dcd = systems['POPC membrane']['popc_membrane.dcd'] iterator = msm.Iterator([psf, dcd], selection='atom_name == "P"', coordinates=True) coordinates = [] for aux_coordinates in iterator: @@ -31,7 +31,7 @@ def test_iterator_2(): assert coordinates.shape == (50, 294, 3) def test_iterator_3(): - msmpk = tests_systems['POPC membrane']['popc_membrane.msmpk'] + msmpk = systems['POPC membrane']['popc_membrane.msmpk'] molsys = msm.convert(msmpk) iterator = msm.Iterator(molsys, selection='atom_name == "P"', coordinates=True) coordinates = [] diff --git a/molsysmt/tests/basic/merge/test_merge_molsysmt_MolSys.py b/molsysmt/tests/basic/merge/test_merge_molsysmt_MolSys.py index 932f85f52..3dff40851 100644 --- a/molsysmt/tests/basic/merge/test_merge_molsysmt_MolSys.py +++ b/molsysmt/tests/basic/merge/test_merge_molsysmt_MolSys.py @@ -4,13 +4,13 @@ # Import package, test suite, and other packages as needed import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems import numpy as np def test_merge_molsysmt_MolSys_1(): - molsys_1 = msm.convert(tests_systems['proline dipeptide']['proline_dipeptide.msmpk'], to_form='molsysmt.MolSys') - molsys_2 = msm.convert(tests_systems['valine dipeptide']['valine_dipeptide.msmpk'], to_form='molsysmt.MolSys') - molsys_3 = msm.convert(tests_systems['lysine dipeptide']['lysine_dipeptide.msmpk'], to_form='molsysmt.MolSys') + molsys_1 = msm.convert(systems['proline dipeptide']['proline_dipeptide.h5msm'], to_form='molsysmt.MolSys') + molsys_2 = msm.convert(systems['valine dipeptide']['valine_dipeptide.h5msm'], to_form='molsysmt.MolSys') + molsys_3 = msm.convert(systems['lysine dipeptide']['lysine_dipeptide.h5msm'], to_form='molsysmt.MolSys') n_atoms_1 = msm.get(molsys_1, element='system', n_atoms=True) n_atoms_2 = msm.get(molsys_2, element='system', n_atoms=True) n_atoms_3 = msm.get(molsys_3, element='system', n_atoms=True) diff --git a/molsysmt/tests/basic/select/test_select_molsysmt_MolSys.py b/molsysmt/tests/basic/select/test_select_molsysmt_MolSys.py index 06b8f00de..b064e7ed6 100644 --- a/molsysmt/tests/basic/select/test_select_molsysmt_MolSys.py +++ b/molsysmt/tests/basic/select/test_select_molsysmt_MolSys.py @@ -4,102 +4,102 @@ """ import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems import numpy as np def test_select_1(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, selection=[0,1,2]) true_output = np.array([0, 1, 2]) assert np.all(output==true_output) def test_select_2(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, element='group', selection=[0,1,2,3,4,5]) true_output = np.array([0,1,2,3,4,5]) assert np.all(output==true_output) def test_select_3(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, element='molecule', selection=[3900, 3910, 3920]) true_output = np.array([3900, 3910, 3920]) assert np.all(output==true_output) def test_select_4(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'atom_name == "C" and group_index == [0,1,2,3]') true_output = np.array([ 2, 11, 18, 27]) assert np.all(output==true_output) def test_select_5(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'atom_name in ["CA","CB"] and group_index == [0,1,2,3]') true_output = np.array([ 1, 4, 10, 13, 17, 20, 26, 29]) assert np.all(output==true_output) def test_select_6(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'atom_type==["C","N"] and group_index == [2]') true_output = np.array([16, 17, 18, 20, 21, 22, 24]) assert np.all(output==true_output) def test_select_7(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'not atom_type=="H" and group_index==3') true_output = np.array([25, 26, 27, 28, 29, 30, 31]) assert np.all(output==true_output) def test_select_8(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'atom_type=="C" and not atom_name=="CA" and group_index==[2,3]') true_output = np.array([18, 20, 21, 22, 27, 29, 30, 31]) assert np.all(output==true_output) def test_select_9(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'atom_name!=["CA","CB","C"] and group_index==[2,3]') true_output = np.array([16, 19, 21, 22, 23, 24, 25, 28, 30, 31]) assert np.all(output==true_output) def test_select_10(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'atom_id<10') true_output = np.array([0, 1, 2, 3, 4, 5, 6, 7, 8]) assert np.all(output==true_output) def test_select_11(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'atom_id<10 and atom_id>=3') true_output = np.array([2, 3, 4, 5, 6, 7, 8]) assert np.all(output==true_output) def test_select_12(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'molecule_type=="water" and molecule_index==[100,101]') true_output = np.array([3916, 3917]) assert np.all(output==true_output) def test_select_13(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'molecule_type=="protein" and atom_type!="H" and group_index==3') true_output = np.array([25, 26, 27, 28, 29, 30, 31]) assert np.all(output==true_output) def test_select_14(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') - output = msm.select(molsys, 'group_name==["GLY","ALA","VAL"] and chain_id=="A" and group_index==[2,3,4,5,6]') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') + output = msm.select(molsys, 'group_name==["GLY","ALA","VAL"] and chain_name=="A" and group_index==[2,3,4,5,6]') true_output = np.array([40, 41, 42, 43, 44, 45, 46, 47, 48, 49]) assert np.all(output==true_output) def test_select_15(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') indices=[10,11,12] output = msm.select(molsys, 'group_index==@indices and atom_name=="N"') true_output = np.array([77, 86, 92]) assert np.all(output==true_output) def test_select_16(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') indices=list(range(10,20)) atoms=["CA", "C", "O", "N"] output = msm.select(molsys, 'atom_name==@atoms & atom_index==@indices') @@ -107,141 +107,141 @@ def test_select_16(): assert np.all(output==true_output) def test_select_17(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') indices=list(range(10,30)) output = msm.select(molsys, 'atom_name=="C" and atom_index in @indices') true_output = np.array([11, 18, 27]) assert np.all(output==true_output) def test_select_19(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') indices=[0,100,200] output = msm.select(molsys, 'group_index==@indices', element='group') true_output = np.array([ 0, 100, 200]) assert np.all(output==true_output) def test_select_20(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'group_name=="ALA" and group_index==[2,3,4,5,6,7]', element='group') true_output = np.array([5, 6, 7]) assert np.all(output==true_output) def test_select_21(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'atom_index==[34,44,64]', element='group') true_output = np.array([4, 5, 9]) assert np.all(output==true_output) def test_select_22(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') - output = msm.select(molsys, 'chain_id==["A","C"] and molecule_type!="water"', element='group') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') + output = msm.select(molsys, 'chain_name==["A","C"] and molecule_type!="water"', element='group') true_output = np.array(list(range(248))) assert np.all(output==true_output) def test_select_23(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'molecule_type=="water"', element='group') true_output = np.array(list(range(497,662))) assert np.all(output==true_output) def test_select_24(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'molecule_type=="water"', element='molecule') true_output = np.array(list(range(2,167))) assert np.all(output==true_output) def test_select_25(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'molecule_type=="water"', element='chain') true_output = np.array([2, 3]) assert np.all(output==true_output) def test_select_26(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, 'group_index==5', element='bond') - true_output = np.array([37, 38, 39, 40]) + true_output = np.array([42, 43, 44, 45]) assert np.all(output==true_output) def test_select_29(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') - output = msm.select(molsys, 'chain_id=="A" within 0.30 nm of chain_id=="B"') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') + output = msm.select(molsys, 'chain_id==0 within 0.30 nm of chain_id==1') true_output = np.array([ 89, 480, 527, 547, 550, 552, 554, 566, 723, 734]) assert np.all(output==true_output) def test_select_30(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') - output = msm.select(molsys, 'chain_id=="A" not within 7.8 nanometers of chain_id=="B"') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') + output = msm.select(molsys, 'chain_id==0 not within 7.8 nanometers of chain_id==1') true_output = np.array([1521, 1522, 1723, 1724]) assert np.all(output==true_output) def test_select_31(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') - output = msm.select(molsys, 'chain_id=="A" within 0.3 nm without pbc of chain_id=="B"') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') + output = msm.select(molsys, 'chain_id==0 within 0.3 nm without pbc of chain_id==1') true_output = np.array([ 89, 480, 527, 547, 550, 552, 554, 566, 723, 734]) assert np.all(output==true_output) def test_select_32(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') - output = msm.select(molsys, 'chain_id=="A" within 0.3 nm with pbc of chain_id=="B"') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') + output = msm.select(molsys, 'chain_id==0 within 0.3 nm with pbc of chain_id==1') true_output = np.array([ 89, 480, 527, 547, 550, 552, 554, 566, 723, 734]) assert np.all(output==true_output) def test_select_33(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') - output = msm.select(molsys, '(atom_name=="N" and chain_id=="A") within 3 angstroms of (atom_type=="O" and molecule_type=="water")') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') + output = msm.select(molsys, '(atom_name=="N" and chain_id==0) within 3 angstroms of (atom_type=="O" and molecule_type=="water")') true_output = np.array([ 119, 213, 473, 531, 654, 696, 799, 1049]) assert np.all(output==true_output) def test_select_34(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') - output = msm.select(molsys, '(atom_name=="CA" and chain_id=="A") within 0.5 nm of (atom_name=="CA" and chain_id=="B")', element='group') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') + output = msm.select(molsys, '(atom_name=="CA" and chain_id==0) within 0.5 nm of (atom_name=="CA" and chain_name=="B")', element='group') true_output = np.array([10, 42, 62, 72, 73]) assert np.all(output==true_output) def test_select_35(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, '(atom_name=="N" bonded to atom_type=="C") and group_index==[10, 11, 12]') true_output = np.array([77, 86, 92]) assert np.all(output==true_output) def test_select_36(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, '(all not bonded to atom_type==["H","N","C","O"]) and molecule_type=="protein"') true_output = np.array([ 363, 1714, 2275, 3626]) assert np.all(output==true_output) def test_select_37(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') - output = msm.select(molsys, '((atom_type=="O" and chain_id=="A") bonded to (atom_type=="C" and chain_id=="A")) and group_index==[3,4]') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') + output = msm.select(molsys, '((atom_type=="O" and chain_name=="A") bonded to (atom_type=="C" and chain_name=="A")) and group_index==[3,4]') true_output = np.array([ 28, 35]) assert np.all(output==true_output) def test_select_38(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') - output = msm.select(molsys, '((atom_name=="N" and chain_id=="A") bonded to atom_type=="C") within 3 angstroms of (atom_type=="O" and molecule_type=="water")') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') + output = msm.select(molsys, '((atom_name=="N" and chain_name=="A") bonded to atom_type=="C") within 3 angstroms of (atom_type=="O" and molecule_type=="water")') true_output = np.array([ 119, 213, 473, 531, 654, 696, 799, 1049]) assert np.all(output==true_output) def test_select_39(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, selection='group_index==[3,4,5]', to_syntax='NGLView') true_output = '@25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44' assert np.all(output==true_output) def test_select_40(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, selection='group_index==[3,4,5]', to_syntax='MDTraj') true_output = 'index 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44' assert np.all(output==true_output) def test_select_41(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, element='group', selection='group_index==[3,4,5]', to_syntax='NGLView') true_output = '7:A 8:A 9:A' assert np.all(output==true_output) def test_select_42(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.select(molsys, element='group', selection='group_index==[3,4,5]', to_syntax='MDTraj') true_output = 'resid 3 4 5' assert np.all(output==true_output) diff --git a/molsysmt/tests/basic/test_copy.py b/molsysmt/tests/basic/test_copy.py index 60ed069d6..f15e1f440 100644 --- a/molsysmt/tests/basic/test_copy.py +++ b/molsysmt/tests/basic/test_copy.py @@ -4,20 +4,20 @@ # Import package, test suite, and other packages as needed import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems import numpy as np import os def test_copy_1(): - molsys = tests_systems['pentalanine']['traj_pentalanine.h5'] + molsys = systems['pentalanine']['traj_pentalanine.h5'] molsys = msm.convert(molsys, to_form='molsysmt.MolSys') molsys_2 = msm.copy(molsys) output = msm.compare(molsys, molsys_2, attributes_type='topological', coordinates=True, box=True) assert output==True def test_copy_2(): - molsys = tests_systems['pentalanine']['traj_pentalanine.h5'] + molsys = systems['pentalanine']['traj_pentalanine.h5'] molsys_2 = msm.copy(molsys, 'traj.h5') form = msm.get_form(molsys_2) os.remove(molsys_2) diff --git a/molsysmt/tests/basic/test_extract.py b/molsysmt/tests/basic/test_extract.py index 7bf59a894..8bb192ca4 100644 --- a/molsysmt/tests/basic/test_extract.py +++ b/molsysmt/tests/basic/test_extract.py @@ -5,25 +5,25 @@ # Import package, test suite, and other packages as needed import molsysmt as msm import numpy as np -from molsysmt.systems import tests as tests_systems +from molsysmt import systems def test_extract_1(): - molsys = tests_systems['T4 lysozyme L99A']['181l.msmpk'] + molsys = systems['T4 lysozyme L99A']['181l.h5msm'] molsys = msm.convert(molsys, to_form='molsysmt.MolSys') molsys = msm.extract(molsys, selection='molecule_type=="small molecule"') output = msm.is_composed_of(molsys, small_molecules=2) assert output == True def test_extract_2(): - molsys = tests_systems['T4 lysozyme L99A']['181l.msmpk'] + molsys = systems['T4 lysozyme L99A']['181l.h5msm'] molsys = msm.convert(molsys, to_form='molsysmt.MolSys') molsys = msm.extract(molsys, selection='molecule_type=="water"') output = msm.is_composed_of(molsys, waters=136) assert output == True def test_extract_3(): - molsys = tests_systems['T4 lysozyme L99A']['181l.msmpk'] + molsys = systems['T4 lysozyme L99A']['181l.h5msm'] molsys = msm.convert(molsys, to_form='molsysmt.MolSys') molsys = msm.extract(molsys, selection='molecule_type==["water", "protein"]') output = msm.is_composed_of(molsys, waters=True, proteins=True) diff --git a/molsysmt/tests/basic/test_get_attributes.py b/molsysmt/tests/basic/test_get_attributes.py index e066ca5c0..80beee4dc 100644 --- a/molsysmt/tests/basic/test_get_attributes.py +++ b/molsysmt/tests/basic/test_get_attributes.py @@ -4,7 +4,7 @@ # Import package, test suite, and other packages as needed import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems import numpy as np def test_get_attributes_string_pdb(): @@ -15,21 +15,21 @@ def test_get_attributes_string_pdb(): assert attributes['box']==True def test_get_attributes_molsysmt_MolSys(): - molsys = msm.convert(tests_systems['T4 lysozyme L99A']['181l.msmpk']) + molsys = msm.convert(systems['T4 lysozyme L99A']['181l.h5msm']) attributes = msm.get_attributes(molsys) assert attributes['group_name']==True assert attributes['entity_name']==True assert attributes['box']==True def test_get_attributes_openmm_Topology(): - molsys = msm.convert(tests_systems['T4 lysozyme L99A']['181l.msmpk'], to_form='openmm.Topology') + molsys = msm.convert(systems['T4 lysozyme L99A']['181l.h5msm'], to_form='openmm.Topology') attributes = msm.get_attributes(molsys) assert attributes['group_name']==True assert attributes['entity_name']==False assert attributes['box']==True -def test_get_attributes_string_aminoacids1(): - molsys = msm.convert(tests_systems['T4 lysozyme L99A']['181l.msmpk'], to_form='string:aminoacids1', selection='molecule_type=="protein"') +def test_get_attributes_string_amino_acids_1(): + molsys = msm.convert(systems['T4 lysozyme L99A']['181l.h5msm'], to_form='string:amino_acids_1', selection='molecule_type=="protein"') attributes = msm.get_attributes(molsys) assert attributes['group_name']==True assert attributes['entity_name']==False diff --git a/molsysmt/tests/basic/test_get_form.py b/molsysmt/tests/basic/test_get_form.py index 92ae32b29..2d9b2b12e 100644 --- a/molsysmt/tests/basic/test_get_form.py +++ b/molsysmt/tests/basic/test_get_form.py @@ -4,36 +4,36 @@ # Import package, test suite, and other packages as needed import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems import numpy as np ## Files def test_file_pdb(): - molsys = tests_systems['chicken villin HP35']['1vii.pdb'] + molsys = systems['chicken villin HP35']['1vii.pdb'] output = msm.get_form(molsys) assert output == 'file:pdb' def test_file_mmtf(): - molsys = tests_systems['chicken villin HP35']['1vii.mmtf'] + molsys = systems['chicken villin HP35']['1vii.mmtf'] output = msm.get_form(molsys) assert output == 'file:mmtf' def test_file_inpcrd_prmtop(): - molsys1 = tests_systems['pentalanine']['pentalanine.inpcrd'] - molsys2 = tests_systems['pentalanine']['pentalanine.prmtop'] + molsys1 = systems['pentalanine']['pentalanine.inpcrd'] + molsys2 = systems['pentalanine']['pentalanine.prmtop'] output = msm.get_form([molsys1, molsys2]) assert output == ['file:inpcrd', 'file:prmtop'] def test_file_xyznpy(): - molsys = tests_systems['particles 4']['traj_particles_4.xyznpy'] + molsys = systems['particles 4']['traj_particles_4.xyznpy'] output = msm.get_form(molsys) assert output == 'file:xyznpy' -def test_file_msmpk(): - molsys = tests_systems['chicken villin HP35']['chicken_villin_HP35.msmpk'] +def test_file_h5msm(): + molsys = systems['chicken villin HP35']['chicken_villin_HP35.h5msm'] output = msm.get_form(molsys) - assert output == 'file:msmpk' + assert output == 'file:h5msm' ## Strings @@ -47,42 +47,42 @@ def test_string_pdb_id_automatic_detection(): output = msm.get_form(molsys) assert output == 'string:pdb_id' -def test_string_aminoacids3(): - molsys = 'aminoacids3:ACEALAGLYVALNME' +def test_string_amino_acids_3(): + molsys = 'amino_acids_3:ACEALAGLYVALNME' output = msm.get_form(molsys) - assert output == 'string:aminoacids3' + assert output == 'string:amino_acids_3' -def test_string_aminoacids3_automatic_detection(): +def test_string_amino_acids_3_automatic_detection(): molsys = 'ACEALAGLYVALNME' output = msm.get_form(molsys) - assert output == 'string:aminoacids3' + assert output == 'string:amino_acids_3' -def test_string_aminoacids1(): - molsys = 'aminoacids1:ALYDERRRT' +def test_string_amino_acids_1(): + molsys = 'amino_acids_1:ALYDERRRT' output = msm.get_form(molsys) - assert output == 'string:aminoacids1' + assert output == 'string:amino_acids_1' -def test_string_aminoacids1_automatic_detection(): +def test_string_amino_acids_1_automatic_detection(): molsys = 'ALYDERRRT' output = msm.get_form(molsys) - assert output == 'string:aminoacids1' + assert output == 'string:amino_acids_1' def test_string_pdb_text(): - molsys = tests_systems['benzamidine']['benzamidine.pdb'] + molsys = systems['benzamidine']['benzamidine.pdb'] molsys = msm.convert(molsys, 'string:pdb_text') molsys = 'pdb_text:'+molsys output = msm.get_form(molsys) assert output == 'string:pdb_text' def test_string_pdb_text_2(): - fff=open(tests_systems['T4 lysozyme L99A']['181l.pdb'],'r') + fff=open(systems['T4 lysozyme L99A']['181l.pdb'],'r') molsys = fff.read() fff.close() output = msm.get_form(molsys) assert output == 'string:pdb_text' def test_string_pdb_automatic_detection(): - molsys = tests_systems['benzamidine']['benzamidine.pdb'] + molsys = systems['benzamidine']['benzamidine.pdb'] molsys = msm.convert(molsys, 'string:pdb_text') output = msm.get_form(molsys) assert output == 'string:pdb_text' @@ -95,13 +95,13 @@ def test_class_XYZ(): assert output == 'XYZ' def test_molsysmt_MolSys(): - molsys = tests_systems['chicken villin HP35']['chicken_villin_HP35.msmpk'] + molsys = systems['chicken villin HP35']['chicken_villin_HP35.h5msm'] molsys = msm.convert(molsys, to_form='molsysmt.MolSys') output = msm.get_form(molsys) assert output == 'molsysmt.MolSys' def test_nglview_NGLWidget(): - molsys = tests_systems['chicken villin HP35']['chicken_villin_HP35.msmpk'] + molsys = systems['chicken villin HP35']['chicken_villin_HP35.h5msm'] molsys = msm.convert(molsys, to_form='molsysmt.MolSys') molsys = msm.view(molsys) output = msm.get_form(molsys) diff --git a/molsysmt/tests/basic/test_get_label.py b/molsysmt/tests/basic/test_get_label.py index 0c6ba6729..fc8c7e536 100644 --- a/molsysmt/tests/basic/test_get_label.py +++ b/molsysmt/tests/basic/test_get_label.py @@ -3,72 +3,72 @@ """ import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems import numpy as np from pandas import DataFrame def test_get_label_1(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.get_label(molsys, element='atom', selection=10) true_output = 'CA-11@10' assert output == true_output def test_get_label_2(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.get_label(molsys, element='atom', selection=[10, 11, 12, 13]) true_output = ['CA-11@10', 'C-12@11', 'O-13@12', 'CB-14@13'] assert np.all(output == true_output) def test_get_label_3(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.get_label(molsys, element='atom', selection=10, string='{atom_name}-{atom_id}@{atom_index}/{group_name}-{group_id}@{group_index}/{chain_name}-{chain_id}@{chain_index}/{entity_name}@{entity_index}') - true_output = 'CA-11@10/PRO-5@1/A-A@0/Triosephosphate isomerase@0' + true_output = 'CA-11@10/PRO-5@1/A-0@0/TRIOSEPHOSPHATE ISOMERASE@0' assert output == true_output def test_get_label_4(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.get_label(molsys, element='group', selection=0) true_output = 'LYS-4@0' assert output == true_output def test_get_label_5(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.get_label(molsys, element='group', selection=3, string='{group_name}-{group_id}@{group_index}/{chain_name}-{chain_id}@{chain_index}/{entity_name}@{entity_index}') - true_output = 'PRO-7@3/A-A@0/Triosephosphate isomerase@0' + true_output = 'PRO-7@3/A-0@0/TRIOSEPHOSPHATE ISOMERASE@0' assert output == true_output def test_get_label_6(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.get_label(molsys, element='component', selection=2) - true_output = '2-2@2' + true_output = 'water-2@2' assert output == true_output def test_get_label_7(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.get_label(molsys, element='component', selection=2, string='{component_index}/{chain_name}-{chain_id}@{chain_index}/{entity_name}@{entity_index}') - true_output = '2/A-C@2/water@1' + true_output = '2/A-2@2/water@1' assert output == true_output def test_get_label_8(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.get_label(molsys, element='chain', selection=2) - true_output = 'A-C@2' + true_output = 'A-2@2' assert output == true_output def test_get_label_9(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.get_label(molsys, element='molecule', selection=0, string='{molecule_name}@{molecule_index}') - true_output = 'Triosephosphate isomerase@0' + true_output = 'TRIOSEPHOSPHATE ISOMERASE@0' assert output == true_output def test_get_label_10(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') output = msm.get_label(molsys, element='entity', selection=0, string='{entity_name}@{entity_index}') - true_output = 'Triosephosphate isomerase@0' + true_output = 'TRIOSEPHOSPHATE ISOMERASE@0' assert output == true_output diff --git a/molsysmt/tests/basic/test_info.py b/molsysmt/tests/basic/test_info.py index b215135e0..c18f1d11e 100644 --- a/molsysmt/tests/basic/test_info.py +++ b/molsysmt/tests/basic/test_info.py @@ -3,12 +3,12 @@ """ import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems import numpy as np from pandas import DataFrame def test_info_1(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') df = msm.info(molsys, element='atom', selection=[9, 10, 11, 12]) true_dict = {'index': {0: 9, 1: 10, 2: 11, 3: 12}, 'id': {0: 10, 1: 11, 2: 12, 3: 13}, @@ -17,24 +17,24 @@ def test_info_1(): 'group index': {0: 1, 1: 1, 2: 1, 3: 1}, 'group id': {0: 5, 1: 5, 2: 5, 3: 5}, 'group name': {0: 'PRO', 1: 'PRO', 2: 'PRO', 3: 'PRO'}, - 'group type': {0: 'aminoacid', - 1: 'aminoacid', - 2: 'aminoacid', - 3: 'aminoacid'}, + 'group type': {0: 'amino acid', + 1: 'amino acid', + 2: 'amino acid', + 3: 'amino acid'}, 'component index': {0: 0, 1: 0, 2: 0, 3: 0}, 'chain index': {0: 0, 1: 0, 2: 0, 3: 0}, 'molecule index': {0: 0, 1: 0, 2: 0, 3: 0}, 'molecule type': {0: 'protein', 1: 'protein', 2: 'protein', 3: 'protein'}, 'entity index': {0: 0, 1: 0, 2: 0, 3: 0}, - 'entity name': {0: 'Triosephosphate isomerase', - 1: 'Triosephosphate isomerase', - 2: 'Triosephosphate isomerase', - 3: 'Triosephosphate isomerase'}} + 'entity name': {0: 'TRIOSEPHOSPHATE ISOMERASE', + 1: 'TRIOSEPHOSPHATE ISOMERASE', + 2: 'TRIOSEPHOSPHATE ISOMERASE', + 3: 'TRIOSEPHOSPHATE ISOMERASE'}} true_df = DataFrame(true_dict) assert df.data.equals(true_df) def test_info_2(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') df = msm.info(molsys, element='atom', selection='group_index==6') true_dict = {'index': {0: 45, 1: 46, 2: 47, 3: 48, 4: 49}, 'id': {0: 46, 1: 47, 2: 48, 3: 49, 4: 50}, @@ -43,11 +43,11 @@ def test_info_2(): 'group index': {0: 6, 1: 6, 2: 6, 3: 6, 4: 6}, 'group id': {0: 10, 1: 10, 2: 10, 3: 10, 4: 10}, 'group name': {0: 'ALA', 1: 'ALA', 2: 'ALA', 3: 'ALA', 4: 'ALA'}, - 'group type': {0: 'aminoacid', - 1: 'aminoacid', - 2: 'aminoacid', - 3: 'aminoacid', - 4: 'aminoacid'}, + 'group type': {0: 'amino acid', + 1: 'amino acid', + 2: 'amino acid', + 3: 'amino acid', + 4: 'amino acid'}, 'component index': {0: 0, 1: 0, 2: 0, 3: 0, 4: 0}, 'chain index': {0: 0, 1: 0, 2: 0, 3: 0, 4: 0}, 'molecule index': {0: 0, 1: 0, 2: 0, 3: 0, 4: 0}, @@ -57,36 +57,36 @@ def test_info_2(): 3: 'protein', 4: 'protein'}, 'entity index': {0: 0, 1: 0, 2: 0, 3: 0, 4: 0}, - 'entity name': {0: 'Triosephosphate isomerase', - 1: 'Triosephosphate isomerase', - 2: 'Triosephosphate isomerase', - 3: 'Triosephosphate isomerase', - 4: 'Triosephosphate isomerase'}} + 'entity name': {0: 'TRIOSEPHOSPHATE ISOMERASE', + 1: 'TRIOSEPHOSPHATE ISOMERASE', + 2: 'TRIOSEPHOSPHATE ISOMERASE', + 3: 'TRIOSEPHOSPHATE ISOMERASE', + 4: 'TRIOSEPHOSPHATE ISOMERASE'}} true_df = DataFrame(true_dict) assert df.data.equals(true_df) def test_info_3(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') df = msm.info(molsys, element='group', selection=[20, 21, 22, 23]) true_dict ={'index': {0: 20, 1: 21, 2: 22, 3: 23}, 'id': {0: 24, 1: 25, 2: 26, 3: 27}, 'name': {0: 'PRO', 1: 'LEU', 2: 'ILE', 3: 'GLU'}, - 'type': {0: 'aminoacid', 1: 'aminoacid', 2: 'aminoacid', 3: 'aminoacid'}, + 'type': {0: 'amino acid', 1: 'amino acid', 2: 'amino acid', 3: 'amino acid'}, 'n atoms': {0: 7, 1: 8, 2: 8, 3: 9}, 'component index': {0: 0, 1: 0, 2: 0, 3: 0}, 'chain index': {0: 0, 1: 0, 2: 0, 3: 0}, 'molecule index': {0: 0, 1: 0, 2: 0, 3: 0}, 'molecule type': {0: 'protein', 1: 'protein', 2: 'protein', 3: 'protein'}, 'entity index': {0: 0, 1: 0, 2: 0, 3: 0}, - 'entity name': {0: 'Triosephosphate isomerase', - 1: 'Triosephosphate isomerase', - 2: 'Triosephosphate isomerase', - 3: 'Triosephosphate isomerase'}} + 'entity name': {0: 'TRIOSEPHOSPHATE ISOMERASE', + 1: 'TRIOSEPHOSPHATE ISOMERASE', + 2: 'TRIOSEPHOSPHATE ISOMERASE', + 3: 'TRIOSEPHOSPHATE ISOMERASE'}} true_df = DataFrame(true_dict) assert df.data.equals(true_df) def test_info_4(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') df = msm.info(molsys, element='component', selection='molecule_type!="water"') true_dict = {'index': {0: 0, 1: 1}, 'n atoms': {0: 1906, 1: 1912}, @@ -95,31 +95,31 @@ def test_info_4(): 'molecule index': {0: 0, 1: 1}, 'molecule type': {0: 'protein', 1: 'protein'}, 'entity index': {0: 0, 1: 0}, - 'entity name': {0: 'Triosephosphate isomerase', - 1: 'Triosephosphate isomerase'}} + 'entity name': {0: 'TRIOSEPHOSPHATE ISOMERASE', + 1: 'TRIOSEPHOSPHATE ISOMERASE'}} true_df = DataFrame(true_dict) assert df.data.equals(true_df) def test_info_5(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') df = msm.info(molsys, element='molecule', selection='molecule_type!="water"') true_dict = {'index': {0: 0, 1: 1}, - 'name': {0: 'Triosephosphate isomerase', 1: 'Triosephosphate isomerase'}, + 'name': {0: 'TRIOSEPHOSPHATE ISOMERASE', 1: 'TRIOSEPHOSPHATE ISOMERASE'}, 'type': {0: 'protein', 1: 'protein'}, 'n atoms': {0: 1906, 1: 1912}, 'n groups': {0: 248, 1: 249}, 'n components': {0: 1, 1: 1}, 'chain index': {0: 0, 1: 1}, 'entity index': {0: 0, 1: 0}, - 'entity name': {0: 'Triosephosphate isomerase', - 1: 'Triosephosphate isomerase'}} + 'entity name': {0: 'TRIOSEPHOSPHATE ISOMERASE', + 1: 'TRIOSEPHOSPHATE ISOMERASE'}} assert df.data.to_dict()==true_dict def test_info_6(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') df = msm.info(molsys, element='entity') true_dict = {'index': {0: 0, 1: 1}, - 'name': {0: 'Triosephosphate isomerase', 1: 'water'}, + 'name': {0: 'TRIOSEPHOSPHATE ISOMERASE', 1: 'water'}, 'type': {0: 'protein', 1: 'water'}, 'n atoms': {0: 3818, 1: 165}, 'n groups': {0: 497, 1: 165}, @@ -129,7 +129,7 @@ def test_info_6(): assert df.data.to_dict()==true_dict def test_info_7(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') df = msm.info(molsys) true_dict = {'form': {0: 'molsysmt.MolSys'}, 'n_atoms': {0: 3983}, @@ -145,7 +145,7 @@ def test_info_7(): assert df.data.equals(true_df) def test_info_8(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') molsys = msm.convert(molsys, to_form='molsysmt.Topology') df = msm.info(molsys) true_dict = {'form': {0: 'molsysmt.Topology'}, @@ -162,7 +162,7 @@ def test_info_8(): assert df.data.equals(true_df) def test_info_9(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') molsys = msm.convert(molsys, to_form='molsysmt.Structures') df = msm.info(molsys) true_dict = {'form': {0: 'molsysmt.Structures'}, @@ -177,7 +177,7 @@ def test_info_9(): assert df.data.equals(true_df) def test_info_10(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') molsys = msm.convert(molsys, to_form=['molsysmt.Topology', 'molsysmt.Structures']) df = msm.info(molsys) true_dict = {'form': {0: ['molsysmt.Topology', 'molsysmt.Structures']}, @@ -194,7 +194,7 @@ def test_info_10(): assert df.data.equals(true_df) def test_info_11(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') df = msm.info(molsys, element='component', selection='molecule_type=="protein"') true_dict = {'index': {0: 0, 1: 1}, 'n atoms': {0: 1906, 1: 1912}, @@ -203,13 +203,13 @@ def test_info_11(): 'molecule index': {0: 0, 1: 1}, 'molecule type': {0: 'protein', 1: 'protein'}, 'entity index': {0: 0, 1: 0}, - 'entity name': {0: 'Triosephosphate isomerase', - 1: 'Triosephosphate isomerase'}} + 'entity name': {0: 'TRIOSEPHOSPHATE ISOMERASE', + 1: 'TRIOSEPHOSPHATE ISOMERASE'}} true_df = DataFrame(true_dict) assert df.data.equals(true_df) def test_info_12(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') group_index_in_component_0 = msm.get(molsys, element='group', selection='component_index==0', index=True)[69] group_index_in_component_1 = msm.get(molsys, element='group', selection='component_index==1', index=True)[12] df = msm.info(molsys, element='group', selection=[group_index_in_component_0, @@ -217,15 +217,15 @@ def test_info_12(): true_dict = {'index': {0: 69, 1: 260}, 'id': {0: 73, 1: 15}, 'name': {0: 'GLY', 1: 'CYS'}, - 'type': {0: 'aminoacid', 1: 'aminoacid'}, + 'type': {0: 'amino acid', 1: 'amino acid'}, 'n atoms': {0: 4, 1: 6}, 'component index': {0: 0, 1: 1}, 'chain index': {0: 0, 1: 1}, 'molecule index': {0: 0, 1: 1}, 'molecule type': {0: 'protein', 1: 'protein'}, 'entity index': {0: 0, 1: 0}, - 'entity name': {0: 'Triosephosphate isomerase', - 1: 'Triosephosphate isomerase'}} + 'entity name': {0: 'TRIOSEPHOSPHATE ISOMERASE', + 1: 'TRIOSEPHOSPHATE ISOMERASE'}} true_df = DataFrame(true_dict) assert df.data.equals(true_df) diff --git a/molsysmt/tests/basic/test_is_composed_of.py b/molsysmt/tests/basic/test_is_composed_of.py index 83670f750..5bd2afd9e 100644 --- a/molsysmt/tests/basic/test_is_composed_of.py +++ b/molsysmt/tests/basic/test_is_composed_of.py @@ -4,10 +4,10 @@ # Import package, test suite, and other packages as needed import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems import numpy as np -molsys = msm.convert(tests_systems['chicken villin HP35']['chicken_villin_HP35_solvated.msmpk'], to_form='molsysmt.MolSys') +molsys = msm.convert(systems['chicken villin HP35']['chicken_villin_HP35_solvated.h5msm'], to_form='molsysmt.MolSys') def test_is_composed_of_1(): output = msm.is_composed_of(molsys, proteins=True) @@ -31,6 +31,6 @@ def test_is_composed_of_5(): assert output == False def test_is_composed_of_6(): - output = msm.is_composed_of(molsys, ions=2, waters=1481, peptides=1) + output = msm.is_composed_of(molsys, ions=2, waters=1483, peptides=1) assert output == True diff --git a/molsysmt/tests/basic/test_remove.py b/molsysmt/tests/basic/test_remove.py index a40fab983..396ccbfb2 100644 --- a/molsysmt/tests/basic/test_remove.py +++ b/molsysmt/tests/basic/test_remove.py @@ -3,13 +3,13 @@ """ import molsysmt as msm -from molsysmt.systems import tests as tests_systems +from molsysmt import systems import numpy as np from pandas import DataFrame def test_remove_1(): - molsys = msm.convert(tests_systems['TcTIM']['1tcd.msmpk'], to_form='molsysmt.MolSys') + molsys = msm.convert(systems['TcTIM']['1tcd.h5msm'], to_form='molsysmt.MolSys') molsys = msm.remove(molsys, selection='chain_index==[1,2,3]') df = msm.info(molsys) true_dict = {'form': {0: 'molsysmt.MolSys'}, @@ -26,7 +26,7 @@ def test_remove_1(): def test_remove_2(): - molsys = tests_systems['Trp-Cage']['1l2y.pdb'] + molsys = systems['Trp-Cage']['1l2y.pdb'] molsys = msm.convert(molsys, to_form='molsysmt.Structures') molsys = msm.remove(molsys, structure_indices=range(1, 38)) df = msm.info(molsys) diff --git a/sandbox/Tests.ipynb b/sandbox/Tests.ipynb index 766c6f114..bc040ad86 100644 --- a/sandbox/Tests.ipynb +++ b/sandbox/Tests.ipynb @@ -28,7 +28,7 @@ { "data": { "application/vnd.jupyter.widget-view+json": { - "model_id": "24b9051b7cf24592a4ef762afee678b3", + "model_id": "95aecdfb81d640ef96e92f4700600df5", "version_major": 2, "version_minor": 0 }, @@ -56,1117 +56,223 @@ { "cell_type": "code", "execution_count": 4, - "id": "4bc239b8-fee0-4bc6-979a-cbff979db70c", + "id": "bc45e326-44d2-4185-9529-38e7b5ad3b5d", "metadata": {}, - "outputs": [ - { - "name": "stdout", - "output_type": "stream", - "text": [ - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n" - ] - } - ], + "outputs": [], "source": [ - "molsys = msm.convert([systems['nglview']['md_1u19.gro'], systems['nglview']['md_1u19.xtc']],\n", - " to_form='molsysmt.MolSys')\n", - "view = msm.convert(molsys, to_form='nglview.NGLWidget')" + "molsys = systems['Trp-Cage']['1l2y.pdb']" ] }, { "cell_type": "code", - "execution_count": 7, - "id": "d2f9687c-6650-48b5-a5b6-8d2bf1bb2b79", + "execution_count": 6, + "id": "5426f384-f5a5-4980-9892-e6360433aaab", "metadata": {}, "outputs": [ { - "name": "stdout", - "output_type": "stream", - "text": [ - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n" - ] + "data": { + "text/plain": [ + "{'name': 'ASPARAGINE',\n", + " 'topology': [{'atoms': ['N',\n", + " 'CA',\n", + " 'C',\n", + " 'O',\n", + " 'CB',\n", + " 'CG',\n", + " 'OD1',\n", + " 'ND2',\n", + " 'OXT',\n", + " 'H',\n", + " 'H2',\n", + " 'HA',\n", + " 'HB2',\n", + " 'HB3',\n", + " 'HD21',\n", + " 'HD22',\n", + " 'HXT'],\n", + " 'bonds': [['N', 'CA'],\n", + " ['N', 'H'],\n", + " ['N', 'H2'],\n", + " ['CA', 'C'],\n", + " ['CA', 'CB'],\n", + " ['CA', 'HA'],\n", + " ['C', 'O'],\n", + " ['C', 'OXT'],\n", + " ['CB', 'CG'],\n", + " ['CB', 'HB2'],\n", + " ['CB', 'HB3'],\n", + " ['CG', 'OD1'],\n", + " ['CG', 'ND2'],\n", + " ['ND2', 'HD21'],\n", + " ['ND2', 'HD22'],\n", + " ['OXT', 'HXT']]},\n", + " {'atoms': ['N',\n", + " 'CA',\n", + " 'C',\n", + " 'O',\n", + " 'CB',\n", + " 'CG',\n", + " 'OD1',\n", + " 'ND2',\n", + " 'OXT',\n", + " 'H',\n", + " 'HN2',\n", + " 'HA',\n", + " '1HB',\n", + " '2HB',\n", + " '1HD2',\n", + " '2HD2',\n", + " 'HXT'],\n", + " 'bonds': [['N', 'CA'],\n", + " ['N', 'H'],\n", + " ['N', 'HN2'],\n", + " ['CA', 'C'],\n", + " ['CA', 'CB'],\n", + " ['CA', 'HA'],\n", + " ['C', 'O'],\n", + " ['C', 'OXT'],\n", + " ['CB', 'CG'],\n", + " ['CB', '1HB'],\n", + " ['CB', '2HB'],\n", + " ['CG', 'OD1'],\n", + " ['CG', 'ND2'],\n", + " ['ND2', '1HD2'],\n", + " ['ND2', '2HD2'],\n", + " ['OXT', 'HXT']]},\n", + " {'atoms': ['N',\n", + " 'H',\n", + " 'CA',\n", + " 'HA',\n", + " 'CB',\n", + " 'HB1',\n", + " 'HB2',\n", + " 'CG',\n", + " 'OD1',\n", + " 'ND2',\n", + " 'HD21',\n", + " 'HD22',\n", + " 'C',\n", + " 'O'],\n", + " 'bonds': [['N', 'H'],\n", + " ['N', 'CA'],\n", + " ['CA', 'HA'],\n", + " ['CA', 'CB'],\n", + " ['CA', 'C'],\n", + " ['CB', 'HB1'],\n", + " ['CB', 'HB2'],\n", + " ['CB', 'CG'],\n", + " ['CG', 'OD1'],\n", + " ['CG', 'ND2'],\n", + " ['ND2', 'HD21'],\n", + " ['ND2', 'HD22'],\n", + " ['C', 'O']]},\n", + " {'atoms': ['N',\n", + " 'HN',\n", + " 'CA',\n", + " 'HA',\n", + " 'CB',\n", + " 'HB1',\n", + " 'HB2',\n", + " 'CG',\n", + " 'OD1',\n", + " 'ND2',\n", + " 'HD21',\n", + " 'HD22',\n", + " 'C',\n", + " 'O'],\n", + " 'bonds': [['CB', 'CA'],\n", + " ['CG', 'CB'],\n", + " ['ND2', 'CG'],\n", + " ['N', 'HN'],\n", + " ['N', 'CA'],\n", + " ['C', 'CA'],\n", + " ['CA', 'HA'],\n", + " ['CB', 'HB1'],\n", + " ['CB', 'HB2'],\n", + " ['ND2', 'HD21'],\n", + " ['ND2', 'HD22'],\n", + " ['C', 'O'],\n", + " ['CG', 'OD1']]}]}" + ] + }, + "execution_count": 6, + "metadata": {}, + "output_type": "execute_result" } ], "source": [ - "check_comparison = msm.compare(molsys, view, attribute_type='topological', rule='equal')" + "msm.element.group.amino_acid.get_group_db('ASN')" ] }, { "cell_type": "code", - "execution_count": 6, - "id": "1b7496b3-afad-4dbd-abe8-5086cc2568e5", + "execution_count": 5, + "id": "fe9d44ed-2858-4e8e-a736-8a18fc3b671a", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ - "Warning! The group name LRT is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n", - "Warning! The group name YPL is reserved in the Protein Data Bank for a small molecule, not for an amino acid.\n" + "ASN ['N', 'CA', 'C', 'O', 'CB', 'CG', 'OD1', 'ND2', 'H1', 'H2', 'H3', 'HA', 'HB2', 'HB3', 'HD21', 'HD22'] [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15]\n" ] }, { - "data": { - "text/plain": [ - "['system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " 'system',\n", - " ...]" - ] - }, - "execution_count": 6, - "metadata": {}, - "output_type": "execute_result" + "ename": "TypeError", + "evalue": "'NoneType' object is not iterable", + "output_type": "error", + "traceback": [ + "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", + "\u001b[0;31mTypeError\u001b[0m Traceback (most recent call last)", + "Cell \u001b[0;32mIn[5], line 1\u001b[0m\n\u001b[0;32m----> 1\u001b[0m molsys \u001b[38;5;241m=\u001b[39m \u001b[43mmsm\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mconvert\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmolsys\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mto_form\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mmolsysmt.MolSys\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/repos@uibcdf/MolSysMT/molsysmt/_private/digestion/digest.py:122\u001b[0m, in \u001b[0;36mdigest..digestor..wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 120\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m func(all_args[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mself\u001b[39m\u001b[38;5;124m'\u001b[39m], \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mfinal_args)\n\u001b[1;32m 121\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 122\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mfinal_args\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/repos@uibcdf/MolSysMT/molsysmt/basic/convert.py:530\u001b[0m, in \u001b[0;36mconvert\u001b[0;34m(molecular_system, to_form, selection, structure_indices, syntax, verbose, skip_digestion, **kwargs)\u001b[0m\n\u001b[1;32m 528\u001b[0m \u001b[38;5;66;03m# If one to one\u001b[39;00m\n\u001b[1;32m 529\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;129;01mnot\u001b[39;00m \u001b[38;5;28misinstance\u001b[39m(from_form, (\u001b[38;5;28mlist\u001b[39m, \u001b[38;5;28mtuple\u001b[39m)):\n\u001b[0;32m--> 530\u001b[0m output \u001b[38;5;241m=\u001b[39m \u001b[43m_convert_one_to_one\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmolecular_system\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mfrom_form\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mto_form\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mto_form\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mselection\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mselection\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mstructure_indices\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstructure_indices\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 531\u001b[0m \u001b[43m \u001b[49m\u001b[43msyntax\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43msyntax\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mverbose\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mverbose\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mskip_digestion\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 533\u001b[0m \u001b[38;5;66;03m# If multiple to one\u001b[39;00m\n\u001b[1;32m 534\u001b[0m \n\u001b[1;32m 535\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[1;32m 536\u001b[0m \n\u001b[1;32m 537\u001b[0m \u001b[38;5;66;03m# conversions in private shortcuts\u001b[39;00m\n\u001b[1;32m 538\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mtuple\u001b[39m(\u001b[38;5;28msorted\u001b[39m(from_form)) \u001b[38;5;129;01min\u001b[39;00m _multiple_conversion_shortcuts:\n", + "File \u001b[0;32m~/repos@uibcdf/MolSysMT/molsysmt/basic/convert.py:87\u001b[0m, in \u001b[0;36m_convert_one_to_one\u001b[0;34m(molecular_system, from_form, to_form, selection, structure_indices, syntax, verbose, **kwargs)\u001b[0m\n\u001b[1;32m 84\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mlen\u001b[39m(missing_arguments)\u001b[38;5;241m>\u001b[39m\u001b[38;5;241m0\u001b[39m:\n\u001b[1;32m 85\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m NotCompatibleConversionError(from_form, to_form, missing_arguments)\n\u001b[0;32m---> 87\u001b[0m output \u001b[38;5;241m=\u001b[39m \u001b[43mfunction\u001b[49m\u001b[43m(\u001b[49m\u001b[43mmolecular_system\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mconversion_arguments\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 89\u001b[0m \u001b[38;5;28;01melif\u001b[39;00m (\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmolsysmt.MolSys\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;129;01min\u001b[39;00m _dict_modules[from_form]\u001b[38;5;241m.\u001b[39m_convert_to) \u001b[38;5;129;01mand\u001b[39;00m (to_form \u001b[38;5;129;01min\u001b[39;00m _dict_modules[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmolsysmt.MolSys\u001b[39m\u001b[38;5;124m'\u001b[39m]\u001b[38;5;241m.\u001b[39m_convert_to):\n\u001b[1;32m 91\u001b[0m output \u001b[38;5;241m=\u001b[39m _convert_one_to_one(molecular_system, from_form, to_form\u001b[38;5;241m=\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mmolsysmt.MolSys\u001b[39m\u001b[38;5;124m'\u001b[39m, selection\u001b[38;5;241m=\u001b[39mselection,\n\u001b[1;32m 92\u001b[0m structure_indices\u001b[38;5;241m=\u001b[39mstructure_indices, syntax\u001b[38;5;241m=\u001b[39msyntax, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs)\n", + "File \u001b[0;32m~/repos@uibcdf/MolSysMT/molsysmt/_private/digestion/digest.py:52\u001b[0m, in \u001b[0;36mdigest..digestor..wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 48\u001b[0m \u001b[38;5;129m@functools\u001b[39m\u001b[38;5;241m.\u001b[39mwraps(func)\n\u001b[1;32m 49\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrapper\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 51\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m kwargs\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mskip_digestion\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;28;01mFalse\u001b[39;00m):\n\u001b[0;32m---> 52\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 54\u001b[0m \u001b[38;5;66;03m# Define caller\u001b[39;00m\n\u001b[1;32m 56\u001b[0m caller \u001b[38;5;241m=\u001b[39m func\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__module__\u001b[39m\u001b[38;5;241m+\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m+\u001b[39mfunc\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\n", + "File \u001b[0;32m~/repos@uibcdf/MolSysMT/molsysmt/form/file_pdb/to_molsysmt_MolSys.py:11\u001b[0m, in \u001b[0;36mto_molsysmt_MolSys\u001b[0;34m(item, atom_indices, structure_indices, get_missing_bonds, skip_digestion)\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mmolsysmt_PDBFileHandler\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m to_molsysmt_MolSys \u001b[38;5;28;01mas\u001b[39;00m molsysmt_PDBFileHandler_to_molsysmt_MolSys\n\u001b[1;32m 10\u001b[0m tmp_item \u001b[38;5;241m=\u001b[39m to_molsysmt_PDBFileHandler(item, skip_digestion\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mTrue\u001b[39;00m)\n\u001b[0;32m---> 11\u001b[0m tmp_item \u001b[38;5;241m=\u001b[39m \u001b[43mmolsysmt_PDBFileHandler_to_molsysmt_MolSys\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtmp_item\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43matom_indices\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43matom_indices\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 12\u001b[0m \u001b[43m \u001b[49m\u001b[43mstructure_indices\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mstructure_indices\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 13\u001b[0m \u001b[43m \u001b[49m\u001b[43mget_missing_bonds\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mget_missing_bonds\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 14\u001b[0m \u001b[43m \u001b[49m\u001b[43mskip_digestion\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[38;5;28;43;01mTrue\u001b[39;49;00m\u001b[43m)\u001b[49m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m tmp_item\n", + "File \u001b[0;32m~/repos@uibcdf/MolSysMT/molsysmt/_private/digestion/digest.py:52\u001b[0m, in \u001b[0;36mdigest..digestor..wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 48\u001b[0m \u001b[38;5;129m@functools\u001b[39m\u001b[38;5;241m.\u001b[39mwraps(func)\n\u001b[1;32m 49\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21mwrapper\u001b[39m(\u001b[38;5;241m*\u001b[39margs, \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mkwargs):\n\u001b[1;32m 51\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m kwargs\u001b[38;5;241m.\u001b[39mget(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mskip_digestion\u001b[39m\u001b[38;5;124m'\u001b[39m, \u001b[38;5;28;01mFalse\u001b[39;00m):\n\u001b[0;32m---> 52\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43margs\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mkwargs\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 54\u001b[0m \u001b[38;5;66;03m# Define caller\u001b[39;00m\n\u001b[1;32m 56\u001b[0m caller \u001b[38;5;241m=\u001b[39m func\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__module__\u001b[39m\u001b[38;5;241m+\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;124m.\u001b[39m\u001b[38;5;124m'\u001b[39m\u001b[38;5;241m+\u001b[39mfunc\u001b[38;5;241m.\u001b[39m\u001b[38;5;18m__name__\u001b[39m\n", + "File \u001b[0;32m~/repos@uibcdf/MolSysMT/molsysmt/form/molsysmt_PDBFileHandler/to_molsysmt_MolSys.py:149\u001b[0m, in \u001b[0;36mto_molsysmt_MolSys\u001b[0;34m(item, atom_indices, structure_indices, get_missing_bonds, skip_digestion)\u001b[0m\n\u001b[1;32m 143\u001b[0m \u001b[38;5;28;01mdel\u001b[39;00m(atom_id_array, atom_name_array, group_index_array, chain_index_array,\n\u001b[1;32m 144\u001b[0m group_id_array, group_name_array, chain_name_array, occupancy_array,\n\u001b[1;32m 145\u001b[0m alternate_location_array, alt_atom_indices, aux_dict)\n\u001b[1;32m 147\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m get_missing_bonds:\n\u001b[0;32m--> 149\u001b[0m bonds \u001b[38;5;241m=\u001b[39m \u001b[43m_get_missing_bonds\u001b[49m\u001b[43m(\u001b[49m\u001b[43mtmp_item\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 150\u001b[0m bonds \u001b[38;5;241m=\u001b[39m np\u001b[38;5;241m.\u001b[39marray(bonds)\n\u001b[1;32m 151\u001b[0m tmp_item\u001b[38;5;241m.\u001b[39mtopology\u001b[38;5;241m.\u001b[39mreset_bonds(n_bonds\u001b[38;5;241m=\u001b[39mbonds\u001b[38;5;241m.\u001b[39mshape[\u001b[38;5;241m0\u001b[39m])\n", + "File \u001b[0;32m~/repos@uibcdf/MolSysMT/molsysmt/_private/digestion/digest.py:122\u001b[0m, in \u001b[0;36mdigest..digestor..wrapper\u001b[0;34m(*args, **kwargs)\u001b[0m\n\u001b[1;32m 120\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m func(all_args[\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mself\u001b[39m\u001b[38;5;124m'\u001b[39m], \u001b[38;5;241m*\u001b[39m\u001b[38;5;241m*\u001b[39mfinal_args)\n\u001b[1;32m 121\u001b[0m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[0;32m--> 122\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43mfunc\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[38;5;241;43m*\u001b[39;49m\u001b[43mfinal_args\u001b[49m\u001b[43m)\u001b[49m\n", + "File \u001b[0;32m~/repos@uibcdf/MolSysMT/molsysmt/build/get_missing_bonds.py:90\u001b[0m, in \u001b[0;36mget_missing_bonds\u001b[0;34m(molecular_system, threshold, selection, structure_index, syntax, engine, sorted, skip_digestion)\u001b[0m\n\u001b[1;32m 85\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m:\n\u001b[1;32m 86\u001b[0m aux_bonds \u001b[38;5;241m=\u001b[39m _bonds_in_unknown_group(molecular_system, atom_indices, atom_names,\n\u001b[1;32m 87\u001b[0m structure_index\u001b[38;5;241m=\u001b[39mstructure_index, threshold\u001b[38;5;241m=\u001b[39mthreshold,\n\u001b[1;32m 88\u001b[0m \u001b[38;5;28msorted\u001b[39m\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m)\n\u001b[0;32m---> 90\u001b[0m bonds \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m aux_bonds\n\u001b[1;32m 91\u001b[0m \u001b[38;5;28mprint\u001b[39m(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124msale\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 92\u001b[0m aux_peptidic_bonds_C[group_index]\u001b[38;5;241m=\u001b[39matom_indices[atom_names\u001b[38;5;241m.\u001b[39mindex(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mC\u001b[39m\u001b[38;5;124m'\u001b[39m)]\n", + "\u001b[0;31mTypeError\u001b[0m: 'NoneType' object is not iterable" + ] } ], "source": [ - "msm.get(view, element='atom', chain_type=True)" + "molsys = msm.convert(molsys, to_form='molsysmt.MolSys')" ] }, { "cell_type": "code", "execution_count": null, - "id": "25de8ca7-6e24-44b6-9458-8ed5965611f8", + "id": "a92a730a-cb94-41f9-acb3-87295cdd357c", "metadata": {}, "outputs": [], "source": [ - "check_comparison" + "msm.info(molsys)" ] }, { "cell_type": "code", "execution_count": null, - "id": "8343990e-0e26-4afe-b110-78d915015a51", + "id": "86ba7d52-06aa-4c56-ba01-9c374bf79786", "metadata": {}, "outputs": [], "source": [ - "check_comparison = msm.compare(molsys, view, comparison='info_no_form', rule='A_eq_B')\n", - "assert check_comparison" + " molsys = systems['Trp-Cage']['1l2y.pdb']\n", + " molsys = msm.convert(molsys, to_form='molsysmt.Structures')\n", + " molsys = msm.remove(molsys, structure_indices=range(1, 38))\n", + " df = msm.info(molsys)\n", + " true_dict = {'form': {0: 'molsysmt.Structures'},\n", + " 'n_atoms': {0: 304},\n", + " 'n_groups': {0: None},\n", + " 'n_components': {0: None},\n", + " 'n_chains': {0: None},\n", + " 'n_molecules': {0: None},\n", + " 'n_entities': {0: None},\n", + " 'n_structures': {0: 1}}\n", + " true_df = DataFrame(true_dict)\n", + " assert df.data.equals(true_df)\n" ] } ],