Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

additional example ? #4

Closed
Nick-Mul opened this issue Apr 29, 2024 · 2 comments
Closed

additional example ? #4

Nick-Mul opened this issue Apr 29, 2024 · 2 comments
Assignees
Labels
status: completed Issue that was successfully solved type: question Further information is requested

Comments

@Nick-Mul
Copy link

Hi this looks really useful and very easy to use. I am sure this should be obvious but the notebook ends with:

Instead of training a machine learning model, we can also compose the elements to make a pipeline that computes the molecular fingerprint matrix.

this is exactly want I want to do, do you mind give an example of how do output this to file ?

Many thanks,
Nick

@c-w-feldmann
Copy link
Collaborator

c-w-feldmann commented Apr 30, 2024

Hi @Nick-Mul ,

For a simple pipeline returning the Morgan Fingerprint it would look like this:

from molpipeline import Pipeline
from molpipeline.any2mol import AutoToMol
from molpipeline.mol2any import MolToMorganFP

pipeline = Pipeline(
    [
        ("auto2mol", AutoToMol()),
        ("morgan_fp", MolToMorganFP()),
    ]
)

pipeline.fit_transform(your_smiles_list)

The default parameter for MolToMorganFP is return_as=sparse which will return the fingerprints as scipy.sparse.csr_martix. Other options would be dense or explicit_bit_vect, which will return a numpy array or a list of rdkit ExplicitBitVect, respectively.

I hope this answers your Question.

Christian

@c-w-feldmann c-w-feldmann self-assigned this Apr 30, 2024
@Nick-Mul
Copy link
Author

Nick-Mul commented May 2, 2024

Thanks Christian, that's perfect!

@Nick-Mul Nick-Mul closed this as completed May 2, 2024
@c-w-feldmann c-w-feldmann added type: question Further information is requested status: completed Issue that was successfully solved labels Sep 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: completed Issue that was successfully solved type: question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants