Calculators
¶
get_calculator(name, **params)
¶
Get molecular calculator based on name
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
str
|
Name of the featurizer |
required |
params |
dict
|
Parameters of the featurizer |
{}
|
Raises:
Type | Description |
---|---|
ValueError
|
When featurizer is not supported |
Returns:
Name | Type | Description |
---|---|---|
featurizer | Callable |
Source code in molfeat/calc/__init__.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
|
Fingerprints
¶
FP_DEF_PARAMS = {'maccs': {}, 'avalon': {'nBits': 512, 'isQuery': False, 'resetVect': False, 'bitFlags': pyAvalonTools.avalonSimilarityBits}, 'ecfp': {'radius': 2, 'nBits': 2048, 'invariants': [], 'fromAtoms': [], 'useChirality': False, 'useBondTypes': True, 'useFeatures': False}, 'fcfp': {'radius': 2, 'nBits': 2048, 'invariants': [], 'fromAtoms': [], 'useChirality': False, 'useBondTypes': True, 'useFeatures': True}, 'topological': {'nBits': 2048, 'targetSize': 4, 'fromAtoms': 0, 'ignoreAtoms': 0, 'atomInvariants': 0, 'nBitsPerEntry': 4, 'includeChirality': False}, 'atompair': {'nBits': 2048, 'minLength': 1, 'maxLength': 30, 'fromAtoms': 0, 'ignoreAtoms': 0, 'atomInvariants': 0, 'nBitsPerEntry': 4, 'includeChirality': False, 'use2D': True, 'confId': -1}, 'rdkit': {'minPath': 1, 'maxPath': 7, 'fpSize': 2048, 'nBitsPerHash': 2, 'useHs': True, 'tgtDensity': 0.0, 'minSize': 128, 'branchedPaths': True, 'useBondOrder': True, 'atomInvariants': 0, 'fromAtoms': 0, 'atomBits': None, 'bitInfo': None}, 'pattern': {'fpSize': 2048, 'atomCounts': [], 'setOnlyBits': None}, 'layered': {'fpSize': 2048, 'minPath': 1, 'maxPath': 7, 'atomCounts': [], 'setOnlyBits': None, 'branchedPaths': True, 'fromAtoms': 0}, 'map4': {'dimensions': 2048, 'radius': 2}, 'secfp': {'n_permutations': 128, 'nBits': 2048, 'radius': 3, 'min_radius': 1, 'rings': True, 'kekulize': False, 'isomeric': False, 'seed': 0}, 'mhfp': {'n_permutations': 128, 'radius': 3, 'min_radius': 1, 'rings': True, 'kekulize': False, 'isomeric': False, 'seed': 0}, 'erg': {'atomTypes': 0, 'fuzzIncrement': 0.3, 'minPath': 1, 'maxPath': 15}, 'estate': {}, 'ecfp-count': {'radius': 2, 'nBits': 2048, 'invariants': [], 'fromAtoms': [], 'useChirality': False, 'useBondTypes': True, 'useFeatures': False, 'includeRedundantEnvironments': False}, 'fcfp-count': {'radius': 2, 'nBits': 2048, 'invariants': [], 'fromAtoms': [], 'useChirality': False, 'useBondTypes': True, 'useFeatures': True, 'includeRedundantEnvironments': False}, 'topological-count': {'nBits': 2048, 'targetSize': 4, 'fromAtoms': 0, 'ignoreAtoms': 0, 'atomInvariants': 0, 'includeChirality': False}, 'avalon-count': {'nBits': 512, 'isQuery': False, 'bitFlags': pyAvalonTools.avalonSimilarityBits}, 'rdkit-count': {'minPath': 1, 'maxPath': 7, 'useHs': True, 'branchedPaths': True, 'useBondOrder': True, 'atomInvariants': 0, 'fromAtoms': 0, 'atomBits': None, 'bitInfo': None}, 'atompair-count': {'nBits': 2048, 'minLength': 1, 'maxLength': 30, 'fromAtoms': 0, 'ignoreAtoms': 0, 'atomInvariants': 0, 'includeChirality': False, 'use2D': True, 'confId': -1}}
module-attribute
¶
FP_FUNCS = {'maccs': rdMolDescriptors.GetMACCSKeysFingerprint, 'avalon': pyAvalonTools.GetAvalonFP, 'ecfp': rdMolDescriptors.GetMorganFingerprintAsBitVect, 'fcfp': partial(rdMolDescriptors.GetMorganFingerprintAsBitVect, useFeatures=True), 'topological': rdMolDescriptors.GetHashedTopologicalTorsionFingerprintAsBitVect, 'atompair': rdMolDescriptors.GetHashedAtomPairFingerprintAsBitVect, 'rdkit': rdmolops.RDKFingerprint, 'pattern': rdmolops.PatternFingerprint, 'layered': rdmolops.LayeredFingerprint, 'map4': MAP4, 'secfp': SECFP, 'erg': rdReducedGraphs.GetErGFingerprint, 'estate': lambda x: EStateFingerprinter.FingerprintMol(x)[0], 'avalon-count': pyAvalonTools.GetAvalonCountFP, 'rdkit-count': rdmolops.UnfoldedRDKFingerprintCountBased, 'ecfp-count': rdMolDescriptors.GetHashedMorganFingerprint, 'fcfp-count': rdMolDescriptors.GetHashedMorganFingerprint, 'topological-count': rdMolDescriptors.GetHashedTopologicalTorsionFingerprint, 'atompair-count': rdMolDescriptors.GetHashedAtomPairFingerprint}
module-attribute
¶
FPCalculator
¶
Bases: SerializableCalculator
Fingerprint bit calculator for a molecule
Source code in molfeat/calc/fingerprints.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
columns
property
¶
Get the name of all the descriptors of this calculator
counting = counting or '-count' in self.method
instance-attribute
¶
input_length = length
instance-attribute
¶
method = method.lower()
instance-attribute
¶
params = default_params
instance-attribute
¶
__call__(mol, raw=False)
¶
Compute the Fingerprint of a molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[rdchem.Mol, str]
|
the molecule of interest |
required |
raw |
bool
|
whether to keep original datatype or convert to numpy. Useful for rdkit's similarity functions |
False
|
Returns:
Name | Type | Description |
---|---|---|
props |
np.ndarray
|
list of computed rdkit molecular descriptors |
Source code in molfeat/calc/fingerprints.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 |
|
__getstate__()
¶
Source code in molfeat/calc/fingerprints.py
301 302 303 304 305 306 307 308 309 310 |
|
__init__(method, length=None, counting=False, **kwargs)
¶
Compute the given fingeprint for a molecule
Note
For efficiency reason, count fingerprints are hashed and potentially re-folded and the count corresponds to the number of bits set to true
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method |
str
|
Name of the fingerprint method to use |
required |
length |
int
|
Length of the fingerprint. Defaults to None. The default corresponds to the fingerpint default. |
None
|
counting |
bool
|
Whether to use the count version of the fingerprint |
False
|
kwargs |
dict
|
any parameters to the fingerprint algorithm |
{}
|
Source code in molfeat/calc/fingerprints.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
|
__len__()
¶
Return the length of the calculator
Source code in molfeat/calc/fingerprints.py
245 246 247 |
|
__setstate__(state)
¶
Set the state of the featurizer
Source code in molfeat/calc/fingerprints.py
312 313 314 315 |
|
to_state_dict()
¶
Get the state dictionary
Source code in molfeat/calc/fingerprints.py
317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
Descriptors
¶
MordredDescriptors
¶
Bases: SerializableCalculator
Compute mordred descriptors. The descriptor calculator does not mask errors in featurization and will propagate them.
Note
Mordred descriptors can results in undefined or nan behaviour depending on your input molecule. It is recommended that the user handles those nan values himself by either removing the descriptor or imputing the missing values.
Source code in molfeat/calc/descriptors.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
|
columns
property
¶
Get the name of all the descriptors of this calculator
do_not_standardize = do_not_standardize
instance-attribute
¶
ignore_3D = ignore_3D
instance-attribute
¶
replace_nan = replace_nan
instance-attribute
¶
__call__(mol, conformer_id=-1)
¶
Get rdkit basic descriptors for a molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[rdchem.Mol, str]
|
the molecule of interest |
required |
conformer_id |
int
|
Optional |
-1
|
Returns:
Name | Type | Description |
---|---|---|
props |
np.ndarray
|
list of computed mordred molecular descriptors |
Source code in molfeat/calc/descriptors.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 |
|
__getstate__()
¶
Serialize the class for pickling.
Source code in molfeat/calc/descriptors.py
238 239 240 241 242 243 244 |
|
__init__(ignore_3D=True, replace_nan=False, do_not_standardize=False, **kwargs)
¶
Mordred descriptor computation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ignore_3D |
bool
|
Whether to ignore 3D descriptors or include them |
True
|
replace_nan |
bool
|
Whether to replace nan or infinite values. Defaults to False. |
False
|
do_not_standardize |
bool
|
Whether to force standardize molecules or keep it the same |
False
|
Source code in molfeat/calc/descriptors.py
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 |
|
__len__()
¶
Return the length of the calculator
Source code in molfeat/calc/descriptors.py
234 235 236 |
|
__setstate__(state)
¶
Reload the class from pickling.
Source code in molfeat/calc/descriptors.py
246 247 248 249 |
|
RDKitDescriptors2D
¶
Bases: SerializableCalculator
Compute a list of available rdkit 2D descriptors for a molecule. The descriptor calculator does not mask errors in featurization and will propagate them
Source code in molfeat/calc/descriptors.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
DESCRIPTORS_FN = {name: fn for (name, fn) in Descriptors.descList}
class-attribute
¶
augment = augment
instance-attribute
¶
avg_ipc = avg_ipc
instance-attribute
¶
columns
property
¶
Get the name of all the descriptors of this calculator
descrs = descrs
instance-attribute
¶
do_not_standardize = do_not_standardize
instance-attribute
¶
replace_nan = replace_nan
instance-attribute
¶
__call__(mol)
¶
Get rdkit basic descriptors for a molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[rdchem.Mol, str]
|
the molecule of interest |
required |
Returns:
Name | Type | Description |
---|---|---|
props |
np.ndarray
|
list of computed rdkit molecular descriptors |
Source code in molfeat/calc/descriptors.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
__getstate__()
¶
Serialize the class for pickling.
Source code in molfeat/calc/descriptors.py
107 108 109 110 111 112 113 114 115 116 117 118 |
|
__init__(replace_nan=False, augment=True, descrs=None, avg_ipc=True, do_not_standardize=False, **kwargs)
¶
RDKit descriptor computation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
replace_nan |
Optional[bool]
|
Whether to replace nan or infinite values. Defaults to False. |
False
|
augment |
Optional[bool]
|
Whether to augment the descriptors with some additional custom features |
True
|
descrs |
List
|
Subset of available features to consider if not None |
None
|
avg_ipc |
Optional[bool]
|
Whether to average IPC values or to use rdkit original |
True
|
do_not_standardize |
Optional[bool]
|
Whether to force standardization of molecule before computation of the descriptor. Set to True if you want molfeat<=0.5.3 behaviour |
False
|
Source code in molfeat/calc/descriptors.py
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
__len__()
¶
Return the length of the calculator
Source code in molfeat/calc/descriptors.py
146 147 148 |
|
RDKitDescriptors3D
¶
Bases: SerializableCalculator
Compute a list of 3D rdkit descriptors
Source code in molfeat/calc/descriptors.py
270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
|
columns
property
¶
Get the descriptors columns
ignore_descrs = ignore_descrs or []
instance-attribute
¶
replace_nan = replace_nan
instance-attribute
¶
__call__(mol, conformer_id=-1)
¶
Get rdkit 3D descriptors for a molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[rdchem.Mol, str]
|
the molecule of interest |
required |
conformer_id |
int
|
Optional conformer id. Defaults to -1. |
-1
|
Returns:
Name | Type | Description |
---|---|---|
props |
np.ndarray
|
list of computed mordred molecular descriptors |
Source code in molfeat/calc/descriptors.py
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
|
__getstate__()
¶
Serialize the class for pickling.
Source code in molfeat/calc/descriptors.py
319 320 321 322 323 324 325 |
|
__init__(replace_nan=False, ignore_descrs=['CalcGETAWAY'], **kwargs)
¶
Compute 3D descriptors
Parameters:
Name | Type | Description | Default |
---|---|---|---|
replace_nan |
bool
|
Whether to replace nan or infinite values. Defaults to False. |
False
|
ignore_descrs |
list
|
Descriptors to ignore for performance issues. Defaults to ["CalcGETAWAY"]. |
['CalcGETAWAY']
|
Source code in molfeat/calc/descriptors.py
275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
|
__len__()
¶
Get the length of the descriptor
Source code in molfeat/calc/descriptors.py
327 328 329 |
|
CATS
¶
CATS 2D and 3D implementation based on original work by Rajarshi Guha rguha@indiana.edu 08/26/07 and Chris Arthur 1/11/2015 Rdkit port This version modernizes the code, improve performance, add supports for 3D as well as allowing distance binning. see: https://masterchemoinfo.u-strasbg.fr/Documents/Conferences/Lecture1_Pharmacophores_Schneider.pdf
CATS
¶
Bases: SerializableCalculator
Cats descriptors calculator based on PPPs (potential pharmacophore points). Can be either 2D or 3D.
!!! note:
We need to consider all pairwise combination of the 6 PPPs described in CATS2D.SMARTS
which would be $P(6,2) + 6$. However, as we only consider lexicographic order, the total size
is then $rac{P(6,2)}{2} + 6 = 21$, explaining the size of CATS2D.DESCRIPTORS
Tip
The CATS descriptor are sensitive to the number of atoms in a molecule, meaning, you would get different results if you add or remove hydrogen atoms
Source code in molfeat/calc/cats.py
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 |
|
DESCRIPTORS = ['DD', 'AD', 'DP', 'DN', 'DL', 'DR', 'AA', 'AP', 'AN', 'AL', 'AR', 'PP', 'NP', 'LP', 'PR', 'NN', 'LN', 'NR', 'LL', 'LR', 'RR']
class-attribute
¶
MAX_DIST_DEFAULT_2D = 8
class-attribute
¶
MAX_DIST_DEFAULT_3D = 5
class-attribute
¶
SMARTS = {'D': ['[!$([#6,H0,-,-2,-3])]'], 'A': ['[!$([#6,F,Cl,Br,I,o,s,nX3,#7v5,#15v5,#16v4,#16v6,*+1,*+2,*+3])]'], 'P': ['[*+]', '[#7H2]'], 'N': ['[*-]', '[C&$(C(=O)O),P&$(P(=O)),S&$(S(=O)O)]'], 'L': ['[Cl,Br,I]', '[S;D2;$(S(C)(C))]', '[C;D2;$(C(=C)(=C))]', '[C;D3;$(C(=C)(C)(C))]', '[C;D4;$(C(C)(C)(C)(C))]', '[C;D3;H1;$(C(C)(C)(C))]', '[C;D2;H2;$(C(C)(C))]'], 'R': ['[a]']}
class-attribute
¶
bins = list(sorted(bins))
instance-attribute
¶
columns
property
¶
Get the descriptors columns
max_dist = max_dist
instance-attribute
¶
scale = scale
instance-attribute
¶
use_3d_distances = use_3d_distances
instance-attribute
¶
__call__(mol, conformer_id=-1)
¶
Get CATS 2D descriptors for a molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[dm.Mol, str]
|
the molecule of interest. |
required |
conformer_id |
int
|
Optional conformer id. Only relevant when |
-1
|
Returns:
Name | Type | Description |
---|---|---|
props |
np.ndarray
|
list of computed rdkit molecular descriptors |
Source code in molfeat/calc/cats.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
|
__getstate__()
¶
Serialize the class for pickling.
Source code in molfeat/calc/cats.py
321 322 323 324 325 326 327 328 |
|
__init__(max_dist=None, bins=None, scale='raw', use_3d_distances=False, **kwargs)
¶
Calculator for the CATS descriptors.
max_dist
and bins
will both determine the length of the fingerprint vector,
which you can get by calling len(calc)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
max_dist |
Union[float, int]
|
Maximum distance between pairs. When set to None, the default for 2D is
set to |
None
|
bins |
List[int]
|
Bins to use. Defaults to equal spacing |
None
|
scale |
str
|
How to scale the values. Supported values are: - 'raw' for the raw values. - 'num' for values normalized by the number of atoms. - 'count' for scaling based on occurence of the PPP. |
'raw'
|
use_3d_distances |
bool
|
Whether to use the 3D distances instead of the topological distances. If set to True, the input molecules must contain a conformer. |
False
|
kwargs |
silently ignored extra parameters for compatibility with other calculators. |
{}
|
Source code in molfeat/calc/cats.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
__len__()
¶
Return the length of the calculator
Source code in molfeat/calc/cats.py
286 287 288 |
|
__setstate__(state)
¶
Reload the class from pickling.
Source code in molfeat/calc/cats.py
330 331 332 333 |
|
Pharmacophore
¶
Pharmacophore2D
¶
Bases: SerializableCalculator
2D Pharmacophore.
The fingerprint is computed using Generate.Gen2DFingerprint
from RDKit.
An explanation of pharmacophore fingerprints and how the bits are set
is available in the RDKit book. In particular the following figure describes the process.
{ align=left }
Source code in molfeat/calc/pharmacophore.py
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
|
bins = bins
instance-attribute
¶
columns
property
¶
Get the name of all the descriptors of this calculator.
factory = factory
instance-attribute
¶
feature_factory
property
¶
includeBondOrder = includeBondOrder
instance-attribute
¶
length = length
instance-attribute
¶
maxPointCount = maxPointCount
instance-attribute
¶
minPointCount = minPointCount
instance-attribute
¶
shortestPathsOnly = shortestPathsOnly
instance-attribute
¶
skipFeats = skipFeats
instance-attribute
¶
trianglePruneBins = trianglePruneBins
instance-attribute
¶
useCounts = useCounts
instance-attribute
¶
__call__(mol, raw=False)
¶
Compute the Pharmacophore fingeprint for the input molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[dm.Mol, str]
|
the molecule of interest |
required |
raw |
bool
|
Whether to return the raw fingerprint or a Numpy array. |
False
|
Returns:
Name | Type | Description |
---|---|---|
fp | the computed fingerprint as a Numpy array or as a raw object. |
Source code in molfeat/calc/pharmacophore.py
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
|
__getstate__()
¶
Serialize the class for pickling.
Source code in molfeat/calc/pharmacophore.py
179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
__init__(factory='pmapper', length=2048, useCounts=None, minPointCount=None, maxPointCount=None, shortestPathsOnly=None, includeBondOrder=None, skipFeats=None, trianglePruneBins=None, bins=None, **kwargs)
¶
Pharmacophore computation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
factory |
Union[str, MolChemicalFeatureFactory]
|
Which features factory to use. One of "default", "cats", "gobbi" , "pmapper" or path to a feature definition or a feature factory object |
'pmapper'
|
length |
Optional[int]
|
Optional desired length. If provided, the fp will be refold or padded to that length. If set to None, fallback to the default for the provided sig factory. |
2048
|
minPointCount |
int
|
Minimum number of points. |
None
|
maxPointCount |
int
|
Maximum number of points. |
None
|
trianglePruneBins |
bool
|
Whether to prune the triangle inequality. |
None
|
includeBondOrder |
bool
|
Whether to consider bond order. |
None
|
shortestPathsOnly |
bool
|
Whether to only use the shortest path between pharmacophores. |
None
|
useCounts |
bool
|
Whether take into account the count information. This will also impact how the folding works. |
None
|
bins |
List[Tuple[int, int]]
|
Bins to use. |
None
|
Source code in molfeat/calc/pharmacophore.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
|
__len__()
¶
Returns the length of the pharmacophore
Source code in molfeat/calc/pharmacophore.py
166 167 168 |
|
__setstate__(state)
¶
Reload the class from pickling.
Source code in molfeat/calc/pharmacophore.py
194 195 196 197 |
|
Pharmacophore3D
¶
Bases: SerializableCalculator
3D Pharmacophore.
The fingerprint is computed using pmapper
.
This featurizer supports building a consensus pharmacophore from a set of molecules.
Source code in molfeat/calc/pharmacophore.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 |
|
bin_step = bin_step
instance-attribute
¶
factory = factory
instance-attribute
¶
length = length
instance-attribute
¶
max_features = max_features
instance-attribute
¶
min_features = min_features
instance-attribute
¶
tolerance = tolerance
instance-attribute
¶
use_modulo = use_modulo
instance-attribute
¶
__call__(mol, conformer_id=-1, raw=False)
¶
Compute the Pharmacophore fingeprint for the input molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[dm.Mol, str]
|
the molecule of interest |
required |
conformer_id |
int
|
the conformer id to use. |
-1
|
raw |
bool
|
Whether to return the raw fingerprint or a Numpy array. |
False
|
Returns:
Name | Type | Description |
---|---|---|
fp | the computed fingerprint as a Numpy array. |
Source code in molfeat/calc/pharmacophore.py
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 |
|
__getstate__()
¶
Serialize the class for pickling.
Source code in molfeat/calc/pharmacophore.py
611 612 613 614 615 616 617 618 619 620 621 |
|
__init__(factory='pmapper', length=2048, bin_step=1, min_features=2, max_features=3, use_modulo=True, tolerance=0)
¶
Pharmacophore computation.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
factory |
Union[str, MolChemicalFeatureFactory]
|
Which features factory to use. One of "default", "cats", "gobbi" , "pmapper" or path to a feature definition or a feature factory object |
'pmapper'
|
length |
int
|
Optional desired length. If provided, the fp will be refold or padded to that length. If set to None, fallback to the default for the provided sig factory. |
2048
|
minPointCount |
Minimum number of points. |
required | |
maxPointCount |
Maximum number of points. |
required | |
trianglePruneBins |
Whether to prune the triangle inequality. |
required | |
includeBondOrder |
Whether to consider bond order. |
required | |
shortestPathsOnly |
Whether to only use the shortest path between pharmacophores. |
required | |
useCounts |
Whether take into account the count information. This will also impact how the folding works. |
required | |
bins |
Bins to use. |
required |
Source code in molfeat/calc/pharmacophore.py
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
|
__setstate__(state)
¶
Reload the class from pickling.
Source code in molfeat/calc/pharmacophore.py
623 624 625 626 |
|
cluster_features(features, min_samples_ratio=0.5, n_mols=None, eps=np.inf, **kwargs)
¶
Cluster a set of pharmacophoric features using OPTICS. The only reason why we are not using SpectralClustering is because of the need to provide the number of clusters.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features |
pd.DataFrame
|
A dataframe of features. |
required |
min_samples_ratio |
float
|
Percentages of mols that must contain a pharmacophoric point to be considered as a core point. |
0.5
|
n_mols |
int
|
Optional number of compounds to compute |
None
|
eps |
float
|
The maximum distance between two samples for one to be considered as in the neighborhood of the other. This is max_eps in OPTICS |
np.inf
|
kwargs |
Any additional parameters to pass to |
{}
|
Source code in molfeat/calc/pharmacophore.py
449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 |
|
compute_fp_from_coords(features_coords, raw=False)
¶
Compute a fingerprint from a list of features.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
features_coords |
List[Tuple[str, Tuple[float]]]
|
Features coords: |
required |
raw |
bool
|
Whether to return the raw fingerprint or a Numpy array. |
False
|
Source code in molfeat/calc/pharmacophore.py
406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 |
|
consensus_fp(mols, align=True, conformer_id=-1, copy=True, min_samples_ratio=0.5, eps=2, raw=False, **cluster_kwargs)
¶
Compute a consensus fingerprint from a list of molecules.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mols |
List[dm.Mol]
|
a list of molecules. |
required |
align |
bool
|
Whether to align the conformers of the molecules. |
True
|
conformer_id |
int
|
Optional conformer id. |
-1
|
copy |
bool
|
Whether to copy the molecules before clustering. |
True
|
min_samples_ratio |
float
|
Percentages of mols that must contain a pharmacophoric point to be considered as a core point. |
0.5
|
eps |
float
|
The maximum distance between two samples for one to be considered as in the neighborhood of the other. |
2
|
raw |
bool
|
Whether to return the raw fingerprint or a Numpy array. |
False
|
cluster_kwargs |
additional keyword arguments for the clustering algorithm. |
{}
|
Source code in molfeat/calc/pharmacophore.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 |
|
get_features(mol, conformer_id=-1)
¶
Retrieve the features for a given molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
dm.Mol
|
the molecule of interest |
required |
Returns:
Name | Type | Description |
---|---|---|
features |
pd.DataFrame
|
the features as a Numpy array |
Source code in molfeat/calc/pharmacophore.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 |
|
get_features_from_many(mols, align=True, conformer_id=-1, copy=True, keep_mols=False)
¶
Extract all the features from a list of molecules after an optional alignement step.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mols |
List[dm.Mol]
|
List of molecules with conformers. |
required |
align |
bool
|
Whether to align the conformers of the molecules. |
True
|
conformer_id |
int
|
Optional conformer id. |
-1
|
copy |
bool
|
Whether to copy the molecules before clustering. |
True
|
keep_mols |
bool
|
Whether to keep the molecules in the returned dataframe. |
False
|
Source code in molfeat/calc/pharmacophore.py
363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
|
show(mol, features=None, alpha=1.0, sphere_radius=0.4, show_legend=True)
¶
Show a 3D view of a given molecule with the pharmacophoric features.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
dm.Mol
|
the molecule of interest |
required |
alpha |
float
|
Alpha value for the colors (currently not working). |
1.0
|
sphere_radius |
float
|
Radius of the spheres for the features. |
0.4
|
show_legend |
bool
|
Display the legend (the layout is bad but at least it shows the legend). |
True
|
Source code in molfeat/calc/pharmacophore.py
524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
|
show_many(mols, align=True, conformer_id=-1, copy=True, min_samples_ratio=0.5, eps=2, alpha=1.0, sphere_radius=0.4, show_legend=True)
¶
Show a 3D view of a given molecule with the pharmacophoric features.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mols |
List[dm.Mol]
|
a list of molecules. |
required |
align |
bool
|
Whether to align the conformers of the molecules. |
True
|
conformer_id |
int
|
Optional conformer id. |
-1
|
copy |
bool
|
Whether to copy the molecules before clustering. |
True
|
min_samples_ratio |
float
|
Percentages of mols that must contain a pharmacophoric point to be considered as a core point. |
0.5
|
eps |
float
|
The maximum distance between two samples for one to be considered as in the neighborhood of the other. |
2
|
alpha |
float
|
Alpha value for the colors (currently not working). |
1.0
|
sphere_radius |
float
|
Radius of the spheres for the features. |
0.4
|
show_legend |
bool
|
Display the legend (the layout is bad but at least it shows the legend). |
True
|
Source code in molfeat/calc/pharmacophore.py
554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 |
|
get_feature_factory(factory)
¶
Build a feature factory.
Source code in molfeat/calc/pharmacophore.py
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 |
|
get_sig_factory(factory, useCounts=None, minPointCount=None, maxPointCount=None, shortestPathsOnly=None, includeBondOrder=None, skipFeats=None, trianglePruneBins=None, bins=None, init_factory=True)
¶
Build a signature factory.
Source code in molfeat/calc/pharmacophore.py
667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 |
|
get_sig_factory_params(factory_name, useCounts=None, minPointCount=None, maxPointCount=None, shortestPathsOnly=None, includeBondOrder=None, skipFeats=None, trianglePruneBins=None, bins=None)
¶
Get the default parameter for a given sig factory allowing some of them to be overriden.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
factory_name |
str
|
The name of the factory. |
required |
Source code in molfeat/calc/pharmacophore.py
710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 |
|
Scaffold Keys
¶
ScaffoldKeyCalculator
¶
Bases: SerializableCalculator
Implementation of the Scaffold Keys described in
Identification of Bioisosteric Scaffolds using Scaffold Keys
by Peter Ertl
Source code in molfeat/calc/skeys.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
|
DESCRIPTORS = ['n_atom_in_rings', 'n_atom_in_conjugated_ring', 'n_atoms_not_in_conjugated_ring', 'n_atom_in_chain', 'n_atom_exocyclic', 'n_nitrogen', 'n_nitrogen_in_ring', 'n_oxygen', 'n_oxygen_in_ring', 'n_sulfur', 'n_heteroatoms', 'n_heteroatoms_in_ring', 'n_atom_spiro_atoms', 'n_heteroatom_more_than_2_conn', 'n_carbon_atleast_2_heteroatoms', 'n_atom_at_least_2_nei_more_than_2_conn', 'abs_scaffold_format_charge', 'n_bonds', 'n_multiple_non_conj_ring_bonds', 'n_bonds_2_heteroatoms', 'n_carbon_het_carbon_het_bonds', 'n_bonds_at_least_3_conn', 'n_exocyclic_single_bonds_carbon', 'n_exocyclic_single_bonds_nitrogen', 'n_non_ring_bonds_2_conj_rings', 'n_non_ring_bonds_conj_nonconj_rings', 'n_bonds_atoms_with_at_least_one_nei_with_2_conn', 'n_simple_rings', 'size_largest_ring', 'n_simple_rings_no_heteroatoms', 'n_simple_rings_1_heteroatoms', 'n_simple_rings_2_heteroatoms', 'n_simple_rings_at_least_3_heteroatoms', 'n_simple_non_conj_5_atoms_rings', 'n_simple_non_conj_6_atoms_rings', 'n_ring_system', 'n_ring_system_with_2_non_conj_simple_ring', 'n_ring_system_with_2_conj_simple_ring', 'n_ring_system_with_conj_non_conj_simple_ring', 'n_ring_system_with_3_conj_simple_ring', 'n_ring_system_with_3_non_conj_simple_ring', 'n_ring_system_with_greater_one_conj_nonconj_simple_ring']
class-attribute
¶
NORM_PARAMS = pd.read_csv(Path(molfeat.__file__).parents[0].joinpath('data/skey_parameters.csv'), index_col=0).loc[DESCRIPTORS]
class-attribute
¶
columns
property
¶
Get the name of all the descriptors of this calculator
normalize = normalize
instance-attribute
¶
use_scaffold = use_scaffold
instance-attribute
¶
verbose = verbose
instance-attribute
¶
__call__(mol)
¶
Compute the Fingerprint of a molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[rdchem.Mol, str]
|
the molecule of interest |
required |
Returns:
Name | Type | Description |
---|---|---|
props |
np.ndarray
|
list of computed rdkit molecular descriptors |
Source code in molfeat/calc/skeys.py
528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 |
|
__getstate__()
¶
Get state of the scaffold key function
Source code in molfeat/calc/skeys.py
176 177 178 179 180 181 182 |
|
__init__(normalize=False, verbose=False, use_scaffold=False, **kwargs)
¶
Init of the scaffold key function
Parameters:
Name | Type | Description | Default |
---|---|---|---|
normalize |
bool
|
whether to normalize the value of the feature |
False
|
verbose |
bool
|
whether to log errors |
False
|
use_scaffold |
bool
|
whether to convert the molecule into scaffold first |
False
|
Source code in molfeat/calc/skeys.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
__len__()
¶
Source code in molfeat/calc/skeys.py
184 185 |
|
abs_scaffold_format_charge(mol)
¶
- absolute value of the scaffold formal charge
Source code in molfeat/calc/skeys.py
292 293 294 295 |
|
compute_normalization(features)
classmethod
¶
Normalize input features. The normalization parameters are computed by the scaffolds of 2.1M molecules from CHEMBL 29.
Source code in molfeat/calc/skeys.py
187 188 189 190 191 192 |
|
n_atom_at_least_2_nei_more_than_2_conn(mol)
¶
- Number of atoms where at least 2 connected atoms have more than 2 connections
Source code in molfeat/calc/skeys.py
284 285 286 287 288 289 290 |
|
n_atom_exocyclic(mol)
¶
- number of exocyclic atoms (connected by multiple bonds to a ring)
Source code in molfeat/calc/skeys.py
226 227 228 229 |
|
n_atom_in_chain(mol)
¶
- number atoms in chains (not counting double-connected exo-chain atoms)
Source code in molfeat/calc/skeys.py
221 222 223 224 |
|
n_atom_in_conjugated_ring(mol)
¶
- number of atoms in conjugated rings
Source code in molfeat/calc/skeys.py
199 200 201 202 203 204 205 206 |
|
n_atom_in_rings(mol)
¶
- number of ring atoms
Source code in molfeat/calc/skeys.py
194 195 196 197 |
|
n_atom_spiro_atoms(mol)
¶
- number of spiro atoms
Source code in molfeat/calc/skeys.py
267 268 269 |
|
n_atoms_not_in_conjugated_ring(mol)
¶
- number of atoms not in conjugated rings (i.e. atoms in aliphatic rings and non-ring atoms)
Source code in molfeat/calc/skeys.py
208 209 210 211 212 213 214 215 216 217 218 219 |
|
n_bonds(mol)
¶
- number of bonds
Source code in molfeat/calc/skeys.py
297 298 299 |
|
n_bonds_2_heteroatoms(mol)
¶
- number of bonds connecting 2 heteroatoms
Source code in molfeat/calc/skeys.py
313 314 315 316 |
|
n_bonds_at_least_3_conn(mol)
¶
- number of bonds with at least 3 connections on both its atoms
Source code in molfeat/calc/skeys.py
323 324 325 326 |
|
n_bonds_atoms_with_at_least_one_nei_with_2_conn(mol)
¶
- number of bonds where both atoms have at least one neighbor (not considering the bond atoms) with more than 2 connections
Source code in molfeat/calc/skeys.py
370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 |
|
n_carbon_atleast_2_heteroatoms(mol)
¶
- number of carbon atoms connected to at least 2 heteroatoms
Source code in molfeat/calc/skeys.py
276 277 278 279 280 281 282 |
|
n_carbon_het_carbon_het_bonds(mol)
¶
- number of bonds connecting 2 heteroatoms through 2 carbons
Source code in molfeat/calc/skeys.py
318 319 320 321 |
|
n_exocyclic_single_bonds_carbon(mol)
¶
- number of exocyclic single bonds where a ring atom is carbon
Source code in molfeat/calc/skeys.py
328 329 330 331 |
|
n_exocyclic_single_bonds_nitrogen(mol)
¶
- number of exocyclic single bonds where a ring atom is nitrogen
Source code in molfeat/calc/skeys.py
333 334 335 336 |
|
n_heteroatom_more_than_2_conn(mol)
¶
- number of heteroatoms with more than 2 connections
Source code in molfeat/calc/skeys.py
271 272 273 274 |
|
n_heteroatoms(mol)
¶
- number of heteroatoms
Source code in molfeat/calc/skeys.py
256 257 258 259 260 |
|
n_heteroatoms_in_ring(mol)
¶
- number of heteroatoms in rings
Source code in molfeat/calc/skeys.py
262 263 264 265 |
|
n_multiple_non_conj_ring_bonds(mol)
¶
- number of multiple, nonconjugated ring bonds
Source code in molfeat/calc/skeys.py
301 302 303 304 305 306 307 308 309 310 311 |
|
n_nitrogen(mol)
¶
- number of nitrogen
Source code in molfeat/calc/skeys.py
231 232 233 234 |
|
n_nitrogen_in_ring(mol)
¶
- number of nitrogen in rings
Source code in molfeat/calc/skeys.py
236 237 238 239 |
|
n_non_ring_bonds_2_conj_rings(mol)
¶
- number of non-ring bonds connecting 2 nonconjugated rings
Source code in molfeat/calc/skeys.py
338 339 340 341 342 343 344 345 346 347 348 349 350 |
|
n_non_ring_bonds_conj_nonconj_rings(mol)
¶
- number of non-ring bonds connecting 2 rings, one of them conjugated and one non-conjugated
Source code in molfeat/calc/skeys.py
352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
n_oxygen(mol)
¶
- number of oxygen
Source code in molfeat/calc/skeys.py
241 242 243 244 |
|
n_oxygen_in_ring(mol)
¶
- number of oxygen in rings
Source code in molfeat/calc/skeys.py
246 247 248 249 |
|
n_ring_system(mol)
¶
- number of ring systems
Source code in molfeat/calc/skeys.py
444 445 446 447 |
|
n_ring_system_with_2_conj_simple_ring(mol)
¶
- number of rings systems with 2 conjugated simple rings
Source code in molfeat/calc/skeys.py
461 462 463 464 465 466 467 468 469 470 471 |
|
n_ring_system_with_2_non_conj_simple_ring(mol)
¶
- number of rings systems with 2 non-conjugated simple rings
Source code in molfeat/calc/skeys.py
449 450 451 452 453 454 455 456 457 458 459 |
|
n_ring_system_with_3_conj_simple_ring(mol)
¶
- number of rings systems with 3 conjugated simple rings
Source code in molfeat/calc/skeys.py
486 487 488 489 490 491 492 493 494 495 496 |
|
n_ring_system_with_3_non_conj_simple_ring(mol)
¶
- number of rings systems with 3 non-conjugated simple rings
Source code in molfeat/calc/skeys.py
498 499 500 501 502 503 504 505 506 507 508 |
|
n_ring_system_with_conj_non_conj_simple_ring(mol)
¶
39 number of ring system containing 2 simple rings, one conjugated and one nonconjugated
Source code in molfeat/calc/skeys.py
473 474 475 476 477 478 479 480 481 482 483 484 |
|
n_ring_system_with_greater_one_conj_nonconj_simple_ring(mol)
¶
- number of ring system containing 3 simple rings, at least one conjugated and one nonconjugated
Source code in molfeat/calc/skeys.py
510 511 512 513 514 515 516 517 518 519 520 521 |
|
n_simple_non_conj_5_atoms_rings(mol)
¶
- number of simple non-conjugated rings with 5 atoms
Source code in molfeat/calc/skeys.py
426 427 428 429 430 431 432 433 |
|
n_simple_non_conj_6_atoms_rings(mol)
¶
- number of simple non-conjugated rings with 6 atoms
Source code in molfeat/calc/skeys.py
435 436 437 438 439 440 441 442 |
|
n_simple_rings(mol)
¶
- number of simple rings
Source code in molfeat/calc/skeys.py
391 392 393 394 |
|
n_simple_rings_1_heteroatoms(mol)
¶
- number of simple rings with 1 heteroatom
Source code in molfeat/calc/skeys.py
408 409 410 411 412 |
|
n_simple_rings_2_heteroatoms(mol)
¶
- number of simple rings with 2 heteroatom
Source code in molfeat/calc/skeys.py
414 415 416 417 418 |
|
n_simple_rings_at_least_3_heteroatoms(mol)
¶
- number of simple rings with 3 or more heteroatoms
Source code in molfeat/calc/skeys.py
420 421 422 423 424 |
|
n_simple_rings_no_heteroatoms(mol)
¶
- number of simple rings with no heteroatoms
Source code in molfeat/calc/skeys.py
402 403 404 405 406 |
|
n_sulfur(mol)
¶
- number of sulfur atoms
Source code in molfeat/calc/skeys.py
251 252 253 254 |
|
size_largest_ring(mol)
¶
- Size of the largest ring
Source code in molfeat/calc/skeys.py
396 397 398 399 400 |
|
skdistance(sk1, sk2, weights=None, cdist=False)
¶
Compute the scaffold distance between two scaffold keys as described in https://pubs.acs.org/doi/abs/10.1021/ci5001983. The input features are expected to be normalized beforehand (see paper)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
sk1 |
np.ndarray
|
scaffold key 1 |
required |
sk2 |
np.ndarray
|
scaffold key 2 |
required |
weights |
Optional[np.ndarray]
|
how to weight each of the features. By default rank ordering is used. |
None
|
cdist |
bool
|
whether to compute the features on a batched of inputs (expected 2D) |
False
|
Returns:
Name | Type | Description |
---|---|---|
dist |
float
|
distance between two scaffold keys |
Source code in molfeat/calc/skeys.py
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 |
|
Shape
¶
ElectroShapeDescriptors
¶
Bases: SerializableCalculator
Compute Electroshape descriptors as described by
Armstrong et al. ElectroShape: fast molecular similarity calculations incorporating shape, chirality and electrostatics. J Comput Aided Mol Des 24, 789-801 (2010). http://dx.doi.org/doi:10.1007/s10822-010-9374-0
Source code in molfeat/calc/shape.py
83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
SUPPORTED_CHARGE_MODELS = ['gasteiger', 'tripos', 'mmff94', 'formal']
class-attribute
¶
charge_model = charge_model
instance-attribute
¶
columns
property
¶
Get the name of all the descriptors of this calculator
electron_scaling = electron_scaling
instance-attribute
¶
replace_nan = replace_nan
instance-attribute
¶
__call__(mol, conformer_id=-1)
¶
Get rdkit 3D descriptors for a molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[dm.Mol, str]
|
the molecule of interest |
required |
conformer_id |
int
|
Optional conformer id. Defaults to -1. |
-1
|
Returns:
Name | Type | Description |
---|---|---|
shape_descriptor |
np.ndarray
|
computed shape descriptor |
Source code in molfeat/calc/shape.py
174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 |
|
__getstate__()
¶
Source code in molfeat/calc/shape.py
126 127 128 129 130 131 132 |
|
__init__(charge_model='gasteiger', replace_nan=False, electron_scaling=25.0, **kwargs)
¶
Constructor for ElectroShape descriptor
Parameters:
Name | Type | Description | Default |
---|---|---|---|
charge_model |
str
|
charge model to use. One of ('gasteiger', 'tripos', 'mmff94', 'formal'). Defaults to "gasteiger".
Note that formal charges will be computed on the fly if not provided in the input molecules.
The |
'gasteiger'
|
replace_nan |
bool
|
whether to replace NaN values. Defaults False |
False
|
electron_scaling |
float
|
scaling factor to convert electron charges to Angstroms. Defaults to 25.0. |
25.0
|
Source code in molfeat/calc/shape.py
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
|
__len__()
¶
Return the length of the calculator
Source code in molfeat/calc/shape.py
134 135 136 |
|
compute_charge(mol, charge_model=None)
staticmethod
¶
Get the molecular charge of the molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
charge_model |
str
|
charge model to use. One of ('gasteiger', 'tripos', 'mmff94', 'formal'). Defaults to "gasteiger". |
None
|
Source code in molfeat/calc/shape.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
USRDescriptors
¶
Bases: SerializableCalculator
Descriptors for the shape of a molecule.
!!! note: The following shape descriptors are offered: * USR: UltraFast Shape Recognition * USRCAT: Ultrafast Shape Recognition with CREDO Atom Types
Source code in molfeat/calc/shape.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
columns
property
¶
Get the name of all the descriptors of this calculator
method = method.upper()
instance-attribute
¶
replace_nan = replace_nan
instance-attribute
¶
__call__(mol, conformer_id=-1)
¶
Get rdkit 3D descriptors for a molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[dm.Mol, str]
|
the molecule of interest |
required |
conformer_id |
int
|
Optional conformer id. Defaults to -1. |
-1
|
Returns:
Name | Type | Description |
---|---|---|
shape_descriptors |
np.ndarray
|
list of computed mordred molecular descriptors |
Source code in molfeat/calc/shape.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
__getstate__()
¶
Source code in molfeat/calc/shape.py
39 40 41 42 43 44 |
|
__init__(method='USR', replace_nan=False, **kwargs)
¶
Constructor for ShapeDescriptors
Parameters:
Name | Type | Description | Default |
---|---|---|---|
method |
str
|
Shape descriptor method to use. One of 'USR', 'USRCAT'. Default to 'USR' |
'USR'
|
replace_nan |
bool
|
Whether to replace nan or infinite values. Defaults to False. |
False
|
augment |
Whether to augment the descriptors with some additional custom features |
required | |
descrs |
List of features to consider if not None |
required |
Source code in molfeat/calc/shape.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
__len__()
¶
Compute descriptors length
Source code in molfeat/calc/shape.py
58 59 60 |
|
usrdistance(shape_1, shape_2, weights=None)
¶
Computes similarity between molecules
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shape_1 |
USR shape descriptor of first molecule |
required | |
shape_2 |
USR shape descriptor |
required | |
weights |
Optional[List[float]]
|
List of scaling factor to use for |
None
|
Returns:
Name | Type | Description |
---|---|---|
dist | Distance [0-1] between shapes of molecules, 0 indicates identical molecules |
Source code in molfeat/calc/shape.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 |
|
Atoms Featurizer
¶
AtomCalculator
¶
Bases: SerializableCalculator
Base class for computing atom properties compatible with DGLLife
Source code in molfeat/calc/atom.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
DEFAULT_FEATURIZER = {'atom_one_hot': atom_one_hot, 'atom_degree_one_hot': atom_degree_one_hot, 'atom_implicit_valence_one_hot': atom_implicit_valence_one_hot, 'atom_hybridization_one_hot': atom_hybridization_one_hot, 'atom_is_aromatic': atom_is_aromatic, 'atom_formal_charge': atom_formal_charge, 'atom_num_radical_electrons': atom_num_radical_electrons, 'atom_is_in_ring': atom_is_in_ring, 'atom_total_num_H_one_hot': atom_total_num_H_one_hot, 'atom_chiral_tag_one_hot': atom_chiral_tag_one_hot, 'atom_is_chiral_center': atom_is_chiral_center}
class-attribute
¶
concat = concat
instance-attribute
¶
featurizer_funcs = featurizer_funcs
instance-attribute
¶
name = name
instance-attribute
¶
__call__(mol, dtype=None)
¶
Get rdkit basic descriptors for a molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[rdchem.Mol, str]
|
the molecule of interest |
required |
dtype |
Callable
|
requested data type |
None
|
Returns:
Name | Type | Description |
---|---|---|
dict | For each function in self.featurizer_funcs with the key |
Source code in molfeat/calc/atom.py
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
__init__(featurizer_funcs=None, concat=True, name='hv')
¶
Init function of the atom property calculator
Parameters:
Name | Type | Description | Default |
---|---|---|---|
featurizer_funcs |
Mapping of feature name to the featurization function.
For compatibility a list of callable/function is still accepted, and the corresponding
featurizer name will be automatically generated. Each function is of signature
|
None
|
|
concat |
bool
|
Whether to concat all the data into a single value in the output dict |
True
|
name |
str
|
Name of the key name of the concatenated features |
'hv'
|
Source code in molfeat/calc/atom.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
__len__()
¶
Get length of the property estimator
Source code in molfeat/calc/atom.py
192 193 194 |
|
feat_size(feat_name=None)
¶
Get the feature size for feat_name
.
When there is only one feature, users do not need to provide feat_name
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feat_name |
Feature for query. |
None
|
Returns:
Name | Type | Description |
---|---|---|
int | Feature size for the feature with name |
Source code in molfeat/calc/atom.py
163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 |
|
from_state_dict(state_dict, override_args=None)
classmethod
¶
Create an instance of an atom calculator from a state dict
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state_dict |
state dictionary to use to create the atom calculator |
required | |
overrride_args |
optional dictionary of arguments to override the ones in the state dict at construction of the new object |
required |
Source code in molfeat/calc/atom.py
128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
to_state_dict()
¶
Convert the Atom calculator to a state dict Due to some constraints and cross-version compatibility, the featurizer functions need to be pickled and not just return a list
Source code in molfeat/calc/atom.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
AtomMaterialCalculator
¶
Bases: AtomCalculator
Atom calculator with the extend atomic property list which have been collected from various material science packages
Source code in molfeat/calc/atom.py
234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 |
|
DEFAULT_FEATURIZER = {'atom_one_hot': atom_one_hot, 'atom_extended_properties': atom_extended_properties, 'atom_degree_one_hot': atom_degree_one_hot, 'atom_implicit_valence_one_hot': atom_implicit_valence_one_hot, 'atom_hybridization_one_hot': atom_hybridization_one_hot, 'atom_is_aromatic': atom_is_aromatic, 'atom_formal_charge': atom_formal_charge, 'atom_num_radical_electrons': atom_num_radical_electrons, 'atom_is_in_ring': atom_is_in_ring, 'atom_chiral_tag_one_hot': atom_chiral_tag_one_hot, 'atom_is_chiral_center': atom_is_chiral_center}
class-attribute
¶
DGLCanonicalAtomCalculator
¶
Bases: AtomCalculator
Default canonical featurizer for atoms used by dgllife
Source code in molfeat/calc/atom.py
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
DEFAULT_FEATURIZER = {'atom_one_hot': atom_one_hot, 'atom_degree_one_hot': atom_degree_one_hot, 'atom_implicit_valence_one_hot': atom_implicit_valence_one_hot, 'atom_formal_charge': atom_formal_charge, 'atom_num_radical_electrons': atom_num_radical_electrons, 'atom_hybridization_one_hot': partial(atom_hybridization_one_hot, allowable_set=DGLLIFE_HYBRIDIZATION_LIST), 'atom_is_aromatic': atom_is_aromatic, 'atom_total_num_H_one_hot': atom_total_num_H_one_hot}
class-attribute
¶
DGLWeaveAtomCalculator
¶
Bases: DGLCanonicalAtomCalculator
Default atom featurizer used by WeaveNet in DGLLife
Source code in molfeat/calc/atom.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
DEFAULT_FEATURIZER = {'atom_one_hot': partial(atom_one_hot, allowable_set=DGLLIFE_WEAVE_ATOMS, encode_unknown=True), 'atom_chiral_tag_one_hot': partial(atom_chiral_tag_one_hot, allowable_set=DGLLIFE_WEAVE_CHIRAL_TYPES), 'atom_formal_charge': atom_formal_charge, 'atom_partial_charge': atom_partial_charge, 'atom_is_aromatic': atom_is_aromatic, 'atom_hybridization_one_hot': partial(atom_hybridization_one_hot, allowable_set=DGLLIFE_HYBRIDIZATION_LIST[:3])}
class-attribute
¶
__call__(mol, dtype=None)
¶
Get rdkit basic descriptors for a molecule
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[rdchem.Mol, str]
|
the molecule of interest |
required |
dtype |
Callable
|
requested data type |
None
|
Returns:
Name | Type | Description |
---|---|---|
dict | For each function in self.featurizer_funcs with the key |
Source code in molfeat/calc/atom.py
353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
__init__(concat=True, name='hv')
¶
Source code in molfeat/calc/atom.py
300 301 302 303 |
|
atom_weave_props(atom)
¶
Get the WeaveNet properties for an atom
Source code in molfeat/calc/atom.py
347 348 349 350 351 |
|
Bonds Featurizer
¶
BondCalculator
¶
Bases: SerializableCalculator
A class for bond featurizer which loops over all bonds in a molecule and
featurizes them with the featurizer_funcs
. The constructed graph is assumed to be
a bi-directed graph by default.
Source code in molfeat/calc/bond.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
DEFAULT_FEATURIZER = {'bond_type_one_hot': bond_type_one_hot, 'bond_stereo_one_hot': bond_stereo_one_hot, 'bond_is_in_ring': bond_is_in_ring, 'bond_is_conjugated': bond_is_conjugated, 'bond_direction_one_hot': bond_direction_one_hot}
class-attribute
¶
concat = concat
instance-attribute
¶
featurizer_funcs = featurizer_funcs
instance-attribute
¶
name = name
instance-attribute
¶
__call__(mol, dtype=None, **kwargs)
¶
Featurize all bonds in a molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[rdchem.Mol, str]
|
the molecule of interest |
required |
dtype |
Callable
|
requested data type |
None
|
Returns:
Name | Type | Description |
---|---|---|
dict | For each function in self.featurizer_funcs with the key |
Source code in molfeat/calc/bond.py
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
|
__init__(featurizer_funcs=None, self_loop=False, concat=True, name='he')
¶
Init function of the bond property calculator
Parameters:
Name | Type | Description | Default |
---|---|---|---|
featurizer_funcs |
Union[list, dict]
|
Mapping feature name to the featurization function. |
None
|
self_loop |
bool
|
Whether self loops will be added. Default to False. If True, an additional column of binary values to indicate the identity of self loops will be added. The other features of the self loops will be zero. |
False
|
concat |
bool
|
Whether to concat all the data into a single value in the output dict |
True
|
name |
str
|
Name of the key name of the concatenated features |
'he'
|
Source code in molfeat/calc/bond.py
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
__len__()
¶
Get length of the property estimator
Source code in molfeat/calc/bond.py
177 178 179 |
|
feat_size(feat_name=None)
¶
Get the feature size for feat_name
.
When there is only one feature, feat_name
can be None.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feat_name |
Optional[str]
|
Feature for query. |
None
|
Returns:
Name | Type | Description |
---|---|---|
int | Feature size for the feature with name |
Source code in molfeat/calc/bond.py
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
|
from_state_dict(state_dict, override_args=None)
classmethod
¶
Create an instance of an atom calculator from a state dict
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state_dict |
state dictionary to use to create the atom calculator |
required | |
overrride_args |
optional dictionary of arguments to override the ones in the state dict at construction of the new object |
required |
Source code in molfeat/calc/bond.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 |
|
to_state_dict()
¶
Convert the Atom calculator to a state dict Due to some constraints and cross-version compatibility, the featurizer functions need to be pickled and not just list
Source code in molfeat/calc/bond.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
DGLCanonicalBondCalculator
¶
Bases: BondCalculator
Source code in molfeat/calc/bond.py
407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 |
|
DEFAULT_FEATURIZER = {'bond_type_one_hot': bond_type_one_hot, 'bond_is_conjugated': bond_is_conjugated, 'bond_is_in_ring': bond_is_in_ring, 'bond_stereo_one_hot': bond_stereo_one_hot}
class-attribute
¶
DGLWeaveEdgeCalculator
¶
Bases: EdgeMatCalculator
Edge featurizer used by WeaveNets
The edge featurization is introduced in Molecular Graph Convolutions:
Moving Beyond Fingerprints <https://arxiv.org/abs/1603.00856>
__.
This featurization is performed for a complete graph of atoms with self loops added, which considers the following default:
- Number of bonds between each pairs of atoms
- One-hot encoding of bond type if a bond exists between a pair of atoms
- Whether a pair of atoms belongs to a same ring
Source code in molfeat/calc/bond.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 |
|
EdgeMatCalculator
¶
Bases: BondCalculator
Generate edge featurizer matrix
Source code in molfeat/calc/bond.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
|
DEFAULT_PAIRWISE_FEATURIZER = {'pairwise_2D_dist': pairwise_2D_dist, 'pairwise_ring_membership': pairwise_ring_membership}
class-attribute
¶
pairwise_atom_funcs = pairwise_atom_funcs
instance-attribute
¶
__call__(mol, dtype=None, flat=True)
¶
Featurize all bonds in a molecule.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mol |
Union[rdchem.Mol, str]
|
the molecule of interest |
required |
dtype |
Callable
|
requested data type |
None
|
flat |
bool
|
whether to return a collapsed N^2, M or a N, N, M matrix |
True
|
Returns:
Name | Type | Description |
---|---|---|
dict | For each function in self.featurizer_funcs with the key |
Source code in molfeat/calc/bond.py
354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
|
__init__(featurizer_funcs=None, pairwise_atom_funcs='default', name='he')
¶
Init function of the edge matrix property calculator
Parameters:
Name | Type | Description | Default |
---|---|---|---|
featurizer_funcs |
Union[list, dict]
|
Mapping feature name to the featurization function. |
None
|
pairwise_atom_funcs |
Union[list, dict, str]
|
Mapping feature name to pairwise featurization function. Use the keywords "default" for the default values |
'default'
|
Source code in molfeat/calc/bond.py
255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
feat_size(feat_name=None)
¶
Get the feature size for feat_name
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
feat_name |
Optional[str]
|
Feature for query. |
None
|
Returns:
Name | Type | Description |
---|---|---|
int | Feature size for the feature with name |
Source code in molfeat/calc/bond.py
327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 |
|
from_state_dict(state_dict, override_args=None)
classmethod
¶
Create an instance of an atom calculator from a state dict
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state_dict |
state dictionary to use to create the atom calculator |
required | |
overrride_args |
optional dictionary of arguments to override the ones in the state dict at construction of the new object |
required |
Source code in molfeat/calc/bond.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 |
|
to_state_dict()
¶
Convert the Atom calculator to a state dict Due to some constraints and cross-version compatibility, the featurizer functions need to be pickled and not just list
Source code in molfeat/calc/bond.py
281 282 283 284 285 286 287 288 289 290 291 292 |
|