Skip to content

Commit

Permalink
added the option to omit fragments in RDKitDescriptors
Browse files Browse the repository at this point in the history
  • Loading branch information
PatWalters committed Nov 24, 2024
1 parent 0befc4f commit c251860
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
author = 'Pat Walters'

# The full version, including alpha/beta/rc tags.
release = '0.5.1'
release = '0.74'

# The short X.Y version.
parsed_version = re.match(
Expand Down
2 changes: 1 addition & 1 deletion useful_rdkit_utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@
from .split_utils import *
from .scaffold_finder import *

__version__ = "0.73"
__version__ = "0.74"
6 changes: 5 additions & 1 deletion useful_rdkit_utils/descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,19 +131,23 @@ def smi2numpy_fp(smi: str, radius: int = 2, nBits: int = 2048) -> np.ndarray:
class RDKitDescriptors:
""" Calculate RDKit descriptors"""

def __init__(self: "RDKitDescriptors", hide_progress: bool = False) -> None:
def __init__(self: "RDKitDescriptors", hide_progress: bool = False, skip_fragments=False) -> None:
"""
Initialize the RDKitDescriptors class.
:param self: An instance of the RDKitDescriptors class
:type self: RDKitDescriptors
:param hide_progress: Flag to hide progress bar
:type hide_progress: bool
:param skip_fragments: Flag to skip fragment descriptors
:type skip_fragments: bool
:return: None
:rtype: None
"""
self.hide_progress = hide_progress
self.desc_names: List[str] = sorted([x[0] for x in Descriptors.descList])
if skip_fragments:
self.desc_names = [x for x in self.desc_names if "fr_" not in x]

def calc_mol(self, mol: Mol) -> np.ndarray:
"""Calculate descriptors for an RDKit molecule
Expand Down

0 comments on commit c251860

Please sign in to comment.