Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Render single atoms #22

Merged
merged 3 commits into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

<groupId>gov.nih.ncats</groupId>
<artifactId>molwitch-renderer</artifactId>
<version>1.0.16</version>
<version>1.0.17</version>

<name>Molwitch Renderer</name>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,10 @@ public void renderChem(Graphics2D g9, Chemical c, int x, int y, int width, int h
}
}

//MM experiment 30 May 2024
if(ca.getBonds().size()==0) {
forceDraw = true;
}
if (!attatch.equals("")) {
attachments.add(attatch);
if (ca.getBondCount() == 0) {
Expand Down
22 changes: 22 additions & 0 deletions src/test/java/gov/nih/ncats/molwitch/renderer/TestRendering.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,5 +372,27 @@ public void testBoundCalc() throws Exception{
});
}

@Test
public void renderSingleAtom0Valence() throws Exception{
String folder ="images\\";
ChemicalRenderer renderer = new ChemicalRenderer();
String name = "4XYU5U00C4";
Chemical c = Chemical.parseMol(new File(getClass().getResource( "/" + name + ".mol").getFile()));
File renderedImageFile = new File(folder + "/" + MolWitch.getModuleName() +"_" + name + ".png");
ImageIO.write(renderer.createImage(c, 600), "PNG", renderedImageFile);
Assert.assertTrue(renderedImageFile.length()> 4000);
}

@Test
public void renderSingleAtomNoValence() throws Exception{
String folder ="images\\";
ChemicalRenderer renderer = new ChemicalRenderer();
String name = "4XYU5U00C4_no_valence";
Chemical c = Chemical.parseMol(new File(getClass().getResource( "/" + name + ".mol").getFile()));
File renderedImageFile =new File(folder + MolWitch.getModuleName() +"_" + name + ".png");
ImageIO.write(renderer.createImage(c, 600), "PNG", renderedImageFile);
Assert.assertTrue(renderedImageFile.length()> 4000);
}

}

6 changes: 6 additions & 0 deletions src/test/resources/4XYU5U00C4.mol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

Marvin 01132105152D

1 0 0 0 0 0 999 V2000
1.7167 -1.6208 0.0000 C 0 0 0 0 0 15 0 0 0 0 0 0
M END
6 changes: 6 additions & 0 deletions src/test/resources/4XYU5U00C4_no_valence.mol
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@



1 0 0 0 0 0 0 0 0 0999 V2000
7.9279 -7.5332 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
M END