Skip to content

Commit

Permalink
Merge commit '384f58f59a4029b176d2b183323badb6543f2d77'
Browse files Browse the repository at this point in the history
  • Loading branch information
targos committed Jul 18, 2024
2 parents bee7a71 + 384f58f commit 66a2646
Show file tree
Hide file tree
Showing 30 changed files with 483 additions and 623 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>2024.7.1</version>
<version>2024.7.2-SNAPSHOT</version>

<name>OpenChemLib</name>
<description>Open Source Chemistry Library</description>
Expand Down Expand Up @@ -209,7 +209,7 @@
<connection>scm:git:[email protected]:Actelion/openchemlib.git</connection>
<developerConnection>scm:git:[email protected]:Actelion/openchemlib.git</developerConnection>
<url>https://github.com/Actelion/openchemlib</url>
<tag>openchemlib-2024.7.1</tag>
<tag>HEAD</tag>
</scm>

<distributionManagement>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void neglectSpaceDelimitedCoordinates() {
* @return
*/
public StereoMolecule getCompactMolecule(String idcode) {
return (idcode == null || idcode.length() == 0) ? null : getCompactMolecule(idcode.getBytes(StandardCharsets.UTF_8), null);
return (idcode == null || idcode.isEmpty()) ? null : getCompactMolecule(idcode.getBytes(StandardCharsets.UTF_8), null);
}

/**
Expand Down Expand Up @@ -151,7 +151,7 @@ public StereoMolecule getCompactMolecule(byte[] idcode, byte[] coordinates, int
* @param idcode null or idcode, which may contain coordinates separated by a space character
*/
public void parse(StereoMolecule mol, String idcode) {
if (idcode == null || idcode.length() == 0) {
if (idcode == null || idcode.isEmpty()) {
parse(mol, (byte[])null, (byte[])null);
return;
}
Expand Down Expand Up @@ -437,9 +437,10 @@ public void parse(StereoMolecule mol, byte[] idcode, byte[] coordinates, int idc
int offset = 0;
while (decodeBits(1) == 1) {
int dataType = offset + decodeBits(4);
int no;
switch (dataType) {
case 0: // datatype 'AtomQFNoMoreNeighbours'
int no = decodeBits(abits);
no = decodeBits(abits);
for (int i=0; i<no; i++) {
int atom = decodeBits(abits);
mMol.setAtomQueryFeature(atom, Molecule.cAtomQFNoMoreNeighbours, true);
Expand Down Expand Up @@ -762,10 +763,10 @@ public void parse(StereoMolecule mol, byte[] idcode, byte[] coordinates, int idc
from = 0;
factor = 8.0;
}
mMol.setAtomX(atom, mMol.getAtomX(from) + factor * (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomY(atom, mMol.getAtomY(from) + factor * (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomX(atom, mMol.getAtomX(from) + factor * (decodeBits(resolutionBits) - binCount / 2.0));
mMol.setAtomY(atom, mMol.getAtomY(from) + factor * (decodeBits(resolutionBits) - binCount / 2.0));
if (coordsAre3D)
mMol.setAtomZ(atom, mMol.getAtomZ(from) + factor * (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomZ(atom, mMol.getAtomZ(from) + factor * (decodeBits(resolutionBits) - binCount / 2.0));
}

if (coordinates[coordsStart] == '#') { // we have 3D-coordinates that include implicit hydrogen coordinates
Expand All @@ -781,10 +782,10 @@ public void parse(StereoMolecule mol, byte[] idcode, byte[] coordinates, int idc
int hydrogen = mMol.addAtom(1);
mMol.addBond(atom, hydrogen, Molecule.cBondTypeSingle);

mMol.setAtomX(hydrogen, mMol.getAtomX(atom) + (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomY(hydrogen, mMol.getAtomY(atom) + (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomX(hydrogen, mMol.getAtomX(atom) + (decodeBits(resolutionBits) - binCount / 2.0));
mMol.setAtomY(hydrogen, mMol.getAtomY(atom) + (decodeBits(resolutionBits) - binCount / 2.0));
if (coordsAre3D)
mMol.setAtomZ(hydrogen, mMol.getAtomZ(atom) + (decodeBits(resolutionBits) - binCount / 2));
mMol.setAtomZ(hydrogen, mMol.getAtomZ(atom) + (decodeBits(resolutionBits) - binCount / 2.0));
}
}

Expand Down Expand Up @@ -935,10 +936,10 @@ public void parseCoordinates(byte[] encodedCoords, int coordsStart, StereoMolecu
from = 0;
factor = 8.0;
}
coords[atom].x = coords[from].x + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[atom].y = coords[from].y + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[atom].x = coords[from].x + factor * (decodeBits(resolutionBits) - binCount / 2.0);
coords[atom].y = coords[from].y + factor * (decodeBits(resolutionBits) - binCount / 2.0);
if (coordsAre3D)
coords[atom].z = coords[from].z + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[atom].z = coords[from].z + factor * (decodeBits(resolutionBits) - binCount / 2.0);
}

double avbl = coordsAre3D ? 1.5 : Molecule.getDefaultAverageBondLength();
Expand All @@ -954,10 +955,10 @@ public void parseCoordinates(byte[] encodedCoords, int coordsStart, StereoMolecu
for (int atom = 0; atom < atomCount; atom++) {
int hCount = mol.getAllConnAtoms(atom) - mol.getConnAtoms(atom);
for (int i = 0; i < hCount; i++) {
coords[hydrogen].x = coords[atom].x + (decodeBits(resolutionBits) - binCount / 2);
coords[hydrogen].y = coords[atom].y + (decodeBits(resolutionBits) - binCount / 2);
coords[hydrogen].x = coords[atom].x + (decodeBits(resolutionBits) - binCount / 2.0);
coords[hydrogen].y = coords[atom].y + (decodeBits(resolutionBits) - binCount / 2.0);
if (coordsAre3D)
coords[hydrogen].z = coords[atom].z + (decodeBits(resolutionBits) - binCount / 2);
coords[hydrogen].z = coords[atom].z + (decodeBits(resolutionBits) - binCount / 2.0);

hydrogen++;
}
Expand Down Expand Up @@ -1072,7 +1073,7 @@ else if (coordinates[coordStart] == '!' || coordinates[coordStart] == '#') {
}

public int getIDCodeVersion(String idcode) {
if (idcode == null || idcode.length() == 0)
if (idcode == null || idcode.isEmpty())
return -1;

return getIDCodeVersion(idcode.getBytes(StandardCharsets.UTF_8));
Expand All @@ -1090,7 +1091,7 @@ public int getIDCodeVersion(byte[] idcode) {
}

public int getAtomCount(String idcode) {
if (idcode == null || idcode.length() == 0)
if (idcode == null || idcode.isEmpty())
return 0;

return getAtomCount(idcode.getBytes(StandardCharsets.UTF_8), 0);
Expand Down Expand Up @@ -1120,7 +1121,7 @@ public int getAtomCount(byte[] idcode, int offset) {
* @return int[] with atom and bond count as first and second values
*/
public int[] getAtomAndBondCounts(String idcode, int[] count) {
if (idcode == null || idcode.length() == 0)
if (idcode == null || idcode.isEmpty())
return null;

return getAtomAndBondCounts(idcode.getBytes(StandardCharsets.UTF_8), 0, count);
Expand Down Expand Up @@ -1192,7 +1193,7 @@ private double decodeShift(int value, int binCount) {
boolean isNegative = (value >= halfBinCount);
if (isNegative)
value -= halfBinCount;
double steepness = binCount/32;
double steepness = binCount/32.0;
double doubleValue = steepness * value / (halfBinCount - value);
return isNegative ? -doubleValue : doubleValue;
}
Expand Down Expand Up @@ -1366,9 +1367,10 @@ public void printContent(byte[] idcode, byte[] coordinates) {
int offset = 0;
while (decodeBits(1) == 1) {
int dataType = offset + decodeBits(4);
int no;
switch (dataType) {
case 0: // datatype 'AtomQFNoMoreNeighbours'
int no = decodeBits(abits);
no = decodeBits(abits);
System.out.print("noMoreNeighbours:");
for (int i = 0; i < no; i++)
System.out.print(" " + decodeBits(abits));
Expand Down Expand Up @@ -1675,12 +1677,12 @@ public void printContent(byte[] idcode, byte[] coordinates) {
factor = 8.0;
}
System.out.print(atom + " (");
coords[0][atom] = coords[0][from] + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[0][atom] = coords[0][from] + factor * (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print((int) coords[0][atom] + ",");
coords[1][atom] = coords[1][from] + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[1][atom] = coords[1][from] + factor * (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print((int) coords[1][atom]);
if (coordsAre3D) {
coords[2][atom] = coords[2][from] + factor * (decodeBits(resolutionBits) - binCount / 2);
coords[2][atom] = coords[2][from] + factor * (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print("," + (int) coords[0][atom]);
}
System.out.print("), ");
Expand Down Expand Up @@ -1719,12 +1721,12 @@ public void printContent(byte[] idcode, byte[] coordinates) {
System.out.print(atom);
for (int i = 0; i < hCount[atom]; i++) {
System.out.print(" (");
coords[0][hydrogen] = coords[0][atom] + (decodeBits(resolutionBits) - binCount / 2);
coords[0][hydrogen] = coords[0][atom] + (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print((int) coords[0][hydrogen] + ",");
coords[1][hydrogen] = coords[1][atom] + (decodeBits(resolutionBits) - binCount / 2);
coords[1][hydrogen] = coords[1][atom] + (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print((int) coords[1][hydrogen]);
if (coordsAre3D) {
coords[2][hydrogen] = coords[2][atom] + (decodeBits(resolutionBits) - binCount / 2);
coords[2][hydrogen] = coords[2][atom] + (decodeBits(resolutionBits) - binCount / 2.0);
System.out.print("," + (int) coords[2][hydrogen]);
}
System.out.print("), ");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public SmilesAtomParser(SmilesParser parser, int mode) {
mParentParser = parser;
mMode = mode;
mAllowCactvs = (mode & SmilesParser.MODE_NO_CACTUS_SYNTAX) == 0;
atomicNo = -1;
charge = 0;
mapNo = 0;
abnormalValence = -1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -436,9 +436,7 @@ else if (includeNodeAtoms) {
public MolDistHistViz createVisualDescriptor(StereoMolecule fragBiggest) {

MolDistHistViz mdhv = null;

recentException = null;

try {
mdhv = creatorMolDistHistViz.create(fragBiggest);
} catch (Exception e) {
Expand All @@ -453,7 +451,6 @@ public MolDistHistViz createVisualDescriptor(StereoMolecule fragBiggest) {
recentException = e;
}
}

return mdhv;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@ public class ConstantsFlexophore {


public static final String TAG_FLEXOPHORE_OBJECT = "FlexDecoded";



public static final int LABEL_WEIGHT_LOW = 0;
public static final int LABEL_WEIGHT_NORMAL = 1;
public static final int LABEL_WEIGHT_MANDATORY = 2;
public static final double VAL_WEIGHT_LOW = 0.5;
public static final double VAL_WEIGHT_NORMAL = 1;
public static final double VAL_WEIGHT_MANDATORY = 2;
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,11 @@ public interface IMolDistHist extends ICompleteGraph {

byte [] getDistHist(int indexAt1, int indexAt2, byte[] arr);

boolean isInevitablePharmacophorePoint(int indexNode);

int getNumInevitablePharmacophorePoints();
boolean isMandatoryPharmacophorePoint(int indexNode);

double getWeightPharmacophorePoint(int indexNode);

int getNumMandatoryPharmacophorePoints();


}
Original file line number Diff line number Diff line change
Expand Up @@ -452,16 +452,19 @@ public int getSizeBytes(){
* Only for interface compliance needed.
*/
@Override
public int getNumInevitablePharmacophorePoints() {
public int getNumMandatoryPharmacophorePoints() {
// TODO Auto-generated method stub
return 0;
}

@Override
public boolean isInevitablePharmacophorePoint(int indexNode) {
// TODO Auto-generated method stub
public boolean isMandatoryPharmacophorePoint(int indexNode) {
return false;
}
@Override
public double getWeightPharmacophorePoint(int indexNode) {
return 1.0;
}

public static int getNumBytesEntry(){
return PPNode.getNumBytesEntry()+1;
Expand Down
Loading

0 comments on commit 66a2646

Please sign in to comment.