@@ -94,36 +94,38 @@ def smiles2mol(
94
94
95
95
Functional usage example:
96
96
97
- .. code-block:: python
97
+ ```python
98
+ import pandas as pd
99
+ import janitor.chemistry
98
100
99
- import pandas as pd
100
- import janitor.chemistry
101
+ df = pd.DataFrame(...)
101
102
102
- df = pd.DataFrame(...)
103
-
104
- df = janitor.chemistry.smiles2mol(
105
- df=df,
106
- smiles_column_name='smiles',
107
- mols_column_name='mols'
108
- )
103
+ df = janitor.chemistry.smiles2mol(
104
+ df=df,
105
+ smiles_column_name='smiles',
106
+ mols_column_name='mols'
107
+ )
108
+ ```
109
109
110
110
Method chaining usage example:
111
111
112
- .. code-block:: python
113
-
114
- import pandas as pd
115
- import janitor.chemistry
112
+ ```python
113
+ import pandas as pd
114
+ import janitor.chemistry
116
115
117
- df = pd.DataFrame(...)
116
+ df = pd.DataFrame(...)
118
117
119
- df = df.smiles2mol(smiles_column_name='smiles',
120
- mols_column_name='mols')
118
+ df = df.smiles2mol(
119
+ smiles_column_name='smiles',
120
+ mols_column_name='mols'
121
+ )
122
+ ```
121
123
122
124
A progressbar can be optionally used.
123
125
124
- - Pass in "notebook" to show a tqdm notebook progressbar. (ipywidgets must
125
- be enabled with your Jupyter installation.)
126
- - Pass in "terminal" to show a tqdm progressbar. Better suited for use
126
+ - Pass in "notebook" to show a ` tqdm` notebook progressbar.
127
+ (`ipywidgets` must be enabled with your Jupyter installation.)
128
+ - Pass in "terminal" to show a ` tqdm` progressbar. Better suited for use
127
129
with scripts.
128
130
- "none" is the default value - progress bar will be not be shown.
129
131
@@ -180,67 +182,70 @@ def morgan_fingerprint(
180
182
181
183
Functional usage example:
182
184
183
- .. code-block:: python
185
+ ```python
186
+ import pandas as pd
187
+ import janitor.chemistry
184
188
185
- import pandas as pd
186
- import janitor.chemistry
189
+ df = pd.DataFrame(...)
187
190
188
- df = pd.DataFrame(...)
189
-
190
- # For "counts" kind
191
- morgans = janitor.chemistry.morgan_fingerprint(
192
- df=df.smiles2mol('smiles', 'mols'),
193
- mols_column_name='mols',
194
- radius=3, # Defaults to 3
195
- nbits=2048, # Defaults to 2048
196
- kind='counts' # Defaults to "counts"
197
- )
191
+ # For "counts" kind
192
+ morgans = janitor.chemistry.morgan_fingerprint(
193
+ df=df.smiles2mol('smiles', 'mols'),
194
+ mols_column_name='mols',
195
+ radius=3, # Defaults to 3
196
+ nbits=2048, # Defaults to 2048
197
+ kind='counts' # Defaults to "counts"
198
+ )
198
199
199
- # For "bits" kind
200
- morgans = janitor.chemistry.morgan_fingerprint(
201
- df=df.smiles2mol('smiles', 'mols'),
202
- mols_column_name='mols',
203
- radius=3, # Defaults to 3
204
- nbits=2048, # Defaults to 2048
205
- kind='bits' # Defaults to "counts"
206
- )
200
+ # For "bits" kind
201
+ morgans = janitor.chemistry.morgan_fingerprint(
202
+ df=df.smiles2mol('smiles', 'mols'),
203
+ mols_column_name='mols',
204
+ radius=3, # Defaults to 3
205
+ nbits=2048, # Defaults to 2048
206
+ kind='bits' # Defaults to "counts"
207
+ )
208
+ ```
207
209
208
210
Method chaining usage example:
209
211
210
- .. code-block:: python
212
+ ```python
213
+ import pandas as pd
214
+ import janitor.chemistry
211
215
212
- import pandas as pd
213
- import janitor.chemistry
216
+ df = pd.DataFrame(...)
214
217
215
- df = pd.DataFrame(...)
216
-
217
- # For "counts" kind
218
- morgans = (
219
- df.smiles2mol('smiles', 'mols')
220
- .morgan_fingerprint(mols_column_name='mols',
221
- radius=3, # Defaults to 3
222
- nbits=2048, # Defaults to 2048
223
- kind='counts' # Defaults to "counts"
224
- )
218
+ # For "counts" kind
219
+ morgans = (
220
+ df.smiles2mol('smiles', 'mols')
221
+ .morgan_fingerprint(
222
+ mols_column_name='mols',
223
+ radius=3, # Defaults to 3
224
+ nbits=2048, # Defaults to 2048
225
+ kind='counts' # Defaults to "counts"
225
226
)
227
+ )
226
228
227
- # For "bits" kind
228
- morgans = (
229
- df.smiles2mol('smiles', 'mols')
230
- .morgan_fingerprint(mols_column_name='mols',
231
- radius=3, # Defaults to 3
232
- nbits=2048, # Defaults to 2048
233
- kind='bits' # Defaults to "counts"
234
- )
229
+ # For "bits" kind
230
+ morgans = (
231
+ df
232
+ .smiles2mol('smiles', 'mols')
233
+ .morgan_fingerprint(
234
+ mols_column_name='mols',
235
+ radius=3, # Defaults to 3
236
+ nbits=2048, # Defaults to 2048
237
+ kind='bits' # Defaults to "counts"
235
238
)
239
+ )
240
+ ```
236
241
237
242
If you wish to join the morgan fingerprints back into the original
238
243
dataframe, this can be accomplished by doing a `join`,
239
244
because the indices are preserved:
240
245
241
- .. code-block:: python
242
-
243
- joined = df.join(morgans)
246
+ ``` python
247
+ joined = df.join(morgans)
248
+ ```
244
249
245
250
:param df: A pandas DataFrame.
246
251
:param mols_column_name: The name of the column that has the RDKIT
@@ -294,52 +299,57 @@ def molecular_descriptors(
294
299
295
300
The molecular descriptors are from the rdkit.Chem.rdMolDescriptors:
296
301
297
- Chi0n, Chi0v, Chi1n, Chi1v, Chi2n, Chi2v, Chi3n, Chi3v,
298
- Chi4n, Chi4v, ExactMolWt, FractionCSP3, HallKierAlpha, Kappa1,
299
- Kappa2, Kappa3, LabuteASA, NumAliphaticCarbocycles,
300
- NumAliphaticHeterocycles, NumAliphaticRings, NumAmideBonds,
301
- NumAromaticCarbocycles, NumAromaticHeterocycles, NumAromaticRings,
302
- NumAtomStereoCenters, NumBridgeheadAtoms, NumHBA, NumHBD,
303
- NumHeteroatoms, NumHeterocycles, NumLipinskiHBA, NumLipinskiHBD,
304
- NumRings, NumSaturatedCarbocycles, NumSaturatedHeterocycles,
305
- NumSaturatedRings, NumSpiroAtoms, NumUnspecifiedAtomStereoCenters,
306
- TPSA.
302
+ ```
303
+ Chi0n, Chi0v, Chi1n, Chi1v, Chi2n, Chi2v, Chi3n, Chi3v,
304
+ Chi4n, Chi4v, ExactMolWt, FractionCSP3, HallKierAlpha, Kappa1,
305
+ Kappa2, Kappa3, LabuteASA, NumAliphaticCarbocycles,
306
+ NumAliphaticHeterocycles, NumAliphaticRings, NumAmideBonds,
307
+ NumAromaticCarbocycles, NumAromaticHeterocycles, NumAromaticRings,
308
+ NumAtomStereoCenters, NumBridgeheadAtoms, NumHBA, NumHBD,
309
+ NumHeteroatoms, NumHeterocycles, NumLipinskiHBA, NumLipinskiHBD,
310
+ NumRings, NumSaturatedCarbocycles, NumSaturatedHeterocycles,
311
+ NumSaturatedRings, NumSpiroAtoms, NumUnspecifiedAtomStereoCenters,
312
+ TPSA.
313
+ ```
307
314
308
315
Functional usage example:
309
316
310
- .. code-block:: python
311
-
312
- import pandas as pd
313
- import janitor.chemistry
317
+ ```python
318
+ import pandas as pd
319
+ import janitor.chemistry
314
320
315
- df = pd.DataFrame(...)
321
+ df = pd.DataFrame(...)
316
322
317
- mol_desc = janitor.chemistry.molecular_descriptors(
323
+ mol_desc = (
324
+ janitor.chemistry.molecular_descriptors(
318
325
df=df.smiles2mol('smiles', 'mols'),
319
326
mols_column_name='mols'
320
327
)
328
+ )
329
+ ```
321
330
322
331
Method chaining usage example:
323
332
324
- .. code-block:: python
333
+ ``` python
325
334
326
- import pandas as pd
327
- import janitor.chemistry
335
+ import pandas as pd
336
+ import janitor.chemistry
328
337
329
- df = pd.DataFrame(...)
338
+ df = pd.DataFrame(...)
330
339
331
- mol_desc = (
332
- df.smiles2mol('smiles', 'mols')
333
- .molecular_descriptors(mols_column_name='mols')
334
- )
340
+ mol_desc = (
341
+ df.smiles2mol('smiles', 'mols')
342
+ .molecular_descriptors(mols_column_name='mols')
343
+ )
344
+ ```
335
345
336
346
If you wish to join the molecular descriptors back into the original
337
347
dataframe, this can be accomplished by doing a `join`,
338
348
because the indices are preserved:
339
349
340
- .. code-block:: python
341
-
342
- joined = df.join(mol_desc)
350
+ ``` python
351
+ joined = df.join(mol_desc)
352
+ ```
343
353
344
354
:param df: A pandas DataFrame.
345
355
:param mols_column_name: The name of the column that has the RDKIT mol
@@ -410,40 +420,39 @@ def maccs_keys_fingerprint(
410
420
411
421
Functional usage example:
412
422
413
- .. code-block:: python
414
-
415
- import pandas as pd
416
- import janitor.chemistry
423
+ ```python
424
+ import pandas as pd
425
+ import janitor.chemistry
417
426
418
- df = pd.DataFrame(...)
427
+ df = pd.DataFrame(...)
419
428
420
- maccs = janitor.chemistry.maccs_keys_fingerprint(
421
- df=df.smiles2mol('smiles', 'mols'),
422
- mols_column_name='mols'
423
- )
429
+ maccs = janitor.chemistry.maccs_keys_fingerprint(
430
+ df=df.smiles2mol('smiles', 'mols'),
431
+ mols_column_name='mols'
432
+ )
433
+ ```
424
434
425
435
Method chaining usage example:
426
436
427
- .. code-block:: python
437
+ ```python
438
+ import pandas as pd
439
+ import janitor.chemistry
428
440
429
- import pandas as pd
430
- import janitor.chemistry
441
+ df = pd.DataFrame(...)
431
442
432
- df = pd.DataFrame(...)
433
-
434
- maccs = (
435
- df.smiles2mol('smiles', 'mols')
436
- .maccs_keys_fingerprint(mols_column_name='mols')
437
- )
443
+ maccs = (
444
+ df.smiles2mol('smiles', 'mols')
445
+ .maccs_keys_fingerprint(mols_column_name='mols')
446
+ )
447
+ ```
438
448
439
449
If you wish to join the maccs keys fingerprints back into the
440
450
original dataframe, this can be accomplished by doing a `join`,
441
451
because the indices are preserved:
442
452
443
- .. code-block:: python
444
-
445
- joined = df.join(maccs_keys_fingerprint)
446
-
453
+ ```python
454
+ joined = df.join(maccs_keys_fingerprint)
455
+ ```
447
456
448
457
:param df: A pandas DataFrame.
449
458
:param mols_column_name: The name of the column that has the RDKIT mol
0 commit comments