Debian Codegraph @

docs/guide/properties.md

raw
1 (properties)=
2
3 # Properties
4
5 The {func}`~pubchempy.get_properties` function allows the retrieval of specific properties without having to deal with entire compound records. This is especially useful for retrieving the properties of a large number of compounds at once:
6
7 ```python
8 p = pcp.get_properties("SMILES", "CC", "smiles", searchtype="superstructure")
9 ```
10
11 Multiple properties may be specified in a list, or in a comma-separated string. The available properties are: MolecularFormula, MolecularWeight, ConnectivitySMILES, SMILES, InChI, InChIKey, IUPACName, XLogP, ExactMass, MonoisotopicMass, TPSA, Complexity, Charge, HBondDonorCount, HBondAcceptorCount, RotatableBondCount, HeavyAtomCount, IsotopeAtomCount, AtomStereoCount, DefinedAtomStereoCount, UndefinedAtomStereoCount, BondStereoCount, DefinedBondStereoCount, UndefinedBondStereoCount, CovalentUnitCount, Volume3D, XStericQuadrupole3D, YStericQuadrupole3D, ZStericQuadrupole3D, FeatureCount3D, FeatureAcceptorCount3D, FeatureDonorCount3D, FeatureAnionCount3D, FeatureCationCount3D, FeatureRingCount3D, FeatureHydrophobeCount3D, ConformerModelRMSD3D, EffectiveRotorCount3D, ConformerCount3D.
12
13 ## Synonyms
14
15 Get a list of synonyms for a given input using the {func}`~pubchempy.get_synonyms` function:
16
17 ```python
18 pcp.get_synonyms("Aspirin", "name")
19 pcp.get_synonyms("Aspirin", "name", "substance")
20 ```
21
22 Inputs that match more than one SID/CID will have multiple, separate synonyms lists returned.
23
24 ## CAS Registry Numbers
25
26 CAS Registry Numbers are not officially supported by PubChem, but they are often present in the synonyms associated with a compound. Therefore it is straightforward to retrieve them by filtering the synonyms to just those with the CAS Registry Number format:
27
28 ```python
29 for result in pcp.get_synonyms("Aspirin", "name"):
30 cid = result["CID"]
31 cas_rns = []
32 for syn in result.get("Synonym", []):
33 match = re.match(r"(\d{2,7}-\d\d-\d)", syn)
34 if match:
35 cas_rns.append(match.group(1))
36 print(f"CAS registry numbers for CID {cid}: {cas_rns}")
37 ```
38
39 ## Identifiers
40
41 There are three functions for getting a list of identifiers for a given input:
42
43 - {func}`~pubchempy.get_cids`
44 - {func}`~pubchempy.get_sids`
45 - {func}`~pubchempy.get_aids`
46
47 For example, passing a CID to {func}`~pubchempy.get_sids` will return a list of SIDs corresponding to the {class}`~pubchempy.Substance` records that were standardised and merged to produce the given {class}`~pubchempy.Compound`.