schrodinger.livedesign.biologics.sequence module

class schrodinger.livedesign.biologics.sequence.AlignedSequence(sequence: 'str', natural_analog_sequence: 'str' = None, identity: 'float' = None, similarity: 'float' = None)

Bases: object

sequence: str
natural_analog_sequence: str = None
identity: float = None
similarity: float = None
static fromProteinSequence(seq: ProteinSequence, ref_seq: ProteinSequence = None, nonstandard_symbol='X')
__init__(sequence: str, natural_analog_sequence: str = None, identity: float = None, similarity: float = None) None
class schrodinger.livedesign.biologics.sequence.AlignedMulticharSequence(sequence: List[str], identity: float = None, similarity: float = None)

Bases: object

Aligned sequence with multi-character residue codes.

sequence: List[str]
identity: float = None
similarity: float = None
static fromProteinSequence(seq: ProteinSequence, ref_seq: ProteinSequence = None, nonstandard_symbol='X')
__init__(sequence: List[str], identity: float = None, similarity: float = None) None
schrodinger.livedesign.biologics.sequence.get_connection_data(mol: Mol) List[Dict[str, Any]]

Get non-backbone connection data from a RDMol as a list of dictionaries.

Parameters:

mol – rdmol to extract connection data from

Returns:

a list of dictionaries containing connection data, where each dictionary describes a connection

schrodinger.livedesign.biologics.sequence.get_sequence_viewer_data(mol: Mol, scheme: AntibodyCDRScheme = AntibodyCDRScheme.Kabat)
Parameters:

mol – rdmol to extract sequence data from

Returns:

a map from polymer id to a dictionary mapping antibody regions to monomer indices in the corresponding simple polymer

Raises:

RuntimeError – if the molecule contains nonlinear peptides

schrodinger.livedesign.biologics.sequence.get_chain_id_by_polymer_id(model: HelmModel) Dict[str, str]

Returns a mapping from polymer id to chain id for a given HelmModel.

Parameters:

model – the HelmModel to extract chain ids from

Returns:

a mapping from polymer id to chain id

schrodinger.livedesign.biologics.sequence.get_annotations_for_helm_model(model: HelmModel, scheme: AntibodyCDRScheme) Dict[str, Dict[str, Union[Tuple[int, int], List[str]]]]

HelmModels reorder polymer chains to canonicalize input, which means that the same polymer can have two different polymer ids in two models if those two models contain different peptide polymers. This function goes back through a HELM model and computes the mapping between each antibody chains and its constituent region annotation.

Parameters:
  • model – HelmModel to extract annotations for

  • scheme – the antibody numbering scheme to use for annotation

Returns:

a map from polymer id to a dictionary mapping antibody regions to monomer indices in the corresponding simple polymer.

schrodinger.livedesign.biologics.sequence.get_sequence_filter_chain_name(entity_class: EntityClass) str

Simplify chain names presented in the sequence viewer filter combobox

Parameters:

entity_class – the entity class of the given polymer chain

Returns:

chain name to label the given entity’s sequence viewer data

schrodinger.livedesign.biologics.sequence.get_polymer_annotations(polymer: HelmPolymer, scheme: AntibodyCDRScheme) Dict[str, Union[Tuple[int, int], List[str]]]

Returns the sequence annotations for a HelmPolymer.

schrodinger.livedesign.biologics.sequence.get_monomer_data(polymer: HelmPolymer) dict[str, dict[str, Any]]

Returns a list of dictionaries containing monomer information for each monomer in the polymer.

schrodinger.livedesign.biologics.sequence.get_ab_annotations(fasta_sequence: str, scheme: AntibodyCDRScheme) Dict[str, Union[Tuple[int, int], List[str]]]

Cheap cache wrapper around antibody.SeqType to reduce the cost of calling get_annotations for each RegistrationData object.

schrodinger.livedesign.biologics.sequence.split_by_hierarchy(region_dict: Dict[str, List[int]]) Dict[str, Dict[str, List[int]]]

Splits a region dictionary into a dictionary of antibody domain boundaries (e.g., VH, CH1) and a dictionary of subdomain boundaries (e.g. HFR1, H1).

schrodinger.livedesign.biologics.sequence.get_arm_indices(model: HelmModel) Dict[str, int]

Returns a mapping from polymer id to arm pairs. If no arm pairing is provided, assignes a unique arm pair to each polymer id.

schrodinger.livedesign.biologics.sequence.align_helm_polymer_sequences(sequences: List[HelmPolymer], align_mode=SeqAlnMode.Multiple, ref_seq_index: Optional[int] = None, gap_open_penalty=None, gap_extend_penalty=None, substitution_matrix: Optional[Dict[Tuple[str, str], int]] = None) List[AlignedSequence]

Returns aligned sequences as a FASTA string.

Parameters:
  • sequences – sequences to align

  • ref_seq_index – if not None, all sequences are pairwise aligned using the sequence at ref_seq_index as a reference sequence

  • polymer_type – the type of polymer to align (Default: PEPTIDE)

  • substitution_matrix – optional custom substitution matrix for pairwise alignment, as a dict mapping (char, char) pairs to scores. If None, defaults to BLOSUM62 for peptides or BLASTN for nucleotides.

Returns:

FASTA string of the aligned sequences

