schrodinger.livedesign.bbchem_endpoints module

Collection of functions intended as bbchem web endpoints.

Copyright Schrodinger, LLC. All rights reserved.

schrodinger.livedesign.bbchem_endpoints.split_data_blocks(data: str, input_format: schrodinger.rdkit_extensions.Format, options: Optional[schrodinger.livedesign.registration.RegistrationOptions] = None)

Iterates across serialized formats, yielding a single data block at a time. Supports iterating across SD, Maestro, and FASTA files; other formats are returned as a single block. NOTE: if a FASTA mapping is set on the registration options, the FASTA is parsed as a single block.

Parameters
  • data – input text string

  • input_format – input format of the data

  • options – registration options

Returns

an iterator of data blocks

schrodinger.livedesign.bbchem_endpoints.to_registration_data(data: str, input_format: schrodinger.rdkit_extensions.Format, options: Optional[schrodinger.livedesign.registration.RegistrationOptions] = None) Iterator[Union[schrodinger.livedesign.registration.RegistrationData, Exception]]

Generalizes small molecule and biologics registration processes, returning all data LiveDesign stores in it’s internal databases. This includes returning rdmol binaries directly as for each entity. Output includes properties from the input mol, computed properties, and potentially any child data of derived virtuals.

schrodinger.livedesign.bbchem_endpoints.to_format(mol_input: str, input_format: schrodinger.rdkit_extensions.Format, output_format: schrodinger.rdkit_extensions.Format, additional_properties: Optional[Dict] = None) str

Main entrypoint for converting to a serialized text format.

Parameters
  • mol_input – serialized mol

  • input_format – input format of the mol string

  • output_format – desired format for output string

  • additional_properties – property data to include on serialization

Returns

converted text string

schrodinger.livedesign.bbchem_endpoints.to_image(mol_input: str, fallback_entity: Optional[schrodinger.livedesign.entity_type.EntityClass] = None, options: Optional[schrodinger.livedesign.draw.ImageGenOptions] = None) bytes

Generates an image from a serialized input string

Parameters
  • mol_input – serialized mol

  • fallback_entity – entity class to use for a fallback image

  • options – image generation options

Returns

generated image SVG or PNG bytes

schrodinger.livedesign.bbchem_endpoints.to_fingerprint(mol_input: str, use: schrodinger.livedesign.search.FingerprintUse, substructure_options: Optional[schrodinger.rdkit.substructure.QueryOptions] = None) rdkit.DataStructs.cDataStructs.ExplicitBitVect

Generates a substructure or similarity fingerprint for a given mol.

Parameters
  • mol_input – serialized mol

  • use – type of fingerprint to generate

  • substructure_options – substructure matching options

schrodinger.livedesign.bbchem_endpoints.num_substructure_matches(*args, **kwargs) int
Returns

number of substructure/subsequence matches

schrodinger.livedesign.bbchem_endpoints.has_substructure_match(*args, **kwargs) bool
Returns

whether any substructure/subsequence match was found

schrodinger.livedesign.bbchem_endpoints.to_sequence_viewer_data(mol_binary_str: str, scheme: schrodinger.infra.util.AntibodyCDRScheme = AntibodyCDRScheme.Kabat) Dict[str, Dict]
Returns

biologics sequence viewer data for the given mol

schrodinger.livedesign.bbchem_endpoints.generate_image(mol: rdkit.Chem.rdchem.Mol, alignment_mol: Optional[rdkit.Chem.rdchem.Mol] = None, substructure_options: Optional[schrodinger.rdkit.substructure.QueryOptions] = None, highlight_mol: Optional[rdkit.Chem.rdchem.Mol] = None, draw_options: Optional[schrodinger.livedesign.draw.ImageGenOptions] = None) bytes

Generates an image used in LiveDesign which may have a request for compound alignment, or substructure highlighting, or both.

Parameters
  • mol – compound to generate an image of

  • alignment_mol – molecule to align to prior to image generation

  • substructure_options – substructure matching options

  • highlight_mol – core to highlight in generated image

  • draw_options – image generation options

Returns

generated image as a string

schrodinger.livedesign.bbchem_endpoints.generate_sar_analysis_image(match_mol: rdkit.Chem.rdchem.Mol, scaffold_mol: rdkit.Chem.rdchem.Mol, substructure_options: Optional[schrodinger.rdkit.substructure.QueryOptions] = None, draw_options: Optional[schrodinger.livedesign.draw.ImageGenOptions] = None) bytes

Generates an image used in LiveDesign that is specifically from SAR analysis output, highlighting the core and all r-groups from the decomposition.

