schrodinger.application.matsci.custom_lipid_prep module

Custom Lipid Preparation module

Copyright Schrodinger, LLC. All rights reserved.

exception schrodinger.application.matsci.custom_lipid_prep.CustomLipidPrepException

Bases: Exception

Exception raised when a validation stage of the custom lipid prep module fails

schrodinger.application.matsci.custom_lipid_prep.lipid_is_phospholipid(lipid_st)

Check if molecule is a phospholipid

Parameters:

lipid_st (structure.Structure) – Structure of lipid

Return type:

bool

Returns:

True if lipid is a phospholipid; False otherwise

schrodinger.application.matsci.custom_lipid_prep.input_is_lipid(lipid_st)

Check if the input molecule is a lipid with the criterion of finding a 12-carbon chain. Unfortunately, this is not foolproof.

Parameters:

lipid_st (structure.Structure) – Structure of lipid

Return type:

bool

Returns:

True if input structure is a lipid; False otherwise

schrodinger.application.matsci.custom_lipid_prep.validate_input_type(lipid_st, lipid_smiles, lipid_name)

Make sure that only one input is provided for the custom lipid, a SMILES string or a structure file

Parameters:
  • lipid_st (None or structure.Structure) – Lipid structure file

  • lipid_name (str) – Lipid SMILES

  • lipid_name – Name ascribed to input structure

Raises:

CustomLipidPrepException – If both SMILES and structure are input or if neither are

schrodinger.application.matsci.custom_lipid_prep.validate_lipid_struct(include_nonlipids, lipid_st, lipid_name)

If input structure is not a lipid, continue only if include_nonlipids option is True

Parameters:
  • include_nonlipids (bool) – True to include non-lipids; False otherwise

  • lipid_st (structure.Structure) – Input structure

  • lipid_name (str) – Name ascribed to input structure

Raises:

CustomLipidPrepException – If the custom lipid is not a lipid and we are not including non-lipids

schrodinger.application.matsci.custom_lipid_prep.validate_phospholipid_struct(include_nonphospholipids, lipid_st, lipid_name)

If lipid is not a phospholipid, continue only if include_nonphospholipids option is True

Parameters:
  • include_nonphospholipids (bool) – True to include non-phospholipids; False otherwise

  • struct (structure.Structure) – Input structure

  • lipid_name (str) – Name assigned to input lipid structure

Raises:

CustomLipidPrepException – If the custom lipid is not a phospholipid and we are not including non-phospholipids

schrodinger.application.matsci.custom_lipid_prep.validate_smiles(lipid_st, lipid_smiles, lipid_name)

Validate a smiles string

Parameters:
  • lipid_st (None or structure.Structure) – Input structure

  • lipid_smiles (None or str) – SMILES string

  • lipid_name (str) – Name assigned to input lipid structure

Raises:

CustomLipidPrepException – If the SMILES input is not valid

schrodinger.application.matsci.custom_lipid_prep.validate_stretching_option(stretching_option, lipid_smiles, cis_option, ccenter_r_option, lipid_name)

Validate stretching option, which must be True if input is SMILES or stereochemistry options are defined

Parameters:
  • stretching_option (bool) – True to stretch the lipid using fast3D; False otherwise

  • lipid_smiles (None or str) – SMILES string

  • cis_option (bool or None) – How and if to assign stereochemistry. None if stereochemistry shouldn’t be assigned; True if cis; False if trans.

  • ccenter_r_option (bool or None) – How and if to assign chirality to chiral centers. None if chirality shouldn’t be assigned; True if R-chiral; False if S- chiral.

  • lipid_name (str) – Name assigned to input lipid structure

Raises:

CustomLipidPrepException – If stretching is turned off but SMILES is input, and if stretching is turned off but stereochemistry is defined

schrodinger.application.matsci.custom_lipid_prep.validate_renumbering_option(renumbering_option, is_phospholipid, lipid_name)

Validate renumbering option, which can only be done if the lipid is a phospholipid

