molsysmt.topology package#

Submodules#

molsysmt.topology.get_bondgraph module#

molsysmt.topology.get_bondgraph.get_bondgraph(molecular_system, nodes_name='atom_index', selection='all', syntax='MolSysMT', to_form='networkx.Graph')[source]#

Building a bond graph from a molecular system.

Parameters:
  • molecular_system (molecular system) – Input system in any supported form.

  • nodes_name ({'atom_index'}, default 'atom_index') – Label to use for nodes; currently only atom indices are supported.

  • selection (str, list, tuple or numpy.ndarray, default 'all') – Atom selection (MolSysMT syntax or indices) used to build the graph.

  • syntax (str, default 'MolSysMT') – Selection syntax when selection is a string.

  • to_form ({'networkx.Graph'}, default 'networkx.Graph') – Output graph type.

Returns:

Graph where nodes represent atoms and edges represent bonds.

Return type:

networkx.Graph

Raises:

NotImplementedError – If nodes_name or to_form is not supported.

Notes

  • Bonds are taken from inner_bonded_atom_pairs at the atom level.

Examples

>>> import molsysmt as msm
>>> from molsysmt import systems
>>> G = msm.topology.get_bondgraph(systems['pentalanine']['pentalanine.prmtop'])
>>> G.number_of_nodes() > 0
True

Added in version 1.0.0.

molsysmt.topology.get_covalent_blocks module#

molsysmt.topology.get_covalent_blocks.get_covalent_blocks(molecular_system, selection='all', remove_bonds=None, output_type='sets', syntax='MolSysMT')[source]#

Identifying covalent blocks (connected components) in a molecular system.

Parameters:
  • molecular_system (molecular system) – Input system in any supported form.

  • selection (str, list, tuple or numpy.ndarray, default 'all') – Atom selection used to build the bond graph.

  • remove_bonds (array-like, optional) – Bonds to remove before computing components (pairs of atom indices).

  • output_type ({'sets', 'numpy.ndarray'}, default 'sets') – Output format: a list of sets of atom indices, or an array labeling each atom with a component id.

  • syntax (str, default 'MolSysMT') – Selection syntax for string-based selections.

Returns:

Covalent blocks as sets or an array of component labels (one per atom).

Return type:

numpy.ndarray or list

Raises:

NotImplementedMethodError – If output_type is unsupported.

Notes

  • Builds a bond graph via get_bondgraph and returns its connected components.

Added in version 1.0.0.

molsysmt.topology.get_covalent_chains module#

molsysmt.topology.get_covalent_chains.get_covalent_chains(molecular_system, chain=None, selection='all', syntax='MolSysMT')[source]#

Building covalent chains given ordered selections for each position.

Parameters:
  • molecular_system (molecular system) – Input system.

  • chain (list of selections) – Ordered selections (per position) defining allowed atoms at each chain step.

  • selection (str, list, tuple or numpy.ndarray, default 'all') – Global atom filter applied before chain assembly.

  • syntax (str, default 'MolSysMT') – Selection syntax for string-based selections.

Returns:

Array of chains (lists of atom indices) satisfying connectivity across the positions.

Return type:

numpy.ndarray

Notes

  • Uses the bond graph to walk across allowed atoms at each position.

Added in version 1.0.0.

molsysmt.topology.get_dihedral_quartets module#

molsysmt.topology.get_dihedral_quartets.get_dihedral_quartets(molecular_system, with_blocks=False, selection='all', syntax='MolSysMT', **kwargs)[source]#

Finding atom quartets that define standard dihedral angles.

Parameters:
  • molecular_system (molecular system) – Input system.

  • with_blocks (bool, default False) – If True, also return covalent blocks after severing the central bond.

  • selection (str, list, tuple or numpy.ndarray, default 'all') – Atom selection to restrict the search.

  • syntax (str, default 'MolSysMT') – Selection syntax for string selections.

  • **kwargs – Flags indicating which dihedrals to compute (e.g., phi=True, psi=True, chi1=True, …).

Returns:

  • list – Quartets of atom indices for the requested dihedrals (list of lists).

  • list, optional – If with_blocks=True, covalent blocks per quartet after removing the central bond.

Notes

  • Uses get_covalent_chains to assemble quartets for each requested dihedral type.

Added in version 1.0.0.

molsysmt.topology.get_sequence_alignment module#

molsysmt.topology.get_sequence_alignment.get_sequence_alignment(molecular_system, selection='all', reference_molecular_system=None, reference_selection='all', engine='Biopython', syntax='MolSysMT', prettyprint=False, alignment_index=0, skip_digestion=False)[source]#

Aligning sequences between a query and reference molecular system.

Parameters:
  • molecular_system (molecular system) – Query system providing the sequence to align.

  • selection (str, list, tuple or numpy.ndarray, default 'all') – Group-level selection in the query system.

  • reference_molecular_system (molecular system, optional) – Reference system to align against.

  • reference_selection (str, list, tuple or numpy.ndarray, default 'all') – Group-level selection in the reference.

  • engine ({'Biopython'}, default 'Biopython') – Alignment engine.

  • syntax (str, default 'MolSysMT') – Selection syntax for string selections.

  • prettyprint (bool, default False) – If True, print a colorized alignment; if False, return aligned sequences.

  • alignment_index (int, default 0) – Alignment index to return when multiple alignments are produced.

  • skip_digestion (bool, default False) – Whether to skip argument digestion.

Returns:

(seq, seq_ref) aligned strings when prettyprint=False; otherwise prints and returns None.

Return type:

tuple of str or None

Raises:
  • NotImplementedError – If an unsupported engine is requested.

  • .. versionadded: – 1.0.0:

molsysmt.topology.get_sequence_identity module#

molsysmt.topology.get_sequence_identity.get_sequence_identity(molecular_system, selection='all', reference_molecular_system=None, reference_selection='all', syntax='MolSysMT', engine='Biopython')[source]#

Calculating sequence identity between two molecular systems.

Parameters:
  • molecular_system (molecular system) – Query system containing the sequence to compare.

  • selection (str, list, tuple or numpy.ndarray, default 'all') – Group-level selection in the query system (MolSysMT syntax or indices).

  • reference_molecular_system (molecular system, optional) – Reference system against which identity is computed.

  • reference_selection (str, list, tuple or numpy.ndarray, default 'all') – Group-level selection in the reference system.

  • syntax (str, default 'MolSysMT') – Selection syntax when using string selections.

  • engine ({'Biopython'}, default 'Biopython') – Alignment engine to use.

Returns:

  • float – Sequence identity percentage (0–100).

  • list of int – Group indices in the query sequence that matched.

  • list of int – Group indices in the reference sequence that matched.

Raises:

NotImplementedError – If an unsupported engine is requested.

Notes

  • Uses get_sequence_alignment to align the two selections and counts identical, aligned positions.

Added in version 1.0.0.

Module contents#