Skip to content

Commit 16c5067

Browse files
Merge pull request #82 from LukaszSztukiewicz/style/last-touches
Style/last touches
2 parents 79a81fd + d418162 commit 16c5067

10 files changed

Lines changed: 138 additions & 25002 deletions

File tree

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MolecularFingerprints"
22
uuid = "6289f4a8-86f2-4df5-b427-d4de5bbdeb05"
33
authors = ["Lukasz Sztukiewicz <lukasz.sztukiewicz@campus.tu-berlin.de>"]
4-
version = "1.0.0-DEV"
4+
version = "1.3.0"
55

66
[deps]
77
Graphs = "86223c79-3864-5bf0-83f7-82e725a168b6"

README.md

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Pkg.add(url="https://github.com/LukaszSztukiewicz/MolecularFingerprints.jl")
2626
using MolecularFingerprints
2727
```
2828

29-
## Usage
29+
## Minimalistic Usage
3030
Once you have installed the MolecularFingerprints.jl package, you can start using it to calculate molecular fingerprints. Here is a simple example:
3131

3232
```julia
@@ -41,6 +41,42 @@ println(fingerprint_vector)
4141
findall(fingerprint_vector) # Indices of bits set to 1
4242
```
4343

44+
## Usage of all Fingerprint Types
45+
The MolecularFingerprints.jl package supports several types of molecular fingerprints. Here is an example of how to use all available fingerprint types:
46+
47+
```julia
48+
smiles = "C1=CC=CC=C1"
49+
50+
# 2. This package implements 4 types of fingerprints.
51+
# All of them could be customized with parameters, but here we use default settings.
52+
ecfp_calc = ECFP() # Extended Connectivity Fingerprints
53+
mhfp_calc = MHFP() # MinHash Fingerprints
54+
torsion_calc = TopologicalTorsion() # Topological Torsion Fingerprints
55+
maccs_calc = MACCS() # MACCS Keys
56+
57+
# 3. Execution: Compute the fingerprint for each type
58+
ecfp_vector = fingerprint(smiles, ecfp_calc)
59+
mhfp_vector = fingerprint(smiles, mhfp_calc)
60+
torsion_vector = fingerprint(smiles, torsion_calc)
61+
maccs_vector = fingerprint(smiles, maccs_calc)
62+
63+
# 4. Analysis: Find indices of active features
64+
65+
# ECFP returns BitVector to see active bits, we can use findall
66+
println("ECFP active bits: ", findall(ecfp_vector))
67+
68+
# MACCS returns BitVector to see active bits, we can use findall
69+
println("MACCS active bits: ", findall(maccs_vector))
70+
71+
# MHFP returns Vector{Int64} with each non-zero entry, so all bits are active
72+
# You will see that are of the 2048 bits are being listed
73+
println("MHFP active bits: ", findall(mhfp_vector .!= 0))
74+
75+
# TopologicalTorsion returns SparseArrays.SparseVector{Int32, Int64} so it is easy to find non-zero entries
76+
using SparseArrays
77+
println("Topological Torsion active bits: ", SparseArrays.findnz(torsion_vector)[1])
78+
```
79+
4480

4581
# Documentation
4682

src/interface.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# ACKNOWLEDGEMENT: docstings were partly written with the support of Microsoft Copilot AI (completion mode, not chat mode)
2+
13
# --- Abstract Interfaces for Fingerprint Calculators ---
24

35
"""

test/Manifest.toml

Lines changed: 49 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/runtests.jl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
using Test
22
using MolecularGraph
3-
using MolecularGraph: smilestomol, MolGraph
43
using MolecularFingerprints
4+
55
using Random: seed!, randstring
6-
using SparseArrays
76
using Graphs: nv, all_simple_paths, degree, vertices
87
using PythonCall: Py, pyimport, pyconvert
98
using Distances: cosine_dist
9+
using MolecularGraph: smilestomol, MolGraph, add_hydrogens!
10+
using SparseArrays: SparseVector, sparsevec, spzeros, findnz
1011

1112
# Set seed for reproducibility across all tests
1213
seed!(42)

test/unit/utils/tanimoto_similarity_tests.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# ACKNOWLEDGEMENT: this code was partly written with the support of Microsoft Copilot AI (completion mode, not chat mode)
2+
13
using MolecularFingerprints
24
using Test
35

0 commit comments

Comments
 (0)