chemfunc


Namechemfunc JSON
Version 1.0.10 PyPI version JSON
download
home_pageNone
SummaryUseful functions and scripts for working with small molecules.
upload_time2024-09-19 23:15:35
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT License Copyright (c) 2024 Kyle Swanson Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords computational chemistry
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Chem Func

[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/chemfunc)](https://badge.fury.io/py/chemfunc)
[![PyPI version](https://badge.fury.io/py/chemfunc.svg)](https://badge.fury.io/py/chemfunc)
[![Downloads](https://pepy.tech/badge/chemfunc)](https://pepy.tech/project/chemfunc)
[![license](https://img.shields.io/github/license/swansonk14/chemfunc.svg)](https://github.com/swansonk14/chemfunc/blob/main/src/LICENSE.txt)

Useful functions and scripts for working with small molecules.

## Installation

Optionally, create a conda environment.
```bash
conda create -y -n chemfunc python=3.12
conda activate chemfunc
```

Install the latest version of Chem Func using pip.
```
pip install chemfunc
```

Alternatively, clone the repository and install the local version of the package.
```
git clone https://github.com/swansonk14/chemfunc.git
cd chemfunc
pip install -e .
```

**Note:** If you get the issue `ImportError: libXrender.so.1: cannot open shared object file: No such file or directory`, run `conda install -c conda-forge xorg-libxrender`.


## Features

Chem Func contains a variety of useful functions and scripts for working with small molecules.

Functions can be imported from the `chemfunc` package. For example:
```python
from pathlib import Path
from chemfunc.sdf_to_smiles import sdf_to_smiles

sdf_to_smiles(
    data_path=Path('molecules.sdf'),
    save_path=Path('molecules.csv')
)
```

Most modules can also be run as scripts from the command line using the `chemfunc` command along with the appropriate function name. For example:
```bash
chemfunc sdf_to_smiles \
    --data_path molecules.sdf \
    --save_path molecules.csv
```

To see a list of available scripts, run `chemfunc -h`.

For each script, run `chemfunc <script_name> -h` to see a description of the arguments for that script.


## Contents

Below is a list of the contents of the package.

[`canonicalize_smiles.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/canonicalize_smiles.py) (function, script)

Canonicalizes SMILES using RDKit canonicalization and optionally strips salts.

[`chemical_diversity.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/chemical_diversity.py) (function, script)

Computes the chemical diversity of a set of molecules in terms of Tanimoto distances.

[`cluster_molecules.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/cluster_molecules.py) (function, script)

Performs k-means clustering to cluster molecules based on Morgan fingerprints.

[`compute_properties.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/compute_properties.py) (function, script)

Computes one or more molecular properties for a set of molecules.

[`convert_sdf.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/convert_sdf.py) (functions)

Functions to convert SDF files to SMILES or SMARTS. Used by `sdf_to_smiles` and `sdf_to_smarts`.

[`deduplicate_smiles.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/deduplicate_smiles.py) (function, script)

Deduplicate a CSV files by SMILES.

[`filter_molecules.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/filter_molecules.py) (function, script)

Filters molecules to those with values in a certain range.

[`measure_experimental_reproducibility.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/measure_experimental_reproducibility.py) (function, script)

Measures the experimental reproducibility of two biological replicates by using one replicate to predict the other.

[`molecular_fingerprints.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/molecular_fingerprints.py) (functions, script)

Contains functions to compute fingerprints for molecules. Parallelized for speed. The function `save_fingerprints` can be used as a script to compute fingerprints from a CSV file and save them as an NPZ file.

[`molecular_properties.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/molecular_properties.py) (functions)

Contains functions to compute molecular properties. Parallelized for speed.

[`molecular_similarities.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/molecular_similarities.py) (functions)

Contains functions to compute similarities between molecules. Parallelized for speed.

[`nearest_neighbor.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/nearest_neighbor.py) (function, script)

Given a dataset of molecules, computes the nearest neighbor molecule in a second dataset using one of several similarity metrics.

[`plot_property_distribution.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/plot_property_distribution.py) (function, script)

Plots the distribution of molecular properties of a set of molecules.

[`plot_tsne.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/plot_tsne.py) (function, script)

Runs a t-SNE on molecular fingerprints from one or more chemical libraries.

[`regression_to_classification.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/regression_to_classification.py) (function, script)

Converts regression data to classification data using given thresholds.

[`sample_molecules.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/sample_molecules.py) (function, script)

Samples molecules from a CSV file, either uniformly at random across the entire dataset or uniformly at random from each cluster within the data.

[`sdf_to_smarts.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/sdf_to_smarts.py) (function, script)

Converts an SDF file to a CSV file with SMARTS.

[`sdf_to_smiles.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/sdf_to_smiles.py) (function, script)

Converts an SDF file to a CSV file with SMILES.

[`select_from_clusters.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/select_from_clusters.py) (function, script)

Selects the best molecule from each cluster.

[`smiles_to_svg.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/smiles_to_svg.py) (function, script)

Converts a SMILES string to an SVG image of the molecule.

[`visualize_molecules.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/visualize_molecules.py)(function, script)

Converts a file of SMILES to images of molecular structures.

[`visualize_reactions.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/visualize_reactions.py) (function, script)

Converts a file of reaction SMARTS to images of chemical reactions.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "chemfunc",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": "Kyle Swanson <swansonk.14@gmail.com>",
    "keywords": "computational chemistry",
    "author": null,
    "author_email": "Kyle Swanson <swansonk.14@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/e7/2f/045b6befffcff4b753d7c1f75f68eda413a3ae676b9fb1a8143e96b3800a/chemfunc-1.0.10.tar.gz",
    "platform": null,
    "description": "# Chem Func\n\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/chemfunc)](https://badge.fury.io/py/chemfunc)\n[![PyPI version](https://badge.fury.io/py/chemfunc.svg)](https://badge.fury.io/py/chemfunc)\n[![Downloads](https://pepy.tech/badge/chemfunc)](https://pepy.tech/project/chemfunc)\n[![license](https://img.shields.io/github/license/swansonk14/chemfunc.svg)](https://github.com/swansonk14/chemfunc/blob/main/src/LICENSE.txt)\n\nUseful functions and scripts for working with small molecules.\n\n## Installation\n\nOptionally, create a conda environment.\n```bash\nconda create -y -n chemfunc python=3.12\nconda activate chemfunc\n```\n\nInstall the latest version of Chem Func using pip.\n```\npip install chemfunc\n```\n\nAlternatively, clone the repository and install the local version of the package.\n```\ngit clone https://github.com/swansonk14/chemfunc.git\ncd chemfunc\npip install -e .\n```\n\n**Note:** If you get the issue `ImportError: libXrender.so.1: cannot open shared object file: No such file or directory`, run `conda install -c conda-forge xorg-libxrender`.\n\n\n## Features\n\nChem Func contains a variety of useful functions and scripts for working with small molecules.\n\nFunctions can be imported from the `chemfunc` package. For example:\n```python\nfrom pathlib import Path\nfrom chemfunc.sdf_to_smiles import sdf_to_smiles\n\nsdf_to_smiles(\n    data_path=Path('molecules.sdf'),\n    save_path=Path('molecules.csv')\n)\n```\n\nMost modules can also be run as scripts from the command line using the `chemfunc` command along with the appropriate function name. For example:\n```bash\nchemfunc sdf_to_smiles \\\n    --data_path molecules.sdf \\\n    --save_path molecules.csv\n```\n\nTo see a list of available scripts, run `chemfunc -h`.\n\nFor each script, run `chemfunc <script_name> -h` to see a description of the arguments for that script.\n\n\n## Contents\n\nBelow is a list of the contents of the package.\n\n[`canonicalize_smiles.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/canonicalize_smiles.py) (function, script)\n\nCanonicalizes SMILES using RDKit canonicalization and optionally strips salts.\n\n[`chemical_diversity.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/chemical_diversity.py) (function, script)\n\nComputes the chemical diversity of a set of molecules in terms of Tanimoto distances.\n\n[`cluster_molecules.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/cluster_molecules.py) (function, script)\n\nPerforms k-means clustering to cluster molecules based on Morgan fingerprints.\n\n[`compute_properties.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/compute_properties.py) (function, script)\n\nComputes one or more molecular properties for a set of molecules.\n\n[`convert_sdf.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/convert_sdf.py) (functions)\n\nFunctions to convert SDF files to SMILES or SMARTS. Used by `sdf_to_smiles` and `sdf_to_smarts`.\n\n[`deduplicate_smiles.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/deduplicate_smiles.py) (function, script)\n\nDeduplicate a CSV files by SMILES.\n\n[`filter_molecules.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/filter_molecules.py) (function, script)\n\nFilters molecules to those with values in a certain range.\n\n[`measure_experimental_reproducibility.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/measure_experimental_reproducibility.py) (function, script)\n\nMeasures the experimental reproducibility of two biological replicates by using one replicate to predict the other.\n\n[`molecular_fingerprints.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/molecular_fingerprints.py) (functions, script)\n\nContains functions to compute fingerprints for molecules. Parallelized for speed. The function `save_fingerprints` can be used as a script to compute fingerprints from a CSV file and save them as an NPZ file.\n\n[`molecular_properties.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/molecular_properties.py) (functions)\n\nContains functions to compute molecular properties. Parallelized for speed.\n\n[`molecular_similarities.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/molecular_similarities.py) (functions)\n\nContains functions to compute similarities between molecules. Parallelized for speed.\n\n[`nearest_neighbor.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/nearest_neighbor.py) (function, script)\n\nGiven a dataset of molecules, computes the nearest neighbor molecule in a second dataset using one of several similarity metrics.\n\n[`plot_property_distribution.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/plot_property_distribution.py) (function, script)\n\nPlots the distribution of molecular properties of a set of molecules.\n\n[`plot_tsne.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/plot_tsne.py) (function, script)\n\nRuns a t-SNE on molecular fingerprints from one or more chemical libraries.\n\n[`regression_to_classification.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/regression_to_classification.py) (function, script)\n\nConverts regression data to classification data using given thresholds.\n\n[`sample_molecules.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/sample_molecules.py) (function, script)\n\nSamples molecules from a CSV file, either uniformly at random across the entire dataset or uniformly at random from each cluster within the data.\n\n[`sdf_to_smarts.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/sdf_to_smarts.py) (function, script)\n\nConverts an SDF file to a CSV file with SMARTS.\n\n[`sdf_to_smiles.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/sdf_to_smiles.py) (function, script)\n\nConverts an SDF file to a CSV file with SMILES.\n\n[`select_from_clusters.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/select_from_clusters.py) (function, script)\n\nSelects the best molecule from each cluster.\n\n[`smiles_to_svg.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/smiles_to_svg.py) (function, script)\n\nConverts a SMILES string to an SVG image of the molecule.\n\n[`visualize_molecules.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/visualize_molecules.py)(function, script)\n\nConverts a file of SMILES to images of molecular structures.\n\n[`visualize_reactions.py`](https://github.com/swansonk14/chemfunc/blob/main/src/chemfunc/visualize_reactions.py) (function, script)\n\nConverts a file of reaction SMARTS to images of chemical reactions.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Kyle Swanson  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "Useful functions and scripts for working with small molecules.",
    "version": "1.0.10",
    "project_urls": {
        "Homepage": "https://github.com/swansonk14/chemfunc",
        "Issues": "https://github.com/swansonk14/chemfunc/issues"
    },
    "split_keywords": [
        "computational",
        "chemistry"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "8b99fa9c452537d9590c8b7c0ddcc5f524eb3ab93a37b87a50b446c3991152a9",
                "md5": "f7e749c8cacb4f9cf9d9058e63e0aa5b",
                "sha256": "e0c8a689890cfcd3ff49a4025993b5953c528887485b88e9fa7d5d6a7ebb25a1"
            },
            "downloads": -1,
            "filename": "chemfunc-1.0.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f7e749c8cacb4f9cf9d9058e63e0aa5b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 31754,
            "upload_time": "2024-09-19T23:15:32",
            "upload_time_iso_8601": "2024-09-19T23:15:32.443648Z",
            "url": "https://files.pythonhosted.org/packages/8b/99/fa9c452537d9590c8b7c0ddcc5f524eb3ab93a37b87a50b446c3991152a9/chemfunc-1.0.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e72f045b6befffcff4b753d7c1f75f68eda413a3ae676b9fb1a8143e96b3800a",
                "md5": "cdd78be7470701c1997172f7acd9413d",
                "sha256": "8e664469d63b9858922193167a11443cae505906f19d29e4e14bb9e1f4aa3ff7"
            },
            "downloads": -1,
            "filename": "chemfunc-1.0.10.tar.gz",
            "has_sig": false,
            "md5_digest": "cdd78be7470701c1997172f7acd9413d",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 19636,
            "upload_time": "2024-09-19T23:15:35",
            "upload_time_iso_8601": "2024-09-19T23:15:35.621872Z",
            "url": "https://files.pythonhosted.org/packages/e7/2f/045b6befffcff4b753d7c1f75f68eda413a3ae676b9fb1a8143e96b3800a/chemfunc-1.0.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-19 23:15:35",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "swansonk14",
    "github_project": "chemfunc",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "chemfunc"
}
        
Elapsed time: 3.00350s