3838 * model. See Journal of Cheminformatics 2018 10:61 https://doi.org/10.1186/s13321-018-0316-5
3939 *
4040 * @author Jeffrey Plante
41- * @cdk.created 2018-12-15
41+ * @cdk.created 2018-12-15
4242 * @cdk.keyword JPLogP
4343 * @cdk.keyword descriptor
4444 * @cdk.keyword lipophilicity
45- * @cdk.cite Journal of Cheminformatics 2018 10:61 https://doi.org/10.1186/s13321-018-0316-5
4645 */
4746public class JPlogPDescriptor extends AbstractMolecularDescriptor implements IMolecularDescriptor {
4847
4948 private static final String [] NAMES = { "JPLogP" };
5049 private boolean addImplicitH = true ;
51- JPlogPcalculator jplogp = null ;
50+ JPlogPCalculator jplogp = null ;
5251
5352 /**
5453 * Default constructor which will setup the required coefficients to enable
5554 * a prediction
5655 */
5756 public JPlogPDescriptor ()
5857 {
59- jplogp = new JPlogPcalculator ();
58+ jplogp = new JPlogPCalculator ();
6059 }
6160
6261 @ Override
@@ -135,24 +134,34 @@ public DescriptorValue calculate(IAtomContainer container) {
135134
136135
137136
138-
139- protected class JPlogPcalculator
137+ /**
138+ * The class that calculated the logP according to the JPlogP method described in:
139+ * Journal of Cheminformatics 2018 10:61 https://doi.org/10.1186/s13321-018-0316-5
140+ *
141+ * This is lower level access and should normally be obtained through the descriptor above.
142+ *
143+ * @author Jeffrey
144+ *
145+ */
146+ protected class JPlogPCalculator
140147 {
141148 Map <Integer , Double > coeffs = null ;
142149
143150 /**
144- * initialise the model with the required values. Could instead read from a
145- * serialised file, but this is simpler and the number of coefficients isn't
146- * too large. Quite simple to update as well when able to output the model
147- * to the screen with minor text manupilation with regex strings.
151+ * Initialises the required coefficients for the trained model from the paper.
148152 */
149- public JPlogPcalculator ()
153+ public JPlogPCalculator ()
150154 {
151155 coeffs = new HashMap <>();
152156 initcoeffs ();
153-
154157 }
155158
159+ /**
160+ * Given a structure in the correct configuration (explicit H and aromatised) it will return the logP as a Double
161+ * or if it is out of domain (encounters an unknown atomtype) it will return Double.NaN
162+ * @param struct the structure to calculate it must have explicit H and be aromatised.
163+ * @return The calculated logP as a Double
164+ */
156165 protected Double calcLogP (IAtomContainer struct )
157166 {
158167 boolean inDomain = true ;
@@ -172,19 +181,16 @@ protected Double calcLogP(IAtomContainer struct)
172181 } else {
173182 System .out .println (atomtype + " not found" );
174183 return Double .NaN ;
175- // new DescriptorValue(getSpecification(), getParameterNames(), getParameters(),
176- // new DoubleResult(Double.NaN), getDescriptorNames());
177184 }
178185 }
179-
180186 return logP ;
181187 }
182188
183189 /**
184190 * Used in Training the model
185191 *
186192 * @param struct
187- * @return
193+ * @return Map representing the Hologram of the given structure
188194 */
189195 public Map <Integer , Integer > getMappedHologram (IAtomContainer struct ) {
190196 Map <Integer , Integer > holo = new HashMap <>();
@@ -204,7 +210,7 @@ public Map<Integer, Integer> getMappedHologram(IAtomContainer struct) {
204210
205211 /**
206212 * Returns the AtomCode for the logP atomtype as previously developed at
207- * Lhasa
213+ * Lhasa see citation at top of class for more information
208214 *
209215 * @param atom
210216 * the atom to type
@@ -253,14 +259,15 @@ private Integer getAtomTypeCode(IAtom atom) {
253259 break ;
254260 }
255261 returnMe += toadd ;
262+ // check for any errors and if so return a null value
256263 if (toadd != 99 ) {
257264 return returnMe ;
258265 } else
259266 return null ;
260267 }
261268
262269 /**
263- *
270+ * Determines and returns the SS (subsection) portion of the atomtype integer for a Hydrogen Atom
264271 * @param atom
265272 * @return the final 2 digits for the given atom
266273 */
@@ -312,7 +319,7 @@ else if (formalOxState >= 1.0)
312319 }
313320
314321 /**
315- *
322+ * Determines and returns the SS (subsection) portion of the atomtype integer for a "Default" ie not C,N,O,H,F Atom
316323 * @param atom
317324 * @return the final 2 digits for the given atom
318325 */
@@ -332,7 +339,7 @@ protected int getDefaultSpecial(IAtom atom) {
332339 }
333340
334341 /**
335- *
342+ * Determines and returns the SS (subsection) portion of the atomtype integer for a Fluorine Atom
336343 * @param atom
337344 * @return the final 2 digits for the given atom
338345 */
@@ -367,7 +374,7 @@ else if (neighbourconn == 4 && ox > 2)
367374 }
368375
369376 /**
370- *
377+ * Determines and returns the SS (subsection) portion of the atomtype integer for an Oxygen Atom
371378 * @param atom
372379 * @return the final 2 digits for the given atom
373380 */
@@ -406,7 +413,7 @@ else if (checkAlphaCarbonyl(atom, "S"))
406413 }
407414
408415 /**
409- *
416+ * Determines and returns the SS (subsection) portion of the atomtype integer for a Nitrogen Atom
410417 * @param atom
411418 * @return the final 2 digits for the given atom
412419 */
@@ -449,7 +456,7 @@ else if (doubleBondHetero(atom))
449456 }
450457
451458 /**
452- *
459+ * Determines and returns the SS (subsection) portion of the atomtype integer for a Carbon Atom
453460 * @param atom
454461 * @return the final 2 digits for the given atom
455462 */
@@ -670,7 +677,13 @@ protected boolean nextToAromatic(IAtom atom)
670677 return false ;
671678 }
672679
673- protected void initcoeffs ()
680+ /**
681+ * initialise the model with the required values. Could instead read from a
682+ * serialised file, but this is simpler and the number of coefficients isn't
683+ * too large. Quite simple to update as well when able to output the model
684+ * to the screen with minor text manupilation with regex strings.
685+ */
686+ private void initcoeffs ()
674687 {
675688 coeffs .put (115200 , 0.3428999504964441 );
676689 coeffs .put (134400 , -0.6009339899021935 );
0 commit comments