chemfp cdk2fpc

The chemfp cdk2fpc command-line tool uses CDK to generate sparse count fingerprints from the input structures. The input formats and fingerprint type command-line arguments are shared with cdk2fps. The output is in FPC format.

Note

Chemfp does not support direct search of FPC files. You must first convert the fingerprints to binary format, eg, with one of the options in fpc2fps then search the binary fingerprints.

The following reads the ChEMBL 36 SDF, generates CDK ECP6 count fingerprints, and saves them to a file. It then uses the “superimpose” method to convert the count fingerprints into binary fingerprints in FPB format. Finally, it processes query structures in SMILES format using the same steps, this time in a pipeline so the binary fingerprints can be used as similarity search queries.

% chemfp cdk2fps --ECFP6 chembl_36.sdf.gz -o chembl_36_ecfp6.fpc
% chemfp fpc2fps chembl_36_ecfp6.fpc -o chembl_36_ecfp6_superimposed.fpb
% chemfp cdk2fpc --using chembl_36_ecfp6.fpc queries.smi | chemfp fpc2fps | \
      simsearch -k 10 chembl_36_ecfp6_superimposed.fpb -o hits.csv

See Sparse fingerprints quick start for a more in-depth version of this example, using RDKit’s Morgan fingerprint instead of CDK’s ECFP.

The fingerprint type and its parameters can be specified on the command-line, as with this Daylight example:

% echo "c1ccccc1O phenol" | chemfp cdk2fpc --Daylight --searchDepth 2  --no-date
#FPC1
#num_bits=4294967296
#type=CDK-DaylightCount/2.10 searchDepth=2 pathLimit=42000 hashPseudoAtoms=0 hashExplicitHydrogens=0
#software=CDK/2.13 chemfp/5.2
67:6,79,66252:6,77381,63670037:6,74365006:2   phenol

The rest of this chapter contains the output from chemfp cdk2fpc --help. Use cdk2fps --help-formats for details about the supported input formats. (cdk2fpc accepts the same formats as cdk2fps.)

chemfp cdk2fpc command-line options

The following comes from chemfp cdk2fpc --help:

Usage: chemfp cdk2fpc [OPTIONS] [FILENAMES]...

  Generate fingerprints from a structure file using CDK.

  If specified, process the filenames, otherwise read from stdin.

Fingerprint types:
  --Daylight        Make Daylight-like fingerprints using
                    cdk.fingerprinter.Fingerprinter (default). Requires
                    explicit hydrogens.
  --GraphOnly       Make Daylight-like fingerprints (ignoring bond types).
                    Requires explicit hydrogens.
--Extended        Make Daylight-like fingerprints extended with ring feature
                    bits, using ExtendedFingerprinter. Requires explicit
                    hydrogens.
  --Hybridization   Make Daylight-like fingerprints based on SP2 hybridization
                    instead of aromaticity. Requires explicit hydrogens.
  --Substructure    Make 307-bit substructure fingerprint. Requires fully
                    implicit hydrogens.
  --ECFP0           Make ECFP0-like circular fingerprints, using
                    CircularFingerprinter(CLASS_ECFP0)
  --ECFP2           Make ECFP0-like circular fingerprints, using
                    CircularFingerprinter(CLASS_ECFP2)
  --ECFP4           Make ECFP0-like circular fingerprints, using
                    CircularFingerprinter(CLASS_ECFP4)
  --ECFP6           Make ECFP0-like circular fingerprints, using
                    CircularFingerprinter(CLASS_ECFP6)
  --FCFP0           Make FCFP0-like circular fingerprints, using
                    CircularFingerprinter(CLASS_FCFP0)
  --FCFP2           Make FCFP0-like circular fingerprints, using
                    CircularFingerprinter(CLASS_FCFP2)
  --FCFP4           Make FCFP0-like circular fingerprints, using
                    CircularFingerprinter(CLASS_FCFP4)
  --FCFP6           Make FCFP0-like circular fingerprints, using
                    CircularFingerprinter(CLASS_FCFP6)
  --AtomPairs2D     Make 780-bit atom-pair fingerprints adapted from Yap Chun
                    Wei's PaDEL.
  --KlekotaRoth     Make 4860-bit Klekota-Roth count fingerprints.
  --type TYPE_STR   Specify a chemfp type string
  --using FILENAME  Get the fingerprint type from the metadata of a
                    fingerprint file

