diff --git a/openchemlib b/openchemlib index 59b3938b..54949b8d 160000 --- a/openchemlib +++ b/openchemlib @@ -1 +1 @@ -Subproject commit 59b3938b9170e41afc956224e977b1a2d51c4b37 +Subproject commit 54949b8d6a4238316da94fa052e948142decc37d diff --git a/scripts/openchemlib/classes.js b/scripts/openchemlib/classes.js index d1b05848..83e162c2 100644 --- a/scripts/openchemlib/classes.js +++ b/scripts/openchemlib/classes.js @@ -61,7 +61,6 @@ const changedClasses = [ ['chem/Molecule', changeMolecule], ['chem/MolfileParser', replaceStandardCharsets(1)], ['chem/Molecule3D', removeCloneInfos], - ['chem/PeriodicTable', replaceHashTable], ['chem/phesaflex/EvaluableFlexibleOverlap', changeEvaluableFlexibleOverlap], ['chem/prediction/IncrementTable', changeIncrementTable], ['chem/prediction/IncrementTableWithIndex', changeIncrementTableWithIndex], diff --git a/scripts/openchemlib/removed.js b/scripts/openchemlib/removed.js index 1b1d6c7b..77c45f0a 100644 --- a/scripts/openchemlib/removed.js +++ b/scripts/openchemlib/removed.js @@ -113,6 +113,7 @@ export const removedClasses = [ 'util/AnimatedGIFWriter.java', 'util/Base64.java', 'util/BinaryEncoder.java', + 'util/BlockingPipe.java', 'util/BrowserControl.java', 'util/concurrent', 'util/datamodel/IdentifiedObject.java', diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/MedianStatisticFunctions.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/MedianStatisticFunctions.java index e18735a1..65d70af9 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/MedianStatisticFunctions.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/MedianStatisticFunctions.java @@ -221,6 +221,8 @@ public static ModelMedianInteger getMedianForInteger(List liScore) { modelMedian.lowerQuartile = (int)(MedianStatisticFunctions.getPercentileFromSortedInt(liScore, 0.25) + 0.5); modelMedian.median = (int)(MedianStatisticFunctions.getPercentileFromSortedInt(liScore, 0.5) + 0.5); modelMedian.upperQuartile = (int)(MedianStatisticFunctions.getPercentileFromSortedInt(liScore, 0.75) + 0.5); + modelMedian.min = liScore.get(0); + modelMedian.max = liScore.get(liScore.size()-1); modelMedian.size = liScore.size(); return modelMedian; } diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/ModelMedianDouble.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/ModelMedianDouble.java index c712069e..e3736cae 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/ModelMedianDouble.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/ModelMedianDouble.java @@ -94,75 +94,55 @@ public double range(){ public String toString() { - StringBuilder sb = new StringBuilder(); - + StringBuilder sb = new StringBuilder(); sb.append(Formatter.format4(lowerQuartile)); sb.append("\t"); sb.append(Formatter.format4(median)); sb.append("\t"); sb.append(Formatter.format4(upperQuartile)); - return sb.toString(); } public static String toString(List liModelMedian) { - StringBuilder sb = new StringBuilder(); - + StringBuilder sb = new StringBuilder(); int length = LENGTH; - int lengthText = 15; sb.append(StringFunctions.format2DefinedLengthTrailing("Id", lengthText)); for (int i = 0; i < liModelMedian.size(); i++) { ModelMedianDouble m = liModelMedian.get(i); - String s = StringFunctions.format2DefinedLengthLeading(Integer.toString(m.id), length); - sb.append(s); } sb.append("\n"); - sb.append(StringFunctions.format2DefinedLengthTrailing("Upper quartile", lengthText)); for (int i = 0; i < liModelMedian.size(); i++) { ModelMedianDouble m = liModelMedian.get(i); - String s = StringFunctions.format2DefinedLengthLeading(Formatter.format2(m.upperQuartile), length); - sb.append(s); } - sb.append("\n"); - sb.append(StringFunctions.format2DefinedLengthTrailing("Median", lengthText)); for (int i = 0; i < liModelMedian.size(); i++) { ModelMedianDouble m = liModelMedian.get(i); - String s = StringFunctions.format2DefinedLengthLeading(Formatter.format2(m.median), length); - sb.append(s); } - sb.append("\n"); - sb.append(StringFunctions.format2DefinedLengthTrailing("Lower quartile", lengthText)); for (int i = 0; i < liModelMedian.size(); i++) { ModelMedianDouble m = liModelMedian.get(i); - String s = StringFunctions.format2DefinedLengthLeading(Formatter.format2(m.lowerQuartile), length); - sb.append(s); } sb.append("\n"); - sb.append(StringFunctions.format2DefinedLengthTrailing("Size", lengthText)); for (int i = 0; i < liModelMedian.size(); i++) { ModelMedianDouble m = liModelMedian.get(i); - String s = StringFunctions.format2DefinedLengthLeading(Integer.toString(m.size), length); - sb.append(s); } diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/ModelMedianInteger.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/ModelMedianInteger.java index e460e590..5b856d08 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/ModelMedianInteger.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/calc/statistics/median/ModelMedianInteger.java @@ -45,7 +45,11 @@ public class ModelMedianInteger { public int median; public int upperQuartile; - + + public int min; + + public int max; + public int id; public int size; diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Element.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Element.java deleted file mode 100644 index b40356c5..00000000 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Element.java +++ /dev/null @@ -1,162 +0,0 @@ -/* -* Copyright (c) 1997 - 2016 -* Actelion Pharmaceuticals Ltd. -* Gewerbestrasse 16 -* CH-4123 Allschwil, Switzerland -* -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this -* list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* 3. Neither the name of the the copyright holder nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -package com.actelion.research.chem; - -import com.actelion.research.util.Formatter; - -import java.util.Comparator; - -public class Element { - - private int orderNumber; - - private String name; - - private String symbol; - - private double weight; - - private double covalentRadius; - - private double vdwRadius; - - private double electronegativity; - - public Element() { - - } - - public Element(int orderNumber, String name, String symbol, - double weight, double covalentRadius, double vdwRadius, double electronegativity) { - - this.orderNumber = orderNumber; - - this.name = name; - - this.symbol = symbol; - - this.weight = weight; - - this.covalentRadius = covalentRadius; - - this.vdwRadius = vdwRadius; - - this.electronegativity = electronegativity; - } - - public int getOrderNumber() { - return orderNumber; - } - - public String getName() { - return name; - } - - public String getSymbol() { - return symbol; - } - - public double getWeight() { - return weight; - } - - public double getCovalentRadius() { - return covalentRadius; - } - - public double getVDWRadius() { - return vdwRadius; - } - - public double getElectronegativity() { - return electronegativity; - } - - public void setElectronegativity(double electronegativity) { - this.electronegativity = electronegativity; - } - - public String toString() { - - return symbol; - } - - - public String toStringForValueTable(){ - - StringBuilder sb = new StringBuilder(); - - sb.append("new Element("); - sb.append(orderNumber); - sb.append(","); - sb.append("\"" + name + "\""); - sb.append(","); - sb.append("\"" + symbol + "\""); - sb.append(","); - sb.append(Formatter.format3(weight)); - sb.append(","); - sb.append(Formatter.format3(covalentRadius)); - sb.append(","); - sb.append(Formatter.format3(vdwRadius)); - sb.append(","); - sb.append(Formatter.format3(electronegativity)); - sb.append("),"); - - return sb.toString(); - - } - - - public static Comparator getComparatorOrderNumber(){ - - return new Comparator() { - @Override - public int compare(Element o1, Element o2) { - - int cmp = 0; - - if(o1.getOrderNumber() > o2.getOrderNumber()){ - cmp=1; - }else if(o1.getOrderNumber() < o2.getOrderNumber()){ - cmp=-1; - } - - return cmp; - } - }; - } - - - -} \ No newline at end of file diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/ExtendedMolecule.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/ExtendedMolecule.java index 48b05958..0997805a 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/ExtendedMolecule.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/ExtendedMolecule.java @@ -3113,8 +3113,7 @@ else if (isAtomicNoElectropositive(mAtomicNo[connAtom])) { state -= bondOrder; } else if (mAtomicNo[atom] != mAtomicNo[connAtom]) { - if (PeriodicTable.getElement(mAtomicNo[atom]).getElectronegativity() - < PeriodicTable.getElement(mAtomicNo[connAtom]).getElectronegativity()) + if (cElectronegativity[mAtomicNo[atom]] < cElectronegativity[mAtomicNo[connAtom]]) state += bondOrder; else state -= bondOrder; diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/ExtendedMoleculeFunctions.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/ExtendedMoleculeFunctions.java index de3afa96..dd05c800 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/ExtendedMoleculeFunctions.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/ExtendedMoleculeFunctions.java @@ -66,13 +66,10 @@ package com.actelion.research.chem; import com.actelion.research.calc.ArrayUtilsCalc; -import com.actelion.research.calc.statistics.StatisticsOverview; import com.actelion.research.calc.statistics.median.MedianStatisticFunctions; -import com.actelion.research.chem.descriptor.DescriptorEncoder; import com.actelion.research.chem.descriptor.DescriptorHandler; import com.actelion.research.chem.descriptor.flexophore.redgraph.SubGraphIndices; import com.actelion.research.chem.mcs.ListWithIntVec; -import com.actelion.research.util.BurtleHasher; import com.actelion.research.util.Formatter; import com.actelion.research.util.datamodel.IntegerDouble; @@ -1063,7 +1060,7 @@ public static boolean isThioEther(StereoMolecule mol, int atom) { } public static boolean isWildcard(StereoMolecule mol, int atom) { - if(mol.getAtomicNo(atom) == PeriodicTable.ConnectionPoint){ + if(mol.getAtomicNo(atom) == 0){ return true; } return false; diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/MolecularFormula.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/MolecularFormula.java index e9f6f177..ebd8157b 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/MolecularFormula.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/MolecularFormula.java @@ -34,7 +34,7 @@ package com.actelion.research.chem; public class MolecularFormula { - private static final double[] sRelativeMass = { 0.0, + public static final double[] sRelativeMass = { 0.0, 1.00794, 4.0026, 6.9410, 9.0122, 10.811, 12.011, // H , He, Li, Be, B , C , 14.007, 15.999, 18.998, 20.180, 22.990, 24.305, // N , O , F , Ne, Na, Mg, 26.982, 28.086, 30.974, 32.066, 35.453, 39.948, // Al, Si, P , S , Cl, Ar, @@ -68,7 +68,7 @@ public class MolecularFormula { 113.15934, 128.17428, 131.19846, 147.17646, 97.11658, 87.0777, // Leu,Lys,Met,Phe,Pro,Ser, 101.10458, 186.2134 , 163.17546, 99.13246 }; // Thr,Trp,Tyr,Val, - private static final double[] sAbsoluteMass = { 0.0, + public static final double[] sAbsoluteMass = { 0.0, 1.007825, 4.00260 , 7.016003, 9.012182, // H, He,Li,Be 11.009305, 12.000000, 14.003074, 15.994915, // B ,C ,N, O 18.998403, 19.992435, 22.989767, 23.985042, // F ,Ne,Na,Mg diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Molecule.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Molecule.java index c86f4246..3895bf3b 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Molecule.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/Molecule.java @@ -462,6 +462,27 @@ public class Molecule implements Serializable { {2,3}, {3} // No, Lr }; + // Allen scale (lanthanides,actinides from ReVEBE & Pauling scale) + public static final float[] cElectronegativity = new float[] { 2.544f, + 2.300f, 4.160f, 0.912f, 1.576f, 2.051f, 2.544f, // H, He, Li, Be, B, C, + 3.066f, 3.610f, 4.193f, 4.787f, 0.869f, 1.293f, // N, O, F, Ne, Na, Mg, + 1.613f, 1.916f, 2.253f, 2.589f, 2.869f, 3.242f, // Al, Si, P, S, Cl, Ar, + 0.734f, 1.034f, 1.190f, 1.380f, 1.530f, 1.650f, // K, Ca, Sc, Ti, V, Cr, + 1.750f, 1.800f, 1.840f, 1.880f, 1.850f, 1.588f, // Mn, Fe, Co, Ni, Cu, Zn, + 1.756f, 1.994f, 2.211f, 2.424f, 2.685f, 2.966f, // Ga, Ge, As, Se, Br, Kr, + 0.706f, 0.963f, 1.120f, 1.320f, 1.410f, 1.470f, // Rb, Sr, Y, Zr, Nb, Mo, + 1.510f, 1.540f, 1.560f, 1.580f, 1.870f, 1.521f, // Tc, Ru, Rh, Pd, Ag, Cd, + 1.656f, 1.824f, 1.984f, 2.158f, 2.359f, 2.582f, // In, Sn, Sb, Te, I, Xe, + 0.659f, 0.881f, 1.02f, 1.04f, 0.92f, 0.95f, // Cs, Ba, La ,Ce, Pr, Nd, + 0.99f, 1.03f, 1.08f, 1.06f, 1.05f, 1.09f, // Pm, Sm, Eu, Gd, Tb, Dy, + 1.12f, 1.08f, 1.11f, 1.21f, 1.09f, 1.16f, // Ho, Er, Tm, Yb, Lu, Hf, + 1.34f, 1.47f, 1.60f, 1.65f, 1.68f, 1.72f, // Ta, W, Re, Os, Ir, Pt, + 1.92f, 1.765f, 1.789f, 1.854f, 2.01f, 2.19f, // Au, Hg, Tl, Pb, Bi, Po, + 2.39f, 2.60f, 0.67f, 0.89f, 0.98f, 1.08f, // At, Rn, Fr, Ra, Ac, Th, + 1.5f, 1.38f, 1.36f, 1.28f, 1.3f, 1.3f, // Pa, U, Np, Pu, Am, Cm, + 1.3f, 1.3f, 1.3f, 1.3f, 1.3f, 1.3f, // Bk, Cf, Es, Fm, Md, No, + }; + transient protected int mMaxAtoms; transient protected int mMaxBonds; diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/PeriodicTable.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/PeriodicTable.java deleted file mode 100644 index 2d8f8bc7..00000000 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/PeriodicTable.java +++ /dev/null @@ -1,287 +0,0 @@ -/* -* Copyright (c) 1997 - 2016 -* Actelion Pharmaceuticals Ltd. -* Gewerbestrasse 16 -* CH-4123 Allschwil, Switzerland -* -* All rights reserved. -* -* Redistribution and use in source and binary forms, with or without -* modification, are permitted provided that the following conditions are met: -* -* 1. Redistributions of source code must retain the above copyright notice, this -* list of conditions and the following disclaimer. -* 2. Redistributions in binary form must reproduce the above copyright notice, -* this list of conditions and the following disclaimer in the documentation -* and/or other materials provided with the distribution. -* 3. Neither the name of the the copyright holder nor the -* names of its contributors may be used to endorse or promote products -* derived from this software without specific prior written permission. -* -* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR -* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -* -*/ - -package com.actelion.research.chem; - -import java.util.HashMap; - -public class PeriodicTable { - - public static final int ConnectionPoint = 0; - - public static final int Hydrogen = 1; - - public static final int Carbon = 6; - - public static final int Nitrogen = 7; - - public static final int Oxygen = 8; - - public static final int Fluorine = 9; - - public static final int Silicon = 14; - - public static final int Phosphorus = 15; - - public static final int Sulfur = 16; - - public static final int Chlorine = 17; - - public static final int Bromine = 35; - - public static final int Iodine = 53; - public static final int Uranium = 92; - - - - private static Element[] arrData; - - private boolean [] arrAlkaline; - - // private HashMap htblDataAtNo; - Element [] elements; - - - private HashMap htblDataName; - - private HashMap htblDataSymbol; - - private static PeriodicTable tbl; - - - private PeriodicTable() { - - elements = new Element [120]; - - htblDataName = new HashMap<>(); - - htblDataSymbol = new HashMap<>(); - -// Order Number, Element Symbol, Atomic Weight, Covalent Radius, VdW radius - arrData = new Element [] { - new Element(1,"Hydrogen","H",1.008,0.435,1.185,2.200), - new Element(2,"Helium","He",4.003,0.930,1.785,0.000), - new Element(3,"Lithium","Li",6.940,1.520,0.000,0.980), - new Element(4,"Beryllium","Be",9.013,1.143,0.000,1.570), - new Element(5,"Boron","B",10.820,0.975,1.700,2.040), - new Element(6,"Carbon","C",12.011,0.655,1.750,2.550), - new Element(7,"Nitrogen","N",14.008,0.750,1.525,3.040), - new Element(8,"Oxygen","O",16.000,0.730,1.400,3.440), - new Element(9,"Fluorine","F",19.000,0.720,1.350,3.980), - new Element(10,"Neon","Ne",20.183,0.710,1.600,0.000), - new Element(11,"Sodium","Na",22.991,1.858,0.000,0.930), - new Element(12,"Magnesium","Mg",24.320,1.605,0.000,1.310), - new Element(13,"Aluminum","Al",26.980,1.432,0.000,1.610), - new Element(14,"Silicon","Si",28.090,1.176,2.000,1.900), - new Element(15,"Phosphorus","P",30.975,1.060,1.900,2.190), - new Element(16,"Sulfur","S",32.066,1.020,1.850,2.580), - new Element(17,"Chlorine","Cl",35.457,0.990,1.780,3.160), - new Element(18,"Argon","Ar",39.944,0.980,1.900,0.000), - new Element(19,"Potassium","K",39.100,2.262,0.000,1.000), - new Element(20,"Calcium","Ca",40.080,1.976,0.000,1.360), - new Element(21,"Scandium","Sc",44.960,1.655,0.000,1.540), - new Element(22,"Titanium","Ti",47.900,1.476,0.000,1.630), - new Element(23,"Vanadium","V",50.950,1.309,0.000,1.660), - new Element(24,"Chromium","Cr",52.010,1.249,0.000,1.550), - new Element(25,"Manganese","Mn",54.940,1.350,0.000,1.830), - new Element(26,"Iron","Fe",55.850,1.241,0.000,1.880), - new Element(27,"Cobalt","Co",58.940,1.254,0.000,1.910), - new Element(28,"Nickel","Ni",58.690,1.246,0.000,1.900), - new Element(29,"Copper","Cu",63.540,1.278,0.000,1.650), - new Element(30,"Zinc","Zn",65.380,1.333,0.000,1.810), - new Element(31,"Gallium","Ga",69.720,1.350,0.000,2.010), - new Element(32,"Germanium","Ge",72.600,1.225,0.000,0.000), - new Element(33,"Arsenic","As",74.910,1.200,2.100,2.180), - new Element(34,"Selenium","Se",78.960,1.160,2.000,2.550), - new Element(35,"Bromine","Br",79.916,1.140,1.970,0.000), - new Element(36,"Krypton","Kr",83.800,1.120,2.000,2.960), - new Element(37,"Rubidium","Rb",85.480,2.470,0.000,0.000), - new Element(38,"Strontium","Sr",87.630,2.151,0.000,0.820), - new Element(39,"Yttrium","Y",88.920,1.824,0.000,0.950), - new Element(40,"Zirconium","Zr",91.220,1.616,0.000,1.220), - new Element(41,"Niobium","Nb",92.910,1.432,0.000,1.330), - new Element(42,"Molybdenum","Mo",95.950,1.363,0.000,1.600), - new Element(43,"Technetium","Tc",99.000,1.367,0.000,2.160), - new Element(44,"Ruthenium","Ru",101.100,1.353,0.000,1.900), - new Element(45,"Rhodium","Rh",102.910,1.345,0.000,2.200), - new Element(46,"Palladium","Pd",106.700,1.375,0.000,2.280), - new Element(47,"Silver","Ag",107.880,1.445,0.000,2.200), - new Element(48,"Cadmium","Cd",112.410,1.489,0.000,1.930), - new Element(49,"Indium","In",114.760,1.666,0.000,1.690), - new Element(50,"Tin","Sn",118.700,1.538,0.000,1.780), - new Element(51,"Antimony","Sb",121.760,1.400,2.200,1.960), - new Element(52,"Tellurium","Te",127.610,1.360,2.200,0.000), - new Element(53,"Iodine","I",126.910,1.330,2.200,2.050), - new Element(54,"Xenon","Xe",131.300,1.310,2.200,2.100), - new Element(55,"Cesium","Cs",132.910,2.632,0.000,2.660), - new Element(56,"Barium","Ba",137.360,2.171,0.000,2.600), - new Element(57,"Lanthanum","La",138.920,1.873,0.000,0.790), - new Element(58,"Cerium","Ce",140.130,1.824,0.000,0.890), - new Element(59,"Praesodymium","Pr",140.920,1.836,0.000,1.100), - new Element(60,"Neodymium","Nd",144.270,1.829,0.000,1.120), - new Element(61,"Promethium","Pm",145.000,1.809,0.000,1.130), - new Element(62,"Samarium","Sm",150.430,1.804,0.000,1.140), - new Element(63,"Europium","Eu",152.000,1.984,0.000,0.000), - new Element(64,"Gadolinium","Gd",156.900,1.818,0.000,1.170), - new Element(65,"Terbium","Tb",158.930,1.800,0.000,0.000), - new Element(66,"Dyprosium","Dy",162.460,1.795,0.000,1.200), - new Element(67,"Holmium","Ho",164.940,1.789,0.000,0.000), - new Element(68,"Erbium","Er",167.200,1.779,0.000,1.220), - new Element(69,"Thulium","Tm",168.940,1.769,0.000,1.230), - new Element(70,"Ytterbium","Yb",173.040,1.940,0.000,1.240), - new Element(71,"Lutetium","Lu",174.990,1.752,0.000,1.250), - new Element(72,"Hafnium","Hf",178.600,1.597,0.000,0.000), - new Element(73,"Tantalium","Ta",180.950,1.428,0.000,1.270), - new Element(74,"Wolfram","W",183.920,1.371,0.000,1.300), - new Element(75,"Rhenium","Re",186.310,1.380,0.000,1.500), - new Element(76,"Osmium","Os",190.200,1.368,0.000,2.360), - new Element(77,"Iridium","Ir",192.200,1.357,0.000,1.900), - new Element(78,"Platinum","Pt",195.230,1.387,0.000,2.200), - new Element(79,"Gold","Au",197.000,1.442,0.000,2.200), - new Element(80,"Mercury","Hg",200.610,1.502,0.000,2.280), - new Element(81,"Thallium","Tl",204.390,1.728,0.000,2.540), - new Element(82,"Lead","Pb",207.210,1.750,0.000,2.000), - new Element(83,"Bismuth","Bi",209.000,1.460,0.000,1.620), - new Element(84,"Polonium","Po",210.000,1.460,0.000,2.330), - new Element(85,"Astatine","At",210.000,1.450,0.000,2.020), - new Element(86,"Radon","Rn",222.000,1.430,0.000,2.000), - new Element(87,"Francium","Fr",223.000,2.500,0.000,2.200), - new Element(88,"Radium","Ra",226.050,2.140,0.000,0.000), - new Element(89,"Actinium","Ac",227.000,1.877,0.000,0.700), - new Element(90,"Thorium","Th",232.050,1.798,0.000,0.890), - new Element(91,"Protactinium","Pa",231.000,1.609,0.000,1.100), - new Element(92,"Uranium","U",238.070,1.568,0.000,1.300), - new Element(93,"Neptunium","Np",237.000,0.000,0.000,1.500), - new Element(94,"Plutonium","Pu",242.000,0.000,0.000,1.380), - new Element(95,"Americium","Am",243.000,0.000,0.000,1.360), - new Element(96,"Curium","Cm",243.000,0.000,0.000,1.280), - new Element(97,"Berkelium","Bk",245.000,0.000,0.000,1.300), - new Element(98,"Californium","Cf",246.000,0.000,0.000,1.300), - new Element(99,"Einsteinium","E",-999.000,0.000,0.000,1.300), - new Element(100,"Fermium","Fm",-999.000,0.000,0.000,1.300), - new Element(101,"Mendelevium","Mv",-999.000,0.000,0.000,1.300) - - }; - - for (Element element : arrData) { - - elements[element.getOrderNumber()]=element; - // htblDataAtNo.put(element.getOrderNumber(), element); - htblDataName.put(element.getName(), element); - htblDataSymbol.put(element.getSymbol().toLowerCase(), element); - } - - arrAlkaline = new boolean[arrData.length]; - - arrAlkaline[3]=true; - arrAlkaline[11]=true; - arrAlkaline[19]=true; - arrAlkaline[37]=true; - arrAlkaline[55]=true; - arrAlkaline[87]=true; - - } - - private static PeriodicTable getInstance() { - if (tbl == null) { - tbl = new PeriodicTable(); - } - return tbl; - } - - public static boolean isAlkaline(int atomicNo) { - return getInstance().arrAlkaline[atomicNo]; - } - - /** - * - * @param sNameOrSymbol - * @return atomic order number or 0 if the input can not be resolved to an element. - */ - public static int number(String sNameOrSymbol) { - - int orderNumber = 0; - - Element el = getInstance().htblDataName.get(sNameOrSymbol); - if (el == null) - el = getInstance().htblDataSymbol.get(sNameOrSymbol.toLowerCase()); - - if (el != null) - orderNumber = el.getOrderNumber(); - - return orderNumber; - } - - public static String symbol(int orderNumber) { - - String sSymbol = ""; - - Element el = getInstance().elements[orderNumber]; - - if (el != null) - sSymbol = el.getSymbol(); - - return sSymbol; - } - - public static int size(){ - return getInstance().elements.length; - } - - /** - * - * @param orderNumber - * @return element weight - */ - public static double getWeight(int orderNumber) { - Element el = getInstance().elements[orderNumber]; - return el.getWeight(); - } - - public static String name(int orderNumber) { - String sName = ""; - Element el = getInstance().elements[orderNumber]; - if (el != null) - sName = el.getName(); - return sName; - } - - public static Element getElement(int orderNumber) { - return getInstance().elements[orderNumber]; - } - - public String toString() { - String sPeriodicTable = ""; - return sPeriodicTable; - } -} \ No newline at end of file diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/descriptor/flexophore/completegraphmatcher/ObjectiveBlurFlexophoreHardMatchUncovered.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/descriptor/flexophore/completegraphmatcher/ObjectiveBlurFlexophoreHardMatchUncovered.java index 41eb0624..cb999898 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/descriptor/flexophore/completegraphmatcher/ObjectiveBlurFlexophoreHardMatchUncovered.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/descriptor/flexophore/completegraphmatcher/ObjectiveBlurFlexophoreHardMatchUncovered.java @@ -855,7 +855,7 @@ public void setBase(IMolDistHist iMolDistHistBase) { resetSimilarityArrays = true; if(!checkAtomTypes(mdhvBase)) { - throw new RuntimeException("Base contains Invalid atom type for similarity calculation " + mdhvBase.getMolDistHist().toString() + "."); + throw new RuntimeException("Base contains Invalid atom type for similarity calculation " + mdhvBase.getMolDistHist().toStringNodes() + "."); } deltaNanoBaseBlur += System.nanoTime()-t0; diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/descriptor/flexophore/redgraph/SubGraphExtractor.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/descriptor/flexophore/redgraph/SubGraphExtractor.java index b39d9692..5178a6ce 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/descriptor/flexophore/redgraph/SubGraphExtractor.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/descriptor/flexophore/redgraph/SubGraphExtractor.java @@ -34,7 +34,10 @@ package com.actelion.research.chem.descriptor.flexophore.redgraph; -import com.actelion.research.chem.*; +import com.actelion.research.chem.ExtendedMoleculeFunctions; +import com.actelion.research.chem.Molecule; +import com.actelion.research.chem.RingCollection; +import com.actelion.research.chem.StereoMolecule; import com.actelion.research.util.hash.HashSetInt; import java.util.*; @@ -871,14 +874,9 @@ private SubGraphIndices largestAliphaticFragment(StereoMolecule mol, int [] arrI int atomicNo = mol.getAtomicNo(indAtmConn); - if((atomicNo == PeriodicTable.Nitrogen) || - (atomicNo == PeriodicTable.Oxygen) || - (atomicNo == PeriodicTable.Fluorine)) { - + if(atomicNo == 7 || atomicNo == 8 || atomicNo == 9) { nCarbonWithElectronegativeNeighbors++; - break; - } } } @@ -893,11 +891,8 @@ private SubGraphIndices largestAliphaticFragment(StereoMolecule mol, int [] arrI SubGraphIndices fragment = null; if(liFragment.size() > 0){ - Collections.sort(liFragment, SubGraphIndices.getComparatorNumIndices()); - fragment = liFragment.get(liFragment.size()-1); - } return fragment; @@ -1146,12 +1141,12 @@ private List getEndStandingHeteroGroups(StereoMolecule mol, Lis if(isSmallRingAtom(indAtmConn)){ // If the end standing atom is of this type it will become an own pharmacophore point. // Even if it is directly connected to a ring. - // Additionally it can be included to the atom types of the ring. - if(atomicNo != PeriodicTable.Nitrogen && - atomicNo != PeriodicTable.Oxygen && - atomicNo != PeriodicTable.Sulfur && - atomicNo != PeriodicTable.Chlorine && - atomicNo != PeriodicTable.Bromine) + // Additionally, it can be included to the atom types of the ring. + if (atomicNo != 7 + && atomicNo != 8 + && atomicNo != 16 + && atomicNo != 17 + && atomicNo != 35) continue; } diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/interactions/statistics/InteractionAtomTypeCalculator.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/interactions/statistics/InteractionAtomTypeCalculator.java index 8470880d..c4610b07 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/interactions/statistics/InteractionAtomTypeCalculator.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/interactions/statistics/InteractionAtomTypeCalculator.java @@ -1,7 +1,7 @@ package com.actelion.research.chem.interactions.statistics; + import com.actelion.research.chem.Molecule; import com.actelion.research.chem.Molecule3D; -import com.actelion.research.chem.PeriodicTable; import com.actelion.research.chem.StereoMolecule; @@ -341,7 +341,7 @@ public static int getAtomType(FunctionalGroup fg, int atomicNo, boolean isAromat public static String getString(int atomType) { StringBuilder sb = new StringBuilder(); - sb.append(PeriodicTable.symbol(atomType & AtomPropertyMask.ATOMIC_NO.getMask())); + sb.append(Molecule.cAtomLabel[atomType & AtomPropertyMask.ATOMIC_NO.getMask()]); int hybrid = (atomType & AtomPropertyMask.HYBRID.getMask())>>AtomPropertyShift.HYBRID_SHIFT.getShift(); if(hybrid>0) { sb.append("." + hybrid); diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/io/pdb/parser/AtomRecord.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/io/pdb/parser/AtomRecord.java index 00840043..42bcca07 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/io/pdb/parser/AtomRecord.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/io/pdb/parser/AtomRecord.java @@ -35,7 +35,7 @@ package com.actelion.research.chem.io.pdb.parser; import com.actelion.research.chem.Coordinates; -import com.actelion.research.chem.PeriodicTable; +import com.actelion.research.chem.Molecule; /** * ModelAtom @@ -104,7 +104,7 @@ public AtomRecord(boolean isHetAtom, this.occupancy = occupancy; this.tempFactor = tempFactor; this.element = element; - this.atomicNo = PeriodicTable.number(element); + this.atomicNo = Molecule.getAtomicNoFromLabel(element); isTerminalC = false; } diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/mcs/MCS.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/mcs/MCS.java index edf0895e..e2644c9a 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/mcs/MCS.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/mcs/MCS.java @@ -218,7 +218,7 @@ private List getAllSolutionsForCommonSubstructures() { try { if (sss.findFragmentInMolecule(SSSearcher.cCountModeOverlapping, SSSearcher.cMatchDBondToDelocalized, excluded) > 0) { molMCS = frag; - List liIndexFragCandidates = new ArrayList(hsIndexFragCandidates); + List liIndexFragCandidates = new ArrayList<>(hsIndexFragCandidates); if (!liIndexFragCandidates.isEmpty()) { IntVec iv = liIndexFragCandidates.get(0); iv.setBits(0, iv.sizeBits()); @@ -244,7 +244,7 @@ private List getAllSolutionsForCommonSubstructures() { System.out.println("Full structure in iv."); } } - StereoMolecule fragSub = getSubFrag(frag, iv); + StereoMolecule fragSub = getSubFrag(frag, iv, false).fragment; sss.setFragment(fragSub); if (sss.findFragmentInMolecule(SSSearcher.cCountModeOverlapping, SSSearcher.cDefaultMatchMode, excluded) > 0) { hsIndexFragSolution.add(iv); @@ -290,10 +290,10 @@ public LinkedList getAllCommonSubstructures() { } liIndexFragSolution.sort(comparatorBitsSet); IntVec ivMCS = liIndexFragSolution.get(liIndexFragSolution.size() - 1); - molMCS = getSubFrag(frag, ivMCS); + molMCS = getSubFrag(frag, ivMCS, false).fragment; List li = new ArrayList(); for (IntVec iv : liIndexFragSolution) { - li.add(getSubFrag(frag, iv)); + li.add(getSubFrag(frag, iv, false).fragment); } return ExtendedMoleculeFunctions.removeSubStructures(li); } @@ -308,7 +308,7 @@ public StereoMolecule getMCS() { } liIndexFragSolution.sort(comparatorBitsSet); IntVec ivMCS = liIndexFragSolution.get(liIndexFragSolution.size() - 1); - molMCS = getSubFrag(frag, ivMCS); + molMCS = getSubFrag(frag, ivMCS, false).fragment; return molMCS; } @@ -341,22 +341,33 @@ public boolean[][] getMCSBondArray(boolean[] arrBondMCSMol, boolean[] arrBondFra arrBondFrag[i]=true; } } - StereoMolecule fragSub = getSubFrag(frag, ivMCSLargest); - sss.setFragment(fragSub); + MappedFragment mf = getSubFrag(frag, ivMCSLargest, true); + sss.setFragment(mf.fragment); // // The substructure has to be searched in the molecule because the mapping indices are not contained in the // IntVec that is the solution from the MCS search. arrMatchListFrag2Mol = null; if(sss.findFragmentInMolecule(SSSearcher.cCountModeOverlapping, SSSearcher.cDefaultMatchMode,excluded)>0){ ArrayList liMatchSubFrag2Mol = sss.getMatchList(); - arrMatchListFrag2Mol = getMappedMatchListFrag2Mol(fragSub, liMatchSubFrag2Mol.get(0)); + int [] mapSubFrag2Mol = liMatchSubFrag2Mol.get(0); + arrMatchListFrag2Mol = new int[frag.getAtoms()]; + Arrays.fill(arrMatchListFrag2Mol, -1); + for (int indexSubFrag = 0; indexSubFrag < mapSubFrag2Mol.length; indexSubFrag++) { + for (int indexFrag2SubFrag = 0; indexFrag2SubFrag < mf.map.length; indexFrag2SubFrag++) { + if(mf.map[indexFrag2SubFrag]==indexSubFrag){ + arrMatchListFrag2Mol[indexFrag2SubFrag]=mapSubFrag2Mol[indexSubFrag]; + break; + } + } + } + int bondsMol = mol.getBonds(); if(arrBondMCSMol==null) { arrBondMCSMol = new boolean [bondsMol]; } else { Arrays.fill(arrBondMCSMol, false); } - getBondArrayMolecule(arrMatchListFrag2Mol, arrBondFrag, arrBondMCSMol); + getBondArrayMolecule(arrMatchListFrag2Mol, arrBondMCSMol); } arrBondMol_Result[0]=arrBondMCSMol; arrBondMol_Result[1]=arrBondFrag; @@ -372,11 +383,11 @@ public int[] getArrMatchListFrag2Mol() { return arrMatchListFrag2Mol; } - private int[] getMappedMatchListFrag2Mol(StereoMolecule fragSub, int[] arrMatchListSubFrag2Mol) - { + private int[] getMappedMatchListFrag2Mol(MappedFragment mf, int[] arrMatchListSubFrag2Mol) { int [] arrMatchListFrag2Mol = new int [frag.getAtoms()]; -// SSSearcher sss = new SSSearcher(); - sss.setMol(fragSub, frag); + Arrays.fill(arrMatchListFrag2Mol, -1); + + sss.setMol(mf.fragment, frag); sss.findFragmentInMolecule(SSSearcher.cCountModeOverlapping, SSSearcher.cDefaultMatchMode, null); ArrayList liMatchSubFrag2Mol = sss.getMatchList(); int [] arrMatchListSubFrag2Frag = liMatchSubFrag2Mol.get(0); @@ -390,33 +401,41 @@ private int[] getMappedMatchListFrag2Mol(StereoMolecule fragSub, int[] arrMatchL } return arrMatchListFrag2Mol; } - - private boolean[] getBondArrayMolecule(int[] arrMatchFragment2Mol, boolean[] arrBondMCSFrag, boolean[] arrBondMCSMol) - { - for (int indexAtFrag=0; indexAtFrag -1) { - arrBondMCSMol[indexBondMol]=true; - } + + + /** + * + * @param arrMatchFragment2Mol Index is the Fragment atom index, value is the matched atom index in molecule. + * @param arrBondMCSMol The bits are set 'true' which corresponds to the bonds for maximum common substructure in the molecule. + * @return + */ + private void getBondArrayMolecule(int[] arrMatchFragment2Mol, boolean[] arrBondMCSMol) { + for (int indexAtFrag1=0; indexAtFrag1 -1) { + arrBondMCSMol[indexBondMol]=true; } } } - return arrBondMCSMol; } + // The original procedure missed atom charge, mass, etc., which is particularly annoying, // when providing a custom SSSearcher(), which matches these properties. TLS 11Feb2021 - private static StereoMolecule getSubFrag(StereoMolecule frag, IntVec iv) { + private static MappedFragment getSubFrag(StereoMolecule frag, IntVec iv, boolean withMap) { boolean[] isFragmentAtom = new boolean[frag.getAtoms()]; int atoms = 0; int bonds = frag.getBonds(); + for (int bond=0; bond hsAtomIndex = new HashSet(); - for (int i = 0; i < bonds; i++) { - if(iv.isBitSet(i)){ - int indexAtom1 = frag.getBondAtom(0, i); - int indexAtom2 = frag.getBondAtom(1, i); - hsAtomIndex.add(indexAtom1); - hsAtomIndex.add(indexAtom2); - } - } - StereoMolecule fragSubBonds = new StereoMolecule(hsAtomIndex.size(), bonds); - fragSubBonds.setFragment(true); - int [] arrMapAtom = new int [frag.getAtoms()]; - ArrayUtilsCalc.set(arrMapAtom, -1); - for (int indexAtom : hsAtomIndex) { - int indexAtomNew = fragSubBonds.addAtom(frag.getAtomicNo(indexAtom)); - fragSubBonds.setAtomX(indexAtomNew, frag.getAtomX(indexAtom)); - fragSubBonds.setAtomY(indexAtomNew, frag.getAtomY(indexAtom)); - fragSubBonds.setAtomZ(indexAtomNew, frag.getAtomZ(indexAtom)); - arrMapAtom[indexAtom]=indexAtomNew; - } - for (int i = 0; i < bonds; i++) { - if(iv.isBitSet(i)){ - int indexAtom1 = frag.getBondAtom(0, i); - int indexAtom2 = frag.getBondAtom(1, i); - int indexAtomNew1 = arrMapAtom[indexAtom1]; - int indexAtomNew2 = arrMapAtom[indexAtom2]; - int type = frag.getBondType(i); - if(frag.isDelocalizedBond(i)){ - type = Molecule.cBondTypeDelocalized; - // fragSubBonds.setBondQueryFeature(bondIndexNew, Molecule.cBondQFDelocalized, true); - } - // int bondIndexNew = fragSubBonds.addBond(indexAtomNew1, indexAtomNew2, type); - fragSubBonds.addBond(indexAtomNew1, indexAtomNew2, type); - } - } - fragSubBonds.ensureHelperArrays(Molecule.cHelperRings); - return fragSubBonds; - }*/ - - private List getAllPlusOneAtomCombinations(IntVec iv, StereoMolecule frag) - { + + private List getAllPlusOneAtomCombinations(IntVec iv, StereoMolecule frag) { int bonds = frag.getBonds(); List liIntVec = new ArrayList(); HashSet hsAtomIndex = new HashSet(); @@ -510,8 +494,7 @@ private List getAllPlusOneAtomCombinations(IntVec iv, StereoMolecule fra * * @param ivSolution */ - private void removeAllSubSolutions(IntVec ivSolution) - { + private void removeAllSubSolutions(IntVec ivSolution) { List liIndexFragSolution = new ArrayList(hsIndexFragCandidates); for (IntVec ivCandidate : liIndexFragSolution) { if(isCandidateInSolution(ivSolution, ivCandidate)) { @@ -526,8 +509,7 @@ private void removeAllSubSolutions(IntVec ivSolution) * @param hsIndexFragSolution * @return */ - private static List getFinalSolutionSet(HashSet hsIndexFragSolution) - { + private static List getFinalSolutionSet(HashSet hsIndexFragSolution){ List liIndexFragSolution = new ArrayList(hsIndexFragSolution); for (int i = liIndexFragSolution.size()-1; i >= 0; i--) { IntVec ivCandidate = liIndexFragSolution.get(i); @@ -544,8 +526,7 @@ private static List getFinalSolutionSet(HashSet hsIndexFragSolut return liIndexFragSolution; } - private static boolean isCandidateInSolution(IntVec ivSolution, IntVec ivCandidate) - { + private static boolean isCandidateInSolution(IntVec ivSolution, IntVec ivCandidate){ IntVec iv = IntVec.OR(ivSolution, ivCandidate); if(iv.equals(ivSolution)){ return true; @@ -553,10 +534,8 @@ private static boolean isCandidateInSolution(IntVec ivSolution, IntVec ivCandida return false; } - private static class ComparatorBitsSet implements Comparator - { - public int compare(IntVec iv1, IntVec iv2) - { + private static class ComparatorBitsSet implements Comparator { + public int compare(IntVec iv1, IntVec iv2) { int bits1 = iv1.getBitsSet(); int bits2 = iv2.getBitsSet(); if(bits1>bits2){ @@ -573,16 +552,11 @@ public int compare(IntVec iv1, IntVec iv2) * @return 1 if full overlap and 0 if no overlap at all. */ public double getScore(){ - double sc = 0; double nBndsFrag = frag.getBonds(); - double nBndsMol = mol.getBonds(); - double nBndsMCS = molMCS.getBonds(); - sc = nBndsMCS/Math.max(nBndsFrag, nBndsMol); - return sc; } @@ -591,61 +565,18 @@ public boolean isConsiderAromaticRings() return considerAromaticRings; } - public boolean isConsiderRings() - { + public boolean isConsiderRings(){ return considerRings; } -// static class Solution { -// -// IntVec iv; -// -// int [] arrMatchMolecule; -// -// -// int hash; -// -// public Solution(IntVec iv, int [] arrMatchMolecule) { -// -// this.iv = new IntVec(iv); -// -// this.arrMatchMolecule = arrMatchMolecule; -// -// int [] a = iv.get(); -// -// int [] arrHash = new int [a.length+arrMatchMolecule.length]; -// -// System.arraycopy(a, 0, arrHash, 0, a.length); -// -// System.arraycopy(arrMatchMolecule, 0, arrHash, a.length, arrMatchMolecule.length); -// -// hash = new IntVec(arrHash).hashCode(); -// -// } -// -// -// public int hashCode() { -// return hash; -// } -// -// public boolean equals(Object obj) { -// -// if(!(obj instanceof Solution)) { -// return false; -// } -// -// Solution solution = (Solution)obj; -// -// if(!iv.equal(solution.iv)){ -// return false; -// } -// -// if(!ArrayUtilsCalc.equals(arrMatchMolecule, solution.arrMatchMolecule)){ -// return false; -// } -// -// return true; -// } -// -// -// } + + private static class MappedFragment { + StereoMolecule fragment; + // Index is atom index in fragment, value is atom index in original fragment. + int [] map; + + public MappedFragment(StereoMolecule fragment, int[] map) { + this.fragment = fragment; + this.map = map; + } + } } diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/AtomicGaussian.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/AtomicGaussian.java index 7639e489..f0966bd6 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/AtomicGaussian.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/AtomicGaussian.java @@ -1,13 +1,8 @@ package com.actelion.research.chem.phesa; -import com.actelion.research.util.EncoderFloatingPointNumbers; - -import java.io.IOException; -import java.nio.ByteBuffer; -import java.util.Arrays; - -import com.actelion.research.chem.PeriodicTable; import com.actelion.research.chem.Coordinates; +import com.actelion.research.chem.conf.VDWRadii; +import com.actelion.research.util.EncoderFloatingPointNumbers; /** * @version: 1.0, February 2018 @@ -77,7 +72,7 @@ public double calculateHeight() { @Override public double calculateWidth() { - double vdwR = PeriodicTable.getElement(atomicNo).getVDWRadius(); + double vdwR = VDWRadii.getVDWRadius(atomicNo); return MolecularVolume.alpha_pref/(vdwR*vdwR); } diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/Gaussian3D.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/Gaussian3D.java index 65af9ea7..15ef7416 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/Gaussian3D.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/Gaussian3D.java @@ -1,8 +1,8 @@ package com.actelion.research.chem.phesa; import com.actelion.research.chem.Coordinates; -import com.actelion.research.chem.PeriodicTable; import com.actelion.research.chem.alignment3d.transformation.Transformation; +import com.actelion.research.chem.conf.VDWRadii; /** * @version: 1.0, February 2018 @@ -51,7 +51,7 @@ public Gaussian3D() {} public abstract double calculateWidth(); public double calculateVolume() { - double vdwR = PeriodicTable.getElement(atomicNo).getVDWRadius(); + double vdwR = VDWRadii.getVDWRadius(atomicNo); double volume = (4.0 * Math.PI/3.0) * vdwR*vdwR*vdwR; return volume; } diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/QuickMathCalculator.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/QuickMathCalculator.java index 0568f35d..e863d0de 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/QuickMathCalculator.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/QuickMathCalculator.java @@ -1,6 +1,6 @@ package com.actelion.research.chem.phesa; -import com.actelion.research.chem.PeriodicTable; +import com.actelion.research.chem.conf.VDWRadii; public class QuickMathCalculator { @@ -31,8 +31,8 @@ private void precalculatePrefactors() { precalcPrefactors = new double[54][54]; for(int i=1;i<54;i++) { //last element taken into account is Iodine for(int j=1;j<54;j++) { - double vdwR1 = PeriodicTable.getElement(i).getVDWRadius(); - double vdwR2 = PeriodicTable.getElement(j).getVDWRadius(); + double vdwR1 = VDWRadii.getVDWRadius(i); + double vdwR2 = VDWRadii.getVDWRadius(j); double alphaSum = MolecularVolume.alpha_pref/(vdwR1*vdwR1) + MolecularVolume.alpha_pref/(vdwR2*vdwR2); precalcPrefactors[i][j] = Math.pow((Math.PI/alphaSum), 1.5); } diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/VolumeGaussian.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/VolumeGaussian.java index 86e0a988..5570755a 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/VolumeGaussian.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/VolumeGaussian.java @@ -2,9 +2,9 @@ import com.actelion.research.calc.Matrix; import com.actelion.research.chem.Coordinates; -import com.actelion.research.chem.PeriodicTable; import com.actelion.research.chem.StereoMolecule; import com.actelion.research.chem.conf.Conformer; +import com.actelion.research.chem.conf.VDWRadii; import com.actelion.research.util.EncoderFloatingPointNumbers; public class VolumeGaussian extends Gaussian3D { @@ -74,7 +74,7 @@ public double calculateHeight() { @Override public double calculateWidth() { - double vdwR = PeriodicTable.getElement(atomicNo).getVDWRadius(); + double vdwR = VDWRadii.getVDWRadius(atomicNo); return MolecularVolume.alpha_pref/(vdwR*vdwR); } diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/pharmacophore/pp/PPGaussian.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/pharmacophore/pp/PPGaussian.java index c7c9c79f..5ef733b0 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/pharmacophore/pp/PPGaussian.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/chem/phesa/pharmacophore/pp/PPGaussian.java @@ -1,10 +1,10 @@ package com.actelion.research.chem.phesa.pharmacophore.pp; import com.actelion.research.chem.Coordinates; -import com.actelion.research.chem.PeriodicTable; import com.actelion.research.chem.StereoMolecule; import com.actelion.research.chem.alignment3d.transformation.Transformation; import com.actelion.research.chem.alignment3d.transformation.TransformationSequence; +import com.actelion.research.chem.conf.VDWRadii; import com.actelion.research.chem.phesa.EncodeFunctions; import com.actelion.research.chem.phesa.Gaussian3D; import com.actelion.research.chem.phesa.MolecularVolume; @@ -178,7 +178,7 @@ public void updateAtomIndeces(int[] map) { @Override public double calculateWidth() { - double vdwR = PeriodicTable.getElement(atomicNo).getVDWRadius(); + double vdwR = VDWRadii.getVDWRadius(atomicNo); return MolecularVolume.alpha_pref/(vdwR*vdwR); } } diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/util/StringFunctions.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/util/StringFunctions.java index 5ea28872..ea1fdb62 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/util/StringFunctions.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/util/StringFunctions.java @@ -1016,7 +1016,7 @@ public static String toStringInteger(List li, String sep){ // for (int i = 0; i < li.size(); i++) { // sb.append(li.get(i)); // if(i < li.size()-1){ -// sb.append(ConstantsDWAR.SEP_VALUE); +// sb.append(CompoundTableConstants.cEntrySeparator); // } // } // return sb.toString(); diff --git a/src/com/actelion/research/gwt/chemlib/com/actelion/research/util/datamodel/DoubleArray.java b/src/com/actelion/research/gwt/chemlib/com/actelion/research/util/datamodel/DoubleArray.java index bb7925f8..61a1d3a7 100644 --- a/src/com/actelion/research/gwt/chemlib/com/actelion/research/util/datamodel/DoubleArray.java +++ b/src/com/actelion/research/gwt/chemlib/com/actelion/research/util/datamodel/DoubleArray.java @@ -35,9 +35,12 @@ import com.actelion.research.calc.INumericalDataColumn; +import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; import java.util.Arrays; import java.util.Collection; import java.util.List; +import java.util.Locale; /** * @@ -260,4 +263,32 @@ public String toString() { sb.append('}'); return sb.toString(); } + + public String toString(int width, int digits) { + final StringBuilder sb = new StringBuilder(); + + String sFormat = ""; + + sFormat += "0"; + int iCounter = 0; + if(digits > 0) + sFormat += "."; + + while(iCounter < digits) { + sFormat += "0"; + iCounter++; + } + + DecimalFormat nf = new DecimalFormat(sFormat, new DecimalFormatSymbols(Locale.US)); + + for (int i = 0; i < size; i++) { + String s0 = nf.format(data[i]); + int margin = width-s0.length(); + for (int j = 0; j < margin; j++) { + sb.append(" "); + } + sb.append(s0); + } + return sb.toString(); + } }