Parameters:
  • renumbering_option (bool) – True to renumber the lipid; False otherwise

  • is_phospholipid (bool) – True if the custom lipid is a phospholipid

  • lipid_name (str) – Name assigned to input lipid structure

Raises:

CustomLipidPrepException – If renumbering is on and the custom lipid is not a phospholipid because only phospholipids can be appropriately renumbered right now

schrodinger.application.matsci.custom_lipid_prep.validate_custom_lipid_name(custom_lipid_name)

Validate custom lipid name

Parameters:

custom_lipid_name (str) – Name of the custom lipid

Raises:

CustomLipidPrepException – If the custom lipid name has more than four characters

class schrodinger.application.matsci.custom_lipid_prep.CustomLipidPrep(custom_lipid_name, lipid_st, lipid_smiles=None, cis=True, ccenter_r=True, include_nonphospholipids=True, include_nonlipids=False, stretch=True, renumber=True, set_pdbres=True, logger=None)

Bases: object

Class to prepare custom lipid

__init__(custom_lipid_name, lipid_st, lipid_smiles=None, cis=True, ccenter_r=True, include_nonphospholipids=True, include_nonlipids=False, stretch=True, renumber=True, set_pdbres=True, logger=None)

Initialize the custom lipid preparation module

Parameters:
  • custom_lipid_name (str) – 4-character name for custom lipid

  • lipid_st (structure.Structure or None) – Custom Lipid structure. If None, lipid_smiles should be defined.

  • lipid_smiles (str or None) – Custom Lipid SMILES string. If lipid_st is defined, this will be ignored

  • cis (bool or None) – True means to make cis double bonds. False means to make trans double bonds. None means to ignore double bond stereochemistry

  • ccenter_r (bool or None) – True means to make R-chiral chiral centers. False means to make S-chiral chiral centers. None means to ignore chirality of chiral centers

  • include_nonphospholipids (bool) – True to include non-phospholipids; False otherwise

  • include_nonlipids (bool) – True to include non-lipids; False otherwise

  • stretch (bool) – True means to run fast 3D and generate the optimal, stretched structure; False otherwise

  • renumber (bool) – True means to conduct the renumbering of phospholipids; False otherwise

  • set_pdbres (bool) – True means to set the s_m_pdb_residue_name; False otherwise

  • logger (logging.Logger) – The logger imported from a driver

run()

Run the custom lipid preparation

static validateAllOptions(custom_lipid_name, lipid_st, lipid_smiles, cis, ccenter_r, include_nonphospholipids, include_nonlipids, stretch, renumber, set_pdbres=True)

Validate all arguments.

Parameters:
  • custom_lipid_name (str) – 4-character name for custom lipid

  • lipid_st (structure.Structure or None) – Custom Lipid structure. If None, lipid_smiles should be defined.

  • lipid_smiles (str or None) – Custom Lipid SMILES string. If lipid_st is defined, this will be ignored

  • cis (bool or None) – True means to make cis double bonds. False means to make trans double bonds. None means to ignore double bond stereochemistry

  • ccenter_r (bool or None) – True means to make R-chiral (CW) chiral centers. False means to make S-chiral (CCW) chiral centers. None means to ignore chirality of chiral centers

  • include_nonphospholipids (bool) – True to include non-phospholipids; False otherwise

  • include_nonlipids (bool) – True to include non-lipids; False otherwise

  • stretch (bool) – True means to run fast 3D and generate the optimal, stretched structure; False otherwise

  • renumber (bool) – True means to conduct the renumbering of phospholipids; False otherwise

  • set_pdbres (bool) – True means to set the s_m_pdb_residue_name; False otherwise

static getLipidStructure(lipid_st, lipid_smiles)

Get the lipid structure by either reading the custom lipid MAE file input or converting the custom smiles string input to a structure.

Parameters:
  • lipid_st (None or structure.Structure) – Lipid structure file

  • lipid_smiles (None or str) – Lipid SMILES string

