-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: CanonizerUtil with NOSTEREO yielded to a wrong result (#165)
- Loading branch information
Showing
11 changed files
with
315 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
'use strict'; | ||
|
||
const OCL = require('../core'); | ||
|
||
test('canonizer chiral', () => { | ||
const molecule = OCL.Molecule.fromSmiles('C[C@H](Cl)CC'); | ||
const idCode = molecule.getIDCode(); | ||
|
||
expect(idCode).toBe('gJPHADILuTb@'); | ||
expect(OCL.CanonizerUtil.getIDCode(molecule, OCL.CanonizerUtil.NORMAL)).toBe( | ||
idCode, | ||
); | ||
|
||
expect( | ||
OCL.CanonizerUtil.getIDCode(molecule, OCL.CanonizerUtil.NOSTEREO), | ||
).toBe('gJPHADILuP@'); | ||
|
||
expect( | ||
OCL.CanonizerUtil.getIDCode(molecule, OCL.CanonizerUtil.BACKBONE), | ||
).toBe('gJPHADILuP@'); | ||
|
||
expect( | ||
OCL.CanonizerUtil.getIDCode(molecule, OCL.CanonizerUtil.TAUTOMER), | ||
).toBe('gJPHADILuTb@'); | ||
|
||
expect( | ||
OCL.CanonizerUtil.getIDCode(molecule, OCL.CanonizerUtil.NOSTEREO_TAUTOMER), | ||
).toBe('gJPHADILuP@'); | ||
|
||
molecule.stripStereoInformation(); | ||
expect(molecule.getIDCode()).toBe('gJPHADILuP@'); | ||
}); | ||
|
||
test('canonizer tautomer', () => { | ||
const molecule = OCL.Molecule.fromSmiles('CC=C(O)CC'); | ||
|
||
const idCode = molecule.getIDCode(); | ||
|
||
expect(idCode).toBe('gGQ@@drsT@@'); | ||
expect(OCL.CanonizerUtil.getIDCode(molecule, OCL.CanonizerUtil.NORMAL)).toBe( | ||
idCode, | ||
); | ||
|
||
expect( | ||
OCL.CanonizerUtil.getIDCode(molecule, OCL.CanonizerUtil.NOSTEREO), | ||
).toBe('gGQ@@drsT@@'); | ||
|
||
expect( | ||
OCL.CanonizerUtil.getIDCode(molecule, OCL.CanonizerUtil.BACKBONE), | ||
).toBe('gGQ@@druT@@'); | ||
|
||
expect( | ||
OCL.CanonizerUtil.getIDCode(molecule, OCL.CanonizerUtil.TAUTOMER), | ||
).toBe('gGQ@@druTAkabXVOtfBicxX~F@'); | ||
|
||
expect( | ||
OCL.CanonizerUtil.getIDCode(molecule, OCL.CanonizerUtil.NOSTEREO_TAUTOMER), | ||
).toBe('gGQ@@druTAkabXVOtfBicxX~F@'); | ||
|
||
molecule.stripStereoInformation(); | ||
expect(molecule.getIDCode()).toBe('gGQ@@drsT@@'); | ||
}); |
Submodule openchemlib
updated
11 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// to run this code: bash buildOpenChemLib && java -classpath build com.Test | ||
|
||
package com; | ||
|
||
import java.io.IOException; | ||
import java.util.TreeMap; | ||
|
||
import com.actelion.research.chem.Canonizer; | ||
import com.actelion.research.chem.CanonizerUtil; | ||
import com.actelion.research.chem.SmilesParser; | ||
import com.actelion.research.chem.StereoMolecule; | ||
import com.actelion.research.chem.contrib.HydrogenHandler; | ||
import com.actelion.research.chem.contrib.DiastereotopicAtomID; | ||
import com.actelion.research.chem.io.SDFileParser; | ||
import java.io.File; | ||
|
||
|
||
public class Test { | ||
|
||
public static void main(String[] args) throws Exception { | ||
|
||
SmilesParser sp = new SmilesParser(); | ||
StereoMolecule mol = new StereoMolecule(); | ||
sp.parse(mol, "CC"); | ||
|
||
System.out.println(mol.getIDCode()); | ||
mol.stripStereoInformation(); | ||
System.out.println(mol.getIDCode()); | ||
System.out.println(CanonizerUtil.getIDCode(mol, CanonizerUtil.IDCODE_TYPE.NORMAL, false)); | ||
System.out.println(CanonizerUtil.getIDCode(mol, CanonizerUtil.IDCODE_TYPE.NOSTEREO, false)); | ||
System.out | ||
.println(CanonizerUtil.getIDCode(mol, CanonizerUtil.IDCODE_TYPE.NOSTEREO_TAUTOMER, false)); | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.