Skip to content

Commit 7db26b8

Browse files
committed
Correct alpha carbon detection.
1 parent f929ace commit 7db26b8

File tree

1 file changed

+36
-20
lines changed
  • descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular

1 file changed

+36
-20
lines changed

descriptor/qsarmolecular/src/main/java/org/openscience/cdk/qsar/descriptors/molecular/ALOGPDescriptor.java

Lines changed: 36 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1052,15 +1052,15 @@ private boolean isPyrroleLikeHetero(IAtom atom) {
10521052
return false;
10531053
}
10541054

1055-
private int getHAtomType(IAtom ai, List connectedAtoms) {
1055+
private int getHAtomType(IAtom atom, List connectedAtoms) {
10561056
//ai is the atom connected to a H atoms.
10571057
//ai environment determines what is the H atom type
10581058
//This procedure is applied only for carbons
10591059
//i.e. H atom type 50 is never returned
10601060

10611061
List<IAtom> ca;
10621062
if (connectedAtoms == null)
1063-
ca = atomContainer.getConnectedAtomsList(ai);
1063+
ca = atomContainer.getConnectedAtomsList(atom);
10641064
else
10651065
ca = connectedAtoms;
10661066

@@ -1072,12 +1072,12 @@ private int getHAtomType(IAtom ai, List connectedAtoms) {
10721072
int xCount = 0;
10731073
boolean hasConjHetereo = false;
10741074

1075-
for (IBond bond : ai.bonds()) {
1075+
for (IBond bond : atom.bonds()) {
10761076
if (bond.getOrder() == IBond.Order.DOUBLE)
10771077
ndoub++;
10781078
else if (bond.getOrder() == IBond.Order.TRIPLE)
10791079
ntrip++;
1080-
final IAtom nbor = bond.getOther(ai);
1080+
final IAtom nbor = bond.getOther(atom);
10811081
if (isHetero(nbor)) {
10821082
if (bond.isAromatic()) {
10831083
if (bond.getOrder() == IBond.Order.SINGLE) {
@@ -1115,27 +1115,43 @@ else if (ndoub == 2 || ntrip == 1)
11151115

11161116
// first check for alpha carbon:
11171117
// -C=X, -C#X and -C:X
1118-
if (ai.getAtomicNumber() == 6 && !ai.isAromatic() && hyb == IAtomType.Hybridization.SP3) {
1119-
boolean noXfirstShell = true;
1120-
boolean xInSecondShell = false;
1121-
for (int j = 0; j <= ca.size() - 1; j++) {
1122-
if (atomContainer.getBond(ai, ((IAtom) ca.get(j))).getOrder() == IBond.Order.SINGLE
1123-
&& ((IAtom) ca.get(j)).getSymbol().equals("C")) { // single bonded
1124-
IAtom aCarbon = ca.get(j);
1125-
for (IBond bond : aCarbon.bonds()) {
1126-
IAtom nbor = bond.getOther(aCarbon);
1127-
if (isHetero(nbor) && (bond.isAromatic() || bond.getOrder() != IBond.Order.SINGLE))
1128-
xInSecondShell = true;
1118+
boolean isAlphaC = false;
1119+
if (atom.getAtomicNumber() == 6 && hyb == IAtomType.Hybridization.SP3) {
1120+
for (IBond bond : atom.bonds()) {
1121+
IAtom nbor = bond.getOther(atom);
1122+
if (isHetero(nbor)) {
1123+
isAlphaC = false;
1124+
break;
1125+
} else if (nbor.getAtomicNumber() == 6) {
1126+
int numDoubX = 0, numTripX = 0, numAromX = 0;
1127+
for (IBond bond2 : nbor.bonds()) {
1128+
IAtom nbor2 = bond2.getOther(nbor);
1129+
if (isHetero(nbor2)) {
1130+
switch (bond2.getOrder()) {
1131+
case SINGLE:
1132+
if (bond2.isAromatic() && !isPyrroleLikeHetero(nbor2))
1133+
numAromX++;
1134+
break;
1135+
case DOUBLE:
1136+
if (bond2.isAromatic())
1137+
numAromX++;
1138+
else
1139+
numDoubX++;
1140+
break;
1141+
case TRIPLE:
1142+
numTripX++;
1143+
break;
1144+
}
1145+
}
11291146
}
1130-
} else {
1131-
if (isHetero(ca.get(j)))
1132-
noXfirstShell = false;
1147+
if (numDoubX + numTripX + numAromX == 1)
1148+
isAlphaC = true;
11331149
}
11341150
}
1135-
if (noXfirstShell && xInSecondShell)
1136-
return 51;
11371151
}
11381152

1153+
if (isAlphaC)
1154+
return 51;
11391155
switch (hyb) {
11401156
case SP1:
11411157
if (oxNum == 0)

0 commit comments

Comments
 (0)