Skip to content

Commit

Permalink
in process
Browse files Browse the repository at this point in the history
  • Loading branch information
dprada committed Oct 17, 2023
1 parent 299e942 commit e5bbaf3
Show file tree
Hide file tree
Showing 9 changed files with 120 additions and 134 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ jobs:

shell: bash -l {0}
run: |
pytest -v --cov=molsysmt --cov-report=xml --color=yes molsysmt/tests/
pytest -n auto -v --cov=molsysmt --cov-report=xml --color=yes molsysmt/tests/
- name: CodeCov
uses: codecov/codecov-action@v1
Expand Down
4 changes: 4 additions & 0 deletions molsysmt/_private/digestion/argument/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def digest_selection(selection, syntax="MolSysMT", caller=None):
return list(selection)
else:
return list([digest_selection(ii, syntax=syntax, caller=caller) for ii in selection])
elif isinstance(selection, range):
return list(selection)
elif selection is None:
return None
else:
Expand All @@ -43,6 +45,8 @@ def digest_selection(selection, syntax="MolSysMT", caller=None):
return np.array([selection], dtype='int64')
elif isinstance(selection, (np.ndarray, list, tuple, range)):
return np.array(selection, dtype='int64')
elif isinstance(selection, range):
return list(selection)
elif selection is None:
return None

Expand Down
3 changes: 3 additions & 0 deletions molsysmt/structure/flip.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@ def flip(molecular_system, vector=[0,0,1], point='[0,0,0] nm', selection='all',
coordinates, length_unit = puw.get_value_and_unit(coordinates)
point = puw.get_value(point, to_unit=length_unit)

point = point[0]

coordinates = msmlib.structure.flip(coordinates, vector, point)

coordinates = puw.quantity(coordinates, unit=length_unit)


if in_place:

set(molecular_system, selection=selection, structure_indices=structure_indices,
Expand Down
59 changes: 29 additions & 30 deletions molsysmt/structure/least_rmsd_align.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
@digest()
def least_rmsd_align(molecular_system, selection='atom_name=="CA"', structure_indices='all',
reference_molecular_system=None, reference_selection=None, reference_structure_indices=0,
syntax='MolSysMT', method='sequence alignment and least rmsd fit',
syntax='MolSysMT',
engine_sequence_alignment = 'Biopython', engine_least_rmsd_fit = 'MolSysMT'):
"""
To be written soon...
Expand All @@ -17,47 +17,46 @@ def least_rmsd_align(molecular_system, selection='atom_name=="CA"', structure_in
if reference_selection is None:
reference_selection = selection

if method == 'sequence alignment and least rmsd fit':
from molsysmt.basic import select

from molsysmt.basic import select
if engine_sequence_alignment == 'Biopython':

if engine_sequence_alignment == 'Biopython':
from molsysmt.topology import get_sequence_identity

from molsysmt.topology import get_sequence_identity
identity, identical_groups, reference_identical_groups = get_sequence_identity(molecular_system,
selection=selection, reference_molecular_system=reference_molecular_system, reference_selection=reference_selection,
engine='Biopython')

identity, identical_groups, reference_identical_groups = get_sequence_identity(molecular_system,
selection=selection, reference_molecular_system=reference_molecular_system, reference_selection=reference_selection,
engine='Biopython')

else:
else:

raise NotImplementedMethodError
raise NotImplementedMethodError

aux_atoms_list = select(molecular_system, element='atom',
selection='group_index==@identical_groups')
selection_to_be_fitted = select(molecular_system, element='atom', selection=selection,
mask=aux_atoms_list)
components_selected = select(molecular_system, element='component', selection=selection)
atoms_in_components_selected = select(molecular_system, element='atom', selection='component_index==@components_selected')
aux_atoms_list = select(molecular_system, element='atom',
selection='group_index==@identical_groups')
selection_to_be_fitted = select(molecular_system, element='atom', selection=selection,
mask=aux_atoms_list)
components_selected = select(molecular_system, element='component', selection=selection)
atoms_in_components_selected = select(molecular_system, element='atom', selection='component_index==@components_selected')

aux_atoms_list = select(reference_molecular_system, element='atom', selection='group_index==@reference_identical_groups')
reference_selection_to_be_fitted = select(reference_molecular_system, element='atom',
selection=reference_selection, mask=aux_atoms_list)
aux_atoms_list = select(reference_molecular_system, element='atom', selection='group_index==@reference_identical_groups')
reference_selection_to_be_fitted = select(reference_molecular_system, element='atom',
selection=reference_selection, mask=aux_atoms_list)

del(aux_atoms_list, components_selected)
del(identity, identical_groups, reference_identical_groups)
del(aux_atoms_list, components_selected)
del(identity, identical_groups, reference_identical_groups)

if engine_least_rmsd_fit == 'MolSysMT':
if engine_least_rmsd_fit == 'MolSysMT':

from molsysmt.structure import fit
from molsysmt.structure import least_rmsd_fit

output = fit(molecular_system=molecular_system, selection=atoms_in_components_selected, selection_fit=selection_to_be_fitted,
structure_indices=structure_indices, reference_molecular_system=reference_molecular_system,
reference_selection_fit=reference_selection_to_be_fitted, reference_structure_indices=reference_structure_indices,
to_form=None, in_place=False, engine='MolSysMT', syntax=syntax)
output = least_rmsd_fit(molecular_system=molecular_system, selection=atoms_in_components_selected,
selection_fit=selection_to_be_fitted,
structure_indices=structure_indices, reference_molecular_system=reference_molecular_system,
reference_selection_fit=reference_selection_to_be_fitted, reference_structure_indices=reference_structure_indices,
to_form=None, in_place=False, engine='MolSysMT', syntax=syntax)

del(atoms_in_components_selected, selection_to_be_fitted, reference_selection_to_be_fitted)
del(structure_indices, reference_structure_indices)
del(atoms_in_components_selected, selection_to_be_fitted, reference_selection_to_be_fitted)
del(structure_indices, reference_structure_indices)

else:

Expand Down
Loading

0 comments on commit e5bbaf3

Please sign in to comment.