Get sequence alignment#

Computing the amino acid or nucleotide sequence alignment between molecular systems.

The function molsysmt.topology.get_sequence_alignment() aligns sequences extracted from polymer chains across two molecular systems using pairwise sequence alignment algorithms.

Added in version 1.0.0.

Basic usage#

Let’s show how to align sequences of T4 lysozyme variants (PDB IDs: 181L and 1L17):

import molsysmt as msm
molsys_1 = msm.convert('pdb_id:181l', to_form='molsysmt.MolSys')
molsys_2 = msm.convert('pdb_id:1l17', to_form='molsysmt.MolSys')

We inspect the residue counts for both protein structures using molsysmt.basic.get():

msm.get(molsys_1, element='atom', selection='molecule_type=="protein"', n_groups=True)
162
msm.get(molsys_2, element='atom', selection='molecule_type=="protein"', n_groups=True)
164

We display the prettyprinted sequence alignment using molsysmt.topology.get_sequence_alignment():

msm.topology.get_sequence_alignment(molsys_1, selection='molecule_type=="protein"',
                                    reference_molecular_system=molsys_2, reference_selection='molecule_type=="protein"',
                                    prettyprint=True)
MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSELDKAIGRNTNGVITKDEAEKLFNQDVDAAVRGILRNAKLKPVYDSLDAVRRAAAINMVFQMGETGVAGFTNSLRMLQQKRWDEAAVNLAKSRWYNQTPNRAKRVITTFRTGTWDAYK--

MNVFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSELDKAIGRNCNGVITKDEAEKLFNQDVDAAVRGILRNAKLKPVYDSLDAVRRCALINMVFQMGETGVAGFTNSLRMLQQKRWDEAAVNLAKSRWYNQTPNRAKRVITTFRTGTWDAYKNL

Alternatively, we can retrieve the aligned sequence strings as a tuple:

seq, seq_ref = msm.topology.get_sequence_alignment(molsys_1, selection='molecule_type=="protein"',
                                    reference_molecular_system=molsys_2, reference_selection='molecule_type=="protein"')
seq
'MNIFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSELDKAIGRNTNGVITKDEAEKLFNQDVDAAVRGILRNAKLKPVYDSLDAVRRAAAINMVFQMGETGVAGFTNSLRMLQQKRWDEAAVNLAKSRWYNQTPNRAKRVITTFRTGTWDAYK--'
seq_ref
'MNVFEMLRIDEGLRLKIYKDTEGYYTIGIGHLLTKSPSLNAAKSELDKAIGRNCNGVITKDEAEKLFNQDVDAAVRGILRNAKLKPVYDSLDAVRRCALINMVFQMGETGVAGFTNSLRMLQQKRWDEAAVNLAKSRWYNQTPNRAKRVITTFRTGTWDAYKNL'