Skip to content

Commit

Permalink
Merge pull request #23 from talagayev/gyration
Browse files Browse the repository at this point in the history
Radius of gyration implementation
  • Loading branch information
talagayev authored Dec 12, 2024
2 parents 3b16951 + 1259152 commit 54ed4be
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mdonatello/mdonatello.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
Stereocenters,
HeavyAtoms,
AllAtoms,
RadiusOfGyration,
HeavyAtomsWeight,
)

Expand Down Expand Up @@ -289,6 +290,7 @@ def update_display(self, _=None):
HeavyAtoms(self.current_mol),
AllAtoms(self.current_mol),
HeavyAtomsWeight(self.current_mol),
RadiusOfGyration(self.current_mol),
]
physiochem_html = [
HTML(str(prop)) for prop in physiochem_properties
Expand Down
37 changes: 34 additions & 3 deletions mdonatello/properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,22 +292,22 @@ class AllAtoms(Property):
Parameters:
-----------
mol : Chem.Mol
The RDKit Mol object of the molecule for which the heavy atom count is being calculated.
The RDKit Mol object of the molecule for which the atom count is being calculated.
Returns:
--------
float
The atom count of the molecule.
"""

name = "Heavy Atoms"
name = "All Atoms"
values_format = False
unit = ""

@cached_property
def property_value(self) -> float:
"""
Calculates the heavy atoms of the molecule.
Calculates the atoms of the molecule.
Returns:
--------
Expand Down Expand Up @@ -348,6 +348,37 @@ def property_value(self) -> float:
return rdMolDescriptors.CalcNumHeavyAtoms(self.mol)


class RadiusOfGyration(Property):
"""A class for calculating the radius of gyration of a molecule.
Parameters:
-----------
mol : Chem.Mol
The RDKit Mol object of the molecule for which the radius of gyration is being calculated.
Returns:
--------
float
The radius of gyration of the molecule.
"""

name = "Gyration Radius"
values_format = True
unit = ""

@cached_property
def property_value(self) -> float:
"""
Calculates the heavy atoms of the molecule.
Returns:
--------
float
The heavy atom count of the molecule.
"""
return rdMolDescriptors.CalcRadiusOfGyration(self.mol)


class HeavyAtomsWeight(Property):
"""A class for calculating the molecular weight of heavy atoms of a molecule.
Expand Down

0 comments on commit 54ed4be

Please sign in to comment.