Return type:

structure.Structure

Returns:

Lipid Structure

setAtomProp(prop_type, atom_idx, settings)

Set the pdbres, pdbname, or hydrophilic/hydrophobic atoms of the lipid

Parameters:
  • prop_type (str) – Property type to set

  • atom_idx (list) – List of atom indices for which to set property

  • settings (list) – What to set each atom index to for given prop_type

makeCustomLipid()

Make MAE of Custom Lipid

class schrodinger.application.matsci.custom_lipid_prep.LipidEndProcessor(struct, include_nonphospholipids=False)

Bases: object

Find the hydrophobic and hydrophilic ends of the lipid structure

__init__(struct, include_nonphospholipids=False)

Initialize the LipidEndProcessor

Parameters:
  • struct (structre.Structure) – the structure to process

  • include_nonphospholipids (bool) – True to find the head and tail atoms of non-phospholipids

static getHeavyStructGraph(struct, asl='not atom.ele H')

Get the networkx graph of the heavy atoms in the structure

Parameters:
  • struct (structure.Structure) – Structure of the lipid

  • asl (str) – Atom selection to acquire graph from structure, where default is creating the graph from heavy atoms only

Returns:

the networkx graph of the heavy atoms in the structure

Return type:

networkx.Graph

getFurthestPair(nodes, start_node=None)

Get the pair of nodes among the given nodes that are furthest apart. Note graph.find_head_tail is more efficient version of this function but lacks the ability to specify a nodes.

Parameters:
  • nodes (list) – the nodes to find the furthest pair among

  • start_node (int) – the node to start from

Returns:

the pair of nodes that are furthest apart, one of them will be the start_node if it is specified

Return type:

tuple

removePhosphorusNodes()

Remove all the nodes between the phosphorus atoms to create graph with tail chains only

Returns:

the graph with the phosphorus nodes removed and the removed nodes

Return type:

tuple(networkx.Graph, list)

getNodesByCondition(nx_graph, condition_fn)

Get the nodes in the graph that satisfy the condition function

Parameters:
  • nx_graph (networkx.Graph) – the graph to search

  • condition_fn (function) – the function to use to determine if a node satisfies the condition

Returns:

the nodes that satisfy the condition

Return type:

list

isNodeElement(node, elements)

Check if the element of the given node belongs to the given elements

Parameters:
  • node (int) – the node to check

  • elements (str or list) – the element(s) to check for in the node

Returns:

True if the node has the element(s), False otherwise

Return type:

bool

isNodeTerminal(node)

Check if the node is terminal (has only one neighbor)

Parameters:

node (int) – the node to check

Returns:

True if the node is terminal, False otherwise

Return type:

bool

findHydrophobicAtoms(sub_graphs)

Find the hydrophobic atoms in the structure

Parameters:

sub_graphs (list(networkx.Graph)) – The sorted list of sub graphs in the structure in order of decreasing size

Returns:

the ids of the hydrophobic atoms

Return type:

tuple

findHydrophilicAtoms(sub_graphs, removed_nodes)

Find the hydrophilic atoms in the structure

Parameters:
  • sub_graphs (list(networkx.Graph)) – The sorted list of sub graphs in the structure in order of decreasing size

  • removed_nodes (list) – the nodes that were removed from the structure

Returns:

the ids of the hydrophilic atoms

Return type:

tuple

searchTerminalAtoms()

Search for the terminal atoms in the structure

Returns:

the ids of the hydrophilic and hydrophobic atoms

Return type:

tuple

getHydrophilicAndHydrophobic()

Get the atom ids of the hydrophilic and hydrophobic atoms in the structure. If the structure has no marked hydrophilic or hydrophobic atoms, then they will be searched assuming that the phosphorus atoms are the central atom and chains are attached to them.

Returns:

the ids of the hydrophilic and hydrophobic atoms, will empty tuple of empty lists if no hydrophilic or hydrophobic atoms are found

Return type:

tuple

