Skip to content

Commit

Permalink
Merge pull request #24 from ncats/chirality_fix_cleanup
Browse files Browse the repository at this point in the history
cleaned up JavaDoc comments.
  • Loading branch information
ChemMitch authored May 10, 2024
2 parents 26ef307 + 7735463 commit 6fe349b
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ public static void setMaxUndefinedStereoCenters(int maxUndefinedStereoCenters) {
CIPTool.label(cimp.getContainer());
} else {
Logger.getLogger(this.getClass().getName()).fine("This molecule is considered NOT complex");
CIPToolMod.label(cimp.getContainer(), cimp);
CIPToolMod.label(cimp.getContainer());
}

for (int i = 0; i < container.getAtomCount(); i++) {
Expand Down
32 changes: 18 additions & 14 deletions src/main/java/org/openscience/cdk/geometry/cip/CIPToolMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -75,28 +75,28 @@
* the ligand ordering can go
* <pre>
* Possibility 1: both sub-ligands in right order
* 3 vs 5 =>
* [2,3'] vs [6,5'] =>
* 2 vs 6 => 2 is higher priority
* 3 vs 5 as follows
* [2,3'] vs [6,5'] yields
* 2 vs 6 yields 2 is higher priority
* therefore 3 is higher priority (correct)
*
* Possibility 2: 3 sub-ligands wrong order, 5 right order
* 3 vs 5 =>
* [3',2] vs [6,5'] =>
* 3' vs 6 => 6 is higher priority
* 3 vs 5 as follows
* [3',2] vs [6,5'] results in
* 3' vs 6 yields 6 is higher priority
* therefore 5 is higher priority (incorrect)
*
* Possibility 3: 3 sub-ligands RIGHT order, 5 wrong order
* 3 vs 5 =>
* [2,3'] vs [5',6] =>
* 2 vs 5' => 2 is higher priority
* 3 vs 5 as follows
* [2,3'] vs [5',6] gives
* 2 vs 5' yields 2 is higher priority
* therefore 3 is higher priority (correct)
*
* Possibility 4: both sub-ligands in WRONG order
* 3 vs 5 =>
* [3',2] vs [5',6] =>
* 3' vs 5' => TIE, go to next
* 2 vs 6 => 2 is higher priority
* 3 vs 5 as follows:
* [3',2] vs [5',6] yields
* 3' vs 5' gives a TIE, go to next
* 2 vs 6 results in 2 as higher priority
* therefore 3 is higher priority (correct)
* </pre>
* <p>
Expand Down Expand Up @@ -137,7 +137,7 @@ public static void setUseNewCentres(boolean centresRule) {
*
* @param container structure to label
*/
public static void label(IAtomContainer container, CdkChemicalImpl chemical) {
public static void label(IAtomContainer container) {

//Experimental new labeller
com.simolecule.centres.CdkLabeller.label(container);
Expand All @@ -161,6 +161,8 @@ public static void label(IAtomContainer container, CdkChemicalImpl chemical) {
* GSRS-MODIFIED: Temporary bug fix for {@link CIPTool#getCIPChirality(IAtomContainer, ITetrahedralChirality)}
*
* @param container structure to label
* @param stereoCenter one atom to identify
* @return type of chirality identified
*/
public static CIP_CHIRALITY getCIPChirality(IAtomContainer container, ITetrahedralChirality stereoCenter) {

Expand All @@ -184,6 +186,8 @@ public static CIP_CHIRALITY getCIPChirality(IAtomContainer container, ITetrahedr
* GSRS-MODIFIED: Temporary bug fix for {@link CIPTool#getCIPChirality(IAtomContainer, IDoubleBondStereochemistry)}
*
* @param container structure to label
* @param stereoCenter one atom to process
* @return which type chirality was identified
*/
public static CIP_CHIRALITY getCIPChirality(IAtomContainer container, IDoubleBondStereochemistry stereoCenter) {

Expand Down
6 changes: 3 additions & 3 deletions src/test/java/TestChiralRead.java
Original file line number Diff line number Diff line change
Expand Up @@ -1565,7 +1565,7 @@ public void testSlowChiralityFalse() throws Exception {
System.out.printf("total atoms: %d bonds: %d; rings: %d\n", c1.getAtomCount(), c1.getBondCount(), ringCount);
CdkChemicalImpl chem = (CdkChemicalImpl)c1.getImpl();

CIPToolMod.label(chem.getContainer(), chem);
CIPToolMod.label(chem.getContainer());
assertTrue(chem.getAtomCount()>0);
//List<TetrahedralChirality> chiralities= chem.getTetrahedrals();
/*List<Chirality> listChi=c1.atoms()
Expand Down Expand Up @@ -1795,7 +1795,7 @@ public void testSlowChiralityTrue() throws Exception {
CdkChemicalImpl chem = (CdkChemicalImpl)c1.getImpl();

long before = (new Date()).getTime();
CIPToolMod.label(chem.getContainer(), chem);
CIPToolMod.label(chem.getContainer());
long after =(new Date()).getTime();
System.out.printf("duration of 'label' call %d\n", (after-before));
assertTrue(chem.getAtomCount() >0);
Expand Down Expand Up @@ -1900,7 +1900,7 @@ public void testSlowChiralitySmall() throws Exception {
System.out.printf("total atoms: %d bonds: %d; rings: %d\n", c1.getAtomCount(), c1.getBondCount(), ringCount);
CdkChemicalImpl chem = (CdkChemicalImpl)c1.getImpl();

CIPToolMod.label(chem.getContainer(), chem);
CIPToolMod.label(chem.getContainer());
List<TetrahedralChirality> listChi= chem.getTetrahedrals();/*c1.atoms()
.filter(ca->ca.getChirality()!=Chirality.Non_Chiral)
.map(ca->ca.getChirality())
Expand Down

0 comments on commit 6fe349b

Please sign in to comment.