forked from bioclipse/bioclipse.qsar
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented a progressbar that ticks by descr/mol calculation and add…
…ed option to cancel build. git-svn-id: https://bioclipse.svn.sourceforge.net/svnroot/bioclipse/bioclipse2/trunk@7041 fcb5ba71-d80d-0410-8237-ba3920747fcc
- Loading branch information
Showing
4 changed files
with
120 additions
and
1 deletion.
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
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
67 changes: 67 additions & 0 deletions
67
plugins/net.bioclipse.cdk.qsar.test/src/net/bioclipse/cdk/qsar/test/testCDKAT.java
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,67 @@ | ||
package net.bioclipse.cdk.qsar.test; | ||
|
||
import java.io.InputStream; | ||
|
||
import org.openscience.cdk.atomtype.CDKAtomTypeMatcher; | ||
import org.openscience.cdk.exception.CDKException; | ||
import org.openscience.cdk.interfaces.IAtom; | ||
import org.openscience.cdk.interfaces.IAtomContainer; | ||
import org.openscience.cdk.interfaces.IAtomType; | ||
import org.openscience.cdk.interfaces.IChemFile; | ||
import org.openscience.cdk.io.CMLReader; | ||
import org.openscience.cdk.io.ReaderFactory; | ||
import org.openscience.cdk.io.formats.CMLFormat; | ||
import org.openscience.cdk.io.formats.IChemFormatMatcher; | ||
import org.openscience.cdk.tools.CDKHydrogenAdder; | ||
import org.openscience.cdk.tools.manipulator.AtomContainerManipulator; | ||
import org.openscience.cdk.tools.manipulator.AtomTypeManipulator; | ||
import org.openscience.cdk.tools.manipulator.ChemFileManipulator; | ||
|
||
public class testCDKAT { | ||
|
||
/** | ||
* @param args | ||
*/ | ||
public static void main(String[] args) { | ||
|
||
InputStream ins = testCDKAT.class.getResourceAsStream("/testFiles/0037.cml"); | ||
|
||
CMLReader reader=new CMLReader(ins); | ||
|
||
IChemFile chemFile = new org.openscience.cdk.ChemFile(); | ||
|
||
|
||
//Read file | ||
try { | ||
chemFile=(IChemFile)reader.read(chemFile); | ||
} catch (CDKException e) { | ||
e.printStackTrace(); | ||
} | ||
|
||
IAtomContainer container = ChemFileManipulator.getAllAtomContainers(chemFile).get(0); | ||
|
||
try { | ||
|
||
CDKAtomTypeMatcher matcher = CDKAtomTypeMatcher.getInstance(container.getBuilder()); | ||
for (IAtom atom : container.atoms()) { | ||
IAtomType matched = matcher.findMatchingAtomType(container, atom); | ||
if (matched != null){ | ||
AtomTypeManipulator.configure(atom, matched); | ||
}else{ | ||
System.out.println("Could not find matching atom type for atom: " + atom); | ||
} | ||
} | ||
|
||
CDKHydrogenAdder hAdder = CDKHydrogenAdder.getInstance(container.getBuilder()); | ||
hAdder.addImplicitHydrogens(container); | ||
AtomContainerManipulator.convertImplicitToExplicitHydrogens(container); | ||
|
||
} catch (Exception e1) { | ||
System.out.println("Error addding hydrogens : " + e1.getMessage()); | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
} |
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 @@ | ||
<cml xmlns="http://www.xml-cml.org/schema"><molecule title="" id="nmrshiftdb20110444"><atomArray><atom id="a1" elementType="C" x2="2.89" y2="-1.25" formalCharge="0" hydrogenCount="0" /><atom id="a2" elementType="C" x2="2.89" y2="-0.42" formalCharge="0" hydrogenCount="0" /><atom id="a3" elementType="C" x2="2.17" y2="0.0" formalCharge="0" hydrogenCount="0" /><atom id="a4" elementType="C" x2="1.44" y2="-0.42" formalCharge="0" hydrogenCount="0" /><atom id="a5" elementType="C" x2="1.44" y2="-1.25" formalCharge="0" hydrogenCount="0" /><atom id="a6" elementType="C" x2="0.72" y2="-1.67" formalCharge="0" hydrogenCount="0" /><atom id="a7" elementType="C" x2="3.61" y2="-1.67" formalCharge="0" hydrogenCount="0" /><atom id="a8" elementType="C" x2="2.17" y2="-2.5" formalCharge="0" hydrogenCount="0" /><atom id="a9" elementType="C" x2="2.89" y2="-2.92" formalCharge="0" hydrogenCount="0" /><atom id="a10" elementType="C" x2="1.44" y2="-2.92" formalCharge="0" hydrogenCount="0" /><atom id="a11" elementType="C" x2="0.0" y2="-4.58" formalCharge="0" hydrogenCount="0" /><atom id="a12" elementType="C" x2="0.72" y2="-5.0" formalCharge="0" hydrogenCount="0" /><atom id="a13" elementType="C" x2="0.0" y2="-3.75" formalCharge="0" hydrogenCount="0" /><atom id="a14" elementType="C" x2="2.89" y2="-3.75" formalCharge="0" hydrogenCount="0" /><atom id="a15" elementType="C" x2="3.61" y2="-4.17" formalCharge="0" hydrogenCount="0" /><atom id="a16" elementType="C" x2="4.33" y2="-3.75" formalCharge="0" hydrogenCount="0" /><atom id="a17" elementType="C" x2="4.33" y2="-2.92" formalCharge="0" hydrogenCount="0" /><atom id="a18" elementType="C" x2="3.61" y2="-2.5" formalCharge="0" hydrogenCount="0" /><atom id="a19" elementType="O" x2="1.44" y2="-3.75" formalCharge="0" hydrogenCount="0" /><atom id="a20" elementType="N" x2="2.17" y2="-1.67" formalCharge="0" hydrogenCount="0" /><atom id="a21" elementType="N" x2="0.0" y2="-2.08" formalCharge="0" hydrogenCount="0" /><atom id="a22" elementType="Si" x2="0.72" y2="-4.17" formalCharge="0" hydrogenCount="0" /></atomArray><bondArray><bond id="b1" atomRefs2="a1 a20" order="S" /><bond id="b2" atomRefs2="a1 a2" order="S" /><bond id="b3" atomRefs2="a1 a7" order="S" /><bond id="b4" atomRefs2="a2 a3" order="S" /><bond id="b5" atomRefs2="a3 a4" order="S" /><bond id="b6" atomRefs2="a4 a5" order="S" /><bond id="b7" atomRefs2="a5 a20" order="S" /><bond id="b8" atomRefs2="a5 a6" order="S" /><bond id="b9" atomRefs2="a6 a21" order="T" /><bond id="b10" atomRefs2="a8 a20" order="S" /><bond id="b11" atomRefs2="a8 a9" order="S" /><bond id="b12" atomRefs2="a8 a10" order="S" /><bond id="b13" atomRefs2="a9 a14" order="D" /><bond id="b14" atomRefs2="a9 a18" order="S" /><bond id="b15" atomRefs2="a10 a19" order="S" /><bond id="b16" atomRefs2="a11 a22" order="S" /><bond id="b17" atomRefs2="a12 a22" order="S" /><bond id="b18" atomRefs2="a13 a22" order="S" /><bond id="b19" atomRefs2="a14 a15" order="S" /><bond id="b20" atomRefs2="a15 a16" order="D" /><bond id="b21" atomRefs2="a16 a17" order="S" /><bond id="b22" atomRefs2="a17 a18" order="D" /><bond id="b23" atomRefs2="a19 a22" order="S" /></bondArray></molecule></cml> |