Skip to content
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 biojava-structure-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<dependency>
<groupId>net.sourceforge.jmol</groupId>
<artifactId>jmol</artifactId>
<version>14.6.2_2016.08.28</version>
<version>14.29.17</version>
</dependency>
<!-- logging dependencies (managed by parent pom, don't set versions or
scopes here) -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,30 +126,44 @@ public JmolStatusListener getStatusListener(){
public void executeCmd(String rasmolScript) {
viewer.evalString(rasmolScript);
}

public void setStructure(final Structure s)
{
public void setStructure(final Structure s, boolean useMmtf) {
this.structure = s;
try (
PipedOutputStream out = new PipedOutputStream();
// Viewer requires a BufferedInputStream for reflection
InputStream in = new BufferedInputStream(new PipedInputStream(out));
) {
new Thread((Runnable)() -> {
try {
MmtfActions.writeToOutputStream(s,out);
} catch (Exception e) {
logger.error("Error generating MMTF output for {}",
s.getStructureIdentifier()==null ? s.getStructureIdentifier().getIdentifier() : s.getName(), e);
}
}).start();
viewer.openReader(null, in);
} catch (IOException e) {
logger.error("Error transfering {} to Jmol",
s.getStructureIdentifier()==null ? s.getStructureIdentifier().getIdentifier() : s.getName(), e);

if (useMmtf) {
try (
PipedOutputStream out = new PipedOutputStream();
// Viewer requires a BufferedInputStream for reflection
InputStream in = new BufferedInputStream(new PipedInputStream(out));
) {
new Thread((Runnable)() -> {
try {
MmtfActions.writeToOutputStream(s,out);
} catch (Exception e) {
logger.error("Error generating MMTF output for {}",
s.getStructureIdentifier()==null ? s.getStructureIdentifier().getIdentifier() : s.getName(), e);
}
}).start();
viewer.openReader(null, in);
} catch (IOException e) {
logger.error("Error transfering {} to Jmol",
s.getStructureIdentifier()==null ? s.getStructureIdentifier().getIdentifier() : s.getName(), e);
}
} else {
// Use mmCIF format
String serialized = s.toMMCIF();
viewer.openStringInline(serialized);

}

evalString("save STATE state_1");

}

public void setStructure(final Structure s) {
// Set the default to MMCIF (until issue #629 is fixed)
setStructure(s, false);
}

/** assign a custom color to the Jmol chains command.
Expand Down