Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
k-ujihara committed Aug 26, 2018
2 parents 3e655ba + bc82ca4 commit b8a63b1
Show file tree
Hide file tree
Showing 15 changed files with 41 additions and 41 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions NCDK/Smiles/SmilesGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ public void SetUseAromaticityFlag(bool useAromaticityFlag)
private static int[] Labels(SmiFlavor flavour, IAtomContainer molecule)
{
// FIXME: use SmiOpt.InChiLabelling
long[] labels = SmiFlavors.IsSet(flavour, SmiFlavor.Isomeric) ? InchiNumbers(molecule)
long[] labels = SmiFlavors.IsSet(flavour, SmiFlavor.Isomeric) ? InChINumbers(molecule)
: Canon.Label(molecule, GraphUtil.ToAdjList(molecule));
int[] cpy = new int[labels.Length];
for (int i = 0; i < labels.Length; i++)
Expand All @@ -581,7 +581,7 @@ private static int[] Labels(SmiFlavor flavour, IAtomContainer molecule)
/// <param name="container">a structure</param>
/// <returns>the inchi numbers</returns>
/// <exception cref="CDKException">the inchi numbers could not be obtained</exception>
private static long[] InchiNumbers(IAtomContainer container)
private static long[] InChINumbers(IAtomContainer container)
{
// TODO: create an interface so we don't have to dynamically load the
// class each time
Expand Down
4 changes: 2 additions & 2 deletions NCDK/Tautomers/InChITautomerGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private List<IAtomContainer> GetTautomers(IAtomContainer mol, string inchi, long
else
{
mol = AtomContainerManipulator.SuppressHydrogens(mol);
MapInputMoleculeToInchiMolgraph(inchiMolGraph, mol);
MapInputMoleculeToInChIMolgraph(inchiMolGraph, mol);
}

List<int> mobHydrAttachPositions = new List<int>();
Expand Down Expand Up @@ -328,7 +328,7 @@ private IAtomContainer ConnectAtoms(string inputInchi, IAtomContainer inputMolec
/// <param name="inchiMolGraph">molecule (bare) as defined in InChI</param>
/// <param name="mol">user input molecule</param>
/// <exception cref="CDKException"></exception>
private void MapInputMoleculeToInchiMolgraph(IAtomContainer inchiMolGraph, IAtomContainer mol)
private void MapInputMoleculeToInChIMolgraph(IAtomContainer inchiMolGraph, IAtomContainer mol)
{
var iter = VentoFoggia.FindIdentical(inchiMolGraph, AtomMatcher.CreateElementMatcher(), BondMatcher.CreateAnyMatcher())
.MatchAll(mol)
Expand Down
40 changes: 20 additions & 20 deletions NCDKTests/Graphs/InChi/InChIGeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected InChIGeneratorFactory GetFactory()
/// Tests element name is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetInchiFromChlorineAtom()
public void TestGetInChIFromChlorineAtom()
{
IAtomContainer ac = new AtomContainer();
ac.Atoms.Add(new Atom("ClH"));
Expand Down Expand Up @@ -113,7 +113,7 @@ public void TestGetWarningMessage()
/// Tests charge is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetInchiFromLithiumIon()
public void TestGetInChIFromLithiumIon()
{
IAtomContainer ac = new AtomContainer();
IAtom a = new Atom("Li");
Expand All @@ -128,7 +128,7 @@ public void TestGetInchiFromLithiumIon()
/// Tests isotopic mass is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetInchiFromChlorine37Atom()
public void TestGetInChIFromChlorine37Atom()
{
IAtomContainer ac = new AtomContainer();
IAtom a = new Atom("ClH");
Expand All @@ -143,7 +143,7 @@ public void TestGetInchiFromChlorine37Atom()
/// Tests implicit hydrogen count is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetInchiFromHydrogenChlorideImplicitH()
public void TestGetInChIFromHydrogenChlorideImplicitH()
{
IAtomContainer ac = new AtomContainer();
IAtom a = new Atom("Cl");
Expand All @@ -158,7 +158,7 @@ public void TestGetInchiFromHydrogenChlorideImplicitH()
/// Tests radical state is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetInchiFromMethylRadical()
public void TestGetInChIFromMethylRadical()
{
IAtomContainer ac = new AtomContainer();
IAtom a = new Atom("C");
Expand All @@ -174,7 +174,7 @@ public void TestGetInchiFromMethylRadical()
/// Tests single bond is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetInchiFromEthane()
public void TestGetInChIFromEthane()
{
IAtomContainer ac = new AtomContainer();
IAtom a1 = new Atom("C");
Expand Down Expand Up @@ -224,7 +224,7 @@ public void NonStandardInChIWithEnumOptions()
/// Tests double bond is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetInchiFromEthene()
public void TestGetInChIFromEthene()
{
IAtomContainer ac = new AtomContainer();
IAtom a1 = new Atom("C");
Expand All @@ -243,7 +243,7 @@ public void TestGetInchiFromEthene()
/// Tests triple bond is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetInchiFromEthyne()
public void TestGetInChIFromEthyne()
{
IAtomContainer ac = new AtomContainer();
IAtom a1 = new Atom("C");
Expand All @@ -262,7 +262,7 @@ public void TestGetInchiFromEthyne()
/// Tests 2D coordinates are correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetInchiEandZ12Dichloroethene2D()
public void TestGetInChIEandZ12Dichloroethene2D()
{
// (E)-1,2-dichloroethene
IAtomContainer acE = new AtomContainer();
Expand Down Expand Up @@ -313,7 +313,7 @@ public void TestGetInchiEandZ12Dichloroethene2D()
/// Tests 3D coordinates are correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetInchiFromLandDAlanine3D()
public void TestGetInChIFromLandDAlanine3D()
{
// L-Alanine
IAtomContainer acL = new AtomContainer();
Expand Down Expand Up @@ -390,7 +390,7 @@ public void ZeroHydrogenCount()
/// Tests element name is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetStandardInchiFromChlorineAtom()
public void TestGetStandardInChIFromChlorineAtom()
{
IAtomContainer ac = new AtomContainer();
ac.Atoms.Add(new Atom("ClH"));
Expand All @@ -403,7 +403,7 @@ public void TestGetStandardInchiFromChlorineAtom()
/// Tests charge is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetStandardInchiFromLithiumIon()
public void TestGetStandardInChIFromLithiumIon()
{
IAtomContainer ac = new AtomContainer();
IAtom a = new Atom("Li");
Expand All @@ -418,7 +418,7 @@ public void TestGetStandardInchiFromLithiumIon()
/// Tests isotopic mass is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetStandardInchiFromChlorine37Atom()
public void TestGetStandardInChIFromChlorine37Atom()
{
IAtomContainer ac = new AtomContainer();
IAtom a = new Atom("ClH");
Expand All @@ -433,7 +433,7 @@ public void TestGetStandardInchiFromChlorine37Atom()
/// Tests implicit hydrogen count is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetStandardInchiFromHydrogenChlorideImplicitH()
public void TestGetStandardInChIFromHydrogenChlorideImplicitH()
{
IAtomContainer ac = new AtomContainer();
IAtom a = new Atom("Cl");
Expand All @@ -448,7 +448,7 @@ public void TestGetStandardInchiFromHydrogenChlorideImplicitH()
/// Tests radical state is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetStandardInchiFromMethylRadical()
public void TestGetStandardInChIFromMethylRadical()
{
IAtomContainer ac = new AtomContainer();
IAtom a = new Atom("C");
Expand All @@ -464,7 +464,7 @@ public void TestGetStandardInchiFromMethylRadical()
/// Tests single bond is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetStandardInchiFromEthane()
public void TestGetStandardInChIFromEthane()
{
IAtomContainer ac = new AtomContainer();
IAtom a1 = new Atom("C");
Expand All @@ -484,7 +484,7 @@ public void TestGetStandardInchiFromEthane()
/// Tests double bond is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetStandardInchiFromEthene()
public void TestGetStandardInChIFromEthene()
{
IAtomContainer ac = new AtomContainer();
IAtom a1 = new Atom("C");
Expand All @@ -503,7 +503,7 @@ public void TestGetStandardInchiFromEthene()
/// Tests triple bond is correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetStandardInchiFromEthyne()
public void TestGetStandardInChIFromEthyne()
{
IAtomContainer ac = new AtomContainer();
IAtom a1 = new Atom("C");
Expand All @@ -522,7 +522,7 @@ public void TestGetStandardInchiFromEthyne()
/// Tests 2D coordinates are correctly passed to InChI.
/// </summary>
[TestMethod()]
public void TestGetStandardInchiEandZ12Dichloroethene2D()
public void TestGetStandardInChIEandZ12Dichloroethene2D()
{

// (E)-1,2-dichloroethene
Expand Down Expand Up @@ -576,7 +576,7 @@ public void TestGetStandardInchiEandZ12Dichloroethene2D()
// @
/// </summary>
[TestMethod()]
public void TestGetStandardInchiFromLandDAlanine3D()
public void TestGetStandardInChIFromLandDAlanine3D()
{

// L-Alanine
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 17 additions & 17 deletions NCDKTests/Tautomers/InChITautomerGeneratorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public InChITautomerGeneratorTest()
: base()
{ }

private ICollection<IAtomContainer> UnitTestWithInchiProvided(string smiles, string inchi, int tautCountExpected)
private ICollection<IAtomContainer> UnitTestWithInChIProvided(string smiles, string inchi, int tautCountExpected)
{
IAtomContainer container = smilesParser.ParseSmiles(smiles);
AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(container);
Expand All @@ -56,7 +56,7 @@ private ICollection<IAtomContainer> UnitTestWithInchiProvided(string smiles, str
return tautomers;
}

private ICollection<IAtomContainer> UnitTestWithoutInchiProvided(string smiles, InChITautomerGenerator.Options flags, int tautCountExpected)
private ICollection<IAtomContainer> UnitTestWithoutInChIProvided(string smiles, InChITautomerGenerator.Options flags, int tautCountExpected)
{
IAtomContainer container = smilesParser.ParseSmiles(smiles);
AtomContainerManipulator.PercieveAtomTypesAndConfigureAtoms(container);
Expand All @@ -69,96 +69,96 @@ private ICollection<IAtomContainer> UnitTestWithoutInchiProvided(string smiles,
[TestMethod()]
public void Test1()
{
UnitTestWithInchiProvided("NC1=CC(N)=NC(O)=N1", "InChI=1S/C4H6N4O/c5-2-1-3(6)8-4(9)7-2/h1H,(H5,5,6,7,8,9)", 5);
UnitTestWithInChIProvided("NC1=CC(N)=NC(O)=N1", "InChI=1S/C4H6N4O/c5-2-1-3(6)8-4(9)7-2/h1H,(H5,5,6,7,8,9)", 5);
}

[TestMethod()]
public void Test2()
{
UnitTestWithInchiProvided("CCCN1C2=C(NC=N2)C(=O)NC1=O", "InChI=1S/C8H10N4O2/c1-2-3-12-6-5(9-4-10-6)7(13)11-8(12)14/h4H,2-3H2,1H3,(H,9,10)(H,11,13,14)", 8);
UnitTestWithInChIProvided("CCCN1C2=C(NC=N2)C(=O)NC1=O", "InChI=1S/C8H10N4O2/c1-2-3-12-6-5(9-4-10-6)7(13)11-8(12)14/h4H,2-3H2,1H3,(H,9,10)(H,11,13,14)", 8);
}

[TestMethod()]
public void Test3()
{
UnitTestWithInchiProvided("CCNC(=N)NC", "InChI=1S/C4H11N3/c1-3-7-4(5)6-2/h3H2,1-2H3,(H3,5,6,7)", 3);
UnitTestWithInChIProvided("CCNC(=N)NC", "InChI=1S/C4H11N3/c1-3-7-4(5)6-2/h3H2,1-2H3,(H3,5,6,7)", 3);
}

[TestMethod()]
public void Test4()
{
UnitTestWithInchiProvided("O=C1NC=CC(=O)N1", "InChI=1S/C4H4N2O2/c7-3-1-2-5-4(8)6-3/h1-2H,(H2,5,6,7,8)", 6);
UnitTestWithInChIProvided("O=C1NC=CC(=O)N1", "InChI=1S/C4H4N2O2/c7-3-1-2-5-4(8)6-3/h1-2H,(H2,5,6,7,8)", 6);
}

[TestMethod()]
public void Test5()
{
UnitTestWithInchiProvided("CCN1CCOC2=CC(NC3=NCCN3)=CC=C12", "InChI=1S/C13H18N4O/c1-2-17-7-8-18-12-9-10(3-4-11(12)17)16-13-14-5-6-15-13/h3-4,9H,2,5-8H2,1H3,(H2,14,15,16)", 2);
UnitTestWithInChIProvided("CCN1CCOC2=CC(NC3=NCCN3)=CC=C12", "InChI=1S/C13H18N4O/c1-2-17-7-8-18-12-9-10(3-4-11(12)17)16-13-14-5-6-15-13/h3-4,9H,2,5-8H2,1H3,(H2,14,15,16)", 2);
}

[TestMethod()]
[TestCategory("SlowTest")]
public void Test6()
{
//Warfarin: not you need to create the InChI with option KET to get the ketone/hydroxyl tautomerism
UnitTestWithInchiProvided("CC(=O)CC(C1=CC=CC=C1)C1=C(O)C2=C(OC1=O)C=CC=C2", "InChI=1/C19H16O4/c1-12(20)11-15(13-7-3-2-4-8-13)17-18(21)14-9-5-6-10-16(14)23-19(17)22/h2-10,15H,1H3,(H2,11,20)(H,17,21,22)", 6);
UnitTestWithInChIProvided("CC(=O)CC(C1=CC=CC=C1)C1=C(O)C2=C(OC1=O)C=CC=C2", "InChI=1/C19H16O4/c1-12(20)11-15(13-7-3-2-4-8-13)17-18(21)14-9-5-6-10-16(14)23-19(17)22/h2-10,15H,1H3,(H2,11,20)(H,17,21,22)", 6);
}

[TestMethod()]
public void Test1_fast()
{
UnitTestWithoutInchiProvided("NC1=CC(N)=NC(O)=N1", 0, 5);
UnitTestWithoutInChIProvided("NC1=CC(N)=NC(O)=N1", 0, 5);
}

[TestMethod()]
public void Test2_fast()
{
UnitTestWithoutInchiProvided("CCCN1C2=C(NC=N2)C(=O)NC1=O", 0, 8);
UnitTestWithoutInChIProvided("CCCN1C2=C(NC=N2)C(=O)NC1=O", 0, 8);
}

[TestMethod()]
public void Test3_fast()
{
UnitTestWithoutInchiProvided("CCNC(=N)NC", 0, 3);
UnitTestWithoutInChIProvided("CCNC(=N)NC", 0, 3);
}

[TestMethod()]
public void Test4_fast()
{
UnitTestWithoutInchiProvided("O=C1NC=CC(=O)N1", 0, 6);
UnitTestWithoutInChIProvided("O=C1NC=CC(=O)N1", 0, 6);
}

[TestMethod()]
public void Test5_fast()
{
UnitTestWithoutInchiProvided("CCN1CCOC2=CC(NC3=NCCN3)=CC=C12", 0, 2);
UnitTestWithoutInChIProvided("CCN1CCOC2=CC(NC3=NCCN3)=CC=C12", 0, 2);
}

[TestMethod()]
public void Test6_fast()
{
//Warfarin: not you need to create the InChI with option KET to get the ketone/hydroxyl tautomerism
UnitTestWithoutInchiProvided("CC(=O)CC(C1=CC=CC=C1)C1=C(O)C2=C(OC1=O)C=CC=C2", InChITautomerGenerator.Options.KetoEnol, 6);
UnitTestWithoutInChIProvided("CC(=O)CC(C1=CC=CC=C1)C1=C(O)C2=C(OC1=O)C=CC=C2", InChITautomerGenerator.Options.KetoEnol, 6);
}

[TestMethod()]
[ExpectedException(typeof(CDKException))]
// bail out on dots in formula
public void TestFail1()
{
UnitTestWithInchiProvided("[I-].CCN1CCOC2=CC(NC3=NCCN3)=CC=C12", "InChI=1S/C13H18N4O.HI/c1-2-17-7-8-18-12-9-10(3-4-11(12)17)16-13-14-5-6-15-13;/h3-4,9H,2,5-8H2,1H3,(H2,14,15,16);1H/p-1", 2);
UnitTestWithInChIProvided("[I-].CCN1CCOC2=CC(NC3=NCCN3)=CC=C12", "InChI=1S/C13H18N4O.HI/c1-2-17-7-8-18-12-9-10(3-4-11(12)17)16-13-14-5-6-15-13;/h3-4,9H,2,5-8H2,1H3,(H2,14,15,16);1H/p-1", 2);
}

[TestMethod()]
[ExpectedException(typeof(CDKException))]
// bail out on dots in formula
public void TestFail2()
{
UnitTestWithInchiProvided("CN1C=C(C)C(=O)N2C1O[Pt]([NH3+])([NH3+])OC3N(C)C=C(C)C(=O)N3[Pt]2([NH3+])[NH3+]", "InChI=1S/2C6H9N2O2.4H3N.2Pt/c2*1-4-3-8(2)6(10)7-5(4)9;;;;;;/h2*3,6H,1-2H3,(H,7,9);4*1H3;;/q2*-1;;;;;2*+4/p-2", 10);
UnitTestWithInChIProvided("CN1C=C(C)C(=O)N2C1O[Pt]([NH3+])([NH3+])OC3N(C)C=C(C)C(=O)N3[Pt]2([NH3+])[NH3+]", "InChI=1S/2C6H9N2O2.4H3N.2Pt/c2*1-4-3-8(2)6(10)7-5(4)9;;;;;;/h2*3,6H,1-2H3,(H,7,9);4*1H3;;/q2*-1;;;;;2*+4/p-2", 10);
}

[TestMethod()]
public void Test_withJniInchi()
public void Test_WithNInChI()
{
string mdlInput = // same as NC1=CC(N)=NC(O)=N1
"\n" + " Mrv0541 02151109592D\n" + "\n" + " 9 9 0 0 0 0 999 V2000\n"
Expand Down

0 comments on commit b8a63b1

Please sign in to comment.