schrodinger.livedesign.biologics.sequence.align_sequences(sequences: List[str], natural_analog_sequences: List[str] = None, align_mode=SeqAlnMode.Multiple, ref_seq_index: Optional[int] = None, polymer_type=PolymerType.PEPTIDE, gap_open_penalty=None, gap_extend_penalty=None, substitution_matrix: Optional[Dict[Tuple[str, str], int]] = None, numbering_scheme: Optional[str] = None) List[AlignedSequence]

Returns aligned sequences as a FASTA string.

Parameters:
  • sequences – sequences to align

  • ref_seq_index – if not None, all sequences are pairwise aligned using the sequence at ref_seq_index as a reference sequence

  • polymer_type – the type of polymer to align (Default: PEPTIDE)

  • substitution_matrix – optional custom substitution matrix for pairwise alignment, as a dict mapping (char, char) pairs to scores. If None, defaults to BLOSUM62 for peptides or BLASTN for nucleotides.

  • numbering_scheme – antibody CDR numbering scheme name. Only used when align_mode is SeqAlnMode.CdrAlignment. One of: Chothia, Kabat, IMGT, EnhancedChothia, AHo

Returns:

FASTA string of the aligned sequences

schrodinger.livedesign.biologics.sequence.align_multichar_sequences(sequences: List[List[str]], align_mode: SeqAlnMode = SeqAlnMode.Multiple, ref_seq_index: Optional[int] = None, polymer_type: PolymerType = PolymerType.PEPTIDE, gap_open_penalty: Optional[float] = None, gap_extend_penalty: Optional[float] = None, substitution_matrix: Optional[Dict[Tuple[str, str], int]] = None) List[AlignedMulticharSequence]

Aligns sequences specified as multi-character residue codes.

This is similar to align_sequences but accepts sequences as lists of residue codes of any length (e.g. ['ALA', 'SEP', 'GLY'] or ['ALA', 'meA', 'GLY']), which allows nonstandard residues to be represented. When using pairwise alignment, nonstandard residue support is enabled so that different nonstandard residues are distinguished from each other during alignment.

Parameters:
  • sequences – sequences to align, each as a list of residue codes

  • align_mode – alignment mode (Multiple or Pairwise). CdrAlignment is not supported for multi-character code input.

  • ref_seq_index – if not None, all sequences are pairwise aligned using the sequence at ref_seq_index as a reference sequence

  • polymer_type – the type of polymer to align (Default: PEPTIDE)

  • gap_open_penalty – override for the gap open penalty

  • gap_extend_penalty – override for the gap extend penalty

  • substitution_matrix – optional custom substitution matrix for pairwise alignment, as a dict mapping (code, code) pairs to scores

Returns:

aligned sequences as AlignedMulticharSequence objects

schrodinger.livedesign.biologics.sequence.make_alignment_seq_with_analogs(seq: str, natural_analog_seq: str, polymer_type: PolymerType, substitution_matrix_codes: Optional[set] = None) ProteinSequence

Returns a ProteinSequence with nonstandard monomers replaced with their natural analogs.

Parameters:
  • seq – sequence to replace nonstandard monomers in

  • natural_analog_seq – sequence of natural analog codes

  • polymer_type – the type of polymer to align

  • substitution_matrix_codes – optional set of codes present in a custom substitution matrix, passed through to get_res_type()

schrodinger.livedesign.biologics.sequence.get_res_type(monomer: str, analog_code: str, polymer_type: PolymerType, substitution_matrix_codes: Optional[set] = None) ResidueType

Returns the ResidueType for a given monomer id, using one-letter codes.

Parameters:
  • monomer – the monomer id to get the residue type for

  • analog_code – single-letter code of the natural analog

  • polymer_type – the type of polymer to align

  • substitution_matrix_codes – optional set of codes present in a custom substitution matrix. When provided, nonstandard monomers whose codes appear in this set will use their own code for alignment scoring instead of being collapsed to ‘X’.

schrodinger.livedesign.biologics.sequence.align_all_to_reference(aln: ProteinAlignment, ref_seq_index: int, align_settings: AlignSettingsModel, support_nonstandard_res: bool = False) None

Aligns a given ProteinAlignment pairwise with respect to the specified reference sequence. Due to the way alignments were implemented, (see protein.alignment.BaseAlignment) ref_seq must be a sequence already in the alignment. The input ProteinAlignment is modified and not returned.

Parameters:
  • aln – the alignment to be aligned

  • ref_seq_index – index corresponding to the reference sequence

  • align_settings – settings for the alignment

  • support_nonstandard_res – when True, use long codes for nonstandard residues during alignment so different nonstandard residues are distinguished from each other

schrodinger.livedesign.biologics.sequence.multiple_align(aln: ProteinAlignment, align_settings: AlignSettingsModel) None

Aligns a given ProteinAlignment via multiple sequence alignment. The input ProteinAlignment is modified and not returned.

Parameters:

aln – the alignment to be aligned

schrodinger.livedesign.biologics.sequence.get_fasta_monomers(model: HelmModel) List[List[HelmMonomer]]

Returns a list of sequences of monomers from a given HelmModel. Only monomers that are FASTA-compatible (nucleotides and amino acids) are included in the output.

Parameters:

model – the HelmModel to get the monomers from