get_matrix_from_profile#

biotite.application_v2.mmseqs.get_matrix_from_profile(app: MMseqsApp, profile_db: ProfileDatabase[MMseqsApp]) → list[SubstitutionMatrix[Any, Any]][source]#

Get a position-specific scoring matrix for each profile in a database.

Parameters:
appMMseqsApp

The application to use.

profile_dbProfileDatabase

The database to read.

Returns:
matriceslist of SubstitutionMatrix

One matrix per profile, in the order the profiles appear in the database. The first alphabet is the alphabet of a PositionalSequence over the consensus sequence of the profile, the second one is the standard protein alphabet.

Notes

MMseqs2 scores only the 20 canonical amino acids, hence the columns of the ambiguous and stop symbols are zero. For the same reason only profiles of protein sequences are supported: the application emits amino acid columns even for a nucleotide profile.

Examples

>>> app = MMseqsApp()
>>> database = app.create_db(path_to_sequences / "cas9.fasta").result()
>>> hits = app.search(database, database, threads=1).result()
>>> profiles = app.result_to_profile(hits, threads=1).result()
>>> matrix = get_matrix_from_profile(app, profiles)[0]
>>> print(matrix.shape)
(1368, 24)
>>> # One symbol per profile column, shown as the consensus residue
>>> print([str(symbol) for symbol in matrix.get_alphabet1().get_symbols()[:10]])
['M', 'K', 'K', 'P', 'Y', 'S', 'I', 'G', 'L', 'D']
>>> # The protein alphabet
>>> print(matrix.get_alphabet2())
('A', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S',
 'T', 'V', 'W', 'Y', 'B', 'Z', 'X', '*')