[Git][java-team/openchemlib][master] 6 commits: New upstream version 2023.1.1+dfsg
Andrius Merkys (@merkys)
gitlab at salsa.debian.org
Tue Jan 17 11:58:41 GMT 2023
Andrius Merkys pushed to branch master at Debian Java Maintainers / openchemlib
Commits:
f7b457ac by Andrius Merkys at 2023-01-17T06:10:09-05:00
New upstream version 2023.1.1+dfsg
- - - - -
f055fe67 by Andrius Merkys at 2023-01-17T06:10:22-05:00
Update upstream source from tag 'upstream/2023.1.1+dfsg'
Update to upstream version '2023.1.1+dfsg'
with Debian dir 5a5a292bb401865ab4666ff5acc1a7974115f5bd
- - - - -
cf451ce5 by Andrius Merkys at 2023-01-17T06:11:04-05:00
Bump copyright years.
- - - - -
72460053 by Andrius Merkys at 2023-01-17T06:11:28-05:00
Set upstream metadata fields: Bug-Database, Bug-Submit.
Changes-By: lintian-brush
Fixes: lintian: upstream-metadata-missing-bug-tracking
See-also: https://lintian.debian.org/tags/upstream-metadata-missing-bug-tracking.html
- - - - -
c527f008 by Andrius Merkys at 2023-01-17T06:11:31-05:00
Update standards version to 4.6.2, no changes needed.
Changes-By: lintian-brush
Fixes: lintian: out-of-date-standards-version
See-also: https://lintian.debian.org/tags/out-of-date-standards-version.html
- - - - -
3b4cd94e by Andrius Merkys at 2023-01-17T06:11:58-05:00
Update changelog for 2023.1.1+dfsg-1 release
- - - - -
30 changed files:
- debian/changelog
- debian/control
- debian/copyright
- debian/upstream/metadata
- pom.xml
- src/main/java/com/actelion/research/calc/Matrix.java
- src/main/java/com/actelion/research/calc/statistics/ModelStatisticsOverviewMedian.java
- src/main/java/com/actelion/research/calc/statistics/StatisticsOverview.java
- src/main/java/com/actelion/research/chem/AbstractDepictor.java
- src/main/java/com/actelion/research/chem/ExtendedMolecule.java
- src/main/java/com/actelion/research/chem/ExtendedMoleculeFunctions.java
- src/main/java/com/actelion/research/chem/IDCodeParser.java
- src/main/java/com/actelion/research/chem/IDCodeParserWithoutCoordinateInvention.java
- src/main/java/com/actelion/research/chem/Molecule.java
- src/main/java/com/actelion/research/chem/MolfileParser.java
- src/main/java/com/actelion/research/chem/SmilesParser.java
- src/main/java/com/actelion/research/chem/coords/CoordinateInventor.java
- src/main/java/com/actelion/research/chem/docking/DockingEngine.java
- src/main/java/com/actelion/research/chem/phesa/PheSAAlignment.java
- src/main/java/com/actelion/research/chem/prediction/FastMolecularComplexityCalculator.java
- src/main/java/com/actelion/research/chem/properties/fractaldimension/FractalDimensionMolecule.java
- src/main/java/com/actelion/research/chem/properties/fractaldimension/ResultFracDimCalc.java
- src/main/java/com/actelion/research/chem/reaction/Reactor.java
- src/main/java/com/actelion/research/gui/JEditableStructureView.java
- src/main/java/com/actelion/research/gui/JLoginDialog.java
- src/main/java/com/actelion/research/gui/JPruningBar.java
- src/main/java/com/actelion/research/gui/dock/TreeFork.java
- src/main/java/com/actelion/research/gui/editor/CustomAtomDialogBuilder.java
- src/main/java/com/actelion/research/gui/editor/GenericEditorArea.java
- src/main/java/com/actelion/research/util/Formatter.java
Changes:
=====================================
debian/changelog
=====================================
@@ -1,3 +1,12 @@
+openchemlib (2023.1.1+dfsg-1) unstable; urgency=medium
+
+ * New upstream version 2023.1.1+dfsg
+ * Bump copyright years.
+ * Set upstream metadata fields: Bug-Database, Bug-Submit.
+ * Update standards version to 4.6.2, no changes needed.
+
+ -- Andrius Merkys <merkys at debian.org> Tue, 17 Jan 2023 06:11:48 -0500
+
openchemlib (2022.12.1+dfsg-1) unstable; urgency=medium
[ Debian Janitor ]
=====================================
debian/control
=====================================
@@ -15,7 +15,7 @@ Build-Depends-Indep:
libopenjfx-java,
libopenjfx-java-doc,
libtablelayout-java,
-Standards-Version: 4.6.1
+Standards-Version: 4.6.2
Vcs-Git: https://salsa.debian.org/java-team/openchemlib.git
Vcs-Browser: https://salsa.debian.org/java-team/openchemlib
Homepage: https://github.com/Actelion/openchemlib
=====================================
debian/copyright
=====================================
@@ -9,11 +9,11 @@ Files-Excluded:
src/main/java/info
Files: *
-Copyright: 1997-2022, Idorsia Pharmaceuticals Ltd, Hegenheimermattweg 91, CH-4123 Allschwil, Switzerland
+Copyright: 1997-2023, Idorsia Pharmaceuticals Ltd, Hegenheimermattweg 91, CH-4123 Allschwil, Switzerland
License: BSD-3-clause
Files: debian/*
-Copyright: 2020-2022, Andrius Merkys <merkys at debian.org>
+Copyright: 2020-2023, Andrius Merkys <merkys at debian.org>
License: BSD-3-clause
Files: src/main/java/com/actelion/research/calc/statistics/median/MedianStatisticFunctions.java
=====================================
debian/upstream/metadata
=====================================
@@ -1,3 +1,5 @@
---
+Bug-Database: https://github.com/Actelion/openchemlib/issues
+Bug-Submit: https://github.com/Actelion/openchemlib/issues/new
Repository: https://github.com/Actelion/openchemlib.git
Repository-Browse: https://github.com/Actelion/openchemlib
=====================================
pom.xml
=====================================
@@ -8,7 +8,7 @@
Please follow the naming scheme YEAR.MONTH.RELEASE_NO_OF_MONTH
(eg. 2016.4.1 for second release in Apr 2016)
-->
- <version>2022.12.1</version>
+ <version>2023.1.1</version>
<name>OpenChemLib</name>
<description>Open Source Chemistry Library</description>
@@ -210,7 +210,7 @@
<connection>scm:git:git at github.com:Actelion/openchemlib.git</connection>
<developerConnection>scm:git:git at github.com:Actelion/openchemlib.git</developerConnection>
<url>https://github.com/Actelion/openchemlib</url>
- <tag>openchemlib-2022.12.1</tag>
+ <tag>openchemlib-2023.1.1</tag>
</scm>
<distributionManagement>
=====================================
src/main/java/com/actelion/research/calc/Matrix.java
=====================================
@@ -41,6 +41,7 @@ import com.actelion.research.util.datamodel.ScorePoint;
import java.awt.*;
import java.io.*;
import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.util.*;
import java.util.List;
@@ -3912,7 +3913,7 @@ public class Matrix {
iCounter++;
}
}
- return new DecimalFormat(sFormat);
+ return new DecimalFormat(sFormat, new DecimalFormatSymbols(Locale.US));
}
public void write(String sFile, boolean bApppend, int digits, int totalWidth) {
=====================================
src/main/java/com/actelion/research/calc/statistics/ModelStatisticsOverviewMedian.java
=====================================
@@ -46,11 +46,11 @@ public class ModelStatisticsOverviewMedian {
@Override
public String toString() {
final StringBuilder sb = new StringBuilder("ModelStatisticsOverviewMedian{");
- sb.append("percentile05=").append(Formatter.format4(percentile05));
- sb.append(", percentile25=").append(Formatter.format4(percentile25));
- sb.append(", median=").append(Formatter.format4(median));
- sb.append(", percentile75=").append(Formatter.format4(percentile75));
- sb.append(", percentile95=").append(Formatter.format4(percentile95));
+ sb.append("percentile05=").append(StatisticsOverview.DF4.format(percentile05));
+ sb.append(", percentile25=").append(StatisticsOverview.DF4.format(percentile25));
+ sb.append(", median=").append(StatisticsOverview.DF4.format(median));
+ sb.append(", percentile75=").append(StatisticsOverview.DF4.format(percentile75));
+ sb.append(", percentile95=").append(StatisticsOverview.DF4.format(percentile95));
sb.append('}');
return sb.toString();
}
=====================================
src/main/java/com/actelion/research/calc/statistics/StatisticsOverview.java
=====================================
@@ -1,8 +1,10 @@
package com.actelion.research.calc.statistics;
import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
import java.text.NumberFormat;
import java.util.Arrays;
+import java.util.Locale;
import com.actelion.research.calc.ArrayUtilsCalc;
import com.actelion.research.calc.Matrix;
@@ -27,8 +29,11 @@ public class StatisticsOverview {
public static final String TAG_PERCENTILE05 = "Percentile.05";
public static final String TAG_PERCENTILE95 = "Percentile.95";
- private static final NumberFormat NF = new DecimalFormat("0.000##");
-
+ public static final NumberFormat DF1 = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.US));
+ public static final NumberFormat DF3 = new DecimalFormat("0.000", new DecimalFormatSymbols(Locale.US));
+ public static final NumberFormat DF4 = new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.US));
+ private static final NumberFormat DF3Plus = new DecimalFormat("0.000##", new DecimalFormatSymbols(Locale.US));
+
private static final int BINS = 20;
private static final int WIDTH = 8;
@@ -242,11 +247,8 @@ public class StatisticsOverview {
}
public double getQuartile(double q) {
-
double [] arr = data.get();
-
Arrays.sort(arr);
-
return getQuartile(arr, q);
}
@@ -272,17 +274,17 @@ public class StatisticsOverview {
sb.append("\n");
sb.append("min\t" + min);
sb.append("\n");
- sb.append("Mean\t" + NF.format(mean));
+ sb.append("Mean\t" + DF3Plus.format(mean));
sb.append("\n");
sb.append("max\t" + max);
sb.append("\n");
- sb.append("SDV\t" + NF.format(sdv));
+ sb.append("SDV\t" + DF3Plus.format(sdv));
sb.append("\n");
- sb.append("Quartile 0.25\t" + NF.format(leftQuartile));
+ sb.append("Quartile 0.25\t" + DF3Plus.format(leftQuartile));
sb.append("\n");
- sb.append("Median\t" + NF.format(median));
+ sb.append("Median\t" + DF3Plus.format(median));
sb.append("\n");
- sb.append("Quartile 0.75\t" + NF.format(rightQuartile));
+ sb.append("Quartile 0.75\t" + DF3Plus.format(rightQuartile));
sb.append("\n");
sb.append("Histogram values below hist min " + valsBelowHistMin + ", values above hist max " + valsAboveHistMax);
sb.append("\n");
@@ -300,10 +302,8 @@ public class StatisticsOverview {
sb.append("\t");
sb.append(Matrix.format(histTrans.get(i,2), dfBins, WIDTH));
sb.append("\n");
-
}
-
-
+
return sb.toString();
}
@@ -341,11 +341,8 @@ public class StatisticsOverview {
}
public static ModelStatisticsOverviewMedian getMedianOverview(DoubleArray da){
-
StatisticsOverview statisticsOverview = new StatisticsOverview(da);
-
statisticsOverview.evaluate();
-
ModelStatisticsOverviewMedian model =
new ModelStatisticsOverviewMedian(
statisticsOverview.percentile05,
@@ -366,15 +363,15 @@ public class StatisticsOverview {
so.evaluate();
sb.append(text1);
sb.append("\t");
- sb.append(Formatter.format3(so.getMean()));
+ sb.append(DF3.format(so.getMean()));
sb.append("\t");
- sb.append(Formatter.format3(so.getSdv()));
+ sb.append(DF3.format(so.getSdv()));
sb.append("\t");
- sb.append(Formatter.format3(so.getMedian()));
+ sb.append(DF3.format(so.getMedian()));
sb.append("\t");
- sb.append(Formatter.format3(so.getPercentile05()));
+ sb.append(DF3.format(so.getPercentile05()));
sb.append("\t");
- sb.append(Formatter.format3(so.getPercentile95()));
+ sb.append(DF3.format(so.getPercentile95()));
return sb.toString();
}
@@ -389,15 +386,15 @@ public class StatisticsOverview {
so.evaluate();
sb.append(text);
sb.append("\t");
- sb.append(Formatter.format1(so.getMean()));
+ sb.append(DF1.format(so.getMean()));
sb.append("\t");
- sb.append(Formatter.format1(so.getSdv()));
+ sb.append(DF1.format(so.getSdv()));
sb.append("\t");
- sb.append(Formatter.format1(so.getMedian()));
+ sb.append(DF1.format(so.getMedian()));
sb.append("\t");
- sb.append(Formatter.format1(so.getPercentile05()));
+ sb.append(DF1.format(so.getPercentile05()));
sb.append("\t");
- sb.append(Formatter.format1(so.getPercentile95()));
+ sb.append(DF1.format(so.getPercentile95()));
return sb.toString();
}
@@ -431,18 +428,16 @@ public class StatisticsOverview {
sb.append("\t");
sb.append(text2);
sb.append("\t");
- sb.append(Formatter.format3(so.getMean()));
+ sb.append(DF3.format(so.getMean()));
sb.append("\t");
- sb.append(Formatter.format3(so.getSdv()));
+ sb.append(DF3.format(so.getSdv()));
sb.append("\t");
- sb.append(Formatter.format3(so.getMedian()));
+ sb.append(DF3.format(so.getMedian()));
sb.append("\t");
- sb.append(Formatter.format3(so.getPercentile05()));
+ sb.append(DF3.format(so.getPercentile05()));
sb.append("\t");
- sb.append(Formatter.format3(so.getPercentile95()));
+ sb.append(DF3.format(so.getPercentile95()));
return sb.toString();
}
-
-
}
=====================================
src/main/java/com/actelion/research/chem/AbstractDepictor.java
=====================================
@@ -1740,9 +1740,11 @@ public abstract class AbstractDepictor<T> {
isoStr = append(isoStr, "*");
if ((queryFeatures & Molecule.cAtomQFIsNotStereo) != 0)
isoStr = append(isoStr, "!*");
- if ((queryFeatures & Molecule.cAtomQFAromatic) != 0)
+ if ((queryFeatures & Molecule.cAtomQFHeteroAromatic) != 0)
+ isoStr = append(isoStr, "ha");
+ else if ((queryFeatures & Molecule.cAtomQFAromatic) != 0)
isoStr = append(isoStr, "a");
- if ((queryFeatures & Molecule.cAtomQFNotAromatic) != 0)
+ else if ((queryFeatures & Molecule.cAtomQFNotAromatic) != 0)
isoStr = append(isoStr, "!a");
if ((queryFeatures & Molecule.cAtomQFMoreNeighbours) != 0)
isoStr = append(isoStr, "s");
=====================================
src/main/java/com/actelion/research/chem/ExtendedMolecule.java
=====================================
@@ -1737,6 +1737,8 @@ public class ExtendedMolecule extends Molecule implements Serializable {
if (mBondType[bond] == cBondTypeDouble
&& getBondParity(bond) == Molecule.cBondParityUnknown)
mBondType[bond] = cBondTypeCross;
+
+ assert((mValidHelperArrays & cHelperBitParities) != 0);
}
=====================================
src/main/java/com/actelion/research/chem/ExtendedMoleculeFunctions.java
=====================================
@@ -235,6 +235,31 @@ public class ExtendedMoleculeFunctions {
return hetero;
}
+ public static int getNumBondsNoHydrogen(ExtendedMolecule mol) {
+ int bnds = 0;
+ for (int i = 0; i < mol.getBonds(); i++) {
+ int at1 = mol.getBondAtom(0,i);
+ int atNo1 = mol.getAtomicNo(at1);
+ int at2 = mol.getBondAtom(1,i);
+ int atNo2 = mol.getAtomicNo(at2);
+ if(atNo1!=1 && atNo2!=1) {
+ bnds++;
+ }
+ }
+ return bnds;
+ }
+ public static int getNumNonHydrogenAtoms(ExtendedMolecule mol) {
+ int non = 0;
+
+ for (int i = 0; i < mol.getAtoms(); i++) {
+ int atomicNo = mol.getAtomicNo(i);
+ if(atomicNo!=1) {
+ non++;
+ }
+ }
+
+ return non;
+ }
public static int getNumCarbonAtoms(ExtendedMolecule mol) {
int carbon = 0;
=====================================
src/main/java/com/actelion/research/chem/IDCodeParser.java
=====================================
@@ -4,6 +4,7 @@ import com.actelion.research.chem.coords.CoordinateInventor;
public class IDCodeParser extends IDCodeParserWithoutCoordinateInvention {
private boolean mEnsure2DCoordinates;
+ private int mCoordinateMode = CoordinateInventor.MODE_DEFAULT;
/**
* This default constructor creates molecules guaranteed to have 2D-atom-coordinates.
@@ -15,10 +16,20 @@ public class IDCodeParser extends IDCodeParserWithoutCoordinateInvention {
}
/**
- *
+ * This default constructor creates molecules guaranteed to have 2D-atom-coordinates.
+ * If 2D-coordinates are not supplied with the idcode, or if supplied coordinates are 3D,
+ * then new 2D-coordinates are created on the fly.
+ * @param coordinateMode mode used for CoordinateInventor
+ */
+ public IDCodeParser(int coordinateMode){
+ this(true);
+ mCoordinateMode = coordinateMode;
+ }
+
+ /**
* @param ensure2DCoordinates If TRUE and no coordinates are passed with the idcode, then
* the parser generates atom coordinates of any molecule and assigns up/down bonds reflecting
- * given atom parities. Generating coordinates is potentially error prone, such that providing
+ * given atom parities. Generating coordinates is potentially error-prone, such that providing
* original coordinates, where available, should be the preferred option.
* <br><b>WARNING:</b> If FALSE: In this case stereo parities are taken directly from the idcode,
* missing explicitly 'unknown' parities, because they are not part of the idcode.
@@ -33,6 +44,8 @@ public class IDCodeParser extends IDCodeParserWithoutCoordinateInvention {
mEnsure2DCoordinates = ensure2DCoordinates;
}
+
+
@Override
protected boolean ensure2DCoordinates() {
return mEnsure2DCoordinates;
@@ -40,7 +53,7 @@ public class IDCodeParser extends IDCodeParserWithoutCoordinateInvention {
@Override
protected void inventCoordinates(StereoMolecule mol) {
- CoordinateInventor inventor = new CoordinateInventor();
+ CoordinateInventor inventor = new CoordinateInventor(mCoordinateMode);
inventor.setRandomSeed(0x1234567890L); // create reproducible coordinates
inventor.invent(mol);
}
=====================================
src/main/java/com/actelion/research/chem/IDCodeParserWithoutCoordinateInvention.java
=====================================
@@ -856,7 +856,7 @@ public class IDCodeParserWithoutCoordinateInvention {
// - have distinguishable substituents on both ends, i.e. is a stereo double bond
// - are not in a small ring
// Here we don't know, whether a double bond without E/Z parity is a stereo bond with unknown
- // configuration or not a stereo bond. Therefore we need to set a flag, that causes the Canonizer
+ // configuration or not a stereo bond. Therefore, we need to set a flag, that causes the Canonizer
// during the next stereo recognition with atom coordinates to assign an unknown configuration rather
// than E or Z based on created or given coordinates.
// In a next step these double bonds are converted into cross bonds by
@@ -869,8 +869,9 @@ public class IDCodeParserWithoutCoordinateInvention {
mMol.setBondParityUnknownOrNone(bond);
}
+ mMol.setParitiesValid(0);
+
if (!coords2DAvailable && ensure2DCoordinates()) {
- mMol.setParitiesValid(0);
try {
inventCoordinates(mMol);
coords2DAvailable = true;
=====================================
src/main/java/com/actelion/research/chem/Molecule.java
=====================================
@@ -150,7 +150,7 @@ public class Molecule implements Serializable {
public static final long cAtomQFSimpleFeatures = 0x00007F800E3FC7FEL;
public static final long cAtomQFNarrowing = 0x00007FFF0FFFFFFEL;
public static final long cAtomQFAny = 0x00000001;
- public static final long cAtomQFAromState = 0x00000006;
+ public static final long cAtomQFAromState = 0x0000400000000006L;
public static final long cAtomQFAromatic = 0x00000002;
public static final long cAtomQFNotAromatic = 0x00000004;
public static final long cAtomQFRingState = 0x00000078;
@@ -3195,7 +3195,7 @@ public class Molecule implements Serializable {
* <p>An inverse logic needs to be applied to translate a user request to the bits needed. For example,
* to only accept atoms that have 1 or 2 hydrogen neighbors, we need to filter out all others. Thus, we
* would call<br>setAtomQueryFeature(atom, cAtomQFNot0Hydrogen | cAtomQFNot3Hydrogen, true);</p>
- * <p>To match only atoms without hydrogen neighbors, call<br>setAtomQueryFeature(atom, cAtomQFHydrogen & ~cAtomQFNot3Hydrogen, true);<br>
+ * <p>To match only atoms without hydrogen neighbors, call<br>setAtomQueryFeature(atom, cAtomQFHydrogen & ~cAtomQFNot0Hydrogen, true);<br>
* This mechanism allows a very efficient atom matching and therefore very fast sub-structure search.</p>
* @param atom
* @param feature one of cAtomQF...
=====================================
src/main/java/com/actelion/research/chem/MolfileParser.java
=====================================
@@ -196,7 +196,10 @@ public class MolfileParser
int chargeDif = parseIntOrSpaces(line.substring(36,39).trim());
if(chargeDif != 0){
- mMol.setAtomCharge(atom,4 - chargeDif);
+ if (chargeDif == 4)
+ mMol.setAtomRadical(atom, Molecule.cAtomRadicalStateD);
+ else
+ mMol.setAtomCharge(atom,4 - chargeDif);
}
int mapNo = (line.length() < 63) ? 0 : parseIntOrSpaces(line.substring(60,63).trim());
=====================================
src/main/java/com/actelion/research/chem/SmilesParser.java
=====================================
@@ -1008,19 +1008,21 @@ public class SmilesParser {
if (mMol.getAtomCustomLabel(atom) != null) { // if we have the exact number of hydrogens
int explicitHydrogen = mMol.getAtomCustomLabelBytes(atom)[0];
- if (mMakeHydrogenExplicit) {
- for (int i=0; i<explicitHydrogen; i++)
- mMol.addBond(atom, mMol.addAtom(1), 1);
- }
- else if (smartsFeatureFound || mSmartsMode == SMARTS_MODE_IS_SMARTS) {
- if (explicitHydrogen == 0)
- mMol.setAtomQueryFeature(atom, Molecule.cAtomQFHydrogen & ~Molecule.cAtomQFNot0Hydrogen, true);
- if (explicitHydrogen == 1)
- mMol.setAtomQueryFeature(atom, Molecule.cAtomQFHydrogen & ~Molecule.cAtomQFNot1Hydrogen, true);
- if (explicitHydrogen == 2)
- mMol.setAtomQueryFeature(atom, Molecule.cAtomQFHydrogen & ~Molecule.cAtomQFNot2Hydrogen, true);
- if (explicitHydrogen == 3)
- mMol.setAtomQueryFeature(atom, Molecule.cAtomQFHydrogen & ~Molecule.cAtomQFNot3Hydrogen, true);
+ if (smartsFeatureFound || mSmartsMode == SMARTS_MODE_IS_SMARTS) {
+ if (mMakeHydrogenExplicit) {
+ for (int i=0; i<explicitHydrogen; i++)
+ mMol.addBond(atom, mMol.addAtom(1), 1);
+ }
+ else {
+ if (explicitHydrogen == 0)
+ mMol.setAtomQueryFeature(atom, Molecule.cAtomQFHydrogen & ~Molecule.cAtomQFNot0Hydrogen, true);
+ if (explicitHydrogen == 1)
+ mMol.setAtomQueryFeature(atom, Molecule.cAtomQFHydrogen & ~Molecule.cAtomQFNot1Hydrogen, true);
+ if (explicitHydrogen == 2)
+ mMol.setAtomQueryFeature(atom, Molecule.cAtomQFHydrogen & ~Molecule.cAtomQFNot2Hydrogen, true);
+ if (explicitHydrogen == 3)
+ mMol.setAtomQueryFeature(atom, Molecule.cAtomQFHydrogen & ~Molecule.cAtomQFNot3Hydrogen, true);
+ }
}
else {
if (!mMol.isMetalAtom(atom)
@@ -1052,11 +1054,9 @@ public class SmilesParser {
mMol.setAtomAbnormalValence(atom, usedValence);
}
- if (!mMol.supportsImplicitHydrogen(atom)) {
- // If implicit hydrogens are not supported, then add explicit ones.
+ if (mMakeHydrogenExplicit || !mMol.supportsImplicitHydrogen(atom))
for (int i=0; i<explicitHydrogen; i++)
mMol.addBond(atom, mMol.addAtom(1), 1);
- }
}
}
else if (!mMakeHydrogenExplicit && (smartsFeatureFound || mSmartsMode == SMARTS_MODE_IS_SMARTS)) {
=====================================
src/main/java/com/actelion/research/chem/coords/CoordinateInventor.java
=====================================
@@ -159,7 +159,8 @@ public class CoordinateInventor {
* @parem ffp null or fragment fingerprint of the molecule, which is used (if available) for faster template location
*/
public void invent(StereoMolecule mol, long[] ffp) {
- boolean paritiesPresent = ((mol.getHelperArrayStatus() & Molecule.cHelperParities) != 0);
+ boolean paritiesPresent = (mol.getHelperArrayStatus() & Molecule.cHelperParities) != 0;
+ int parityState = mol.getHelperArrayStatus() & Molecule.cHelperBitsStereo;
if (mRandom == null)
mRandom = new Random();
@@ -227,8 +228,10 @@ public class CoordinateInventor {
}
}
- if (paritiesPresent)
+ if (paritiesPresent) {
+ mMol.setParitiesValid(parityState);
mMol.setStereoBondsFromParity();
+ }
if (mAbsoluteOrientationTemplateFound)
mMol.removeAtomMarkers();
=====================================
src/main/java/com/actelion/research/chem/docking/DockingEngine.java
=====================================
@@ -364,7 +364,7 @@ public class DockingEngine {
Translation translate = new Translation(new double[] {origCOM.x, origCOM.y, origCOM.z});
rot.apply(best);
translate.apply(best);
- return new DockingResult(best,bestEnergy,contributions);
+ return new DockingResult(mol, best,bestEnergy,contributions);
}
else {
throw new DockingFailedException("docking failed");
@@ -570,6 +570,7 @@ public class DockingEngine {
public static class DockingResult implements Comparable<DockingResult> {
private double score;
+ private StereoMolecule input; //might be a different enantiomer/protomer than the pose
private StereoMolecule pose;
private Map<String,Double> contributions;
private static final String DELIMITER = ";";
@@ -577,12 +578,22 @@ public class DockingEngine {
private static final String DELIMITER3 = "%";
private static final String NULL_CONTRIBUTION = "#";
- public DockingResult(StereoMolecule pose, double score, Map<String,Double> contributions) {
+ public DockingResult(StereoMolecule input,
+ StereoMolecule pose, double score, Map<String,Double> contributions) {
this.score = score;
this.pose = pose;
this.contributions = contributions;
+ this.input = input;
}
+
+
+ public void setInput(StereoMolecule input) {
+ this.input = input;
+ }
+
+
+
public double getScore() {
return score;
}
@@ -606,6 +617,8 @@ public class DockingEngine {
sb.append(DELIMITER);
sb.append(idcoords);
sb.append(DELIMITER);
+ sb.append(input.getIDCode());
+ sb.append(DELIMITER);
sb.append(encoder.encodeToString(EncodeFunctions.doubleToByteArray(score)));
sb.append(DELIMITER);
if(contributions==null || contributions.keySet().size()==0)
@@ -632,11 +645,14 @@ public class DockingEngine {
IDCodeParserWithoutCoordinateInvention parser = new IDCodeParserWithoutCoordinateInvention();
parser.parse(pose, idcode, idcoords);
pose.ensureHelperArrays(Molecule.cHelperCIP);
- double score = EncodeFunctions.byteArrayToDouble(decoder.decode(s[2].getBytes()));
+ String idcodeInput = s[2];
+ StereoMolecule input = new StereoMolecule();
+ new IDCodeParser().parse(input, idcodeInput);
+ double score = EncodeFunctions.byteArrayToDouble(decoder.decode(s[3].getBytes()));
Map<String,Double> contributions = null;
- if(!s[3].equals(NULL_CONTRIBUTION)) {
+ if(!s[4].equals(NULL_CONTRIBUTION)) {
contributions = new HashMap<String,Double>();
- String[] splitted = s[3].split(DELIMITER2);
+ String[] splitted = s[4].split(DELIMITER2);
for(String contr : splitted) {
String[] splitted2 = contr.split(DELIMITER3);
String name = splitted2[0];
@@ -645,7 +661,7 @@ public class DockingEngine {
}
}
- DockingResult dockingResult = new DockingResult(pose,score,contributions);
+ DockingResult dockingResult = new DockingResult(input,pose,score,contributions);
return dockingResult;
}
=====================================
src/main/java/com/actelion/research/chem/phesa/PheSAAlignment.java
=====================================
@@ -1,6 +1,7 @@
package com.actelion.research.chem.phesa;
import com.actelion.research.chem.Canonizer;
import com.actelion.research.chem.Coordinates;
+import com.actelion.research.chem.IDCodeParser;
import com.actelion.research.chem.IDCodeParserWithoutCoordinateInvention;
import com.actelion.research.chem.Molecule;
import com.actelion.research.chem.StereoMolecule;
@@ -410,17 +411,25 @@ public class PheSAAlignment {
public static class PheSAResult implements Comparable <PheSAResult>{
private StereoMolecule refMol;
private StereoMolecule fitMol;
+ private StereoMolecule fitInput;
+
private double sim;
private double[] contributions;
private static final String DELIMITER = ";";
- public PheSAResult(StereoMolecule refMol, StereoMolecule fitMol, double sim) {
+ public PheSAResult(StereoMolecule refMol, StereoMolecule fitInput, StereoMolecule fitMol, double sim) {
this.refMol = refMol;
this.fitMol = fitMol;
this.sim = sim;
this.contributions = new double[4];
+ this.fitInput = fitInput;
}
+ public void setFitInput(StereoMolecule fitInput) {
+ this.fitInput = fitInput;
+ }
+
+
public StereoMolecule getRefMol() {
return refMol;
}
@@ -461,6 +470,9 @@ public class PheSAAlignment {
sb.append(encoder.encodeToString(EncodeFunctions.doubleToByteArray(sim)));
sb.append(DELIMITER);
sb.append(encoder.encodeToString(EncodeFunctions.doubleArrayToByteArray(contributions)));
+ sb.append(DELIMITER);
+ sb.append(fitInput.getIDCode());
+
return sb.toString();
}
@@ -481,7 +493,9 @@ public class PheSAAlignment {
fitMol.ensureHelperArrays(Molecule.cHelperCIP);
double sim = EncodeFunctions.byteArrayToDouble(decoder.decode(s[4].getBytes()));
double[] contributions = EncodeFunctions.byteArrayToDoubleArray(decoder.decode(s[5].getBytes()));
- PheSAResult pheSAResult = new PheSAResult(refMol,fitMol,sim);
+ StereoMolecule fitInput = new StereoMolecule();
+ new IDCodeParser().parse(fitInput,s[6]);
+ PheSAResult pheSAResult = new PheSAResult(refMol,fitInput,fitMol,sim);
pheSAResult.setContributions(contributions);
return pheSAResult;
}
=====================================
src/main/java/com/actelion/research/chem/prediction/FastMolecularComplexityCalculator.java
=====================================
@@ -37,9 +37,7 @@ package com.actelion.research.chem.prediction;
import com.actelion.research.chem.Canonizer;
import com.actelion.research.chem.Molecule;
import com.actelion.research.chem.StereoMolecule;
-import com.actelion.research.util.SortedList;
-import javax.swing.*;
import java.util.TreeSet;
/**
@@ -49,8 +47,6 @@ import java.util.TreeSet;
public class FastMolecularComplexityCalculator {
protected static final int MAX_BOND_COUNT = 7;
- public static boolean createIDCodes;
-
/**
* Ambiguous bonds are normalized.
* @param mol
@@ -62,9 +58,9 @@ public class FastMolecularComplexityCalculator {
if (bondCount < 2)
return 0;
- mol.ensureHelperArrays(Molecule.cHelperRings);
+ mol.ensureHelperArrays(Molecule.cHelperSymmetrySimple);
StereoMolecule fragment = new StereoMolecule(mol.getAtoms(), mol.getBonds());
- TreeSet<String> fragmentSet = new TreeSet<String>();
+ TreeSet<String> fragmentSet = new TreeSet<>();
int[] atomMap = new int[mol.getAllAtoms()];
boolean[][] bondsTouch = new boolean[mol.getBonds()][mol.getBonds()];
@@ -79,8 +75,6 @@ public class FastMolecularComplexityCalculator {
}
}
- SortedList<BondSet> bondSets = new SortedList<>();
-
boolean[] bondIsMember = new boolean[mol.getBonds()];
int maxLevel = bondCount - 2;
int[] levelBond = new int[maxLevel+1];
@@ -105,13 +99,8 @@ public class FastMolecularComplexityCalculator {
if (levelBondFound) {
bondIsMember[levelBond[level]] = true;
if (level == maxLevel) {
- BondSet bondSet = new BondSet(bondIsMember, mol.getBonds());
- if (bondSets.addIfNew(bondSet) && createIDCodes) {
- mol.copyMoleculeByBonds(fragment, bondIsMember, true, atomMap);
- String idcode = new Canonizer(fragment).getIDCode();
-if (!fragmentSet.contains(idcode)) System.out.println(idcode+"\tComplexity");
- fragmentSet.add(idcode);
- }
+ mol.copyMoleculeByBonds(fragment, bondIsMember, true, atomMap);
+ fragmentSet.add(new Canonizer(fragment).getIDCode());
bondIsMember[levelBond[level]] = false;
}
else {
@@ -128,41 +117,6 @@ if (!fragmentSet.contains(idcode)) System.out.println(idcode+"\tComplexity");
bondIsMember[rootBond] = false;
}
-if (createIDCodes)
- SwingUtilities.invokeLater(() -> System.out.println("Complex fragments:"+fragmentSet.size()));
-else
- SwingUtilities.invokeLater(() -> System.out.println("Complex bondsets:"+bondSets.size()));
-
return (float)Math.log(fragmentSet.size()) / bondCount;
}
}
-
-class BondSet implements Comparable<BondSet> {
- private int[] sortedBonds;
-
- public BondSet(boolean[] bondMask, int bondCount) {
- sortedBonds = new int[FastMolecularComplexityCalculator.MAX_BOND_COUNT+1];
- int count = 0;
- for (int bond=0; bond<bondCount; bond++) {
- if (count == sortedBonds.length)
- System.out.println("!!!");
- if (bondMask[bond])
- sortedBonds[count++] = bond;
- }
- }
-
- public boolean equals(BondSet bs) {
- for (int i=0; i<sortedBonds.length; i++)
- if (bs.sortedBonds[i] != sortedBonds[i])
- return false;
- return true;
- }
-
- @Override
- public int compareTo(BondSet bs) {
- for (int i=0; i<sortedBonds.length; i++)
- if (bs.sortedBonds[i] != sortedBonds[i])
- return bs.sortedBonds[i] < sortedBonds[i] ? -1 : 1;
- return 0;
- }
-}
=====================================
src/main/java/com/actelion/research/chem/properties/fractaldimension/FractalDimensionMolecule.java
=====================================
@@ -56,6 +56,8 @@ import java.util.List;
*/
public class FractalDimensionMolecule {
+ public static final String MSG_ZERO = "Zero by definition. Max bond count at one bond.";
+
private static final int MAX_THREADS_BOND_VECTOR_TO_IDCODE = 3;
private ExhaustiveFragmentsStatistics exhaustiveFragmentsStatistics;
@@ -111,14 +113,15 @@ public class FractalDimensionMolecule {
int nBondsAtMaxNumFrags = pBnds_MaxNumUniqueFrags.x;
int nMaxFrags = pBnds_MaxNumUniqueFrags.y;
- resultFracDimCalc.fractalDimension = Math.log10(nMaxFrags) / Math.log10(nBondsAtMaxNumFrags+1);
-
- resultFracDimCalc.bondsAtMaxFrag = nBondsAtMaxNumFrags;
-
- resultFracDimCalc.maxNumUniqueFrags = nMaxFrags;
-
- resultFracDimCalc.sumUniqueFrags = getSumUniqueFrags(liFragBnds_NumUniqueFrags);
-
+ if(nBondsAtMaxNumFrags==1){
+ resultFracDimCalc.fractalDimension = 0;
+ resultFracDimCalc.message = MSG_ZERO;
+ } else {
+ resultFracDimCalc.fractalDimension = Math.log10(nMaxFrags) / Math.log10(nBondsAtMaxNumFrags);
+ resultFracDimCalc.bondsAtMaxFrag = nBondsAtMaxNumFrags;
+ resultFracDimCalc.maxNumUniqueFrags = nMaxFrags;
+ resultFracDimCalc.sumUniqueFrags = getSumUniqueFrags(liFragBnds_NumUniqueFrags);
+ }
return resultFracDimCalc;
}
=====================================
src/main/java/com/actelion/research/chem/properties/fractaldimension/ResultFracDimCalc.java
=====================================
@@ -33,6 +33,7 @@
package com.actelion.research.chem.properties.fractaldimension;
+import com.actelion.research.chem.ExtendedMoleculeFunctions;
import com.actelion.research.util.Formatter;
import java.util.ArrayList;
@@ -52,6 +53,8 @@ public class ResultFracDimCalc extends InputObjectFracDimCalc {
public static final String TAG_SUM_UNIQUE_FRAGMENTS_CALC = "SumUniqueFragmentsCalculated";
+ public static final String TAG_ATOM_COUNT = "AtomCountNonH";
+ public static final String TAG_BOND_COUNT = "BondCountNonH";
public static final String TAG_BONDS_AT_MAX_FRAGS_CALC = "BondNumberAtMaxNumFragCalculated";
public static final String TAG_MAX_NUM_UNIQUE_FRAGMENTS_CALC = "MaxNumUniqueFragmentsCalculated";
@@ -64,6 +67,8 @@ public class ResultFracDimCalc extends InputObjectFracDimCalc {
TAG_ID,
TAG_SUM_UNIQUE_FRAGMENTS_CALC,
TAG_BONDS_AT_MAX_FRAGS_CALC,
+ TAG_ATOM_COUNT,
+ TAG_BOND_COUNT,
TAG_MAX_NUM_UNIQUE_FRAGMENTS_CALC,
TAG_FRACTAL_DIM,
TAG_MESSAGE};
@@ -75,6 +80,8 @@ public class ResultFracDimCalc extends InputObjectFracDimCalc {
double fractalDimension;
+ int atomCount;
+ int bondCount;
int bondsAtMaxFrag;
int maxNumUniqueFrags;
@@ -90,6 +97,9 @@ public class ResultFracDimCalc extends InputObjectFracDimCalc {
fractalDimension = Double.NaN;
+ atomCount = ExtendedMoleculeFunctions.getNumNonHydrogenAtoms(inputObjectFracDimCalc.getData());
+ bondCount = ExtendedMoleculeFunctions.getNumBondsNoHydrogen(inputObjectFracDimCalc.getData());
+
bondsAtMaxFrag = -1;
maxNumUniqueFrags = -1;
@@ -107,6 +117,14 @@ public class ResultFracDimCalc extends InputObjectFracDimCalc {
return bondsAtMaxFrag;
}
+ public int getBondCount() {
+ return bondCount;
+ }
+
+ public int getAtomCount() {
+ return atomCount;
+ }
+
public int getMaxNumUniqueFrags() {
return maxNumUniqueFrags;
}
@@ -128,6 +146,10 @@ public class ResultFracDimCalc extends InputObjectFracDimCalc {
sb.append(SEP);
sb.append(getSumUniqueFrags());
sb.append(SEP);
+ sb.append(getAtomCount());
+ sb.append(SEP);
+ sb.append(getBondCount());
+ sb.append(SEP);
sb.append(getBondsAtMaxFrag());
sb.append(SEP);
sb.append(getMaxNumUniqueFrags());
@@ -148,6 +170,10 @@ public class ResultFracDimCalc extends InputObjectFracDimCalc {
sb.append(SEP);
sb.append(TAG_SUM_UNIQUE_FRAGMENTS_CALC);
sb.append(SEP);
+ sb.append(TAG_ATOM_COUNT);
+ sb.append(SEP);
+ sb.append(TAG_BOND_COUNT);
+ sb.append(SEP);
sb.append(TAG_BONDS_AT_MAX_FRAGS_CALC);
sb.append(SEP);
sb.append(TAG_MAX_NUM_UNIQUE_FRAGMENTS_CALC);
@@ -166,6 +192,8 @@ public class ResultFracDimCalc extends InputObjectFracDimCalc {
li.add(TAG_SMILES);
li.add(TAG_ID);
li.add(TAG_SUM_UNIQUE_FRAGMENTS_CALC);
+ li.add(TAG_ATOM_COUNT);
+ li.add(TAG_BOND_COUNT);
li.add(TAG_BONDS_AT_MAX_FRAGS_CALC);
li.add(TAG_MAX_NUM_UNIQUE_FRAGMENTS_CALC);
li.add(TAG_FRACTAL_DIM);
@@ -173,6 +201,4 @@ public class ResultFracDimCalc extends InputObjectFracDimCalc {
return li;
}
-
-
}
=====================================
src/main/java/com/actelion/research/chem/reaction/Reactor.java
=====================================
@@ -193,17 +193,25 @@ public class Reactor {
}
private int[] getSortedConnectedAtomicNos(StereoMolecule mol, int atom) {
- int[] atomicNo = new int[mol.getConnAtoms(atom)];
- for (int i=0; i<mol.getConnAtoms(atom); i++)
- atomicNo[i] = mol.getAtomicNo(mol.getConnAtom(atom, i));
+ int[] atomicNo = new int[mol.getConnAtoms(atom) - mol.getExcludedNeighbourCount(atom)];
+ int index = 0;
+ for (int i=0; i<mol.getConnAtoms(atom); i++) {
+ int connAtom = mol.getConnAtom(atom, i);
+ if ((mol.getAtomQueryFeatures(connAtom) & Molecule.cAtomQFExcludeGroup) == 0)
+ atomicNo[index++] = mol.getAtomicNo(connAtom);
+ }
Arrays.sort(atomicNo);
return atomicNo;
}
private int[] getSortedConnectedMapNos(StereoMolecule mol, int atom) {
- int[] mapNo = new int[mol.getConnAtoms(atom)];
- for (int i=0; i<mol.getConnAtoms(atom); i++)
- mapNo[i] = mol.getAtomMapNo(mol.getConnAtom(atom, i));
+ int[] mapNo = new int[mol.getConnAtoms(atom) - mol.getExcludedNeighbourCount(atom)];
+ int index = 0;
+ for (int i=0; i<mol.getConnAtoms(atom); i++) {
+ int connAtom = mol.getConnAtom(atom, i);
+ if ((mol.getAtomQueryFeatures(connAtom) & Molecule.cAtomQFExcludeGroup) == 0)
+ mapNo[index++] = mol.getAtomMapNo(connAtom);
+ }
Arrays.sort(mapNo);
return mapNo;
}
=====================================
src/main/java/com/actelion/research/gui/JEditableStructureView.java
=====================================
@@ -35,6 +35,7 @@
package com.actelion.research.gui;
import com.actelion.research.chem.StereoMolecule;
+import com.actelion.research.gui.editor.GenericEditorArea;
import com.actelion.research.gui.editor.SwingEditorDialog;
import com.actelion.research.gui.hidpi.HiDPIHelper;
@@ -47,28 +48,27 @@ public class JEditableStructureView extends JStructureView {
private static final String EDIT_MESSAGE = "<double click or drag & drop>";
private boolean mAllowQueryFeatures;
+ private int mAllowedPseudoAtoms;
public JEditableStructureView() {
- super(null);
- setEditable(true);
- mAllowQueryFeatures = true;
+ this(null);
}
public JEditableStructureView(StereoMolecule mol) {
super(mol);
setEditable(true);
+ mAllowedPseudoAtoms = GenericEditorArea.DEFAULT_ALLOWED_PSEUDO_ATOMS;
mAllowQueryFeatures = true;
}
public JEditableStructureView(int dragAction, int dropAction) {
- super(null, dragAction, dropAction);
- setEditable(true);
- mAllowQueryFeatures = true;
+ this(null, dragAction, dropAction);
}
public JEditableStructureView(StereoMolecule mol, int dragAction, int dropAction) {
super(mol, dragAction, dropAction);
setEditable(true);
+ mAllowedPseudoAtoms = GenericEditorArea.DEFAULT_ALLOWED_PSEUDO_ATOMS;
mAllowQueryFeatures = true;
}
@@ -93,7 +93,8 @@ public class JEditableStructureView extends JStructureView {
public void mouseClicked(MouseEvent e) {
if (e.getClickCount() == 2 && isEnabled() && isEditable()) {
SwingEditorDialog theDialog = createDrawDialog();
- theDialog.getDrawArea().setAllowQueryFeatures(mAllowQueryFeatures);
+ theDialog.getDrawArea().setAllowedPseudoAtoms(mAllowedPseudoAtoms);
+ theDialog.getDrawArea().setAllowQueryFeatures(mAllowQueryFeatures);
theDialog.getDrawArea().setDisplayMode(getDisplayMode());
theDialog.addStructureListener(this);
theDialog.setVisible(true);
@@ -107,6 +108,10 @@ public class JEditableStructureView extends JStructureView {
return (c instanceof Frame) ? new SwingEditorDialog((Frame) c, getMolecule(), Dialog.ModalityType.DOCUMENT_MODAL) : new SwingEditorDialog((Dialog) c, getMolecule(), Dialog.ModalityType.DOCUMENT_MODAL);
}
+ public void setAllowedPseudoAtoms(int apa) {
+ mAllowedPseudoAtoms = apa;
+ }
+
public void setAllowQueryFeatures(boolean allow) {
if (mAllowQueryFeatures != allow) {
mAllowQueryFeatures = allow;
=====================================
src/main/java/com/actelion/research/gui/JLoginDialog.java
=====================================
@@ -52,9 +52,19 @@ public class JLoginDialog extends JDialog implements WindowListener {
private JTextField mTextFieldUserID;
private JPasswordField mTextFieldPassword;
+ public JLoginDialog(Dialog owner, ActionListener listener) {
+ super(owner, "Database Login", true);
+ initialize(listener);
+ setLocationRelativeTo(owner);
+ }
+
public JLoginDialog(Frame owner, ActionListener listener) {
super(owner, "Database Login", true);
+ initialize(listener);
+ setLocationRelativeTo(owner);
+ }
+ private void initialize(ActionListener listener) {
JPanel p1 = new JPanel();
p1.setBorder(BorderFactory.createEmptyBorder(8, 8, 8, 8));
p1.setLayout(new GridLayout(2, 2, 4, 4));
@@ -92,7 +102,6 @@ public class JLoginDialog extends JDialog implements WindowListener {
}
pack();
- setLocationRelativeTo(owner);
}
public String getUserID() {
=====================================
src/main/java/com/actelion/research/gui/JPruningBar.java
=====================================
@@ -76,7 +76,7 @@ public class JPruningBar extends JPanel implements MouseListener, MouseMotionLis
private static final int cBorder = 2;
private float mLowValue,mMinValue,mHighValue,mMaxValue,mSegmentSize;
- private boolean mIsHorizontal,mUpdateNeeded,mUseRedColor,mAllowDoubleClickChange;
+ private boolean mIsHorizontal,mUpdateNeeded,mUseRedColor,mAllowDoubleClickChange,mWasDragged;
private int mID,mMousePosition,mClickedArea,mPosition1,mPosition2;
private ArrayList<PruningBarListener> mListener;
@@ -207,10 +207,14 @@ public class JPruningBar extends JPanel implements MouseListener, MouseMotionLis
* @param silent if true, PruningBarEvents are suppressed
*/
public void setLowAndHigh(float low, float high, boolean silent) {
- boolean lowChanged = setLow(low);
- boolean highChanged = setHigh(high);
-
- if (highChanged || lowChanged) {
+ if (low < mMinValue)
+ low = mMinValue;
+ if (high > mMaxValue)
+ high = mMaxValue;
+ if ((low != mLowValue || high != mHighValue)
+ && low <= high) {
+ mLowValue = low;
+ mHighValue = high;
if (!silent)
informListeners(false);
mUpdateNeeded = true;
@@ -344,6 +348,8 @@ public class JPruningBar extends JPanel implements MouseListener, MouseMotionLis
else
mMousePosition = e.getY();
+ mWasDragged = false;
+
mClickedArea = 0;
if (mMousePosition < mPosition1)
mClickedArea = 0;
@@ -362,7 +368,8 @@ public class JPruningBar extends JPanel implements MouseListener, MouseMotionLis
}
public void mouseReleased(MouseEvent e) {
- informListeners(false);
+ if (mWasDragged)
+ informListeners(false);
}
public void mouseEntered(MouseEvent e) {}
@@ -413,6 +420,8 @@ public class JPruningBar extends JPanel implements MouseListener, MouseMotionLis
if (position == mMousePosition)
return;
+ mWasDragged = true;
+
float change = mSegmentSize * (float)(position - mMousePosition);
if (!mIsHorizontal) // tribute to inverted Y-scale in java
change = -change;
=====================================
src/main/java/com/actelion/research/gui/dock/TreeFork.java
=====================================
@@ -179,6 +179,7 @@ class MySplitPane extends JSplitPane {
public MySplitPane(int newOrientation, Component newLeftComponent, Component newRightComponent, double proportionalLocation) {
super(newOrientation, true, newLeftComponent, newRightComponent);
+ proportionalLocation = Math.min(1, Math.max(0, proportionalLocation));
setDividerLocation(proportionalLocation);
setResizeWeight(proportionalLocation);
setBorder(null);
=====================================
src/main/java/com/actelion/research/gui/editor/CustomAtomDialogBuilder.java
=====================================
@@ -176,7 +176,7 @@ public class CustomAtomDialogBuilder implements GenericEventListener<GenericActi
}
if (text.length() != 0) {
- int atomicNo = Molecule.getAtomicNoFromLabel(text);
+ int atomicNo = Molecule.getAtomicNoFromLabel(text, mEditorArea.getAllowedPseudoAtoms());
if (atomicNo != 0 || text.equals("?")) {
int mass = 0;
if (mTextFieldMass.getText().length() != 0) {
=====================================
src/main/java/com/actelion/research/gui/editor/GenericEditorArea.java
=====================================
@@ -65,6 +65,13 @@ public class GenericEditorArea implements GenericEventListener {
public static final String TEMPLATE_TYPE_REACTION_QUERIES = "REACTION_QUERIES";
public static final String TEMPLATE_SECTION_KEY = "SECTION";
+ public static final int DEFAULT_ALLOWED_PSEUDO_ATOMS
+ = Molecule.cPseudoAtomsHydrogenIsotops
+ | Molecule.cPseudoAtomsAminoAcids
+ | Molecule.cPseudoAtomR
+ | Molecule.cPseudoAtomsRGroups
+ | Molecule.cPseudoAtomAttachmentPoint;
+
private static final int MAX_CONNATOMS = 8;
private static final int MIN_BOND_LENGTH_SQUARE = 100;
@@ -195,11 +202,7 @@ public class GenericEditorArea implements GenericEventListener {
mCurrentCursor = SwingCursorHelper.cPointerCursor;
mAtomKeyStrokeBuffer = new StringBuilder();
- mAllowedPseudoAtoms = Molecule.cPseudoAtomsHydrogenIsotops
- | Molecule.cPseudoAtomsAminoAcids
- | Molecule.cPseudoAtomR
- | Molecule.cPseudoAtomsRGroups
- | Molecule.cPseudoAtomAttachmentPoint;
+ mAllowedPseudoAtoms = DEFAULT_ALLOWED_PSEUDO_ATOMS;
mTextSizeFactor = 1.0;
@@ -2669,7 +2672,11 @@ public class GenericEditorArea implements GenericEventListener {
}
}
- private void setAllowPseudoAtoms(int apa) {
+ public int getAllowedPseudoAtoms() {
+ return mAllowedPseudoAtoms;
+ }
+
+ public void setAllowedPseudoAtoms(int apa) {
mAllowedPseudoAtoms = apa;
}
=====================================
src/main/java/com/actelion/research/util/Formatter.java
=====================================
@@ -7,9 +7,11 @@ package com.actelion.research.util;
import java.math.RoundingMode;
import java.text.DateFormat;
import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
+import java.util.Locale;
import java.util.StringTokenizer;
/**
@@ -45,18 +47,18 @@ public class Formatter {
private static DateFormat[] dateTimeParsers;
private static DateFormat[] dateTimeFormatters;
- private static final DecimalFormat df0 = new DecimalFormat("0");
- private static final DecimalFormat df1 = new DecimalFormat("0.0");
- private static final DecimalFormat df2 = new DecimalFormat("0.00");
- private static final DecimalFormat dfmax2 = new DecimalFormat("0.##");
- private static final DecimalFormat df3 = new DecimalFormat("0.000");
- private static final DecimalFormat dfmax3 = new DecimalFormat("0.###");
- private static final DecimalFormat df4 = new DecimalFormat("0.0000");
- private static final DecimalFormat df8 = new DecimalFormat("0.00000000");
- private static final DecimalFormat dfE = new DecimalFormat("0.00E0");
+ private static final DecimalFormat df0 = new DecimalFormat("0", new DecimalFormatSymbols(Locale.US));
+ private static final DecimalFormat df1 = new DecimalFormat("0.0", new DecimalFormatSymbols(Locale.US));
+ private static final DecimalFormat df2 = new DecimalFormat("0.00", new DecimalFormatSymbols(Locale.US));
+ private static final DecimalFormat dfmax2 = new DecimalFormat("0.##", new DecimalFormatSymbols(Locale.US));
+ private static final DecimalFormat df3 = new DecimalFormat("0.000", new DecimalFormatSymbols(Locale.US));
+ private static final DecimalFormat dfmax3 = new DecimalFormat("0.###", new DecimalFormatSymbols(Locale.US));
+ private static final DecimalFormat df4 = new DecimalFormat("0.0000", new DecimalFormatSymbols(Locale.US));
+ private static final DecimalFormat df8 = new DecimalFormat("0.00000000", new DecimalFormatSymbols(Locale.US));
+ private static final DecimalFormat dfE = new DecimalFormat("0.00E0", new DecimalFormatSymbols(Locale.US));
- public static final DecimalFormat dfI2 = new DecimalFormat("00");
- public static final DecimalFormat dfI3 = new DecimalFormat("000");
+ public static final DecimalFormat dfI2 = new DecimalFormat("00", new DecimalFormatSymbols(Locale.US));
+ public static final DecimalFormat dfI3 = new DecimalFormat("000", new DecimalFormatSymbols(Locale.US));
static {
//Set default format
View it on GitLab: https://salsa.debian.org/java-team/openchemlib/-/compare/12d4da9686617daf062a529fc4d655dcb333006f...3b4cd94e428c532338f6a757704efdf2078b5152
--
View it on GitLab: https://salsa.debian.org/java-team/openchemlib/-/compare/12d4da9686617daf062a529fc4d655dcb333006f...3b4cd94e428c532338f6a757704efdf2078b5152
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-java-commits/attachments/20230117/06855b7b/attachment.htm>
More information about the pkg-java-commits
mailing list