Generate molecular fingerprints with guaranteed collision‑free bits.
Project description
bit_collision_free_MF
A Python package for generating molecular fingerprints without bit collisions.
Description
bit_collision_free_MF generates Morgan fingerprints while eliminating bit collisions, which can significantly improve the accuracy and reliability of molecular fingerprints in cheminformatics applications. The package automatically determines the optimal fingerprint length to ensure that each structural feature maps to a unique bit in the fingerprint.
Installation
Requirements
- Python 3.9 or higher
- numpy
- pandas
- rdkit
Simple Installation
pip install bit_collision_free_MF
This will automatically install all dependencies, including RDKit.
Manual Installation
# Install dependencies
pip install numpy pandas rdkit
# Install the package
pip install bit_collision_free_MF
For development installation:
# Clone the repository
git clone https://github.com/Shifa-Zhong/bit_collision_free_MF.git
cd bit_collision_free_MF
# Install in development mode
pip install -e .
Troubleshooting
If you encounter issues installing RDKit:
- Verify Python version: This package requires Python 3.9 or higher.
- Alternative installation methods:
- For older Python versions:
pip install rdkit-pypi - Using conda:
conda install -c conda-forge rdkit
- For older Python versions:
Features
- Automatically determines the optimal fingerprint length to avoid bit collisions
- Supports custom fingerprint radius
- Option to remove zero-value columns
- Easy CSV export with customizable headers
- Seamless integration with pandas and NumPy
Usage
Basic Usage
from bit_collision_free_MF import generate_fingerprints, save_fingerprints
import pandas as pd
# Load your data
data = pd.read_csv('your_molecules.csv')
# Generate fingerprints
fingerprints, fp_generator = generate_fingerprints(
data,
smiles_column='smiles',
radius=1,
remove_zero_columns=True
)
# Save fingerprints to CSV
save_fingerprints(
fingerprints,
fp_generator,
output_path='path/to/output.csv',
include_header=True
)
Using the CollisionFreeMorganFP Class Directly
from bit_collision_free_MF import CollisionFreeMorganFP
import pandas as pd
# Load your data
data = pd.read_csv('your_molecules.csv')
smiles_list = data['smiles'].tolist()
# Create and fit the fingerprint generator
fp_generator = CollisionFreeMorganFP(radius=1)
fp_generator.fit(smiles_list)
# Generate fingerprints
fingerprints = fp_generator.transform(smiles_list, remove_zero_columns=True)
# Get feature names
feature_names = fp_generator.get_feature_names()
# Create a DataFrame with the fingerprints
result_df = pd.DataFrame(fingerprints, columns=feature_names)
# Save to CSV
result_df.to_csv('fingerprints.csv', index=False)
License
MIT License
Copyright (c) 2025 Shifa Zhong; Jibai Li
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.
Contact
For academic inquiries or collaboration, please contact:
- Shifa Zhong (sfzhong@tongji.edu.cn)
- Jibai Li (51263903065@stu.ecnu.edu.cn)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bit_collision_free_mf-0.5.0.tar.gz.
File metadata
- Download URL: bit_collision_free_mf-0.5.0.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
670e4a8f3ab5720e16a952debccec7c3c26573d2c8b3e882c2442dd46371f2cb
|
|
| MD5 |
aed25ca7db5985d91ff6eb2184f4bb38
|
|
| BLAKE2b-256 |
31733dec228d5f8d44ad55942158403d5419eeb080b240d33471bda709790c01
|
File details
Details for the file bit_collision_free_mf-0.5.0-py3-none-any.whl.
File metadata
- Download URL: bit_collision_free_mf-0.5.0-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4eae6bea43e270523bbcd1a7d85331518fb7ab2d19afaf7e0fbfe98eb22b3fee
|
|
| MD5 |
b7ddc8721352c47bb5dd7394365162c8
|
|
| BLAKE2b-256 |
19c80b6d02510792ec2c7666086dd3d9c35c719bc40c17742c5f81013013d709
|