class schrodinger.application.matsci.custom_lipid_prep.RenumberLipid(lipid_st, head_tail_info, logger=None)

Bases: object

Class for finding the correct pdbnames for lipid atoms

__init__(lipid_st, head_tail_info, logger=None)

Initialize identifying features of the custom lipid

Parameters:
  • lipid (structure.Structure) – The lipid structure

  • head_tail_info (FindHeadTail) – Class instance of FindHeadTail, containing information about tail_skeletons and head_skeleton

  • logger (logging.Logger) – The logger imported from a driver

createSegmentInfo()

Creates a dictionary containing information about each segment of the lipid. Skeletons are the backbone atom indices for each segment. Start denotes the numbering of each segment, immediately following the atom element (e.g., the head is renumbered C1 and so on, the first tail is renumbered C2 and so on, the second tail is renumbered C3…)

getPDBNames()
For each segment of the lipid (Head, Tail), get the pdbnames associated

with each skeleton

setSpacing(atom_name)

Set appropriate four-character spacing for pdbname where spaces precede the atomname

Parameters:

atom_name (str) – Atom name with greater than or equal to four characters and incorrect spacing

Return type:

str

Returns:

Four-character atom name (pdbname)

storePDBName(atom_idx, atom_name)

Add the atom name (pdbname) to the dictionary with atom index as key if it doesn’t already exist

Parameters:
  • atom_idx (int) – Index of atom

  • atom_name (str) – Name of atom

makePDBName(atom_idx, s_idx, is_backbone=True)

Generate the atom’s name (pdbname)

Parameters:
  • atom_idx (int) – Index of atom

  • s_idx (int) – Number associated with head vs. tail atoms. Head has s_idx = 1; tail has s_idx = 2, 3… depending on tail order

  • is_backbone (bool) – True if atom is on the lipid backbone; False if atom branches from the backbone

getSegmentPDBNames(lipid_segment, skeletons, start)

Get the pdbname for each atom in the head or tail

Parameters:
  • lipid_segment (str) – Lipid segment (Head, Tail)

  • skeletons (list(lists)) – backbone path of indices for head or for each tail

  • start (int) – Starting number to tag each segment pdbname in pdbname prefix

class schrodinger.application.matsci.custom_lipid_prep.FindHeadTail(lipid_st, include_nonphospholipids, logger=None)

Bases: LipidEndProcessor

Class for finding head atoms & tail atoms

__init__(lipid_st, include_nonphospholipids, logger=None)

Initialize lipid structure and common lipid entities

Parameters:
  • lipid (structure_file) – The lipid structure

  • include_nonphospholipids (bool) – True means to find the head/tail atoms for lipids that are not phospholipids

  • logger (logging.Logger) – The logger imported from a driver

createLipidSkeleton(is_phospholipid=False)

Create lipid skeleton for phospholipids. Skeletons are used in renumbering and, thus, only make sense to calculate if the lipid is a phospholipid

findAnchorHierarchy(anchor_O_idx)

Find the anchoring carbon’s hierarchy to determine order of tails Carbon’s hierarchy: The first tail is the one that’s closest to the head

Parameters:

anchor_O_idx (int) – Index of atom anchoring tail to lipid head

Return type:

int

Returns:

The distance (in bonds) between the anchor atom and a head atom

findAnchoredPath(path)

Find the anchoring carbon atom index for the tail with path Cut the path at the carbon after the first non-carbon atom

Parameters:

path (list) – Shortest path from a given tail atom idx to head

Return type:

tuple(list, int)

Returns:

Cut path from anchor to tail at anchor atom and number of bonds b/w anchor and head atom

mapHead()

Find the path of the head from the anchor to the top

Return type:

list

Returns:

List of head indices, where list[0] is the anchor atom

mapTails()

Find the path of each tail from the anchor to tail atom index

Return type:

list of lists

Returns:

List of each tail indices, where list[0] is anchor atom

class schrodinger.application.matsci.custom_lipid_prep.StretchMol(lipid_st, head_tail_info, logger=None)

