From 46f2577d961fac7b5fad4ef3f89b8662f13813e1 Mon Sep 17 00:00:00 2001 From: korffmo Date: Fri, 16 Feb 2024 18:43:18 +0100 Subject: [PATCH] added Flexophore functionality for synthon processing --- .../chem/descriptor/flexophore/DistHist.java | 4 +- .../flexophore/PPNodeVizHelper.java | 41 ++++++++++++++++++ .../generator/CreatorMolDistHistViz.java | 42 +++++++++++++++++-- 3 files changed, 81 insertions(+), 6 deletions(-) create mode 100644 src/main/java/com/actelion/research/chem/descriptor/flexophore/PPNodeVizHelper.java diff --git a/src/main/java/com/actelion/research/chem/descriptor/flexophore/DistHist.java b/src/main/java/com/actelion/research/chem/descriptor/flexophore/DistHist.java index f9f8dd4c..28d6fc34 100644 --- a/src/main/java/com/actelion/research/chem/descriptor/flexophore/DistHist.java +++ b/src/main/java/com/actelion/research/chem/descriptor/flexophore/DistHist.java @@ -224,10 +224,10 @@ public List getClusterCenter(int maxDistance){ } /** - * The distnce histograms are stored in a single array. + * The distance histograms are stored in a single array. * @param indexAt1 * @param indexAt2 - * @param arrHist + * @param arrHist a deep copy is taken. */ public void setDistHist(int indexAt1, int indexAt2, byte [] arrHist) { diff --git a/src/main/java/com/actelion/research/chem/descriptor/flexophore/PPNodeVizHelper.java b/src/main/java/com/actelion/research/chem/descriptor/flexophore/PPNodeVizHelper.java new file mode 100644 index 00000000..56d0cab5 --- /dev/null +++ b/src/main/java/com/actelion/research/chem/descriptor/flexophore/PPNodeVizHelper.java @@ -0,0 +1,41 @@ +package com.actelion.research.chem.descriptor.flexophore; + +import com.actelion.research.chem.Molecule3D; +import com.actelion.research.chem.StereoMolecule; +import com.actelion.research.chem.descriptor.flexophore.redgraph.SubGraphIndices; + +import java.util.ArrayList; +import java.util.List; + +/* + + + + Created by Modest von Korff + 16/02/2024 + + */ +public class PPNodeVizHelper { + + public static PPNodeViz createWithoutCoordinates(SubGraphIndices sgi, int indexPPPoint, Molecule3D mol){ + int [] arrIndexAtomFrag = sgi.getAtomIndices(); + PPNodeViz ppNodeViz = new PPNodeViz(); + ppNodeViz.setIndex(indexPPPoint); + for (int index : arrIndexAtomFrag) { + int interactionType = mol.getInteractionAtomType(index); + ppNodeViz.add(interactionType); + ppNodeViz.addIndexOriginalAtom(index); + } + return ppNodeViz; + } + public static List createWithoutCoordinates(List liSubGraphIndices, Molecule3D mol){ + List liPPNodeViz = new ArrayList<>(); + for (int i = 0; i < liSubGraphIndices.size(); i++) { + SubGraphIndices sgi = liSubGraphIndices.get(i); + PPNodeViz ppNodeViz = createWithoutCoordinates(sgi, i, mol); + liPPNodeViz.add(ppNodeViz); + } + return liPPNodeViz; + } + +} diff --git a/src/main/java/com/actelion/research/chem/descriptor/flexophore/generator/CreatorMolDistHistViz.java b/src/main/java/com/actelion/research/chem/descriptor/flexophore/generator/CreatorMolDistHistViz.java index 89b3e186..61b9e1e3 100644 --- a/src/main/java/com/actelion/research/chem/descriptor/flexophore/generator/CreatorMolDistHistViz.java +++ b/src/main/java/com/actelion/research/chem/descriptor/flexophore/generator/CreatorMolDistHistViz.java @@ -45,10 +45,7 @@ import org.openmolecules.chem.conf.gen.ConformerGenerator; import org.openmolecules.chem.conf.gen.RigidFragmentCache; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashSet; -import java.util.List; +import java.util.*; /** * CreatorMolDistHistViz @@ -460,6 +457,43 @@ public static MolDistHistViz create(List liMultCoordFragInde return molDistHistViz; + } + public static MolDistHistViz createWithoutCoordinates(List liMultCoordFragIndex, Molecule3D molecule3D){ + + MolDistHistViz molDistHistViz = new MolDistHistViz(liMultCoordFragIndex.size(), molecule3D); + + List liPPNodeViz = new ArrayList<>(); + for (int i = 0; i < liMultCoordFragIndex.size(); i++) { + SubGraphIndices sgi = liMultCoordFragIndex.get(i); + + int [] arrIndexAtomFrag = sgi.getAtomIndices(); + + PPNodeViz ppNodeViz = new PPNodeViz(); + ppNodeViz.setIndex(i); + + for (int index : arrIndexAtomFrag) { + int interactionType = molecule3D.getInteractionAtomType(index); + ppNodeViz.add(interactionType); + ppNodeViz.addIndexOriginalAtom(index); + } + liPPNodeViz.add(ppNodeViz); + } + + molDistHistViz.set(liPPNodeViz); + + byte [] arrHistPercent = new byte [ConstantsFlexophoreGenerator.BINS_HISTOGRAM]; + Arrays.fill(arrHistPercent, (byte)1); + + for (int i = 0; i < liMultCoordFragIndex.size(); i++) { + for (int j = i+1; j < liMultCoordFragIndex.size(); j++) { + molDistHistViz.setDistHist(i,j,arrHistPercent); + } + } + + molDistHistViz.realize(); + + return molDistHistViz; + } private static Molecule3D createPharmacophorePoints(Molecule3D molecule3D, List liMultCoordFragIndex) {