public void setChemObject(IChemObject object) { if (object instanceof IReaction) { source = object; // update table contents IReaction reaction = (IReaction)source; idField.setText(reaction.getID()); //TODO //directionField.setSelectedIndex(reaction.getDirection()); solventField.setText((String)reaction.getProperty(SOLVENT)); tempField.setText((String)reaction.getProperty(TEMPERATURE)); } else { throw new IllegalArgumentException("Argument must be an Reaction"); } }
private Bounds generateReactionConditions(IReaction chemObj, Color fg, double scale) { String title = chemObj.getProperty(CDKConstants.REACTION_CONDITIONS); if (title == null || title.isEmpty()) return new Bounds(); return new Bounds(MarkedElement.markup(StandardGenerator.embedText(font, title, fg, 1/scale), "conditions")); }
private Bounds generateReactionConditions(IReaction chemObj, Color fg, double scale) { String title = chemObj.getProperty(CDKConstants.REACTION_CONDITIONS); if (title == null || title.isEmpty()) return new Bounds(); return new Bounds(MarkedElement.markup(StandardGenerator.embedText(font, title, fg, 1/scale), "conditions")); }
writer.write('\n'); String line = (String) reaction.getProperty(CDKConstants.TITLE); if (line == null) line = ""; if (line.length() > 80) line = line.substring(0, 80); line = (String) reaction.getProperty(CDKConstants.REMARK); if (line == null) line = ""; if (line.length() > 80) line = line.substring(0, 80);
String line = (String) reaction.getProperty(TITLE); if (line == null) { String rid = reaction.getID() == null ? "" : reaction.getID(); line = (String) reaction.getProperty(REMARK); if (line == null) { line = "";
@Test public void emptyCXSMILES() throws InvalidSmilesException { IReaction reaction = smipar.parseReactionSmiles("CC1=NC2=C(O)C=CC=C2C=C1.CC(Cl)=O>[Al+3].[Cl-].[Cl-].[Cl-].[O-][N+](=O)C1=CC=CC=C1>CC(=O)C1=C2C=CC(C)=NC2=C(O)C=C1 ||"); assertThat(reaction.getProperty(CDKConstants.TITLE, String.class), is("")); }
@Test public void fragmentGroupingAgents() throws InvalidSmilesException { IReaction reaction = smipar.parseReactionSmiles("CC1=NC2=C(O)C=CC=C2C=C1.CC(Cl)=O>[Al+3].[Cl-].[Cl-].[Cl-].[O-][N+](=O)C1=CC=CC=C1>CC(=O)C1=C2C=CC(C)=NC2=C(O)C=C1 |f:2.3.4.5|"); assertThat(reaction.getReactantCount(), is(2)); assertThat(reaction.getAgents().getAtomContainerCount(), is(2)); assertThat(reaction.getProductCount(), is(1)); assertThat(reaction.getProperty(CDKConstants.TITLE, String.class), is("")); }
@Test public void fragmentGroupingReactants() throws InvalidSmilesException { IReaction reaction = smipar.parseReactionSmiles("CC1=NC2=C(O)C=CC=C2C=C1.CC(Cl)=O.[Al+3].[Cl-].[Cl-].[Cl-]>[O-][N+](=O)C1=CC=CC=C1>CC(=O)C1=C2C=CC(C)=NC2=C(O)C=C1 |f:2.3.4.5|"); assertThat(reaction.getReactantCount(), is(3)); assertThat(reaction.getAgents().getAtomContainerCount(), is(1)); assertThat(reaction.getProductCount(), is(1)); assertThat(reaction.getProperty(CDKConstants.TITLE, String.class), is("")); }
@Test public void fragmentGroupingInvalid() throws InvalidSmilesException { IReaction reaction = smipar.parseReactionSmiles("CC1=NC2=C(O)C=CC=C2C=C1.CC(Cl)=O.[Al+3].[Cl-].[Cl-].[Cl-]>[O-][N+](=O)C1=CC=CC=C1>CC(=O)C1=C2C=CC(C)=NC2=C(O)C=C1 |f:2.3.4.5,4.6|"); assertThat(reaction.getReactantCount(), is(6)); assertThat(reaction.getAgents().getAtomContainerCount(), is(1)); assertThat(reaction.getProductCount(), is(1)); assertThat(reaction.getProperty(CDKConstants.TITLE, String.class), is("")); }
@Test public void fragmentGroupingProducts() throws InvalidSmilesException { IReaction reaction = smipar.parseReactionSmiles("CC1=NC2=C(O)C=CC=C2C=C1.CC(Cl)=O>[O-][N+](=O)C1=CC=CC=C1>CC(=O)C1=C2C=CC(C)=NC2=C(O)C=C1.[Al+3].[Cl-].[Cl-].[Cl-] |f:3.4.5.6|"); assertThat(reaction.getReactantCount(), is(2)); assertThat(reaction.getAgents().getAtomContainerCount(), is(1)); assertThat(reaction.getProductCount(), is(2)); assertThat(reaction.getProperty(CDKConstants.TITLE, String.class), is("")); }
/** */ @Test public void testReactionProperties() throws Exception { String filename = "data/cml/reaction.2.cml"; InputStream ins = this.getClass().getClassLoader().getResourceAsStream(filename); CMLReader reader = new CMLReader(ins); IChemFile chemFile = new ChemFile(); chemFile = (IChemFile) reader.read(chemFile); reader.close(); IReaction reaction = chemFile.getChemSequence(0).getChemModel(0).getReactionSet().getReaction(0); Assert.assertEquals("3", (String) reaction.getProperty("Ka")); } }