[Git][java-team/openchemlib][upstream] New upstream version 2021.11.0+dfsg

Andrius Merkys (@merkys) gitlab at salsa.debian.org
Fri Nov 5 10:50:18 GMT 2021



Andrius Merkys pushed to branch upstream at Debian Java Maintainers / openchemlib


Commits:
22a8091d by Andrius Merkys at 2021-11-05T04:57:55-04:00
New upstream version 2021.11.0+dfsg
- - - - -


9 changed files:

- pom.xml
- src/main/java/com/actelion/research/chem/ExtendedMolecule.java
- src/main/java/com/actelion/research/chem/IsomericSmilesCreator.java
- src/main/java/com/actelion/research/chem/Mutator.java
- src/main/java/com/actelion/research/chem/RingCollection.java
- src/main/java/com/actelion/research/chem/SmilesParser.java
- src/main/java/com/actelion/research/chem/docking/DockingEngine.java
- src/main/java/com/actelion/research/chem/io/CompoundTableConstants.java
- src/main/java/com/actelion/research/chem/reaction/Reactor.java


Changes:

=====================================
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>2021.10.1</version>
+    <version>2021.11.0</version>
 
     <name>OpenChemLib</name>
     <description>Open Source Chemistry Library</description>
@@ -195,7 +195,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-2021.10.1</tag>
+      <tag>openchemlib-2021.11.0</tag>
   </scm>
 
     <distributionManagement>


