schrodinger.protein.mafft_utils module

schrodinger.protein.mafft_utils.set_mafft_environment()

Sets the required mafft binaries environment variable required to run mafft on unix systems.

schrodinger.protein.mafft_utils.get_mafft_path(mafft_exe: str) str | None

Returns the path to the mafft executable file. Using any mafft binaries requires to be done within the set_mafft_environment context manager if MAFFT_BINARIES env variable is not custom set.

Parameters:

mafft_exe – the executable file included in the mafft library

Return type:

str

Returns:

path to mafft executable file

Raises:

RuntimeError – if no mafft executable file can be found

schrodinger.protein.mafft_utils.generate_allowed_hex_codes(exclude_hex_codes: list[str]) list[str]

Generates a list of 2-digit lowercase hexadecimal strings for integers from 1 to 255, excluding any hex codes present in the exclude_hex_codes list.

schrodinger.protein.mafft_utils.map_residue_names_to_hex(seqs: list[ProteinSequence]) dict[str, str]

Maps unique residue names in given sequences to hex code. Returns a dictionary mapping residue name (str) to hex string (str).

Parameters:

seqs – List of protein sequences.

class schrodinger.protein.mafft_utils.MafftHexReader

Bases: object

A class to read and write MAFFT hex files and extract seqeunces hex codes.

classmethod read(file_name: str)

Read a MAFFT hex file and extract sequences as hex codes.

class schrodinger.protein.mafft_utils.MafftHexWriter

Bases: object

A class to write sequences to a MAFFT hex file.

classmethod write(file_name: str, sequences: list[ProteinSequence], residue_mapper: dict[str, str])

Write sequences to a MAFFT hex file. Residue names are converted to hex codes using the provided mapper.