def ListPocketsInfo(MolName, ChainIDs): """List pockect residues information across all chains.""" if not (OptionsInfo["All"] or OptionsInfo["PocketLigands"] or OptionsInfo["PocketSolvents"] or OptionsInfo["PocketInorganics"]): return for ChainID in ChainIDs: MiscUtil.PrintInfo( "\nListing ligand pockets information for chain %s..." % (ChainID)) LigandsInfo = PyMOLUtil.GetLigandResiduesInfo(MolName, ChainID) if not len(LigandsInfo["ResNames"]): MiscUtil.PrintInfo("\nNumber of residues in ligand pocket: None") MiscUtil.PrintInfo("Chain ID: %s; Ligands: None" % (ChainID)) continue for LigandResName in sorted(LigandsInfo["ResNames"]): for LigandResNum in LigandsInfo["ResNum"][LigandResName]: ListPocketsPolymerInfo(MolName, ChainID, LigandResName, LigandResNum) ListPocketsSolventsInfo(MolName, ChainID, LigandResName, LigandResNum) ListPocketsInorganicsInfo(MolName, ChainID, LigandResName, LigandResNum)
def GetSelectionResiduesInfo(MolName, ChainID, SelectionType): """Get residues info for a specified selection type. """ SelectionInfo = None SelectionLabel = None if re.match("^Ligands$", SelectionType, re.I): SelectionLabel = "ligand" SelectionInfo = PyMOLUtil.GetLigandResiduesInfo( MolName, ChainID) if ChainID is not None else None elif re.match("^Solvents$", SelectionType, re.I): SelectionLabel = "solvent" SelectionInfo = PyMOLUtil.GetSolventResiduesInfo( MolName, ChainID) if ChainID is not None else None elif re.match("^Inorganics$", SelectionType, re.I): SelectionLabel = "inorganic" SelectionInfo = PyMOLUtil.GetInorganicResiduesInfo( MolName, ChainID) if ChainID is not None else None elif re.match("^Chains$", SelectionType, re.I): SelectionLabel = "polymer chain" SelectionInfo = PyMOLUtil.GetPolymerResiduesInfo( MolName, ChainID) if ChainID is not None else None elif re.match("^NonStandardAminoAcids$", SelectionType, re.I): SelectionLabel = "non-standard amino acids" SelectionInfo = PyMOLUtil.GetAminoAcidResiduesInfo( MolName, ChainID, "NonStandard") if ChainID is not None else None else: MiscUtil.PrintError( "Failed to retrieve residues information: Selection type %s is not valid..." % SelectionType) return SelectionInfo, SelectionLabel