=====================================
src/main/java/com/actelion/research/chem/ExtendedMolecule.java
=====================================
@@ -1664,8 +1664,9 @@ public class ExtendedMolecule extends Molecule implements Serializable {
 
 
 	/**
-	 * Converts any stereo bond attached with its pointed tip
-	 * to this atom into a single bond.
+	 * Converts any stereo bond being attached with the pointed tip to the given potential stereocenter
+	 * (TH or allene) into a single bond. For allenic stereo centers, stereo bonds at the allene end atoms
+	 * are converted. Atoms with PI electrons are not touched, unless they are P,S,...
 	 * @param atom
 	 */
 	public void convertStereoBondsToSingleBonds(int atom) {
@@ -1673,12 +1674,13 @@ public class ExtendedMolecule extends Molecule implements Serializable {
 			for (int i=0; i<2; i++) {
 				int alleneEnd = findAlleneEndAtom(atom, mConnAtom[atom][i]);
 				if (alleneEnd != -1)
-					convertStereoBondsToSingleBonds(alleneEnd);
+					for (int j=0; j<mConnAtoms[alleneEnd];j++)
+						if (isStereoBond(mConnBond[alleneEnd][j]))
+							mBondType[mConnBond[alleneEnd][j]] = cBondTypeSingle;
 				}
 			return;
 			}
 
-		// avoid flattening allene stereo bonds
 		if (mPi[atom] == 0 || mAtomicNo[atom] >= 15) {
 			for (int i=0; i<mAllConnAtoms[atom]; i++) {
 				int connBond = mConnBond[atom][i];


=====================================
src/main/java/com/actelion/research/chem/IsomericSmilesCreator.java
=====================================
@@ -42,6 +42,7 @@ import java.util.List;
 public class IsomericSmilesCreator {
 	public static final int MODE_CREATE_SMARTS = 1;
 	public static final int MODE_INCLUDE_MAPPING = 2;
+	public static final int MODE_KEKULIZED_OUTPUT = 4;  // no lower case atom labels and single/double bonds to represent aromaticity
 
 	private StereoMolecule mMol;
 	private Canonizer mCanonizer;
@@ -430,6 +431,7 @@ public class IsomericSmilesCreator {
 		if (!isAnyAtom
 		 && atomList == null
 		 && mMol.isAromaticAtom(atom)
+		 && (mMode & MODE_KEKULIZED_OUTPUT) == 0
 		 && (mMol.getAtomPi(atom) != 0
 		  || (mMol.getAtomAbnormalValence(atom) == -1
 		   && mMol.getAtomRadical(atom) == Molecule.cAtomRadicalStateNone)))
@@ -461,7 +463,7 @@ public class IsomericSmilesCreator {
 				(!isAnyAtom && !isOrganic(mMol.getAtomicNo(atom)))
 				|| atomList != null
 				|| qualifiesForAtomParity(atom)
-				|| (mMol.isAromaticAtom(atom) && mMol.getAtomPi(atom) == 0)
+				|| (mMol.isAromaticAtom(atom) && mMol.getAtomPi(atom) == 0 && (mMode & MODE_KEKULIZED_OUTPUT) == 0)
 				|| charge != 0
 				|| isotop != 0
 				|| mapNo != 0
@@ -513,13 +515,13 @@ public class IsomericSmilesCreator {
 
 	private String createMultiAtomLabel(int atom, int[] atomicNo, StringBuilder buffer) {
 		buffer.setLength(0);
-		boolean isAromatic = mMol.isAromaticAtom(atom);
+		boolean isLowerCase = mMol.isAromaticAtom(atom) && (mMode & MODE_KEKULIZED_OUTPUT) == 0;
 
 		for (int a:atomicNo) {
 			if (buffer.length() != 0)
 				buffer.append(',');
 			String label = Molecule.cAtomLabel[a];
-				buffer.append(isAromatic ? label.toLowerCase() : label);
+				buffer.append(isLowerCase ? label.toLowerCase() : label);
 			}
 
 		return buffer.toString();
@@ -740,11 +742,12 @@ public class IsomericSmilesCreator {
 					}
 				}
 			}
-		if (startLength == builder.length() && !mMol.isAromaticBond(bond)) {
+		if (startLength == builder.length() && (!mMol.isAromaticBond(bond) || (mMode & MODE_KEKULIZED_OUTPUT) != 0)) {
 			int bondType = mMol.getBondType(bond) & Molecule.cBondTypeMaskSimple;
 			if (bondType == Molecule.cBondTypeSingle) {
 				if (mMol.isAromaticAtom(mMol.getBondAtom(0, bond))
-				 && mMol.isAromaticAtom(mMol.getBondAtom(1, bond)))
+				 && mMol.isAromaticAtom(mMol.getBondAtom(1, bond))
+				 && (mMode & MODE_KEKULIZED_OUTPUT) == 0)
 					builder.append('-');
 			} else if (bondType == Molecule.cBondTypeDouble)
 				builder.append('=');


=====================================
src/main/java/com/actelion/research/chem/Mutator.java
=====================================
@@ -1521,20 +1521,19 @@ public class Mutator {
 		}
 
 	private void repairStereoChemistry(StereoMolecule mol) {
+		for (int bond=0; bond<mol.getAllBonds(); bond++)
+			if (mol.isStereoBond(bond))
+				mol.setBondType(bond, Molecule.cBondTypeSingle);
+
         for (int atom=0; atom<mol.getAtoms(); atom++) {
-            switch (mol.getAtomParity(atom)) {
-            case Molecule.cAtomParityUnknown:
-                int parity = (mRandom.nextDouble() < 0.5) ? Molecule.cAtomParity1 : Molecule.cAtomParity2;
-                boolean isPseudo = mol.isAtomParityPseudo(atom);
-                mol.setAtomParity(atom, parity, isPseudo);
-            case Molecule.cAtomParity1:
-            case Molecule.cAtomParity2:
+        	int parity = mol.getAtomParity(atom);
+        	if (parity == Molecule.cAtomParityUnknown) {
+		        parity = (mRandom.nextDouble()<0.5) ? Molecule.cAtomParity1 : Molecule.cAtomParity2;
+		        boolean isPseudo = mol.isAtomParityPseudo(atom);
+		        mol.setAtomParity(atom, parity, isPseudo);
+	            }
+        	if (parity != Molecule.cAtomParityNone)
                 mol.setStereoBondFromAtomParity(atom);
-                break;
-            case Molecule.cAtomParityNone:
-                mol.convertStereoBondsToSingleBonds(atom);
-                break;
-                }
             }
         for (int bond=0; bond<mol.getBonds(); bond++) {
         	if (mol.isBINAPChiralityBond(bond)) {
@@ -1547,10 +1546,6 @@ public class Mutator {
 	            case Molecule.cBondParityZor2:
 	                mol.setStereoBondFromBondParity(bond);
 	                break;
-	            case Molecule.cBondParityNone:
-	                mol.convertStereoBondsToSingleBonds(mol.getBondAtom(0, bond));
-	                mol.convertStereoBondsToSingleBonds(mol.getBondAtom(1, bond));
-	                break;
 	                }
         		}
             }


=====================================
src/main/java/com/actelion/research/chem/RingCollection.java
=====================================
@@ -50,6 +50,7 @@ public class RingCollection {
 	public static final int MODE_SMALL_AND_LARGE_RINGS_AND_AROMATICITY = MODE_SMALL_RINGS
 																	   | MODE_LARGE_RINGS
 																	   | MODE_AROMATICITY;
+	public static final int MODE_INCLUDE_TAUTOMERIC_BONDS = 8;
 
 	private ExtendedMolecule mMol;
 	private ArrayList<int[]> mRingAtomSet;
@@ -171,7 +172,7 @@ public class RingCollection {
 			mIsAromatic = new boolean[mRingAtomSet.size()];
 			mIsDelocalized = new boolean[mRingAtomSet.size()];
 			mHeteroPosition = new int[mRingAtomSet.size()];
-			determineAromaticity(mIsAromatic, mIsDelocalized, mHeteroPosition, false);
+			determineAromaticity(mIsAromatic, mIsDelocalized, mHeteroPosition, (mode & MODE_INCLUDE_TAUTOMERIC_BONDS) != 0);
 			}
 
 		// find large rings by examining every potential ring bond
@@ -729,7 +730,7 @@ public class RingCollection {
 	public boolean qualifiesAsAmideTypeBond(int bond) {
 		for (int i=0; i<2; i++) {
 			int atom1 = mMol.getBondAtom(i, bond);
-			if (mMol.getAtomicNo(atom1) == 7
+			if ((mMol.getAtomicNo(atom1) == 7)
 			 && mMol.getConnAtoms(atom1) == 2) {
 				int atom2 = mMol.getBondAtom(1-i, bond);
 				if (mMol.getAtomicNo(atom2) == 6) {


=====================================
src/main/java/com/actelion/research/chem/SmilesParser.java
=====================================
@@ -54,7 +54,7 @@ public class SmilesParser {
 
 	private static final int INITIAL_CONNECTIONS = 16;
 	private static final int MAX_CONNECTIONS = 100; // largest allowed one in SMILES is 99
-	private static final int MAX_BRACKET_LEVELS = 64;
+	private static final int BRACKET_LEVELS = 32;
 	private static final int MAX_AROMATIC_RING_SIZE = 15;
 
 	private static final int HYDROGEN_ANY = -1;
@@ -239,7 +239,7 @@ public class SmilesParser {
 
 		TreeMap<Integer,THParity> parityMap = null;
 
-		int[] baseAtom = new int[MAX_BRACKET_LEVELS];
+		int[] baseAtom = new int[BRACKET_LEVELS];
 		baseAtom[0] = -1;
 
 		int[] ringClosureAtom = new int[INITIAL_CONNECTIONS];
@@ -857,8 +857,10 @@ public class SmilesParser {
 			if (theChar == '(') {
 				if (baseAtom[bracketLevel] == -1)
 					throw new Exception("Smiles with leading parenthesis are not supported");
-				baseAtom[bracketLevel+1] = baseAtom[bracketLevel];
 				bracketLevel++;
+				if (baseAtom.length == bracketLevel)
+					baseAtom = Arrays.copyOf(baseAtom, baseAtom.length + BRACKET_LEVELS);
+				baseAtom[bracketLevel] = baseAtom[bracketLevel-1];
 				continue;
 				}
 
@@ -1213,6 +1215,22 @@ public class SmilesParser {
 				} while (qualifyingBondFound);
 			}
 
+		/* Some SMILES still contain kekulized aromatic rings with lowercase hetero atoms, e.g. C1=CC=C[se]1
+		// If we recognize those rings to be aromatic, we remove the aromaticity marker from all ring atoms.
+		if (mAromaticAtoms != 0) {
+			RingCollection daylightTypeRingSet = new RingCollection(mMol, RingCollection.MODE_SMALL_RINGS_AND_AROMATICITY | RingCollection.MODE_INCLUDE_TAUTOMERIC_BONDS);
+			for (int ring=0; ring<daylightTypeRingSet.getSize(); ring++) {
+				if (daylightTypeRingSet.isAromatic(ring)) {
+					int[] ringAtom = daylightTypeRingSet.getRingAtoms(ring);
+					for (int atom:ringAtom)
+						if (mMol.isMarkedAtom(atom)) {
+							mMol.setAtomMarker(atom, false);
+							mAromaticAtoms--;
+						}
+					}
+				}
+			} taken out, because OpenChemLib should not start interpreting invalid SMILES; TLS 20-Oct-2021 */
+
 		while (mAromaticAtoms >= 2)
 			if (!connectConjugatedRadicalPairs(isAromaticBond))
 				break;


=====================================
src/main/java/com/actelion/research/chem/docking/DockingEngine.java
=====================================
@@ -90,8 +90,11 @@ public class DockingEngine {
 
 	
 	public DockingEngine(StereoMolecule rec, StereoMolecule nativeLig, int mcSteps, int startPositions,
-			ScoringFunction scoringFunction) {
-
+			ScoringFunction scoringFunction) throws DockingFailedException {
+		for(int ra=0;ra<rec.getAtoms();ra++) {
+			if(rec.getImplicitHydrogens(ra)>0)
+				throw new DockingFailedException("please add hydrogen atoms to receptor structure!");
+		}
 		nativeLigand = new Molecule3D(nativeLig);
 		nativeLigand.ensureHelperArrays(Molecule.cHelperCIP);
 		Molecule3D receptor = new Molecule3D(rec);
@@ -128,7 +131,7 @@ public class DockingEngine {
 
 	}
 	
-	public DockingEngine(StereoMolecule receptor, StereoMolecule nativeLigand) {
+	public DockingEngine(StereoMolecule receptor, StereoMolecule nativeLigand) throws DockingFailedException {
 		this(receptor,nativeLigand,DEFAULT_NR_MC_STEPS,DEFAULT_START_POSITIONS,ScoringFunction.CHEMPLP);
 	}
 	


=====================================
src/main/java/com/actelion/research/chem/io/CompoundTableConstants.java
=====================================
@@ -173,6 +173,8 @@ public interface CompoundTableConstants {
     String cColumnPropertyReferenceTypeTopDown = "topdown";	// a connection is only referenced from top record
     String cColumnPropertyFormula = "formula";
     String cColumnPropertySuperposeMolecule = "superposeMol";	// idcode+coords to be displayed in every cell
+    String cColumnPropertyProteinCavity = "proteinCavity";	// idcode+coords of protein cavity to be displayed in every cell
+    String cColumnPropertyNaturalLigand = "naturalLigand";	// idcode+coords of natural ligand, if proteinCavity is given (not shown, used for surface creation)
     String cColumnPropertySuperpose = "superpose";  // cSuperposeValueReferenceRow or null
     String cColumnPropertySuperposeAlign = "align";  // cSuperposeAlignValueShape or null
     String cColumnPropertyCommentUploadStatus = "commentUploadStatus";


=====================================
src/main/java/com/actelion/research/chem/reaction/Reactor.java
=====================================
@@ -270,7 +270,7 @@ public class Reactor {
 		StereoMolecule genericReactant = mGenericReaction.getReactant(no);
 
 		mSSSearcher.setMol(genericReactant, mReactant[no]);
-		int matchMode = SSSearcher.cMatchDBondToDelocalized + (mAllowChargeCorrections ? 0 : SSSearcher.cMatchAtomCharge);
+		int matchMode = SSSearcher.cDefaultMatchMode + (mAllowChargeCorrections ? 0 : SSSearcher.cMatchAtomCharge);
 		if (mSSSearcher.findFragmentInMolecule(SSSearcher.cCountModeRigorous, matchMode) == 0) {
 			mMatchList[no] = new ArrayList<>();
 			mReactantMatchCombinationCount = 0;



View it on GitLab: https://salsa.debian.org/java-team/openchemlib/-/commit/22a8091d1e0be92c7f1ef4c65c7cf754bac2680a

-- 
View it on GitLab: https://salsa.debian.org/java-team/openchemlib/-/commit/22a8091d1e0be92c7f1ef4c65c7cf754bac2680a
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/20211105/c1385183/attachment.htm>


More information about the pkg-java-commits mailing list