Skip to content

Commit

Permalink
fix: add Molecular formula
Browse files Browse the repository at this point in the history
  • Loading branch information
Kohulan committed Mar 22, 2024
1 parent 40e66f3 commit c3e6a5f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 5 additions & 2 deletions app/modules/coconut/descriptors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
from app.modules.all_descriptors import get_cdk_rdkit_combined_descriptors
from app.modules.npscorer import get_np_score
from app.modules.toolkits.cdk_wrapper import get_CDK_descriptors
from app.modules.toolkits.cdk_wrapper import get_murko_framework, get_CDK_MolecularFormula
from app.modules.toolkits.cdk_wrapper import (
get_murko_framework,
get_CDK_MolecularFormula,
)
from app.modules.toolkits.helpers import parse_input
from app.modules.toolkits.rdkit_wrapper import get_rdkit_descriptors
from app.modules.tools.sugar_removal import get_sugar_info
Expand Down Expand Up @@ -63,7 +66,7 @@ def get_COCONUT_descriptors(smiles: str, toolkit: str) -> Union[Dict[str, float]

CombinedDescriptors = list(Descriptors)
CombinedDescriptors.extend(
[hasLinearSugar, hasCircularSugars, framework, nplikeliness,molFormula],
[hasLinearSugar, hasCircularSugars, framework, nplikeliness, molFormula],
)

DescriptorList = (
Expand Down
10 changes: 7 additions & 3 deletions app/modules/toolkits/cdk_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,9 @@ def get_vander_waals_volume(molecule: any) -> float:
cdk_base + ".geometry.volume.VABCVolume",
)().calculate(molecule)
return VABCVolume

def get_CDK_MolecularFormula(molecule: any)->str:


def get_CDK_MolecularFormula(molecule: any) -> str:
"""This function takes the input SMILES and creates a CDK IAtomContainer.
Args:
Expand All @@ -189,11 +190,14 @@ def get_CDK_MolecularFormula(molecule: any)->str:
Returns:
str : MolecularFormula generated using CDK.
"""
MolecularFormulaManipulator = JClass(cdk_base + ".tools.manipulator.MolecularFormulaManipulator")
MolecularFormulaManipulator = JClass(
cdk_base + ".tools.manipulator.MolecularFormulaManipulator"
)

MolecularFormula = MolecularFormulaManipulator.getMolecularFormula(molecule)
return MolecularFormulaManipulator.getString(MolecularFormula)


def get_CDK_descriptors(molecule: any) -> Union[tuple, str]:
"""Take an input SMILES and generate a selected set of molecular.
Expand Down

0 comments on commit c3e6a5f

Please sign in to comment.