Parameters
  • match_mol – source molecule for R-group decomposition to highlight and generate image of

  • scaffold_mol – scaffold molecule on which to find R-groups

  • substructure_options – substructure matching options

  • draw_options – image generation options

Returns

generated image as a string

schrodinger.livedesign.bbchem_endpoints.pop_properties(mol: rdkit.Chem.rdchem.Mol) dict
Parameters

mol – molecule to extract, then clear all properties from

Returns

map of all removed properties as strings

schrodinger.livedesign.bbchem_endpoints.set_properties(mol: rdkit.Chem.rdchem.Mol, new_props: dict)
Parameters
  • mol – molecule to clear, then set given properties on

  • new_props – map of properties to add onto the molecule

schrodinger.livedesign.bbchem_endpoints.split_fragments(mol: rdkit.Chem.rdchem.Mol)
Param

input molecule

Returns

iterable containing each fragment mol

schrodinger.livedesign.bbchem_endpoints.enumerate_stereoisomers(mol: rdkit.Chem.rdchem.Mol, max_stereoisomers: int = 512) Iterator[rdkit.Chem.rdchem.Mol]

Generates stereoisomers from a specified SDF structure string.

Parameters
  • structure – structure from which to generate stereoisomers

  • max_stereoisomers – maximum number of stereoisomers to generate

Returns

generated stereoisomers

schrodinger.livedesign.bbchem_endpoints.rgroup_decompose(scaffold_mol: rdkit.Chem.rdchem.Mol, match_mol: rdkit.Chem.rdchem.Mol, options: Optional[schrodinger.rdkit.substructure.QueryOptions] = None) List[dict]

Decomposes a molecule into its core and R-groups given a scaffold

Parameters
  • scaffold_mol – scaffold molecule on which to find R-groups

  • match_mol – source molecule for R-group decomposition

  • stereospecific – whether to consider bond stereochemistry and atom chirality of scaffold

Returns

list of dicts of R-group matches

schrodinger.livedesign.bbchem_endpoints.get_rgroup_labels(scaffold_mol: rdkit.Chem.rdchem.Mol) List[str]
Parameters

scaffold_mol – scaffold molecule

Returns

R-group labels present on the scaffold

schrodinger.livedesign.bbchem_endpoints.check_reaction(rxn_input: str) schrodinger.livedesign.check_reaction.RxnCheckResult
schrodinger.livedesign.bbchem_endpoints.setup_reaction(rxn_input: str) str

Tidy up and convert user sketched reactions into a format that can be used for reaction enumeration.

Parameters

rxn_input – a RXNBlock or RXNSMARTS describing the user’s reaction.

Returns

a SMARTS string describing the cleaned up reaction

schrodinger.livedesign.bbchem_endpoints.run_reaction(rxn_input: str, reactant_lists: List[List[str]], max_products: int = None, property_filters: dict = None) Iterator[str]

Execute a reaction on one or more sets of reagents

Basically, each “reaction” can have one or more than reagents, and could be run on one or more sets of reagents.

Parameters
  • rxn_input – reaction definition in any supported format, such as RXN or reaction SMARTS.

  • reactant_lists – lists of reactants in any supported format, such as MOL or SMILES. Each list has to have the correct length, matching the number of reactant templates used by the reaction.

  • max_products – yield at most this many unique products. If not provided, all products are returned without limit or deduplication. (The canonical SMILES is used as the key.)

  • property_filters – dictionary with JSON data describing the property filters, with the schema expected by schrodinger.ui.qt.filter_dialog_dir.filter_core.Filter.

Returns

generator of products in SDF format.

schrodinger.livedesign.bbchem_endpoints.get_PLDB_SMARTS(smiles: str) Tuple[str, List]

Generates SMARTS from the given mol with a unique atom map number on each atom, which PLDB uses to indicate canonical atom indices. Also collects which of those indices are marked with the SKETCHER_SELECTED_PROP to return a list of the indices of all sketcher-selected atoms.

Parameters

mol – input SMILES

Returns

(PLDB compatible SMARTS pattern, list of selected atom indices)

schrodinger.livedesign.bbchem_endpoints.get_json_formatted_structure_hierarchy(mol_input: str, input_format: schrodinger.rdkit_extensions.Format) str

Generates a JSON string representing the structure hierarchy of the molecule. This is used by LiveDesign to display the structure hierarchy viewer for the molecule and its components.

Note that this only process the first structure in the given string.

Parameters
  • mol_input – serialized mol

  • input_format – input format of the mol string

Returns

JSON string representing the structure hierarchy