Fingerprint options:
  --searchDepth INT              Search depth (default=7) [Daylight, Extended,
                                 GraphOnly, Hybridization]
  --pathLimit INT                Path limit (default=42000) [Daylight,
                                 Extended, GraphOnly, Hybridization]
  --hashPseudoAtoms 0|1          Include pseudo-atoms in path enumeration
                                 (default=0) [Daylight, Extended, GraphOnly,
                                 Hybridization]
  --hashExplicitHydrogens 0|1    Include explicit hydrogens in path
                                 enumeration (default=0) [Daylight, Extended,
                                 GraphOnly, Hybridization]
  --perceiveStereochemistry 0|1  Re-perceive stereochemistry from 2D/3D
                                 coordinates (default=0) [ECFP, FCFP]

Options:
  --id-tag TAG                    Get the record it from the tag TAG instead
                                  of the first line of the record.
  --in FORMAT                     Input structure format (default guesses from
                                  filename)
  -o, --output FILENAME           Save the fingerprints to FILENAME
                                  (default=stdout)
  --out FORMAT                    Output structure format (default guesses
                                  from output filename, or is 'fpc')
  --include-metadata / --no-metadata
                                  With --no-metadata, do not include the
                                  header metadata for FPC output.
  --no-date                       Do not include the 'date' metadata in the
                                  output header
  --date STR                      An ISO 8601 date (like
                                  '2025-02-07T11:10:15') to use for the 'date'
                                  metadata in the output header
  --delimiter VALUE               Delimiter style for SMILES and InChI files.
                                  Forces '-R delimiter=VALUE'.
  --has-header                    Skip the first line of a SMILES or InChI
                                  file. Forces '-R has_header=1'.
  -R NAME=VALUE                   Specify a reader argument
  --cxsmiles / --no-cxsmiles      Use --no-cxsmiles to disable the default
                                  support for CXSMILES extensions. Forces '-R
                                  cxsmiles=1' or '-R cxsmiles=0'.
  --errors [strict|report|ignore]
                                  How should structure parse errors be
                                  handled? (default=ignore)
  --progress / --no-progress      Show a progress bar (default: show unless
                                  the output is a terminal)
  --help-formats                  List the available formats and reader
                                  arguments
  --version                       Show the version and exit.
  --license-check                 Check the license and report results to
                                  stdout.
  --help                          Show this message and exit.

  By default the CDK structure reader determines the file format and
  compression type based on the filename extension. Unknown filename
  extensions are treated as a uncompressed SMILES files.

  If the data comes from stdin, or the guess based on extension name is wrong,
  then use "--in FORMAT" option to change the default input format. For
  examples:

     --in smi
     --in sdf.gz

  Use `-R` to specify format-specific reader arguments. In particular, use

     -R hydrogens=make-explicit

  to ensure that all implicit hydrogens are made explicit, and use

     -R hydrogens=make-implicit

  to ensure that all explicit hydrogens (including chiral hydrogesn) are made
  explicit.

  Use `--help-formats` for a list of available formats and reader arguments.

  Examples:

  1) Generate Daylight fingerprints from a SMILES file and ensure that all
  implicit hydrogens are made explicit (CDK's Daylight fingerprinter requires
  explicit hydrogens):

    cdk2fpc dataset.smi -R hydrogens=make-explicit

  -or-

    cdk2fpc --Daylight dataset.smi -R hydrogens=make-explicit

  2) Generate EState fingerprints from a gzip-compressed SDF and ensure that
  all explicit hydrogens are made implicit (CDK's EState pattern definitions
  require implicit hydrogens). Save the results to "test.fps".

    cdk2fpc --EState dataset.sdf.gz -R hydrogens=make-implicit -o test.fps