Skip to content

Commit

Permalink
Add usage of SDF as inputs
Browse files Browse the repository at this point in the history
  • Loading branch information
FanwangM committed Dec 2, 2021
1 parent 4b05c62 commit 4c30bc4
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,28 @@ fingerprints = from_mdl('mols.mdl', fingerprints=True, descriptors=False)
_ = from_mdl('mols.mdl', output_csv='descriptors.csv')
```

### SDF to Descriptors/Fingerprints

The "from_sdf" function accepts a filepath as an argument, and returns a list.
Each list element is a dictionary with descriptors/fingerprints corresponding to each supplied
molecule (indexed as they appear in the SDF file).

```python
from padelpy import from_sdf

# calculate molecular descriptors for molecules in `mols.sdf`
descriptors = from_sdf('mols.sdf')

# in addition to descriptors, calculate PubChem fingerprints
desc_fp = from_sdf('mols.sdf', fingerprints=True)

# only calculate fingerprints
fingerprints = from_sdf('mols.sdf', fingerprints=True, descriptors=False)

# save descriptors to a CSV file
_ = from_sdf('mols.sdf', output_csv='descriptors.csv')
```

### Command Line Wrapper

Alternatively, you can have more control over PaDEL-Descriptor with the command-line wrapper function. Any combination of arguments supported by PaDEL-Descriptor can be accepted by the "padeldescriptor" function.
Expand All @@ -84,9 +106,12 @@ from padelpy import padeldescriptor
# to supply a configuration file
padeldescriptor(config='\\path\\to\\config')

# to supply an input and output file
# to supply an input (MDL) and output file
padeldescriptor(mol_dir='molecules.mdl', d_file='descriptors.csv')

# to supply an input (SDF) and output file
padeldescriptor(mol_dir='molecules.sdf', d_file='descriptors.csv')

# a SMILES file can be supplied
padeldescriptor(mol_dir='molecules.smi', d_file='descriptors.csv')

Expand Down

0 comments on commit 4c30bc4

Please sign in to comment.