{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"name":"python","version":"3.10.13","mimetype":"text/x-python","codemirror_mode":{"name":"ipython","version":3},"pygments_lexer":"ipython3","nbconvert_exporter":"python","file_extension":".py"},"kaggle":{"accelerator":"none","dataSources":[{"sourceId":67356,"databundleVersionId":8006601,"sourceType":"competition"}],"dockerImageVersionId":30698,"isInternetEnabled":true,"language":"python","sourceType":"notebook","isGpuEnabled":false}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"markdown","source":"This is a demo on the usage of pubchempy which allows more feature extraction and properties understanding of the molecules and building blocks","metadata":{}},{"cell_type":"code","source":"!pip install pubchempy","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:37:45.849772Z","iopub.execute_input":"2024-04-30T03:37:45.850173Z","iopub.status.idle":"2024-04-30T03:37:59.043301Z","shell.execute_reply.started":"2024-04-30T03:37:45.850130Z","shell.execute_reply":"2024-04-30T03:37:59.041857Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import pubchempy as pcp","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:18:56.316909Z","iopub.execute_input":"2024-04-30T03:18:56.317373Z","iopub.status.idle":"2024-04-30T03:18:56.329086Z","shell.execute_reply.started":"2024-04-30T03:18:56.317327Z","shell.execute_reply":"2024-04-30T03:18:56.327511Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"c = pcp.Compound.from_cid(5090)\nprint(c.molecular_formula)","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:18:58.537336Z","iopub.execute_input":"2024-04-30T03:18:58.537775Z","iopub.status.idle":"2024-04-30T03:18:58.912618Z","shell.execute_reply.started":"2024-04-30T03:18:58.537742Z","shell.execute_reply":"2024-04-30T03:18:58.910614Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Molecular weight, also known as molar mass or molecular mass, is the mass of a molecule. It is a measure of the sum of the atomic masses of all the atoms in a molecule.\n\nThe molecular weight is expressed in atomic mass units (u) or grams per mole (g/mol). It is calculated by adding up the atomic masses of each atom in the molecule according to its chemical formula.\n\nFor example, the molecular weight of water (H2O) can be calculated as follows:\n\nThe atomic mass of hydrogen (H) is approximately 1.008 u.\nThe atomic mass of oxygen (O) is approximately 15.999 u.\nSo, to calculate the molecular weight of water:\n(2 * 1.008 u) + (1 * 15.999 u) = 18.015 u.\n\nTherefore, the molecular weight of water is approximately 18.015 u.\n\nThe molecular weight is an important property of a molecule as it provides information about its mass and is used in various calculations, such as determining the amount of substance in moles, performing stoichiometric calculations, and preparing solutions of specific concentrations.","metadata":{}},{"cell_type":"code","source":"print(c.molecular_weight)","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:19:23.275887Z","iopub.execute_input":"2024-04-30T03:19:23.276823Z","iopub.status.idle":"2024-04-30T03:19:23.282708Z","shell.execute_reply.started":"2024-04-30T03:19:23.276787Z","shell.execute_reply":"2024-04-30T03:19:23.281380Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(c.isomeric_smiles)","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:19:38.317991Z","iopub.execute_input":"2024-04-30T03:19:38.318382Z","iopub.status.idle":"2024-04-30T03:19:38.324688Z","shell.execute_reply.started":"2024-04-30T03:19:38.318352Z","shell.execute_reply":"2024-04-30T03:19:38.323385Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"xlogP refers to the calculated octanol-water partition coefficient (logP) value of a compound.\n\nThe octanol-water partition coefficient is a measure of a compound's hydrophobicity, specifically its tendency to partition between an organic solvent (typically octanol) and water. It provides information about a compound's solubility and distribution in biological systems.\n\nThe xlogP value in PubChemPy is an estimate of the octanol-water partition coefficient calculated using the XLOGP3 algorithm. XLOGP3 is a widely used method for predicting logP values based on the compound's molecular structure and various physicochemical properties.\n\nThe logP value itself represents the logarithm of the ratio of the compound's concentration in octanol to its concentration in water at equilibrium. A higher logP value indicates a greater tendency for the compound to be soluble in octanol relative to water, indicating higher hydrophobicity.\n\nIn PubChemPy, the xlogP value can be accessed as a property of a compound object retrieved from the PubChem database using the library's functions or methods. It provides a useful descriptor for characterizing a compound's hydrophobic nature and can be used in various cheminformatics analyses and modeling tasks.","metadata":{}},{"cell_type":"code","source":"print(c.xlogp)","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:19:56.106229Z","iopub.execute_input":"2024-04-30T03:19:56.106650Z","iopub.status.idle":"2024-04-30T03:19:56.113083Z","shell.execute_reply.started":"2024-04-30T03:19:56.106604Z","shell.execute_reply":"2024-04-30T03:19:56.111335Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The IUPAC name, also known as the systematic name, is a naming system for chemical compounds established by the International Union of Pure and Applied Chemistry (IUPAC). It is a standardized method used to describe the chemical structure of a compound using a systematic set of rules.\n\nThe IUPAC name provides a unique and unambiguous way to identify a compound based on its composition and structural features. It is particularly useful when dealing with complex organic compounds that may have multiple functional groups or substituents.\n\nThe IUPAC naming rules are designed to convey important information about the compound's structure and composition. They specify the order in which substituents are listed, the use of numerical prefixes to indicate the number of specific groups, and the use of specific suffixes and prefixes to denote functional groups or structural features.\n\nFor example, the IUPAC name for the compound with the molecular formula CH3CH2OH is \"ethanol.\" The name \"ethanol\" indicates that the compound consists of two carbon atoms (eth-) with a single bond between them (-an-) and an attached hydroxyl group (-ol).\n\nThe IUPAC naming system is widely used in chemistry and is recognized internationally. It ensures consistency and clarity in the communication of chemical structures and is an important tool for chemists, researchers, and regulatory agencies.","metadata":{}},{"cell_type":"code","source":"print(c.iupac_name)","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:20:19.239408Z","iopub.execute_input":"2024-04-30T03:20:19.239824Z","iopub.status.idle":"2024-04-30T03:20:19.245306Z","shell.execute_reply.started":"2024-04-30T03:20:19.239792Z","shell.execute_reply":"2024-04-30T03:20:19.244355Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(c.synonyms)","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:20:37.035486Z","iopub.execute_input":"2024-04-30T03:20:37.035893Z","iopub.status.idle":"2024-04-30T03:20:37.558813Z","shell.execute_reply.started":"2024-04-30T03:20:37.035862Z","shell.execute_reply":"2024-04-30T03:20:37.557189Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pcp.get_compounds('C#CCOc1ccc(CN)cc1.Cl', 'smiles') #test retrieval on a sample building block 2 smiles","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:21:30.784365Z","iopub.execute_input":"2024-04-30T03:21:30.784873Z","iopub.status.idle":"2024-04-30T03:21:31.330213Z","shell.execute_reply.started":"2024-04-30T03:21:30.784837Z","shell.execute_reply":"2024-04-30T03:21:31.329065Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"c = pcp.Compound.from_cid(112756509)\nprint(c.molecular_formula)","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:21:52.432206Z","iopub.execute_input":"2024-04-30T03:21:52.432640Z","iopub.status.idle":"2024-04-30T03:21:52.767174Z","shell.execute_reply.started":"2024-04-30T03:21:52.432589Z","shell.execute_reply":"2024-04-30T03:21:52.765743Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"print(c.iupac_name)","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:22:18.138117Z","iopub.execute_input":"2024-04-30T03:22:18.138577Z","iopub.status.idle":"2024-04-30T03:22:18.145107Z","shell.execute_reply.started":"2024-04-30T03:22:18.138541Z","shell.execute_reply":"2024-04-30T03:22:18.143660Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"pcp.get_compounds('C#CC[C@@H](CC(=O)O)NC(=O)OCC1c2ccccc2-c2ccccc21','smiles')","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:23:38.182520Z","iopub.execute_input":"2024-04-30T03:23:38.182925Z","iopub.status.idle":"2024-04-30T03:23:38.904184Z","shell.execute_reply.started":"2024-04-30T03:23:38.182893Z","shell.execute_reply":"2024-04-30T03:23:38.903050Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"c = pcp.Compound.from_cid(2761703)\nprint(c.isomeric_smiles)\nprint(c.molecular_formula)\nprint(c.molecular_weight)\nprint(c.xlogp)\nprint(c.iupac_name)\nprint(c.synonyms)","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:26:03.078871Z","iopub.execute_input":"2024-04-30T03:26:03.079280Z","iopub.status.idle":"2024-04-30T03:26:03.830815Z","shell.execute_reply.started":"2024-04-30T03:26:03.079239Z","shell.execute_reply":"2024-04-30T03:26:03.829674Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"The PubChem CACTVS fingerprint is a type of molecular fingerprinting system used in computational chemistry and cheminformatics. It is a binary fingerprint that represents the presence or absence of certain chemical substructures or features within a molecule.\n\nThe CACTVS (Computer-Assisted Structure Verification System) fingerprint is generated using an algorithm that analyzes the molecular structure of a compound and assigns a unique bit string to represent its features. Each bit in the fingerprint corresponds to a specific feature, such as the presence or absence of a particular chemical group or the occurrence of a specific structural pattern.\n\nThe CACTVS fingerprint is widely used in chemical databases and similarity searching. It allows researchers to compare molecules based on their structural similarity and identify potential matches or analogs. By comparing the fingerprints of different molecules, researchers can quickly identify compounds with similar structural characteristics, which can be helpful in drug discovery, chemical classification, and other areas of chemical research.\n\nIt's important to note that the CACTVS fingerprint is just one of many fingerprinting methods available in cheminformatics, and different fingerprinting algorithms may be more suitable for specific applications depending on the research objectives and requirements.","metadata":{}},{"cell_type":"code","source":"c.cactvs_fingerprint","metadata":{"execution":{"iopub.status.busy":"2024-04-30T03:27:46.374601Z","iopub.execute_input":"2024-04-30T03:27:46.375008Z","iopub.status.idle":"2024-04-30T03:27:46.382842Z","shell.execute_reply.started":"2024-04-30T03:27:46.374978Z","shell.execute_reply":"2024-04-30T03:27:46.381515Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"markdown","source":"Feel free to experiment more and continue the post here.","metadata":{}}]}