chemfp.highlevel.conversion module

This module should not be imported directly.

It contains internal implementation details of the high-level API available from the top-level chemfp module.

This module is included in the documentation because parts of this module are returned to the user, and are part of the public API.

class chemfp.highlevel.conversion.ConversionInfo(description, source_locations, destination_location, output_filename, output_format, times)

Bases: object

Store information about the conversion to FPS or FPB file.

An instance of this object is returned by the rdkit2fps(), oe2fps(), ob2fps(), cdk2fps(), convert2fps(), and sdf2fps() functions.

The public attributes are:

description: str

A human readable string description of the conversion.

source_locations: list[Location]

A list of io.Location values, one for each processed input source.

destination_location: Location

The io.Location for the output destination.

output_filename: str, bytes, Path, or None

The destination filename, or None.

output_format: str or None

The output file format, or None.

times: dict['total', float]

A one-element dictionary where the value for the key “total” is the time required, in seconds, as a float.

get_description() str

Return a human-readable description of the conversion run

load_output(reorder: bool = True, allow_mmap: bool = True, *, progress: bool = True)

Load the fingerprints which were written to the created output file.

This is the same as calling chemfp.load_fingerprints() using the output filename and format. The reorder, allow_mmap and progress values are passed down as well.

Parameters:
  • reorder (True or False) – Specify if fingerprints should be reordered for better performance

  • allow_mmap (True or False) – Allow chemfp to use mmap on FPB files, instead of reading the file’s contents into memory

  • progress (True, False, or a callable) – Enable or disable progress bars, optionally specifying the progress bar constructor

Returns:

chemfp.arena.FingerprintArena

property num_input_records

the number of input records read

property num_output_records

the number of output records written

open_output(*, allow_mmap: bool = True)

Open the newly created output fingerprint file for reading.

This is the same as calling chemfp.open using the output filename and format, along with the optional allow_mmap.

Parameters:

allow_mmap (boolean) – if True, use mmap to open uncompressed FPB files, otherwise read the contents

Returns:

a chemfp.fps_io.FPSReader or chemfp.arena.FingerprintArena