skchem package

Subpackages

Submodules

skchem.base module

# skchem.base

Base classes for scikit-chem objects.

class skchem.base.AtomTransformer(max_atoms=100, **kwargs)[source]

Bases: skchem.base.BaseTransformer

Transformer that will produce a Panel.

Concrete classes inheriting from this should implement _transform_atom, _transform_mol and minor_axis.

See also

Transformer

axes_names

tuple – The names of the axes.

minor_axis

pd.Index – Minor axis of transformed values.

transform(mols)[source]

Transform objects according to the objects transform protocol.

Parameters:mols (skchem.Mol or pd.Series or iterable) – The mol objects to transform.
Returns:pd.Series or pd.DataFrame
class skchem.base.BaseTransformer(n_jobs=1, verbose=True)[source]

Bases: object

Transformer Base Class.

Specific Base Transformer classes inherit from this class and implement transform and axis_names.

axes_names

tuple – The names of the axes.

copy()[source]

Return a copy of this object.

classmethod from_params(params)[source]

Create a instance from a params dictionary.

get_params()[source]

Get a dictionary of the parameters of this object.

n_jobs
optional_bar(**kwargs)[source]
to_dict()[source]

Return a dictionary representation of the object.

to_json(target=None)[source]

Serialize the object as JSON.

Parameters:
  • target (str or file-like) – A file or filepath to serialize the object to. If None, return the JSON as a string.
  • Returns – None or str
to_yaml(target=None)[source]

Serialize the object as YAML.

Parameters:
  • target (str or file-like) – A file or filepath to serialize the object to. If None, return the YAML as a string.
  • Returns – None or str
transform(mols)[source]

Transform objects according to the objects transform protocol.

Parameters:mols (skchem.Mol or pd.Series or iterable) – The mol objects to transform.
Returns:pd.Series or pd.DataFrame
class skchem.base.BatchTransformer(n_jobs=1, verbose=True)[source]

Bases: skchem.base.BaseTransformer

Mixin for which transforms on multiple molecules save overhead.

Implement _transform_series with the transformation rather than _transform_mol. Must occur before Transformer or AtomTransformer in method resolution order.

See also

Transformer, AtomTransformer.

class skchem.base.CLIWrapper(error_on_fail=False, warn_on_fail=True, **kwargs)[source]

Bases: skchem.base.External, skchem.base.BaseTransformer

CLI wrapper.

Concrete classes inheriting from this must implement _cli_args, monitor_progress, _parse_outfile, _parse_errors.

monitor_progress(filename)[source]

Report the progress.

n_jobs
class skchem.base.External(**kwargs)[source]

Bases: object

Mixin for wrappers of external CLI tools.

Concrete classes must implement validate_install.

install_hint

str – an explanation of how to install external tool.

install_hint = ''
static validate_install()[source]

Determine if the external tool is available.

validated

bool – whether the external tool is installed and active.

class skchem.base.Featurizer[source]

Bases: object

Base class for m -> data transforms, such as Fingerprinting etc.

Concrete subclasses should implement name, returning a string uniquely identifying the featurizer.

class skchem.base.Transformer(n_jobs=1, verbose=True)[source]

Bases: skchem.base.BaseTransformer

Molecular based Transformer Base class.

Concrete Transformers inherit from this class and must implement _transform_mol and _columns.

See also

AtomTransformer.

axes_names

tuple – The names of the axes.

columns

pd.Index – The column index to use.

transform(mols, **kwargs)[source]

Transform objects according to the objects transform protocol.

Parameters:mols (skchem.Mol or pd.Series or iterable) – The mol objects to transform.
Returns:pd.Series or pd.DataFrame

skchem.metrics module

skchem.metrics.bedroc_score(y_true, y_pred, decreasing=True, alpha=20.0)[source]

BEDROC metric implemented according to Truchon and Bayley.

The Boltzmann Enhanced Descrimination of the Receiver Operator Characteristic (BEDROC) score is a modification of the Receiver Operator Characteristic (ROC) score that allows for a factor of early recognition.

References

The original paper by Truchon et al. is located at 10.1021/ci600426e.

Parameters:
  • y_true (array_like) – Binary class labels. 1 for positive class, 0 otherwise.
  • y_pred (array_like) – Prediction values.
  • decreasing (bool) – True if high values of y_pred correlates to positive class.
  • alpha (float) – Early recognition parameter.
Returns:

Value in interval [0, 1] indicating degree to which the predictive technique employed detects (early) the positive class.

Return type:

float

Module contents

A cheminformatics library to integrate with the Scientific Python Stack