Bases: object

Class for acquiring optimal structure of lipid using Fast3D

__init__(lipid_st, head_tail_info, logger=None)

Initialize the temporary structure to be stretched

Parameters:
  • lipid_st (structure.Structure) – The unstretched temporary structure

  • head_tail_info (FindHeadTail) – Class instance of FindHeadTail, containing information about head_idx and tail_idx for selecting the best structure created by Fast3d

  • logger (logging.Logger) – The logger imported from a driver

getHeadTailCOM(struct)

Find the centers of mass for head and tail atoms

Parameters:

struct (structure.Structure) – A fast3D-generated structure of lipid

Return type:

tuple(float, float)

Returns:

Vector of coordinates of head COM and tail COM

genDistHeadTail(struct)

Find the distance between the centers of mass of the head and tail atom indices for a given structure

Parameters:

struct (structure.Structure) – A fast3D-generated structure of lipid

Return type:

float

Returns:

Distance between COM of tail atoms with COM of head atoms

genDistTails(struct)

Find the average distance between each tail atom for a given structure

Parameters:

struct (structure.Structure) – A fast3D-generated structure of lipid

Return type:

float

Returns:

Average distance among tail atoms

updateBestStruct(conf_info, fast3d_conf)

Update the best structure and update the information of the best struct

Parameters:
  • conf_info (namedtuple) – Structure information, including head-tail distance, average tail-tail distance, and index of conformer generated by fast3D

  • fast3d_conf (structure.Structure) – Structure generated by fast3D

checkIsBest(fast3d_conf, conf_n)

Of all the conformers output by fast3D engine, return the best structure based on the following criteria: 1) structure has the longest distance b/w head-tail COMs and 2) the shortest distance b/w all tail atoms

Parameters:
  • fast3d_conf (structure.Structure) – Structure generated by fast3D

  • conf_n (int) – Number of fast3D structure generated

generateConformers()

Run Fast3D engine to generate structure conformers

class schrodinger.application.matsci.custom_lipid_prep.SetStereochemistry(struct, cis=True, ccenter_r=True, logger=None)

Bases: object

Class for setting the double bond type in the lipid tails

STEREOZ = rdkit.Chem.rdchem.BondStereo.STEREOZ
STEREOE = rdkit.Chem.rdchem.BondStereo.STEREOE
__init__(struct, cis=True, ccenter_r=True, logger=None)

Initialize the RDKit molecule

Parameters:
  • struct (structure.Structure) – Lipid structure

  • cis (bool or None) – True if changing double bonds in tails to cis-stereochemistry; False if changing them to trans. None if ignoring double bond stereochemistry

  • ccenter_r (bool or None) – True if changing chiral center chirality to R (clock- wise); False if changing chiral center chirality to S (counter- clockwise); None if ignoring chiral center stereochemistry

  • logger (logging.Logger) – The logger imported from a driver

prepStructure(struct)

Generate 3D conformation of the structure if it doesn’t already have 3D coordinates

Return type:

schrodinger.structure.Structure

Returns:

3D lipid structure

isChiralCenter(atom)

Check if the atom is a chiral center

Parameters:

atom (rdkit.Chem.rdchem.Atom) – RDKit atom

Return type:

bool

Returns:

True if the atom is a chiral center; False otherwise

isDoubleBond(bond)

Check if a bond is a double bond

Parameters:

bond (rdkit.Chem.rdchem.Bond) – RDKit bond

Return type:

bool

Returns:

True if the bond type is double

isCCBond(bond)

Check if the bond is between two carbon atoms

Parameters:

bond (rdkit.Chem.rdchem.Bond) – RDKit bond

Return type:

bool

Returns:

True if the bond type is double

fromSmiles()

Create isomeric SMILES string from RDKit molecule

Return type:

str

Returns:

SMILES string

createStereoStructure()

Create lipid structure from SMILES string

Return type:

structure.Structure

Returns:

Lipid structure