id 'application'
id 'eclipse'
id "com.diffplug.gradle.spotless" version "3.28.0"
- id 'com.github.johnrengelman.shadow' version '4.0.3'
+ id 'com.github.johnrengelman.shadow' version '6.0.0'
id 'com.install4j.gradle' version '10.0.3'
id 'com.dorongold.task-tree' version '2.1.1' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree
id 'com.palantir.git-version' version '0.13.0' apply false
}
}
+task testTask2(type: Test) {
+ group = "Verification"
+ description = "Tests that need to be isolated from the main test run"
+ useTestNG() {
+ includeGroups name
+ excludeGroups testng_excluded_groups.split(",")
+ preserveOrder true
+ useDefaultListeners=true
+ }
+}
+task testTask3(type: Test) {
+ group = "Verification"
+ description = "Tests that need to be isolated from the main test run"
+ useTestNG() {
+ includeGroups name
+ excludeGroups testng_excluded_groups.split(",")
+ preserveOrder true
+ useDefaultListeners=true
+ }
+}
+
/* insert more testTaskNs here -- change N to next digit or other string */
/*
task testTaskN(type: Test) {
showExceptions true
showCauses true
showStackTraces true
-
+ if (test_output) {
+ showStandardStreams true
+ }
info.events = [ TestLogEvent.FAILED ]
}
if (buildDist) {
dependsOn makeDist
}
- from ("${jalviewDir}/${libDistDir}") {
- include("*.jar")
- }
- manifest {
- attributes "Implementation-Version": JALVIEW_VERSION,
- "Application-Name": applicationName
+
+ def jarFiles = fileTree(dir: "${jalviewDir}/${libDistDir}", include: "*.jar", exclude: "regex.jar").getFiles()
+ def groovyJars = jarFiles.findAll {it1 -> file(it1).getName().startsWith("groovy-swing")}
+ def otherJars = jarFiles.findAll {it2 -> !file(it2).getName().startsWith("groovy-swing")}
+ from groovyJars
+ from otherJars
+
+ // we need to include the groovy-swing Include-Package for it to run in the shadowJar
+ doFirst {
+ def jarFileManifests = []
+ groovyJars.each { jarFile ->
+ def mf = zipTree(jarFile).getFiles().find { it.getName().equals("MANIFEST.MF") }
+ if (mf != null) {
+ jarFileManifests += mf
+ }
+ }
+
+ manifest {
+ attributes "Implementation-Version": JALVIEW_VERSION, "Application-Name": applicationName
+ from (jarFileManifests) {
+ eachEntry { details ->
+ if (!details.key.equals("Import-Package")) {
+ details.exclude()
+ }
+ }
+ }
+ }
}
duplicatesStrategy "INCLUDE"
You can run different defined groups of tests with
```bash
-gradle test -PtestngGroups=Network
+gradle test -Ptestng_groups=Network
```
Available groups include Functional (default), Network, External.
To exclude one or more groups of tests, add them as a comma separated list in testngExcludedGroups.
```bash
-gradle test -PtestngExcludedGroups=Not-bamboo
+gradle test -Ptestng_excluded_groups=Not-bamboo
```
+#### Viewing stdout and stderr for tests
+By default, gradle doesn't report any of the output or error streams produced by tests. You can enable output by setting the following:
+
+```bash
+gradle test -Ptest_output=1
+```
### Installer packaging with *install4j*
import jalview.datamodel.SequenceFeature
import jalview.gui.Desktop
-def af = jalview.bin.Jalview.currentAlignFrame
+def af = Jalview.getCurrentAlignFrame()
def av = af.viewport
def fr = Desktop.getAlignFrameFor(av.codingComplement).getFeatureRenderer()
def counts = 0
}
af.getFeatureRenderer().featuresAdded()
af.alignPanel.paintAlignment(true, true)
-println "Added " + countm + " missense and " + counts + " synonymous variants"
\ No newline at end of file
+println "Added " + countm + " missense and " + counts + " synonymous variants"
import jalview.gui.*;
import jalview.io.*;
-def class JvLoadTest {
+class JvLoadTest {
FileLoader fl = null;
def String safename = null;
JvLoadTest(String sname) {
System.gc();
jalview.gui.Desktop.instance.desktop.showMemoryUsage(true);
return new JvLoadTest(tempFile)
-}
\ No newline at end of file
+}
void printSimilarityMatrix(boolean selview=false, boolean includeids=true, SimilarityParams pidMethod) {
- def currentAlignFrame = jalview.bin.Jalview.getCurrentAlignFrame()
+ def currentAlignFrame = Jalview.getCurrentAlignFrame()
jalview.gui.AlignViewport av = currentAlignFrame.getCurrentView()
print "\n"
}
-}
\ No newline at end of file
+}
*/
// run an alignment on the current alignFrame
import jalview.ws.jws2.*;
+import jalview.ws.jws2.jabaws2.Jws2Instance;
import jalview.datamodel.*;
// First get the JABA service discoverer and see if there are any services.
disc.run();
}
-for (jalview.ws.jws2.Jws2Discoverer.Jws2Instance service: disc.getServices()) {
+for (jalview.ws.jws2.jabaws2.Jws2Instance service: disc.getServices()) {
if (service.serviceType.indexOf("uscle")>-1) {
// now - go through the services if any, and find a Muscle service
import static java.awt.Toolkit.*
-def curviewport = Jalview.getAlignFrames()[Jalview.getAlignFrames().length-1].getViewport();
+def curviewport = Jalview.getCurrentAlignFrame().getViewport();
// TSV output by default.
// change "\t" to "," to output CSV file
/*
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
* Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jalview. If not, see <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
-def af = Jalview.getAlignFrames();
-def al = af[0].viewport.alignment;
+def al = Jalview.getCurrentAlignFrame().viewport.alignment;
ParseProperties pp = new ParseProperties(al);
-pp.getScoresFromDescription("Score", "ScanPS Raw Score", "([-0-9.+]+)");
+pp.getScoresFromDescription("Score", "ScanPS Raw Score", "([-0-9.+]+)", true);
def sqs = al.getSequenceAt(0);
def annots = sqs.getAnnotation();
/*
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
* Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jalview. If not, see <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
// do something groovy in jalview
println "Hello World.\n"
-println "First sequence is " + currentAlFrame.viewport.alignment.getSequenceAt(0).getDisplayId(true)
+println "First sequence is " + Jalview.getCurrentAlignFrame().viewport.alignment.getSequenceAt(0).getDisplayId(true)
def alf = Jalview.getAlignFrames()
for (ala in alf)
{
- // ala is an jalview.gui.AlignFrame object
+ // ala is an jalview.gui.AlignFrame object
println ala.getTitle()
// get the parent jalview.datamodel.Alignment from the alignment viewport
def alignment = ala.viewport.alignment
// get the first sequence from the jalview.datamodel.Alignment object
- def seq = alignment.getSequenceAt(0)
+ def seq = alignment.getSequenceAt(0)
}
Jalview.quit()
import jalview.gui.AlignFrame;
import jalview.gui.AlignViewport;
import java.util.BitSet;
-import javax.swing.JOptionPane;
+import jalview.gui.JvOptionPane;
import groovy.swing.SwingBuilder;
def toselect = getFeatureInput(); // change this to select the desired feature type
cs.addElement(i);
}
ala.viewport.setColumnSelection(cs);
- ala.alignPanel.paintAlignment(true);
+ ala.alignPanel.paintAlignment(true, true);
ala.statusBar.setText("Marked "+bs.cardinality()+" columns containing features of type "+toselect)
} else {
ala.statusBar.setText("No features of type "+toselect+" found.");
null, 'Select columns by feature by type','Enter type of feature', JvOptionPane.OK_OPTION)
return response
- }
\ No newline at end of file
+ }
import java.awt.datatransfer.StringSelection
import static java.awt.Toolkit.*
-def curviewport = Jalview.getAlignFrames()[Jalview.getAlignFrames().length-1].getViewport()
+def curviewport = Jalview.getCurrentAlignFrame().getViewport()
def debug = false
for (ala in af)
{
- def al = ala.viewport.alignment;
+ def al = ala.getViewport().getAlignment();
if (al!=null)
{
SequenceI[] seqs = al.getSequencesArray();
}
}
}
+ ala.repaint();
}
-
\ No newline at end of file
+
/*
* Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
* Copyright (C) $$Year-Rel$$ The Jalview Authors
- *
+ *
* This file is part of Jalview.
- *
+ *
* Jalview is free software: you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
+ * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation, either version 3
* of the License, or (at your option) any later version.
- *
- * Jalview is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty
- * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
* PURPOSE. See the GNU General Public License for more details.
- *
+ *
* You should have received a copy of the GNU General Public License
* along with Jalview. If not, see <http://www.gnu.org/licenses/>.
* The Jalview Authors are detailed in the 'AUTHORS' file.
*/
-import jalview.bin.Jalview
import jalview.workers.FeatureSetCounterI
import jalview.workers.AlignmentAnnotationFactory
/*
* Demonstration of FeatureSetCounterI
- * compute annotation tracks counting number of displayed
+ * compute annotation tracks counting number of displayed
* features of each type in each column
*/
/*
* discover features on the current view
*/
-
-def featuresDisp=Jalview.currentAlignFrame.currentView.featuresDisplayed
+
+def featuresDisp=Jalview.getCurrentAlignFrame().currentView.featuresDisplayed
if (featuresDisp == null) {
print 'Need at least one feature visible on alignment'
}
assert 'java.util.ArrayList' == visibleFeatures.class.name
/*
- * A closure that returns an array of features present
+ * A closure that returns an array of features present
* for each feature type in visibleFeatures
- * Argument 'features' will be a list of SequenceFeature
+ * Argument 'features' will be a list of SequenceFeature
*/
-def getCounts =
- { features ->
+def getCounts =
+ { features ->
int[] obs = new int[visibleFeatures.size]
for (sf in features)
{
* or sf.getValue(attributeName) for GFF 'column 9' properties
*/
int pos = 0
- for (type in visibleFeatures)
+ for (type in visibleFeatures)
{
- if (type.equals(sf.type))
+ if (type.equals(sf.type))
{
obs[pos]++
}
}
obs
}
-
+
/*
* Define something that counts each visible feature type
*/
def columnSetCounter =
[
- getNames: { visibleFeatures as String[] },
+ getNames: { visibleFeatures as String[] },
getDescriptions: { visibleFeatures as String[] },
getMinColour: { [0, 255, 255] as int[] }, // cyan
getMaxColour: { [0, 0, 255] as int[] }, // blue
- count:
- { res, feats ->
- getCounts.call(feats)
+ count:
+ { res, feats ->
+ getCounts.call(feats)
}
] as FeatureSetCounterI
-1.8.3-1.3.0_FJVL
+1.8.3-1.3.1_FJVL
-1.8.3-1.3.0_JVL
+1.8.3-1.3.1_JVL
<parent>
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
- <version>1.8.3-1.3.0_FJVL</version>
+ <version>1.8.3-1.3.1_FJVL</version>
</parent>
<artifactId>getdown-ant</artifactId>
<parent>
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
- <version>1.8.3-1.3.0_FJVL</version>
+ <version>1.8.3-1.3.1_FJVL</version>
</parent>
<artifactId>getdown-core</artifactId>
String query = jalviewUri.getQuery();
_appargs.clear();
- _appargs.add("-open");
if (host != null && host.length() > 0) {
URL newUrl = new URL(
(https?"https":"http")
}
if (ext != null && LOCATOR_FILE_EXTENSION.equals(ext.toLowerCase(Locale.ROOT))) {
// this file extension should have been dealt with in Getdown class
- } else {
- _appargs.add(0, "-open");
}
}
<parent>
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
- <version>1.8.3-1.3.0_FJVL</version>
+ <version>1.8.3-1.3.1_FJVL</version>
</parent>
<artifactId>getdown-launcher</artifactId>
if [ x$JVLVERSION != x ]; then
export VERSION=$JVLVERSION
else
- export VERSION=1.8.3-1.3.0_JVL
+ export VERSION=1.8.3-1.3.1_JVL
fi
if [ x${VERSION%_JVL} = x$VERSION ]; then
<groupId>com.threerings.getdown</groupId>
<artifactId>getdown</artifactId>
<packaging>pom</packaging>
- <version>1.8.3-1.3.0_FJVL</version>
+ <version>1.8.3-1.3.1_FJVL</version>
<name>getdown</name>
<description>An application installer and updater.</description>
testng_groups = Functional
testng_excluded_groups =
+test_output =
+
j8libDir = j8lib
j11libDir = j11lib
bamboo_channelbase = https://builds.jalview.org/browse
bamboo_planKey =
-bamboo_getdown_channel_suffix = /latest/artifact/shared/getdown-channel
+bamboo_getdown_channel_suffix = /latest/artifact/shared/getdown-build-for-website/default
eclipse_codestyle_file = utils/eclipse/JalviewCodeStyle.xml
eclipse_extra_jdt_prefs_file = utils/eclipse/org.eclipse.jdt.core.jalview.prefs
<mapID target="pdbfts" url="html/features/pdbsequencefetcher.html#pdbfts" />
<mapID target="siftsmapping" url="html/features/siftsmapping.html" />
<mapID target="pdbchooser" url="html/features/structurechooser.html" />
+ <mapID target="structureandpaefromfile" url="html/features/structurechooser.html#loadfromfile" />
<mapID target="structuresvia3dbeacons" url="html/features/structurechooser.html#3dbeaconssearch" />
+ <mapID target="workingwithpae" url="html/features/paematrices.html" />
+ <mapID target="paematrixformat" url="html/io/paematrixformat.html" />
<mapID target="selectcolbyannot" url="html/features/columnFilterByAnnotation.html" />
<mapID target="biojsmsa" url="html/features/biojsmsa.html" />
<!-- DO NOT WRAP THESE LINES - help2Website relies on each item being on one line! -->
<tocitem text="Jalview Documentation" target="home" expand="true">
<tocitem text="What's new" target="new" expand="true">
- <tocitem text="Latest Release Notes" target="release"/>
- <tocitem text="Support for ChimeraX" target="chimera"/>
- <tocitem text="Support for Pymol" target="pymol"/>
- <tocitem text="Structures via 3D Beacons" target="structuresvia3dbeacons" />
- <tocitem text="Startup Memory Settings" target="startupprefs" />
- <tocitem text="The Java Console, Logging and Reporting Bugs" target="logging" />
- <tocitem text="Command line launch" target="jalviewcltool"/>
+ <tocitem text="Latest Release Notes" target="release"/>
+ <tocitem text="Next Generation Command Line Interface" target="clarguments" />
+ <tocitem text="AlphaFold PAE Matrices" target="workingwithpae" />
+ <tocitem text="Nucleotide Ambiguity colours" target="colours.nucleotideambiguity" />
</tocitem>
<tocitem text="Editing Alignments" target="edit" />
<p>Jalview allows the columns of an alignment to be coloured using
any numerical annotation rows added to that alignment.</p>
Select "Colour"
- <strong>→</strong> ".. by Annotation" to bring up the
+ <strong>→</strong> "by Annotation..." to bring up the
Colour by Annotation settings window.
<br>
+ <br>You can also apply Colour by annotation for a particular annotation
+ (or per-sequence set) by right-clicking an annotation row's label and selecting "Colour by Annotation..." or "Colour by Annotation (per Sequence)..." from the
+ <strong>Annotation label popup menu</strong>. (<em>Since Jalview 2.11.3</em>)
+ <br>
+ <div align="center">
+ <img src="../features/annotationsubmenucolbyannot.png" width="414" height="266">
+ </div>
+ <p><strong>The Colour by Annotation Settings Window</strong></p>
<br>
<div align="center">
<img src="annotationColourSetting.gif" width="471" height="256">
<p>
In addition to the definition of groups and sequence features,
- Jalview can display symbols and graphs under the columns of an
+ Jalview can display symbols, line graphs, histograms and heatmaps under the columns of an
alignment. These annotation tracks are displayed in the annotation
area below the alignment. The annotation area's visibility is
controlled with the <strong>View→Show Annotation</strong>
<ul>
<li><a name="seqannots"><strong>Sequence
associated annotation.</strong></a><br />Data displayed on sequence
- annotation rows are associated with the positions of a sequence.
+ associated annotation rows are associated with the positions of a sequence.
Often this is 'Reference annotation' such as secondary structure
information derived from 3D structure data, or from the results of
sequence based prediction of <a href="../webServices/jnet.html">secondary
structure</a> and <a href="../webServices/proteinDisorder.html">disorder</a>.
- If reference annotation is available for a the currently selected
- sequences, it can be shown by selecting the <strong>Add
+ If reference annotations are available for a particular sequence or the current selections, they can be shown by selecting the <strong>Add
Reference Annotation</strong> option in the sequence or selection popup
- menu.</li>
+ menu.<br/>Jalview currently supports the following sources of sequence associated annotation:<ul><li>Protein and RNA Secondary Structure<br/>These can be obtained from JPred and RNAAliFold secondary structure prediction services, and also for imported 3D Structure data.</li><li>Temperature factor, Model Quality or AlphaFold Reliability</br>Jalview extracts and displays values from the 'Temperature Factor' column of PDB and mmCIF files, interpreted in various ways. For regular PDB files, these are imported directly as 'Temperature Factor', but for structures from computational methods such as EBI-AlphaFold, these values are interpreted and shown as 'AlphaFold Reliability' or 'Model Quality' according to the source.</li><li><a href="paematrices.html">Predicted Alignment Error</a> heatmaps<br/>These are displayed for models retrieved from EBI-AlphaFold or when a supported JSON format PAE file is provided when importing a <a href="structurechooser.html#loadpdbfile">local 3D structure file</a>.</li></ul></li>
<li><strong>Group associated annotation.</strong><br />Data can
be associated with groups defined on the alignment. If sequence
groups are defined, <a href="../calculations/conservation.html">Conservation</a>
alignment</a>. Annotations can also be used to <a
href="../features/columnFilterByAnnotation.html">select or
hide columns</a> via the dialog opened from the <strong>Selection</strong>
- menu.
+ menu. You can also colour, select or hide columns of the alignment using any displayed annotation row by right-clicking its label and selecting the option from the displayed pop-up menu.
</p>
<p>
+ <strong>Adjusting the height of histograms, line graphs and heatmaps</strong><br/>The height of line graphs, bar charts and <a href="paematrices.html">predicted alignment error (PAE) matrix heatmaps</a> can be adjusted simply by click-dragging them up or down to increase or decrease the height. Hold down <em><strong>SHIFT</strong></em> to adjust the height of all instances of a particular type of annotation row.</p>
+ <p>
<strong>Sequence Highlighting and Selection from Annotation</strong>
</p>
<p>
(Mac CMD) double-click</strong> will toggle inclusion of associated
sequences in the selection.
<p>
+ <strong>Selecting, analysing and exploring heatmap annotation</strong>
+ </p><p>Mouseovers on heap annotation tracks result in a tooltip displaying information about the range of values under the mouse, and their associated row and column in the heatmap.<br/>For <a href="paematrices.html">Predicted Alignment Error (PAE) matrices</a>, the only form of heatmap annotation currently supported by Jalview, both the vertical and horizontal positions in the heatmap correspond to positions in linked 3D structures and the associated sequence in the alignment - so clicking any position in a heatmap will select columns in the alignment corresponding to the selected row(s) and column under the mouse.
+ <ul>
+ <li>Rows and columns in the heatmap corresponding to currently selected columns in the alignment are shown as red horizontal and vertical bands.</li>
+ <li><em>Rectangular Selections</em> can be created by pressing <em>CMD (or Window/Meta key)</em> whilst click-dragging across an area of the annotation.</li>
+ <li><em>Data driven selections</em> - e.g. selecting regions of low values of Predicted Alignment Error in a heatmap can be dome by pressing <em>CTRL</em> whilst clicking a region of an alignment.</li>
+ </ul>
+ Heatmap annotations can also be clustered, enabling columns of the alignment to be grouped based on similarity of the sets of values in the heatmap. <em>Double clicking</em> a region of a clustered heatmap annotation will select both the row and columns of the alignment grouped by the clustering. See <a href="paematrices.html#clustering">clustering PAE matrices</a> for more information.
+ <p>
<strong>Interactive Alignment Annotation</strong>
</p>
<p>
in 2.5)</em><br> <em>Selecting this toggles whether column
labels will be shrunk to fit within each column, or displayed
using the view's standard font size.</em></li>
+ <li><strong></strong><em>(introduced in 2.11.3)</em><br/><em></em></li>
+ <li><strong></strong><em>(introduced in 2.11.3)</em><br/><em></em></li>
+ <li><strong></strong><em>(introduced in 2.11.3)</em><br/><em></em></li>
+ <li><strong></strong><em>(introduced in 2.11.3)</em><br/><em></em></li>
+ <li><strong></strong><em>(introduced in 2.11.3)</em><br/><em></em></li>
+ <li><strong></strong><em>(introduced in 2.11.3)</em><br/><em></em></li>
+
</ul>
<p>
<strong>Editing labels and secondary structure annotation
<h2><a name="alignmentlinkedids"></a>Alignment linked IDs</h2>
<p>
- Jalview's alignment related arguments are linked together using a <em>linked ID</em>. In all of the basic usage examples this linked ID is assigned using a default formula of <code>JALVIEW:<em>n</em></code> where <em>n</em> starts at 0 and increments every time there is an <code>--open</code>ed file (or a first use of <code>--append</code>) or the <code>--new</code> argument is used.
+ Jalview's alignment related arguments are linked together using a <em>linked ID</em>. In all of the basic usage examples this linked ID is assigned using a default formula of <code>JALVIEW:<em>n</em></code> where <em>n</em> starts at 0 and increments every time there is an <code>‑‑open</code>ed file (or a first use of <code>‑‑append</code>) or the <code>‑‑new</code> argument is used.
</p>
<p>
- When another alignment related argument is used (without a specified linked ID), it is assigned this default linked ID. When the <code>--all</code> argument is used, following alignment related arguments are applied to all of the linked IDs (made so far).
+ When another alignment related argument is used (without a specified linked ID), it is assigned this default linked ID. When the <code>‑‑all</code> argument is used, following alignment related arguments are applied to all of the linked IDs (made so far).
</p>
<p>
</p>
<p>
- A specified linked ID will also take precedence over a wildcard or <code>--all</code> set linked ID. e.g.
+ A specified linked ID will also take precedence over a wildcard or <code>‑‑all</code> set linked ID. e.g.
<pre>
jalview --open[myID] examples/uniref50.fa --all --colour taylor --colour[myID] gecos-blossom
</pre>
</p>
- <h2><a name="moresubstitutions"></a>More substitutions (<code>{n}</code>, <code>{++n}</code>, <code>[*]</code>)</h2>
+ <h2><a name="moresubstitutions"></a>More substitutions (<code>{n}</code>, <code>{++n}</code>, <code>[*]</code>, <code>{m}</code>, <code>{++m}</code>)</h2>
<p>
In the <a href="clarguments-basic.html#substitutions">basic usage document</a> we have a list of special strings that get replaced in output filename values with parts of input filename values.
</p>
<p>
- There is also an incrementor integer value <code>{n}</code> that can be put into both linked IDs and filenames and works across different linked IDs. Whenever you use <code>{n}</code> in a linked ID or filename value it is replaced with the current value of <em>n</em>. The initial value is 0, and it can be incremented by using the argument <code>--npp</code> or <code>--n++</code>, or using a another special substitution <code>{++n}</code> in either a linked ID or filename value which increments the value and is replaced with the new incremented value of <em>n</em>.
+ There is also an incrementor integer value <code>{n}</code> that can be put into both linked IDs and filenames and works across different linked IDs. Whenever you use <code>{n}</code> in a linked ID or filename value it is replaced with the current value of <em>n</em>. The initial value is 0, and it can be incremented by using the argument <code>‑‑npp</code> or <code>‑‑n++</code>, or using a another special substitution <code>{++n}</code> in either a linked ID or filename value which increments the value and is replaced with the new incremented value of <em>n</em>.
</p>
<p>
- In the same way that the <code>--all</code> argument enables (some) following arguments to apply to all opened alignments so far, the special linked ID <code>*</code> will also apply an individual argument to all opened linked IDs (in fact when you use the <code>--all</code> argument it simply changes the default linked ID to <code>*</code>).
+ In the same way that the <code>‑‑all</code> argument enables (some) following arguments to apply to all opened alignments so far, the special linked ID <code>*</code> will also apply an individual argument to all opened linked IDs (in fact when you use the <code>‑‑all</code> argument it simply changes the default linked ID to <code>*</code>).
<pre>
jalview --open[myId1] fileA.fa --open[myId2] fileB.fa --open[myId3] fileC.fa --colour[*] taylor --all --image tmp/image-{++n}.png --headless
</pre>
</pre>
because all of the command line arguments are read and sorted into their linked IDs before starting to be processed, and the <code>[myId3]</code> specified linked ID takes precedence over the <code>[*]</code> wildcard linked ID.
</p>
- </p>
+ <p>
+ All of the substitutions talked about so far are evaluated in the argument parsing process. If in some cases (almost certainly involving structure images!) you find <code>{n}</code> is not incrementing when you think it should, when specifying <code>‑‑structureimage</code> filenames you can also use <code>{m}</code> and <code>{++m}</code>, along with <code>{structuredirname}</code>, <code>{structurebasename}</code> and <code>{structureextension}</code> which are substituted at the point of use. <code>{m}</code> is just a plain counter starting at 0.
+ </p>
<h2><a name="equalsseparatorandfileglobs"></a>Equals separator and Java file globs</h2>
</p>
<p>
- One benefit of this is seen above in the <code>--image</code> argument, the special "alloutput" wildcard filename <code>*.png</code> will not be expanded by the shell, so does not need to be escaped or surrounded with quotation marks.
+ One benefit of this is seen above in the <code>‑‑image</code> argument, the special "alloutput" wildcard filename <code>*.png</code> will not be expanded by the shell, so does not need to be escaped or surrounded with quotation marks.
</p>
<p>
</p>
<p>
- Some arguments (such as <code>--scale=<em>n</em></code>) are used to modify the behaviour of other "primary" arguments (such as <code>--image=filename</code>). These arguments can alternatively be specifed as <em>sub-value modifiers</em> of the values given to the primary argument. If specified as a sub-value modifier, this modifier takes precedence over any following linked argument if given. e.g
+ Some arguments (such as <code>‑‑scale=<em>n</em></code>) are used to modify the behaviour of other "primary" arguments (such as <code>‑‑image=filename</code>). These arguments can alternatively be specifed as <em>sub-value modifiers</em> of the values given to the primary argument. If specified as a sub-value modifier, this modifier takes precedence over any following linked argument if given. e.g
<pre>
jalview --open=[colour=zappo]examples/*.fa
</pre>
</p>
<p>
- You can specify multiple sub-value modifiers separating them with a comma (','). If you wish to specify a "boolean" argument, such as <code>--wrap</code> or <code>--nowrap</code> then simply use the argument name without a value, like this:
+ You can specify multiple sub-value modifiers separating them with a comma (','). If you wish to specify a "boolean" argument, such as <code>‑‑wrap</code> or <code>‑‑nowrap</code> then simply use the argument name without a value, like this:
<pre>
jalview --open=[colour=gecos-flower,wrap,noannotations,features=examples/plantfdx.features]examples/plantfdx.fa
</pre>
</p>
<p>
- Because <code>--argfiles</code> takes a filename argument, and multiple <code>--argfiles</code> can be read on the command line, you can also use file globs to specify multiple <code>--argfile</code> values. If you produce an argument file for each set of alignment files that you wish to associate then you can act on all of them with, e.g.
+ Because <code>‑‑argfiles</code> takes a filename argument, and multiple <code>‑‑argfiles</code> can be read on the command line, you can also use file globs to specify multiple <code>‑‑argfile</code> values. If you produce an argument file for each set of alignment files that you wish to associate then you can act on all of them with, e.g.
<pre>
jalview --argfile=*/argfile.txt --headless
</pre>
<h2><a name="onlyargumentfiles"></a>Only argument files</h2>
<p>
- When you use an <code>--argfile</code> argument, all other non-initialising arguments on the command line <em>will be ignored</em>. Only the initialising arguments and any and all <code>--argfiles</code> arguments on the command line will be used. You can also set initialising arguments in argument files.
+ When you use an <code>‑‑argfile</code> argument, all other non-initialising arguments on the command line <em>will be ignored</em>. Only the initialising arguments and any and all <code>‑‑argfiles</code> arguments on the command line will be used. You can also set initialising arguments in argument files.
</p>
<li><a href="#alloutputwildcard">The all output wildcard</a></li>
</ul>
- <h2><a name="openingalignments"></a>Opening alignments (<code>--open</code>, <code>--append</code>, <code>--new</code>)</h2>
+ <h2><a name="openingalignments"></a>Opening alignments (<code>‑‑open</code>, <code>‑‑append</code>, <code>‑‑new</code>)</h2>
<p>
- To simply open one or more alignment files in different windows just put the filenames as the first arguments:
+ To simply open one or more alignment files in different alignment windows just put the filenames as the first arguments:
<pre>
jalview filename1 filename2 ...
</pre>
</p>
<p>
- (Using initial filenames is the same as using the <code>--open</code> argument, and further arguments can be used
+ (Using initial filenames is the same as using the <code>‑‑open</code> argument, and further arguments can be used
after the initial filenames.)
</p>
- <h3><a name="open"></a><code>--open</code></h3>
+ <h3><a name="open"></a><code>‑‑open</code></h3>
<p>
- Use the <code>--open</code> argument to open alignment files each in their own window.
+ Use the <code>‑‑open</code> argument to open alignment files each in their own window.
</p>
<p>
</pre>
</p>
- <h3><a name="append"></a><code>--append</code></h3>
+ <h3><a name="append"></a><code>‑‑append</code></h3>
<p>
To append several alignment files together use:
<pre>
jalview --open filename1.fa --append filename2.fa filename3.fa
</pre>
- or, if you haven't previously used <code>--open</code> then you can use --append to open one new window and keep appending each set of alignments:
+ or, if you haven't previously used <code>‑‑open</code> then you can use --append to open one new window and keep appending each set of alignments:
<pre>
jalview --append these/filename*.fa --append more/filename*.fa
</p>
<p>
- <strong>Note</strong> that whilst you can include a Jalview Project File (<code>.jvp</code>) as an <code>--append</code> value, the items in the file will always open in their original windows and not append to another.
+ <strong>Note</strong> that whilst you can include a Jalview Project File (<code>.jvp</code>) as an <code>‑‑append</code> value, the items in the file will always open in their original windows and not append to another.
</p>
- <h3><a name="new"></a><code>--new</code></h3>
+ <h3><a name="new"></a><code>‑‑new</code></h3>
<p>
- To append different sets of alignment files in different windows, use <code>--new</code> to move on to a new alignment window:
+ To append different sets of alignment files in different windows, use <code>‑‑new</code> to move on to a new alignment window:
<pre>
jalview --append these/filename*.fa --new --append other/filename*.fa
</pre>
</p>
<p>
- <code>--open</code> is like using <code>--new --append</code> applied to every filename/URL given to <code>--open</code>
+ <code>‑‑open</code> is like using <code>‑‑new --append</code> applied to every filename/URL given to <code>‑‑open</code>
</p>
- <h2><a name="alignmentoptions"></a>Alignment options (<code>--colour</code>, <code>--wrap</code>, <code>--showannotations</code>, <code>--title</code>)</h2>
+ <h2><a name="alignmentoptions"></a>Alignment options (<code>‑‑colour</code>, <code>‑‑wrap</code>, <code>‑‑showannotations</code>, <code>‑‑title</code>)</h2>
- <h3><a name="colour"></a><code>--colour</code></h3>
+ <p>
+ An opened alignment window (or set of opened alignment windows) can be modified in its appearance using the following arguments before the next <code>‑‑open</code> argument. These modifying arguments apply to the one or more files that were opened with the preceding <code>‑‑open</code> argument. E.g. <code>‑‑open file.fa --colour gecos-flower</code> will colour the one alignment window with <code>file.fa</code>. However, <code>‑‑open *.fa --colour gecos-flower</code> will colour every alignment window matching <code>file*.fa</code>, and <code> --open file1.fa file2.fa --colour gecos-flower</code>
+ will colour both opened alignment windows.
+ </p>
+
+ <h3><a name="colour"></a><code>‑‑colour</code></h3>
<p>
- You can specify a residue/base colouring for the alignment using the <code>--colour</code> option (note spelling -- Jalview is made in Scotland!):
+ You can specify a residue/base colouring for the alignment using the <code>‑‑colour</code> option (note spelling -- Jalview is made in Scotland!):
<pre>
jalview --open examples/uniref50.fa --colour gecos-flower
</pre>
<code>sequence-id</code>
</p>
- <h3><a name="wrap"></a><code>--wrap</code></h3>
+ <h3><a name="wrap"></a><code>‑‑wrap</code></h3>
<p>
- An alignment should open with your usual preferences stored in the <code>.jalview_properties</code> file. To open an alignment with the sequences (definitely) wrapped, following your <code>--open</code> (or first <code>--append</code>) argument use the argument <code>--wrap</code>:
+ An alignment should open with your usual preferences stored in the <code>.jalview_properties</code> file. To open an alignment with the sequences (definitely) wrapped, following your <code>‑‑open</code> (or first <code>‑‑append</code>) argument use the argument <code>‑‑wrap</code>:
<pre>
jalview --open examples/uniref50.fa --wrap
</pre>
- To ensure an alignment is not wrapped use <code>--nowrap</code>:
+ To ensure an alignment is not wrapped use <code>‑‑nowrap</code>:
<pre>
jalview --open examples/uniref50.fa --nowrap
</pre>
</p>
- <h3><a name="showannotations"></a><code>--showannotations</code> / <code>--noshowannotations</code></h3>
+ <h3><a name="showannotations"></a><code>‑‑showannotations</code> / <code>‑‑noshowannotations</code></h3>
<p>
- You can specify whether the currently opened alignment window should show alignment annotations (e.g. Conservation, Quality, Consensus...) or not with either <code>--showannotations</code> or <code>--noshowannotations</code>. If you don't specify then your saved preference will be used.
+ You can specify whether the currently opened alignment window should show alignment annotations (e.g. Conservation, Quality, Consensus...) or not with either <code>‑‑showannotations</code> or <code>‑‑noshowannotations</code>. If you don't specify then your saved preference will be used.
<pre>
jalview --open examples/uniref50.fa --noshowannotations
</pre>
</p>
- <h3><a name="title"></a><code>--title</code></h3>
+ <h3><a name="title"></a><code>‑‑title</code></h3>
<p>
- If you would like to give the alignment window a specific title you can do so with the <code>--title</code> option:
+ If you would like to give the alignment window a specific title you can do so with the <code>‑‑title</code> option:
<pre>
jalview --open examples/uniref50.fa --title "My example alignment"
</pre>
- <h2><a name="adding3dstructures"></a>Adding 3D structures (<code>--structure</code>, <code>--seqid</code>, <code>--structureviewer</code>, <code>--paematrix</code>, <code>--tempfac</code>, <code>--showssannotations</code>)</h2>
+ <h2><a name="adding3dstructures"></a>Adding 3D structures (<code>‑‑structure</code>, <code>‑‑seqid</code>, <code>‑‑structureviewer</code>, <code>‑‑paematrix</code>, <code>‑‑tempfac</code>, <code>‑‑showssannotations</code>)</h2>
<p>
</p>
- <h3><a name="structure"></a><code>--structure</code></h3>
+ <h3><a name="structure"></a><code>‑‑structure</code></h3>
<p>
- You can add a 3D structure file to a sequence in the current alignment window with the <code>--structure</code> option:
+ You can add a 3D structure file to a sequence in the current alignment window with the <code>‑‑structure</code> option:
<pre>
jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb
</pre>
By default this attaches to the first sequence in the alignment but most likely you will want to attach it to a specific sequence.
</p>
- <h3><a name="seqid"></a><code>--seqid</code></h3>
+ <h3><a name="seqid"></a><code>‑‑seqid</code></h3>
<p>
- The easiest way to specify a sequence ID for your structure is to follow the <code>--structure</code> argument with a <code>--seqid</code> argument with a value of a sequence ID in the alignment. This does of course require some knowledge of the sequences in the alignment files
+ The easiest way to specify a sequence ID for your structure is to follow the <code>‑‑structure</code> argument with a <code>‑‑seqid</code> argument with a value of a sequence ID in the alignment. This does of course require some knowledge of the sequences in the alignment files
that have been opened.
<br/>
- Alternatively you can specify a <em>sub-value</em> with the <code>--structure</code> argument value. You do this by preceding the value with square brackets and <code>seqid=SequenceId</code>,
+ Alternatively you can specify a <em>sub-value</em> with the <code>‑‑structure</code> argument value. You do this by preceding the value with square brackets and <code>seqid=SequenceId</code>,
like this:
<pre>
jalview --open examples/uniref50.fa --structure [seqid=FER1_SPIOL]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
</p>
<p>
- The sub-value <code>seqid=FER1_SPIOL</code> takes precedence over the following argument <code>--seqid FER1_SPIOL</code> if you accidentally specify both (in which case the argument will probably be completely unused).
+ The sub-value <code>seqid=FER1_SPIOL</code> takes precedence over the following argument <code>‑‑seqid FER1_SPIOL</code> if you accidentally specify both (in which case the argument will probably be completely unused).
</p>
<p>
Remember that you might need to escape any spaces in the sequence ID or enclose the ID in quotation marks.
</p>
- <h3><a name="structureviewer"></a><code>--structureviewer</code></h3>
+ <h3><a name="structureviewer"></a><code>‑‑structureviewer</code></h3>
<p>
- You can specify which structure viewer (or none) to use to open the structure using either the <code>--structureviewer</code> argument or the <code>structureviewer</code> sub-value. Multiple sub-values can be specified together, separated by a comma ','. Possible values for the <code>structureviewer</code> are:
+ You can specify which structure viewer (or none) to use to open the structure using either the <code>‑‑structureviewer</code> argument or the <code>structureviewer</code> sub-value. Multiple sub-values can be specified together, separated by a comma ','. Possible values for the <code>structureviewer</code> are:
<br/>
<code>none</code>,
<br/>
</pre>
</p>
- <h3><a name="paematrix"></a><code>--paematrix</code></h3>
+ <h3><a name="paematrix"></a><code>‑‑paematrix</code></h3>
<p>
- If you are opening a structure file that has a PAE matrix (provided as a JSON file), such as from an AlphaFold model or an nf-core pipeline, you can add the PAE matrix as an annotation by following the <code>--structure</code> argument with a <code>--paematrix</code> argument with the filename. You can also specify a <code>paematrix=filename</code> sub-value.
+ If you are opening a structure file that has a PAE matrix (provided as a JSON file), such as from an AlphaFold model or an nf-core pipeline, you can add the PAE matrix as an annotation by following the <code>‑‑structure</code> argument with a <code>‑‑paematrix</code> argument with the filename. You can also specify a <code>paematrix=filename</code> sub-value.
<pre>
jalview --open examples/uniref50.fa --structure [seqid=FER1+SPIOL,structureviewer=pymol]examples/AlphaFold/AF-P00221-F1-model_v4.pdb --paematrix examples/AlphaFold/AF-P00221-F1-predicted_aligned_error_v4.json
</pre>
</p>
- <h3><a name="tempfac"></a><code>--tempfac</code></h3>
+ <h3><a name="tempfac"></a><code>‑‑tempfac</code></h3>
<p>
- Structure files may have a temperature factor associated with the structure component positions. If the temperature factor is a pLDDT confidence score, such as with an AlphaFold model, you can specify this by using a following argument of <code>--tempfac</code> with a value of <code>plddt</code>. This will enable standard pLDDT colouring of the temperature factor annotation. Valid values are:
+ Structure files may have a temperature factor associated with the structure component positions. If the temperature factor is a pLDDT confidence score, such as with an AlphaFold model, you can specify this by using a following argument of <code>‑‑tempfac</code> with a value of <code>plddt</code>. This will enable standard pLDDT colouring of the temperature factor annotation. Valid values are:
<code>default</code>,
<code>plddt</code>.
More types of temperature factor may be added in future releases of Jalview.
<br/>
The value can also be specified as a sub-value:
<pre>
- jalview --open examples/uniref50.fa --structure [seqid=FER1+SPIOL,structureviewer=jmol,tempfac=plddt]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
+ jalview --open examples/uniref50.fa --structure [seqid=FER1_SPIOL,structureviewer=jmol,tempfac=plddt]examples/AlphaFold/AF-P00221-F1-model_v4.pdb
</pre>
which is equivalent to
<pre>
- jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --tempfac plddt --seqid FER1+SPIOL
+ jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --tempfac plddt --seqid FER1_SPIOL
--structureviewer jmol
</pre>
<!-- notempfac not yet working. undocumented until then -->
- <h3><a name="showssannotations"></a><code>--showssannotations</code> / <code>--noshowssannotations</code></h3>
+ <h3><a name="showssannotations"></a><code>‑‑showssannotations</code> / <code>‑‑noshowssannotations</code></h3>
<p>
- You can specify whether the currently opened alignment window should show secondary structure annotations or not with either <code>--showssannotations</code> or <code>--noshowssannotations</code>. If you don't specify then your saved preference will be used.
+ You can specify whether the currently opened alignment window should show secondary structure annotations or not with either <code>‑‑showssannotations</code> or <code>‑‑noshowssannotations</code>. If you don't specify then your saved preference will be used.
<pre>
jalview --open examples/uniref50.fa --structure examples/AlphaFold/AF-P00221-F1-model_v4.pdb --noshowssannotations
</pre>
</pre>
</p>
- <h2><a name="outputtingalignmentfiles"></a>Outputting/converting alignment files and images (<code>--output</code>, <code>--format</code>, <code>--image</code>, <code>--type</code>, <code>--textrenderer</code>, <code>--scale</code>, <code>--backups</code>, <code>--overwrite</code>)</h2>
+ <h2><a name="outputtingalignmentfiles"></a>Outputting/converting alignment files and images (<code>‑‑output</code>, <code>‑‑format</code>, <code>‑‑image</code>, <code>‑‑structureimage</code>, <code>‑‑type</code>, <code>‑‑scale</code>, <code>‑‑width</code>, <code>‑‑height</code>, <code>‑‑imagecolour</code>, <code>‑‑bgcolour</code>, <code>‑‑textrenderer</code>, <code>‑‑overwrite</code>, <code>‑‑backups</code>, <code>‑‑mkdirs</code>)</h2>
<p>
You can save an alignment as an alignment file, or exported as an image, in different formats. Jalview's alignment output formats are:
In bitmap formats (currently only PNG, but what else would you want?!) you can specify a scaling factor to improve the resolution of the output image.
</p>
- <h3><a name="output"></a><code>--output</code></h3>
+ <h3><a name="output"></a><code>‑‑output</code></h3>
<p>
- To save the open alignment in a new alignment file use <code>--output filename</code>. The format for the file can be found from the extension of <code>filename</code>, or if you are using a non-standard extension you can use a following <code>--format</code> argument, or specify it as a sub-value modifier.
+ To save the open alignment in a new alignment file use <code>‑‑output filename</code>. The format for the file can be found from the extension of <code>filename</code>, or if you are using a non-standard extension you can use a following <code>‑‑format</code> argument, or specify it as a sub-value modifier.
</p>
<p>
Recognised formats and their recognised extensions are:
</p>
<p>
- <em>Important!</em> If you use <code>--output</code> or any other argument that outputs a file, then it will be assumed you want to run Jalview in headless mode (as if you had specified <code>--headless</code>). To use Jalview with <code>--output</code> and not assume headless mode, use the <code>--gui</code> argument (the order doesn't matter).
+ <em>Important!</em> If you use <code>‑‑output</code> or any other argument that outputs a file, then it will be assumed you want to run Jalview in headless mode (as if you had specified <code>‑‑headless</code>). To use Jalview with <code>‑‑output</code> and not assume headless mode, use the <code>‑‑gui</code> argument (the order doesn't matter).
</p>
<p>
</pre>
</p>
- <h3><a name="format"></a><code>--format</code></h3>
+ <h3><a name="format"></a><code>‑‑format</code></h3>
<p>
- To specify the format of the output file (if using an unrecognised file extension) use the <code>--format</code> argument to specify a value (see above). A sub-value modifier on the <code>--output</code> value can also be used.
+ To specify the format of the output file (if using an unrecognised file extension) use the <code>‑‑format</code> argument to specify a value (see above). A sub-value modifier on the <code>‑‑output</code> value can also be used.
</p>
- <h3><a name="image"></a><code>--image</code></h3>
- To export the open alignment window as an image, use the <code>--image</code> argument, which will give an image of the alignment and annotations as it appears (or would appear if not in <code>--headless</code> mode) in the alignment window if it was large enough for the whole alignment, including colour choice and features.
+ <h3><a name="image"></a><code>‑‑image</code></h3>
+ <p>
+ To export the open alignment window as an image, use the <code>‑‑image</code> argument, which will give an image of the alignment and annotations as it appears (or would appear if not in <code>‑‑headless</code> mode) in the alignment window if it was large enough for the whole alignment, including colour scheme and features.
+ </p>
<p>
<pre>
jalview --open examples/plantfdx.fa --colour gecos-blossom --features examples/plantfdx.features --annotations examples/plantfdx.annotations --image plantfdx.png --headless
</pre>
</p>
+ <h3><a name="structureimage"></a><code>‑‑structureimage</code></h3>
<p>
- This by default produces a PNG image of screen or webpage resolution, which you may want to improve upon. There are two ways of doing this with Jalview: increasing the scale of the PNG image, or using a vector based image format (EPS, SVG, HTML).
+ To export an open structure as an image, use the <code>‑‑structureimage</code> argument, which will give an image of the structure as it appears (or would appear if not in <code>‑‑headless</code> mode) in a Jmol window including colour scheme. <code>‑‑structureimage</code> can currently only be used with structures opened with the <code>jmol</code> structureviewer (the default viewer).
+ </p>
+ <p>
+ <pre>
+ jalview --open examples/plantfdx.fa --colour gecos-blossom --features examples/plantfdx.features --annotations examples/plantfdx.annotations --image plantfdx.png --headless
+ </pre>
+ </p>
+
+ <p>
+ These by default produce a PNG image of screen or webpage resolution, which you will probably want to improve upon. There are two ways of doing this with Jalview: increasing the scale of the PNG image, or using a vector based image format (EPS, SVG, HTML).
<p>
+ <h3><a name="type"></a><code>‑‑type</code></h3>
+
+ <p>
+ To specify the type of image file to write (if using an unrecognised file extension) use the <code>‑‑type</code> argument to specify a value (see above). A sub-value modifier on the <code>‑‑image</code> and <code>‑‑structureimage</code> value can also be used. Valid values are:
+ <br/>
+ <code>png</code> - A Portable Network Graphics image (bitmap, default),
+ <br/>
+ <code>svg</code> - A Scalable Vector Graphics image (vector),
+ <br/>
+ <code>eps</code> - An Encapsulated PostScript file (vector),
+ <br/>
+ <code>html</code> - An HTML rendition of the alignment with embedded source data (vector/web browser),
+ <br/>
+ <code>biojs</code> - An HTML rendition of the alignment with interactive MSA viewer <a href="biojsmsa.html">BioJS-MSA</a> (vector).
+ </p>
+
<h3><a name="bitmap"></a>Bitmap image types (<code>png</code>)</h3>
<p>
Let's increase the resolution of the PNG image:
</p>
- <h3><a name="scale"></a><code>--scale</code></h3>
+ <h3><a name="scale"></a><code>‑‑scale</code></h3>
<p>
- We can increase the size of the PNG image by a factor of <em>S</em> by following the <code>--image</code> argument with a <code>--scale <em>S</em></code> argument and value. The value doesn't have to be an integer and should be given as an integer or floating point formatted number, e.g.
+ We can increase the size of the PNG image by a factor of <em>S</em> by following the <code>‑‑image</code> or <code>‑‑structureimage</code> argument with a <code>‑‑scale <em>S</em></code> argument and value. The value doesn't have to be an integer and should be given as an integer or floating point formatted number, e.g.
<pre>
jalview --open examples/uniref50.fa --colour gecos-ocean --image mypic.png --scale 5.5 --headless
</pre>
- which will produce a PNG image 5.5 times larger (and more detailed) than without the <code>--scale</code> argument.
+ which will produce a PNG image 5.5 times larger (and more detailed) than without the <code>‑‑scale</code> argument.
</p>
<p>
However, since you won't necessarily already know the size of an alignment's exported image you can specify either an exact width or height (in pixels) with either one of the
- <code>--width</code> and <code>--height</code> arguments:
+ <code>‑‑width</code> and <code>‑‑height</code> arguments:
- <h3><a name="width"></a><code>--width</code></h3>
+ <h3><a name="width"></a><code>‑‑width</code></h3>
<p>
- Specify an exact width of an exported PNG image with <code>--width</code>:
+ Specify an exact width of an exported PNG image with <code>‑‑width</code>:
<pre>
jalview --headless --open https://www.ebi.ac.uk/interpro/api/entry/pfam/PF03760/?annotation=alignment%3Aseed --noshowannotations --colour gecos-sunset --image wallpaper.png --width 3840
</pre>
</p>
- <h3><a name="height"></a><code>--height</code></h3>
+ <h3><a name="height"></a><code>‑‑height</code></h3>
<p>
- Alternatively specify an exact height with the <code>--height</code> argument:
+ Alternatively specify an exact height with the <code>‑‑height</code> argument:
<pre>
jalview --headless --open https://www.ebi.ac.uk/interpro/api/entry/pfam/PF03760/?annotation=alignment%3Aseed --noshowannotations --colour gecos-ocean --image wallpaper.png --height 2160
</pre>
</p>
<p>
- You can specify two or all of <code>--scale</code>, <code>--width</code> and <code>--height</code> as limits to the size of the image (think of one or two bounding boxes) and the one which produces the smallest scale of image is used. You can also specify each of these as sub-value modifiers to the <code>--image</code> value:
+ You can specify two or all of <code>‑‑scale</code>, <code>‑‑width</code> and <code>‑‑height</code> as limits to the size of the image (think of one or two bounding boxes) and the one which produces the smallest scale of image is used. You can also specify each of these as sub-value modifiers to the <code>‑‑image</code> or <code>‑‑structureimage</code> value:
<pre>
jalview --headless --open https://www.ebi.ac.uk/interpro/api/entry/pfam/PF03760/?annotation=alignment%3Aseed --noshowannotations --colour gecos-flower --image [scale=0.25,width=320,height=240]thumbnail.png
</pre>
</p>
+ <h3><a name="imagecolour"></a><code>‑‑imagecolour</code></h3>
+
+ <p>
+ Specify a colour scheme to use just for this image using the <code>‑‑imagecolour</code> argument:
+ <pre>
+ jalview --open examples/uniref50.fa --colour gecos-flower --image uniref50-residues.png --height 2160 --image uniref50-helix.png --imagecolour helix-propensity --width 800 --image uniref50-turn.png --imagecolour turn-propensity --width 800
+ </pre>
+ </p>
+
+ <h3><a name="bgcolour"></a><code>‑‑bgcolour</code></h3>
+
+ <p>
+ <strong>Only applies to <code>‑‑structureimage</code>.</strong> Specify a background colour for a structure image. The colour can be specified as a named colour recognised by Java (e.g. <code>"white"</code>, <code>"cyan"</code>) or as a RRGGBB 6 digit hex string (e.g. <code>ffffff</code>, <code>00ffff</code>).
+ </p>
+ <p>
+ E.g.
+ <pre>
+ jalview --open examples/uniref50.fa --colour gecos-sunset --structure examples/AF-P00221-F1-model_v4.pdb --seqid FER1_SPIOL --structureimage temp.png --bgcolour magenta
+ </pre>
+ </p>
+
<p>
Next we look at vector image formats, which maintain detail at all resolutions.
</p>
- <h3><a name="vector"></a>Vector image export</h3>
+ <h3><a name="vector"></a>Vector image export (<code>svg</code>, <code>eps</code>, <code>html</code>, <code>biojs</code>)</h3>
<p>
- Jalview can export an alignment in Encapsulated PostScript (<code>eps</code>), Scalable Vector Graphics (<code>svg</code>), HTML (<code>html</code>) or BioJSON -- another HTML format (<code>biojs</code>), by using, e.g.
+ Jalview can export an alignment in Encapsulated PostScript (<code>eps</code>), Scalable Vector Graphics (<code>svg</code>), HTML (<code>html</code>) or <a href="biojsmsa.html">BioJSON</a> -- another HTML format with an interactive MSA viewer (<code>biojs</code>), by using, e.g.
<pre>
jalview --open examples/uniref50.fa --colour gecos-flower --image printable.eps
</pre>
- The image format can be specified with the <code>--type</code> argument or as a sub-value modifier on the <code>--image</code> value. If neither is used the <code>type</code> will be guessed from the image file extension. The following three examples should produce the same contents:
+ The image format can be specified with the <code>‑‑type</code> argument or as a sub-value modifier on the <code>‑‑image</code> value. If neither is used the <code>type</code> will be guessed from the image file extension. The following three examples should produce the same contents:
<pre>
jalview --open examples/uniref50.fa --colour gecos-flower --image printable.eps
jalview --open examples/uniref50.fa --colour gecos-flower --image printable.postscript --type eps
jalview --open examples/uniref50.fa --colour gecos-flower --image [type=eps]printable.postscript
+ jalview --open examples/uniref50.fa --colour gecos-flower --image [type=biojs]printable.html
</pre>
</p>
- <h3><a name="textrenderer"></a><code>--textrenderer</code></h3>
+ <h3><a name="textrenderer"></a><code>‑‑textrenderer</code></h3>
<p>
- In a vector format any text that appears on the page (including residue/base labels) can be saved in the image file either as <code>text</code> or as <code>lineart</code> using the <code>--textrenderer</code> argument. This is only available for <code>eps</code>, <code>svg</code> and <code>html</code> formats.
+ In a vector format any text that appears on the page (including residue/base labels) can be saved in the image file either as <code>text</code> or as <code>lineart</code> using the <code>‑‑textrenderer</code> argument. This is only available for <code>eps</code>, <code>svg</code> and <code>html</code> formats.
</p>
<p>
</p>
<p>
- The type of <code>--textrenderer</code> can be specified with an argument following <code>--image</code> or as a sub-value modifier:
+ The type of <code>‑‑textrenderer</code> can be specified with an argument following <code>‑‑image</code> or as a sub-value modifier:
<pre>
jalview --open examples/uniref50.fa --colour gecos-flower --image printable.html --type biojs
jalview --open examples/uniref50.fa --colour gecos-flower --image [type=eps,textrenderer=lineart]printable.ps
</pre>
</p>
+ <h3><a name="outputbehaviour"></a>Output behaviour</h3>
+
+ <h3><a name="overwrite"></a><code>‑‑overwrite</code></h3>
+
+ <p>
+ By default, Jalview will refuse to overwrite an output file (alignment or image) unless backups are in operation (alignment files only). To force overwriting files, use the <code>‑‑overwrite</code> argument.
+ </p>
+
+ <h3><a name="backups"></a><code>‑‑backups / --nobackups</code></h3>
- <h2><a name="filenamesubstitutionsandbatchprocessing"></a>Filename substitutions and batch processing (<code>--substitutions</code>, <code>--close</code>, <code>--all</code>)</h2>
+ <p>
+ Jalview should honour your preferences for backup files of output alignment files. Using <code>‑‑backups</code> or <code>‑‑nobackups</code> forces the behaviour. With no backups set, you will need to use <code>‑‑overwrite</code> to overwrite an existing file. Note that Jalview does not make backup files of exported images.
+ </p>
+
+ <h3><a name="mkdirs"></a><code>‑‑mkdirs</code></h3>
+
+ <p>
+ If you want to output a file into a folder that doesn't yet exist (this might happen particularly when using <code>{dirname}</code> substitutions -- see below), then Jalview will fail to write the file since the parent directory doesn't exist. You can use <code>‑‑mkdirs</code> to tell Jalview to make the new directory (or directories, it will create several nested directories if necessary) before writing the file. <code>‑‑mkdirs</code> is cautious and will generally refuse to make a new directory using a relative path with <code>..</code> in.
+ </p>
+
+ <h2><a name="filenamesubstitutionsandbatchprocessing"></a>Filename substitutions and batch processing (<code>‑‑substitutions</code>, <code>‑‑close</code>, <code>‑‑all</code>)</h2>
<p>
One of the more powerful aspects of Jalview's command line operations is that stores all of the different opened alignment arguments (before opening them) and can apply some arguments to <em>all</em> of the alignments as they are opened. This includes display and output arguments.
</p>
<p>
+ Specifically for <code>‑‑structureimage</code> output, you can also use substitutions using parts of the structure filename:
+ <ul>
+ <li><code>{structuredirname}</code> -- is replaced by the directory path to the opened structure file.</li>
+ <li><code>{structurebasename}</code> -- is replaced by the base of the filename of the opened structure file. This is without the path or file extension (if there is one).</li>
+ <li><code>{structureextension}</code> -- is replaced by the extension of the filename of the opened structure file.</li>
+ </ul>
+ </p>
+
+ <p>
These filename substitutions are on by default, but if for whatever reason you wish to disable the substitutions, they can be turned off (or back on again) through the list of arguments with:
</p>
- <h3><a name="substitutions"></a><code>--substitutions / --nosubstitutions</code></h3>
+ <h3><a name="substitutions"></a><code>‑‑substitutions / --nosubstitutions</code></h3>
<p>
Enable (or disable) filename substitutions in the following argument values and sub-value modifier values.
</p>
<p>
- For opening single files this is less useful, since you could obviously just type the output filename, but for multiple opened alignments you can also use these substituted values and they will be replaced by the relevant part of the filename given for each opened alignment window. Normally an <code>--output</code> or <code>--image</code> argument will only be applied to the latest opened alignment window, but you can tell Jalview to apply some arguments to all alignments that have been opened (so far) by using the <code>--all</code> argument.
+ For opening single files this is less useful, since you could obviously just type the output filename, but for multiple opened alignments you can also use these substituted values and they will be replaced by the relevant part of the filename given for each opened alignment window. Normally an <code>‑‑output</code> or <code>‑‑image</code> argument will only be applied to the latest opened alignment window, but you can tell Jalview to apply some arguments to all alignments that have been opened (so far) by using the <code>‑‑all</code> argument.
</p>
- <h3><a name="all"></a><code>--all / -noall</code></h3>
+ <h3><a name="all"></a><code>‑‑all / -noall</code></h3>
<p>
- When using the <code>--all</code> argument, following arguments will apply to all of the previously opened alignment windows. You can turn this behaviour off again for following arguments using the <code>--noall</code> argument. The arguments that can apply to all previously opened alignments are:
+ When using the <code>‑‑all</code> argument, following arguments will apply to all of the previously opened alignment windows. You can turn this behaviour off again for following arguments using the <code>‑‑noall</code> argument. The arguments that can apply to all previously opened alignments are:
<br/>
- <code>--colour</code>
+ <code>‑‑colour</code>
<br/>
- <code>--sortbytree</code>
+ <code>‑‑sortbytree</code>
<br/>
- <code>--showannotations</code>
+ <code>‑‑showannotations</code>
<br/>
- <code>--wrap</code>
+ <code>‑‑wrap</code>
<br/>
- <code>--nostructure</code>
+ <code>‑‑nostructure</code>
<br/>
- <code>--notempfac</code>
+ <code>‑‑notempfac</code>
<br/>
- <code>--showssannotations</code>
+ <code>‑‑showssannotations</code>
<br/>
- <code>--image</code>
+ <code>‑‑image</code>
<br/>
- <code>--type</code>
+ <code>‑‑type</code>
<br/>
- <code>--textrenderer</code>
+ <code>‑‑textrenderer</code>
<br/>
- <code>--scale</code>
+ <code>‑‑scale</code>
<br/>
- <code>--width</code>
+ <code>‑‑width</code>
<br/>
- <code>--height</code>
+ <code>‑‑height</code>
<br/>
- <code>--output</code>
+ <code>‑‑output</code>
<br/>
- <code>--format</code>
+ <code>‑‑format</code>
<br/>
- <code>--groovy</code>
+ <code>‑‑groovy</code>
<br/>
- <code>--backups</code>
+ <code>‑‑backups</code>
<br/>
- <code>--overwrite</code>
+ <code>‑‑overwrite</code>
<br/>
- <code>--close</code>
+ <code>‑‑close</code>
</p>
<p>
- In particular, for our example above, we can use <code>-all</code> and <code>--output</code> like this (<code>--close</code> will be explained in a moment):
+ In particular, for our example above, we can use <code>-all</code> and <code>‑‑output</code> like this (<code>‑‑close</code> will be explained in a moment):
<pre>
jalview --open all_my_fasta_files/*.fa --all --output all_my_converted_stockholm_files/{basename}.stk --close --headless
</pre>
</pre>
</p>
- <h3><a name="close"></a><code>--close</code></h3>
+ <h3><a name="close"></a><code>‑‑close</code></h3>
<p>
- The <code>--close</code> tag is used to close an alignment window after all output files or image exports are performed. This reduces memory use, especially if an <code>--open</code> value is set to open many files. These will be opened, formatted and output sequentially so since they are closed before the next one is opened memory use will not build up over a large number of alignments.
+ The <code>‑‑close</code> tag is used to close an alignment window after all output files or image exports are performed. This reduces memory use, especially if an <code>‑‑open</code> value is set to open many files. These will be opened, formatted and output sequentially so since they are closed before the next one is opened memory use will not build up over a large number of alignments.
<pre>
</pre>
</p>
- <h2><a name="alloutputwildcard"></a>The all output wildcard: <code>--output "*.ext"</code>, <code>--image "*.ext"</code></h2>
+ <h2><a name="alloutputwildcard"></a>The all output wildcard: <code>‑‑output "*/*.ext"</code>, <code>‑‑image "*/*.ext"</code></h2>
+
+ <p>
+ Purely as an intuitive syntactic sweetener, you can use the <code>‑‑output</code> wildcard <code>*</code> in two places as part of an output path and filename.
+ </p>
+
+ <p>
+ Using an asterisk (<code>*</code>) as a filename before an extension, e.g. <code>‑‑image "tmp/*.png"</code> will result in that asterisk being treated as a <code>{basename}</code> substitution.
+ </p>
+
+ <p>
+ Using an asterisk (<code>*</code>) before a file separator (usually </code>/</code>), e.g. <code>‑‑image "tmp/*/file1.png"</code> will result in that asterisk being treated as a <code>{dirname}</code> substitution.
+ </p>
+
+ <p>
+ You can combine these, using an asterisk (<code>*</code>) before and after the last file separator, e.g. <code>‑‑image "tmp/*/*.png"</code> will result in being substituted like <code>tmp/{dirname}/{basename}.png</code>.
+ </p>
<p>
- Purely as an intuitive syntactic sweetener, you can use the <code>--output</code> wildcard <code>*</code> <em>at the beginning of the output filename</em> as shorthand for <code>--all --output {dirname}/{basename}</code> followed by whatever you put after the '<code>*</code>'. For example, to achieve the same as the thumbnails example above, you could use
+ For example, to achieve the same as the thumbnails example above, you could use
<pre>
- jalview --open */*.fa --image "*.png" --colour gecos-flower --width 256 --height 256 --close --headless
+ jalview --open */*.fa --image "*/*.png" --colour gecos-flower --width 256 --height 256 --close --headless
</pre>
- Here we move the <code>--colour</code> argument after the <code>--output</code> argument (it will still be applied before the image export or file output) so that it is included after the implied <code>--all</code> argument. The thumbnails will be placed in the same directory as the alignment file with the same filename except for a different extension of <code>.png</code>.
+ Here we move the <code>‑‑colour</code> argument after the <code>‑‑output</code> argument (it will still be applied before the image export or file output) so that it is included after the implied <code>‑‑all</code> argument. The thumbnails will be placed in the same directory as the alignment file with the same filename except for a different extension of <code>.png</code>.
</p>
<p>
</p>
<p>
- An alternative is to use an equals sign ('=') with no spaces between the argument and the value, <code>--output=*.ext</code>, which Jalview will interpret the same, but the shell will not automatically expand before it is sent to Jalview, e.g.
+ An alternative is to use an equals sign ('=') with no spaces between the argument and the value, <code>‑‑output=*.ext</code>, which Jalview will interpret the same, but the shell will not automatically expand before it is sent to Jalview, e.g.
<pre>
jalview --open all_my_fasta_files/*.fa --output=*.stk --close --headless
</pre>
<li><a href="#processingalignments">Processing alignments</a></li>
<li><a href="#outputtingalignmentfiles">Outputting alignment files</a></li>
<li><a href="#exportingimagefiles">Exporting image files</a></li>
- <li><a href="#exporting3dstructureimagefiles">Exporting 3D structure image files</a></li>
<li><a href="#controllingflowofarguments">Controlling flow of arguments</a></li>
</ul>
<td><code>‑‑headless</code></td>
<td>Run Jalview in headless mode. In headless mode, no GUI interface will be created and Jalview will quit after all arguments have been processed.
<br/>
- If you use a command line argument to specify an output file of some kind (<code>--output</code>, <code>--image</code> or <code>--structureimage</code>) then <strong>headless mode will be assumed</strong>. If you don't want this behaviour use <code>--gui</code>.
+ If you use a command line argument to specify an output file of some kind (<code>‑‑output</code>, <code>‑‑image</code> or <code>‑‑structureimage</code>) then <strong>headless mode will be assumed</strong>. If you don't want this behaviour use <code>‑‑gui</code>.
</td>
</tr>
<tr valign="top">
<td><code>‑‑gui</code></td>
- <td>Force Jalview to run in graphical mode. This can be used to counter the assumption of headless mode when an argument that creates an output file is used. <code>--gui</code> takes precedence over <code>--headless</code>.</td>
+ <td>Force Jalview to run in graphical mode. This can be used to counter the assumption of headless mode when an argument that creates an output file is used. <code>‑‑gui</code> takes precedence over <code>‑‑headless</code>.</td>
</tr>
<tr valign="top">
</tr>
<tr valign="top">
+ <td><code>‑‑javaconsole / ‑‑nojavaconsole</code></td>
+ <td>Show (/ or don't show) the Java Console. Using one of these overrides any saved Preference.</td>
+ </tr>
+
+ <tr valign="top">
<td><code>‑‑questionnaire / ‑‑noquestionnaire</code></td>
<td>Show (/ or don't show) the questionnaire if one is available.</td>
</tr>
<td align="center">✓</td>
</tr>
+ <tr valign="top">
+ <td><code>‑‑mkdirs</code></td>
+ <td>Enable automatic creation of new directories and parent directories for filenames given, or created through substitutions, in <code>‑‑output</code>, <code>‑‑image</code> or <code>‑‑structureimage</code> arguments.
+ <td></td>
+ <td align="center">✓</td>
+ </tr>
+
+
+
+Automatically create directories when outputting a file to a new directory
</table>
<code>biojs</code>.
</td>
<td>
- <code>type=<em>name</em>,
- <code>textrenderer=<em>name</em>,
- <code>scale=<em>number</em>,
- <code>width=<em>number</em>,
- <code>height=<em>number</em>
+ <code>
+ type=<em>name</em>,
+ <br/>
+ textrenderer=<em>name</em>,
+ <br/>
+ scale=<em>number</em>,
+ <br/>
+ width=<em>number</em>,
+ <br/>
+ height=<em>number</em>,
+ <br/>
+ imagecolour=<em>name</em>
+ </code>
+ </td>
+ <td align="center">✓</td>
+ </tr>
+
+ <tr valign="top">
+ <td><code>‑‑structureimage <em>filename</em></code></td>
+ <td>Export an image of a 3D structure opened in JMOL (currently jmol only). Each <code>‑‑structureimage</code> filename will output a file for each <code>‑‑structureimage</code> that has been applied to the open alignment window. In this situation, to avoid overwriting the same file with each structure, additional substitutions <code>{structuredirname}</code>, <code>{structurebasename}</code> and <code>{structureextname}</code> are available being substituted with the directory path, file basename and file extension of each structure file. Image formats can be:
+ <br/>
+ <code>svg</code>,
+ <br/>
+ <code>png</code>,
+ <br/>
+ <code>eps</code>.
+ </td>
+ <td>
+ <code>
+ type=<em>name</em>,
+ <br/>
+ textrenderer=<em>name</em>,
+ <br/>
+ scale=<em>number</em>,
+ <br/>
+ width=<em>number</em>,
+ <br/>
+ height=<em>number</em>,
+ <br/>
+ imagecolour=<em>name</em>
+ <br/>
+ bgcolour=<em>name</em>
+ </code>
</td>
<td align="center">✓</td>
</tr>
<tr valign="top">
<td><code>‑‑type <em>name</em></code></td>
- <td>Set the image format for the preceding <code>‑‑image</code> to <em>name</em>. Valid values for <em>name</em> are:
+ <td>Set the image format for the preceding <code>‑‑image</code> or <code>‑‑structureimage</code> to <em>name</em>. Valid values for <em>name</em> are:
<br/>
<code>svg</code>,
<br/>
<tr valign="top">
<td><code>‑‑textrenderer <em>name</em></code></td>
- <td>Sets whether text in a vector image format (SVG, HTML, EPS) should be rendered as text or vector line-art. Valid values for <em>name</em> are:
+ <td>Sets whether text in a vector image format (SVG, HTML, EPS) should be rendered as text or vector line-art. Applies to the preceding <code>‑‑image</code> or <code>‑‑structureimage</code>. Valid values for <em>name</em> are:
<br/>
<code>text</code>,
<br/>
<tr valign="top">
<td><code>‑‑scale <em>number</em></code></td>
- <td>Sets a scaling for bitmap image format (PNG). Should be given as a floating point number. This can also be set as a sub-value modifier to the <code>--image</code> value. If used in conjunction with <code>--width</code> and <code>--height</code> then the smallest scaling will be used (<code>scale</code>, <code>width</code> and <code>height</code> provide bounds for the image).
+ <td>Sets a scaling for bitmap image format (PNG). Should be given as a floating point number. Applies to the preceding <code>‑‑image</code> or <code>‑‑structureimage</code>. This can also be set as a sub-value modifier to the <code>‑‑image</code> or <code>‑‑structureimage</code> value. If used in conjunction with <code>‑‑width</code> and <code>‑‑height</code> then the smallest size will be used (<code>scale</code>, <code>width</code> and <code>height</code> provide bounds for the image).
</td>
<td></td>
<td align="center">✓</td>
<tr valign="top">
<td><code>‑‑width <em>number</em></code></td>
- <td>Sets a width for bitmap image format (PNG) with the height maintaining the aspect ratio. Should be given as a positive integer. This can also be set as a sub-value modifier to the <code>--image</code> value. If used in conjunction with <code>--scale</code> and <code>--height</code> then the smallest scaling will be used (<code>scale</code>, <code>width</code> and <code>height</code> provide bounds for the image).
+ <td>Sets a width for bitmap image format (PNG) with the height maintaining the aspect ratio. Applies to the preceding <code>‑‑image</code> or <code>‑‑structureimage</code>. Should be given as a positive integer. This can also be set as a sub-value modifier to the <code>‑‑image</code> or <code>‑‑structureimage</code> value. If used in conjunction with <code>‑‑scale</code> and <code>‑‑height</code> then the smallest size will be used (<code>scale</code>, <code>width</code> and <code>height</code> provide bounds for the image).
</td>
<td></td>
<td align="center">✓</td>
<tr valign="top">
<td><code>‑‑height <em>number</em></code></td>
- <td>Sets a height for bitmap image format (PNG) with the width maintaining the aspect ratio. Should be given as a positive integer. This can also be set as a sub-value modifier to the <code>--image</code> value. If used in conjunction with <code>--scale</code> and <code>--width</code> then the smallest scaling will be used (<code>scale</code>, <code>width</code> and <code>height</code> provide bounds for the image).</td>
- <td></td>
- <td align="center">✓</td>
- </tr>
-
- <tr valign="top">
- <td><code>‑‑groovy <em>filename</em></code></td>
- <td>Process a groovy script in the file for the open alignment.</td>
- <td></td>
- <td align="center">✓</td>
- </tr>
-
- </table>
-
-
- <h2><a name="exporting3dstructureimagefiles"></a>Exporting 3D structure image files (<code>jmol</code> only)</h2>
-
- <table border="1" cellpadding="3">
- <tr valign="top">
- <td><strong>argument</strong></td>
- <td><strong>action</strong></td>
- <td><strong>sub-value modifiers</strong> (optional)</td>
- <td><strong>linked</strong> (optional)</td>
- </tr>
-
- <tr valign="top">
- <td><code>‑‑structureimage <em>filename</em></code></td>
- <td>Export an image of a 3D structure opened in JMOL. Image formats can be:
- <br/>
- <code>svg</code>,
- <br/>
- <code>png</code>,
- <br/>
- <code>eps</code>.
- </td>
- <td>
- <code>structureimagetype=<em>name</em>,
- <code>structureimagetextrenderer=<em>name</em>,
- <code>structureimagescale=<em>number</em>,
- <code>structureimagewidth=<em>number</em>,
- <code>structureimageheight=<em>number</em>
- </td>
- <td align="center">✓</td>
- </tr>
-
- <tr valign="top">
- <td><code>‑‑structureimagetype <em>name</em></code></td>
- <td>Set the structure image format for the preceding --structureimage. Valid values are:
- <br/>
- <code>svg</code>,
- <br/>
- <code>png</code>,
- <br/>
- <code>eps</code>.
- </td>
- <td></td>
- <td align="center">✓</td>
- </tr>
-
- <tr valign="top">
- <td><code>‑‑structureimagetextrenderer <em>name</em></code></td>
- <td>Sets whether text in a vector structure image format (SVG, EPS) should be rendered as text or vector line-art. Possible values are:
- <br/>
- <code>text</code>,
- <br/>
- <code>lineart</code>.
- </td>
+ <td>Sets a height for bitmap image format (PNG) with the width maintaining the aspect ratio. Applies to the preceding <code>‑‑image</code> or <code>‑‑structureimage</code>. Should be given as a positive integer. This can also be set as a sub-value modifier to the <code>‑‑image</code> or <code>‑‑structureimage</code> value. If used in conjunction with <code>‑‑scale</code> and <code>‑‑width</code> then the smallest size will be used (<code>scale</code>, <code>width</code> and <code>height</code> provide bounds for the image).</td>
<td></td>
<td align="center">✓</td>
</tr>
<tr valign="top">
- <td><code>‑‑structureimagescale <em>number</em></code></td>
- <td>Sets a scaling for bitmap structure image format (PNG). Should be given as a floating point number. If used in conjunction with --structureimagewidth and --structureimageheight then the smallest scaling will be used (structureimagescale, structureimagewidth and structureimageheight provide bounds for the structure image).
- </td>
+ <td><code>‑‑bgcolour <em>name</em></code></td>
+ <td>Only applies to structure images (opened with <code>jmol</code> structure viewer). Sets the background colour of the preceding <code>‑‑structureimage</code>. <em>name</em> should be either a named colour (e.g. <code>white</code>, <code>cyan</code>) known to Jmol, or can be given as a six digit RGB hex string (e.g. <code>ffffff</code>, <code>00ffff</code>). This can also be set as a sub-value modifier to the <code>‑‑structureimage</code> value.</td>
<td></td>
<td align="center">✓</td>
</tr>
<tr valign="top">
- <td><code>‑‑structureimagewidth <em>number</em></code></td>
- <td>Sets a width for bitmap structure image format (PNG) with the height maintaining the aspect ratio. Should be given as a positive integer. If used in conjunction with --structureimagescale and --structureimageheight then the smallest scaling will be used (structureimagescale, structureimagewidth and structureimageheight provide bounds for the structure image).
- </td>
- <td></td>
- <td align="center">✓</td>
- </tr>
-
- <tr valign="top">
- <td><code>‑‑structureimageheight <em>number</em></code></td>
- <td>Sets a height for bitmap structure image format (PNG) with the width maintaining the aspect ratio. Should be given as a positive integer. If used in conjunction with --structureimagescale and --structureimagewidth then the smallest scaling will be used (structureimagescale, structureimagewidth and structureimageheight provide bounds for the structure image).
- </td>
+ <td><code>‑‑groovy <em>filename</em></code></td>
+ <td>Process a groovy script in the file for the open alignment.</td>
<td></td>
<td align="center">✓</td>
</tr>
<td>
Move on to a new alignment window. This will ensure <code>‑‑append</code> will start a new alignment window and other linked arguments will apply to the new alignment window.
<br/>
- <em>Note</em> that <code>--open</code> already starts a new alignment window for each file it opens.
+ <em>Note</em> that <code>‑‑open</code> already starts a new alignment window for each file it opens.
</td>
</tr>
<tr valign="top">
<td><code>‑‑substitutions / ‑‑nosubstitutions</code></td>
<td>The following argument values allow (or don't allow) subsituting filename parts. This is initially true. Valid substitutions are
+ <br/>
<code>{basename}</code> - the filename-without-extension of the currently <code>‑‑open</code>ed file (or first <code>‑‑append</code>ed file),
<br/>
<code>{dirname}</code>, - the directory (folder) name of the currently <code>‑‑open</code>ed file (or first <code>‑‑append</code>ed file),
+ <code>{extension}</code>, - the extension of the filename of the currently <code>‑‑open</code>ed file (or first <code>‑‑append</code>ed file),
<br/>
<code>{argfilebasename}</code> - the filename-without-extension of the current <code>‑‑argfile</code>,
<br/>
<code>{argfiledirname}</code> - the directory (folder) name of the current <code>‑‑argfile</code>,
<br/>
+ <code>{structurebasename}</code> - the filename-without-extension of the <code>‑‑structure</code> file. Only available to <code>‑‑structureimage</code> .
+ <br/>
+ <code>{structuredirname}</code>, - the directory (folder) name of the <code>‑‑structure</code> file. Only available to <code>‑‑structureimage</code> .
+ <br/>
+ <code>{structureextension}</code>, - the extension of the filename of the <code>‑‑structure</code> file. Only available to <code>‑‑structureimage</code> .
+ <br/>
<code>{n}</code> - the value of the index counter (starting at 0).
<br/>
- <code>{++n}</code> - increase and substitute the value of the index counter,
+ <code>{++n}</code> - increase and substitute the value of the index counter.
+ <br/>
+ <code>{m}</code> - the value of the on-the-fly counter (starting at 0). Only available to <code>‑‑structureimage</code> .
+ <br/>
+ <code>{++m}</code> - increase and substitute the (incremented) value of the on-the-fly counter. Only available to <code>‑‑structureimage</code> .
<br/>
<code>{}</code> - the value of the current alignment window <em>default</em> index.
</td>
<tr valign="top">
<td><code>‑‑allstructures / ‑‑noallstructures</code></td>
<td>
- Apply (or stop applying) the following 3D structure formatting arguments to all structures <em>within the current open alignment</em>. Whilst <code>--allstructures</code> will continue to operate for a <code>--new</code> alignment, the structure formatting arguments must be set again for each new alignment.
+ Apply (or stop applying) the following 3D structure formatting arguments to all structures <em>within the current open alignment</em>. Whilst <code>‑‑allstructures</code> will continue to operate for a <code>‑‑new</code> alignment, the structure formatting arguments must be set again for each new alignment.
</td>
</tr>
</p>
<p>
- These new arguments are all accessed with a <code>--doubledash</code> form of
+ These new arguments are all accessed with a <code>‑‑doubledash</code> form of
command line argument (with the one exception where simply opening one or more
files can be performed without any arguments other than the filenames).
</p>
<p>
However, you cannot mix old and new style arguments, so if you use any
<code>-singledash</code> arguments (with the exception of <code>-help</code> or <code>-h</code>), they will all be interpreted as
- old style arguments with the new <code>--doubledash</code>
+ old style arguments with the new <code>‑‑doubledash</code>
arguments being ignored. If you have a script
that uses the old arguments without any dashes, and uses the bare-word
<code>open</code> then these will also be interpreted as old style arguments.
<li>
For arguments that require a value, the value can be given after an equals-sign ('=') or a space (' ').
<br/>
- <code>--arg value</code>
+ <code>‑‑arg value</code>
<br/>
- <code>--arg=value</code>
+ <code>‑‑arg=value</code>
</li>
<li>
For arguments that can take multiple values (these will be filenames), the multiple filenames should appear after a space. If you use a filename wildcard you can put this after a space (which will be expanded by the shell unto multiple filenames before they reach Jalview), or you can put it after an equals-sign, which will be used by Jalview to find a list of files. You cannot use an equals-sign and value followed by further values.
<br/>
- <code>--arg file1.fa otherfile.stk</code>
+ <code>‑‑arg file1.fa otherfile.stk</code>
<br/>
- <code>--arg filename*.fa</code> <em>(filenames expanded by shell)</em>
+ <code>‑‑arg filename*.fa</code> <em>(filenames expanded by shell)</em>
<br/>
- <code>--arg=filename*.fa</code> <em>(filenames expanded by Jalview)</em>
+ <code>‑‑arg=filename*.fa</code> <em>(filenames expanded by Jalview)</em>
</li>
<li>
For arguments that act as a switch, most can be negated by preceding the argument name with <code>no</code>.
<br/>
- <code>--switch</code>
+ <code>‑‑switch</code>
<br/>
- <code>--noswitch</code>
+ <code>‑‑noswitch</code>
</li>
<li>
- Some values can be modified, or may need additional information (for instance an <code>--image</code> output can be modified with a <code>--scale=number</code> factor, or a <code>--structure</code> can refer to a sequence with a <code>--seqid=ID</code>). This additional information can be added in a number of different ways.
+ Some values can be modified, or may need additional information (for instance an <code>‑‑image</code> output can be modified with a <code>‑‑scale=number</code> factor, or a <code>‑‑structure</code> can refer to a sequence with a <code>‑‑seqid=ID</code>). This additional information can be added in a number of different ways.
<ul>
<li>
An argument immediately following the main argument.
<br/>
- <code>--image output.png --scale 2.5</code>
+ <code>‑‑image output.png --scale 2.5</code>
</li>
<li>
A <em>sub-value modifier</em>, which is where one or more (comma-separated) values are added to the start of the main value, placed in square brackets.
<br/>
- <code>--open=[nowrap,colour=gecos-blossom]uniref50.fa</code>
+ <code>‑‑open=[nowrap,colour=gecos-blossom]uniref50.fa</code>
<br/>
Sub-value modifiers with a value must use an equals-sign separator, and those that act as a switch can simply be included without an equals-sign or value, and can be preceded with <code>no</code> to negate the value, as with the argument name.
</li>
<li>
Another argument with the same <em>linked ID</em>. A linked ID is an optional identifier for a particular open alignment, placed in square brackets immediately following the argument name (before the equals-sign or space). If linked IDs are specified they do not need to be near to each other.
<br/>
- <code>--image[MYID]=output.png --other --args --scale[MYID]=2.5</code>
+ <code>‑‑image[MYID]=output.png --other --args --scale[MYID]=2.5</code>
</li>
<li>
An argument that is designated as applying to <em>all linked IDs</em>
<br/>
- <code>--image=output.png --other --args --all --scale=2.5</code>
+ <code>‑‑image=output.png --other --args --all --scale=2.5</code>
<br/>
- <code>--image=output.png --other --args --scale[*]=2.5</code>
+ <code>‑‑image=output.png --other --args --scale[*]=2.5</code>
</li>
</ul>
</li>
<h2><a name="headlessmode"></a>Headless mode</h2>
<p>
- Jalview can be run in headless mode, i.e. without the usual graphical user interface (GUI), by specifying the <code>--headless</code> argument. With command line arguments you can specify operations for Jalview to perform on one or more files and then stop running. Most likely you will want to output another file, either an alignment for image file.
+ Jalview can be run in headless mode, i.e. without the usual graphical user interface (GUI), by specifying the <code>‑‑headless</code> argument. With command line arguments you can specify operations for Jalview to perform on one or more files and then stop running. Most likely you will want to output another file, either an alignment for image file.
</p>
<p>
- <strong>If you specify an argument for an output file</strong> (one or more of <code>--output</code>, <code>--image</code> or <code>--structureimage</code>) then it will be assumed that you wish to <strong>run in headless mode</strong>.
+ <strong>If you specify an argument for an output file</strong> (one or more of <code>‑‑output</code>, <code>‑‑image</code> or <code>‑‑structureimage</code>) then it will be assumed that you wish to <strong>run in headless mode</strong>.
</p>
<p>
- You can force Jalview to run in graphical mode using the <code>--gui</code> argument.
+ You can force Jalview to run in graphical mode using the <code>‑‑gui</code> argument.
</p>
<p>
* The Jalview Authors are detailed in the 'AUTHORS' file.
-->
<head>
-<title>Groovy Shell</title>
+<title>Groovy Console</title>
</head>
<body>
<p>
- <strong>The Groovy Shell</strong>
+ <strong>The Groovy Console</strong>
</p>
<p>
Groovy (<a href="http://www.groovy-lang.org/">www.groovy-lang.org</a>)
short pause, you should then see the <a
href="https://groovy-lang.org/groovyconsole.html">Groovy
Console</a> appear. This allows you to interactively execute Groovy
- scripts whilst Jalview is running. We've also provided a <strong>Calculations→Execute
- Groovy Script</strong> button so you can execute the currently loaded
+ scripts whilst Jalview is running. We've also provided a <strong>Calculations→Run
+ Groovy Console Script</strong> button so you can execute the currently loaded
groovy script whilst viewing an alignment.
</p>
<p>
we recommend you also take a look at Jalview's source, since all the
public methods of the jalview class hierarchy can be called from
Groovy scripts. In addition, the following objects are also defined:
+ </p>
-
-
<ul>
- <li><strong>Jalview</strong> - this is bound to <code>jalview.bin.Jalview</code>.<br />Useful
- methods include:
+ <li><strong>Jalview</strong> - this is bound to <code>jalview.bin.groovy.JalviewObject</code> providing access to the following useful
+ methods:
<ul>
<li>Jalview.getAlignFrames() - returns a list of
jalview.gui.AlignFrame objects</li>
<li>Jalview.getCurrentAlignFrame() - returns the alignment
- window which is currently being looked at by the user</li>
+ window which has most recently been in focus. If you change focus to another alignment window then re-running <code>Jalview.getCurrentAlignFrame()</code> will return the new <code>AlignFrame</code>.</li>
</ul></li>
- <li><strong>currentAlFrame</strong> - this is only defined when
- running a Groovy script via the --groovy command line argument. It
- returns the first alignment window created after acting on the
- other arguments passed on the command line.</li>
+ <li><strong>currentAlFrame</strong> When used on the command line this refers to the current opened alignment.
+ <br/>
+ When used from the Groovy Console, it refers to the alignment that was in focus when the Groovy Console was opened.
+ <br/>
+ When a Groovy Console script is run from <em>Calculate</em>-><em>Run Groovy Console Script</em>, <code>currentAlFrame</code> us updated to that alignment.</li>
</ul>
<p>
+ If you specify a <code>--groovy</code> argument before an <code>--open</code> argument
+ then you should ensure your script doesn't refer to <code>currentAlFrame</code>.
+ <p>
+
+ <p>
<em>A simple script</em><br />
<ul>
<li>Getting the title, alignment and first sequence from the
current alignFrame<br> <pre>
-def alf = Jalview.getAlignFrames();
-print alf[0].getTitle();
-def alignment = alf[0].viewport.alignment;
+def al = Jalview.getCurrentAlignFrame();
+print al.getTitle();
+def alignment = al.viewport.alignment;
def seq = alignment.getSequenceAt(0);
</pre>
</li>
<li><strong>Show Chains<br>
</strong><em>Select which of the PDB file's chains are to be
displayed.</em></li>
- <li><strong>Colour by ..<br></strong><em>Submenu
+ <li><strong>Ligands<br>
+ </strong><em>When available, allows the display of all, none or specific
+ ligands (also known as HETATM groups) in the Jmol view, using CPK
+ spacefilling.</em></li>
+ <li><strong>Colour by ..<br></strong><em>Submenu
allowing specific alignment views to be selected for
colouring associated chains in the structure display. This
menu contains all the alignment views associated with the
--- /dev/null
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Working with PAE Matrices in Jalview</title>
+</head>
+
+<body>
+ <p>
+ <strong>Working with Predicted Alignment Error Matrices in
+ Jalview</strong>
+ </p>
+
+ <p>Predicted Alignment Error (PAE) matrices are produced by
+ deep-learning based 3D-structure prediction pipelines such as
+ AlphaFold. They reflect how reliably two parts of a model have been
+ positioned in space, by giving for each residue the likely error (in
+ Ångstroms) between that residue and every other modelled
+ position the pair of residues' real relative position, if the model
+ and real 3D structure were superimposed at that residue.</p>
+ <p>
+ Jalview visualises PAE matrices as an alignment annotation track,
+ shaded from dark green to white, similar to the encoding used on the
+ EBI-AlphaFold website (see <a
+ href="https://alphafold.ebi.ac.uk/entry/O04090">O04090 3D model</a>
+ at EBI-AlphaFoldDB).
+ </p>
+ <div style="display: flex; flex-wrap: wrap;" align="center"
+ width="100%">
+ <figure>
+ <img src="../structures/epas1_annotdetail.png" height="300" />
+ <figcaption>
+ Alignment of EPAS1 homologs from Human, Rat and Cow<br />with
+ predicted alignment error shown for Human
+ </figcaption>
+ </figure>
+ <figure>
+ <img src="../structures/epas1_pae_ebiaf.png" height="300" />
+ <figcaption>
+ Predicted Alignment Error for Human EPAS1<br />from <a
+ href="https://alphafold.ebi.ac.uk/entry/Q99814">https://alphafold.ebi.ac.uk/entry/Q99814</a>
+ </figcaption>
+ </figure>
+ </div>
+ <p>
+ <strong>Importing PAE Matrices</strong>
+ </p>
+ <p>
+ Jalview retrieves PAE matrices when importing predicted 3D structures
+ from the EBI-AlphaFold database via <a
+ href="../features/structurechooser.html">Jalview's structure
+ chooser</a> GUI. If you have produced your own models and accompanying
+ PAE matrices using a pipeline such as ColabFold, then you can load
+ them both together via the <a
+ href="../features/structurechooser.html#loadpdbfile">Load PDB
+ File</a> dropdown menu in the 3D structure chooser, providing it is in a
+ <a href="../io/paematrixformat.html">supported PAE format</a>.
+ </p>
+ <p>
+ The <a href="../features/clarguments-basic.html">Command Line
+ Interface</a> also provides a options for importing PAE matrices along
+ side models, enabling the automated production of alignment figures
+ annotated with PAE matrices and PLDDT scores.
+ </p>
+ <p>
+ <strong>Showing PAE Matrix Annotations </strong>
+ </p>
+ <p>
+ When viewing 3D structures from the EBI-AlphaFold database or local 3D
+ structures with an associated PAE file, the PAE is imported as <i>Reference
+ Annotation</i>, which is not always automatically added to the alignment
+ view.
+ </p>
+ <p>To show the PAE, right click the sequence and locate the 'Add
+ Reference Annotation' entry in the Sequence ID submenu, or select all
+ sequences and locate the option in the Selection submenu. You can do
+ this in any alignment window (or view) where a sequence with
+ associated PAE data appears.</p>
+ <p>
+ <strong>Adjusting the height of PAE matrix annotations</strong>
+ </p>
+ <p>
+ PAE annotations behave in the same way as Jalview's line graph and
+ histogram tracks. Click+dragging up and down with the left (select)
+ mouse button held down will increase or decrease the height of the
+ annotation. You can also hold down <strong><em>SHIFT</em></strong>
+ whilst doing this to adjust the height of all PAE rows at once.
+ </p>
+ <p>PAE matrix annotation rows behave like any other sequence
+ associated annotation, with the following additional features:</p>
+ <ul>
+ <li>The vertical axis of the PAE heatmap is mapped to positions
+ on the linked 3D structure.
+ <ul>
+ <li>Mousing over the matrix shows a tooltip giving information
+ on the range of values under the mouse.<br />Positions in the
+ associated 3D structure are also highlighted in any linked views.
+ </li>
+ <li>Clicking on positions in the matrix selects columns of the
+ alignment corresponding to the row and column in the matrix.</li>
+ </ul>
+ </li>
+ <li>Rectangular selections (created by Cmd (or Alt)+Click
+ dragging on the matrix) can be created to select multiple ranges of
+ columns at once.</li>
+ <li>Columns corresponding to adjacent regions with similarly low
+ levels of predicted alignment error can be selected by Ctrl+Clicking
+ on a region in the matrix.</li>
+ <li>Columns of an alignment showing a PAE matrix can be grouped
+ and selected by clustering the matrix.</li>
+ </ul>
+ <p>
+ <strong><a name="clustering">Clustering PAE Matrices</a></strong>
+ </p>
+ <p>PAE matrices are useful for identifying regions of 3D structure
+ predictions that are likely to be positioned in space in the same or
+ similar way as shown in the predicted structure data. Regions of low
+ PAE often correlate with high alphafold reliability (PLDDT) scores,
+ but also complement them since they highlight well-folded regions such
+ as domains, and how well those regions have been predicted to be
+ positioned relative to eachother, which is important when evaluating
+ whether domain-domain interactions or other contacts can be trusted.</p>
+ <p>To make it more easy to identify regions of low PAE, Jalview can
+ cluster the PAE matrix, allowing columns of the matrix to be grouped
+ according to their similarity, using an Average Distance (UPGMA) tree
+ algorithm and the sum of differences between each column's PAE values.</p>
+ <p>
+ <strong><em>dist<sub>ij</sub></em> = ∥ <em><u>p</u><sub>i</sub>-<u>p</u><sub>j</sub></em>
+ ∥</strong>
+ </p>
+ <p>
+ To create a PAE matrix tree, right click on a PAE annotation's label
+ to open the annotation popup menu, and select <strong><em>Cluster
+ Matrix</em></strong>. Once the calculation has finished, a tree viewer will open,
+ and columns of the matrix are then partitioned into groups such that
+ the third left-most node from the root is placed in its own group.
+ Colours are randomly assigned to each group, and by default these will
+ also be overlaid on the matrix annotation row.
+ <p>
+ <ul>
+ <li>The PAE matrix tree viewer behaves like other tree views in
+ Jalview, except selecting nodes or groups of nodes in the tree select
+ columns in the alignment rather than sequences, and clicking adjust
+ the matrix's partition.</li>
+ <li>Only one tree and clustering can be defined for a PAE matrix,
+ regardless of whether it is displayed in different views or
+ alignments.</li>
+ <li>Double clicking on a position in the PAE annotation where a
+ clustering has been defined will select both the row and column
+ clusters for the clicked position. This makes it easy to select
+ clusters corresponding to pairs of interacting regions.</li>
+ <li>Cluster colours for a PAE matrix can be used to colour
+ sequences or columns of the alignment via the <strong><em><a
+ href="../colourSchemes/annotationColouring.html">Colour by
+ Annotation.. dialog</a></em></strong>
+ (opened by right-clicking the annotation label
+ and selecting from the popup menu).
+ </li>
+ </ul>
+ <p>
+ <strong>PAE matrices and Jalview Projects</strong>
+ </p>
+ <p>Any PAE matrices imported to Jalview are saved along side any
+ trees and clustering defined on them in Jalview Projects.</p>
+ <p>
+ <em>Support for visualision and analysis of predicted alignment
+ error matrices was added in Jalview 2.11.3. </em>
+ </p>
+</body>
+</html>
</p>
<p>The search box is displayed by pressing Control and F or
selecting "Find..." from the "Search" menu.</p>
- <img src="search.png" width="400" height="152">
+ <img src="search.png" height="152">
<p>"Find next" will find the next occurrence of the
query and adjust the alignment window view to show it, and
"Find all" highlights all matches for a query. The
<ul>
<li>The search uses regular expressions. (understands a mixture
of posix and perl style regex - see below for a summary)</li>
- <li>Gaps are ignored when matching the query to the sequences
- in the alignment.</li>
- <li>Hidden columns can optionally be ignored (<em>since Jalview 2.11</em>)</li>
- <li>The search is applied to both sequences and their IDs. It can
- optionally also be applied to the description string (<em>since Jalview
- 2.10</em>), and sequence feature descriptions (<em>since Jalview 2.11.2.5</em>).
- </li>
- <li>If a region is selected, then search will <strong>only</strong>
+ <li>If a region is selected, then search will <strong>only</strong>
be performed on that region.<br />
<em>Tip: to quickly clear the current selection, click the
alignment view you wish to search, then press 'Escape'.</em>
</li>
+ <li>Gaps are ignored when matching the query to the sequences
+ in the alignment.</li>
+ <li>Hidden columns can optionally be ignored (<em>since Jalview 2.11</em>)</li>
+ <li>The search is applied to both sequences and their IDs. <br />
+ Check boxes also enable searching of:
+ <ul>
+ <li><strong>Sequence description</strong> (<em>since Jalview 2.10</em>)
+ </li>
+ <li><strong>Sequence Feature</strong> type and description for currently displayed features (<em>since Jalview
+ 2.11.3.0</em>)
+ </li>
+ </ul>
+ </li>
<li>Tick the "Match Case" box to perform a case
sensitive search.</li>
<li>To access a <a href="#queryhistory">previously used
<strong>Copying highlighted regions to a new alignment</strong>
</p>
<p>
- You can copy the currently highlighted matching regions of sequences to the clipboard with alt-Command-C.
+ Press <strong>Copy</strong> button or type Ctrl (Cmd on OSX) + Shift +
+ C to copy highlighted search results to the clipboard, enabling them
+ to be pasted to a new alignment (via Shift+Ctrl (or Cmd) + V).
</p>
- <p>
+ <p>
<strong>A quick Regular Expression Guide</strong>
</p>
style="width: 464px; height: 173px;"> <br /> <strong>Manual
selection/association of PDB files with Sequences</strong>
</p>
- <p>To manually associate PDB files with a sequence, select 'From
- File', or 'Enter PDB Id' from the drop-down menu:
- <ul>
- <li><strong>From File</strong> - allows you to load a PDB file
- from the local machine or network and associate it with the
- selected sequence. PDB files associated in this way will also be
- saved in the <a href="jalarchive.html">Jalview Archive file</a>.<br></li>
- <li><strong>Enter PDB Id</strong> - allows you specify a PDB ID
- for your sequence. The PDB Rest API, provided by EMBL-EBI, is used
- to validate and fetch structure data.<br></li>
- </ul>
-
- <p>
- <em>The Structure Chooser interface was introduced in Jalview
- 2.9. </em>
- </p>
+ <p>
+ <strong>Manual Association of PDBe accessions with sequences</strong>
+ </p>
+ <p>If for some reason the PDBe and 3D beacons search fail to
+ automatically the PDB structure or model you wish to import, you can
+ select 'Enter PDB Id' from the drop-down menu to manually specify PDB
+ identifiers for one or more selected sequences. The PDB Rest API,
+ provided by EMBL-EBI, is used to validate accessions exist, and fetch
+ structure data.</p>
+ <p>
+ <strong><a name="loadpdbfile">Import structure models
+ and metadata from file</a></strong>
+ </p>
+ <p>
+ Selecting the <strong>From File</strong> option from the drop down
+ menu allows 3D structure data to be imported from your own computer.
+ PDB or mmCIF files associated in this way are also saved in <a
+ href="jalarchive.html">Jalview Projects</a>. <br /> <img
+ src="local-pdb-import.png" style="width: 330px; height: 321px;"><br />
+ The 'From File' dialog provides a drop down menu which allows you to
+ specify how the Temperature Factor metadata for each residue in the 3D
+ structure data file is interpreted:
+
+ <ul>
+ <li>Default - Jalview will try to automatically determine whether
+ to show as 'Temperature Factor', 'AlphaFold Reliability' or 'Model
+ Quality'</li>
+ <li>PLDDT - Model has PLDDT scores in the temperature factor
+ column.</li>
+ </ul>
+ <p>
+ An additional <em>Predicted Alignment Error</em> file can also be
+ provided when importing 3D structure data. Jalview supports import of
+ PAE Matrices provided as <a href="../io/paematrixformat.html">AlphaFold
+ format JSON files</a> - which are also produced by ColabFold. See <a
+ href="paematrices.html">Working with PAE Matrices</a> for details on
+ what Jalview allows you to do with associated PAE matrix data.
+ </p>
+ <p>
+ <em>The Structure Chooser interface was introduced in Jalview
+ 2.9. </em>
+ </p>
</body>
</html>
<strong>Structure Viewers in the Jalview Desktop</strong><br /> The
<a href="jmol.html">Jmol viewer</a> has been included since Jalview
2.3. Jalview 2.8.2 included support for <a href="chimera.html">Chimera</a>,
- provided it is installed and can be launched by Jalview. ChimeraX and PyMOL
+ provided it is installed and can be launched by Jalview. ChimeraX and <a href="pymol.html">PyMOL</a>
support is included from Jalview 2.11.2. The default
viewer can be configured in the <a href="preferences.html#structure">Structure
tab</a> in the <strong>Tools→Preferences</strong> dialog box.
un-tick the <strong>Superpose Structures</strong> checkbox.
</p>
- <p>
- <em>Superposing structures</em><br/>Jalview superposes structures using
- the visible portions of any associated sequence alignments. A
- message in the structure viewer's status bar will be shown if not
- enough aligned columns were available to perform a superposition.
- </p>
- <p>
- See the <a href="jmol.html">Jmol
- </a> and <a href="chimera.html">Chimera</a> help pages for
- more information about their capabilities.</p>
-
-
- <p>
+ <p>
+ <em>Superposing structures</em><br />Jalview superposes structures
+ using the currently selected columns (if more than 3 columns are
+ selected), or the visible portions of any associated sequence
+ alignments. Depending on the viewer, Root Mean Squared Deviation (RMS
+ or RMSD) for each pair of superpositions may be output in the
+ structure viewer's console.
+ </p>
+ <p>A message in the structure viewer's status bar will be shown if
+ not enough aligned columns were available to perform a superposition.
+ </p>
+ <p>
+ See the <a href="jmol.html">Jmol</a>, <a href="chimera.html">Chimera/X</a>
+ and <a href="pymol.html">Pymol</a> help pages for more information
+ about their individual capabilities.
+ </p>
+ <p>
<strong>Retrieving sequences from the PDB</strong><br>You can
retrieve sequences from the PDB using the <a
href="pdbsequencefetcher.html">Sequence Fetcher</a>. The sequences
<li>Copy and paste it into the groovy script console</li>
<li>Load the example Feredoxin project (the one that opens by
default when you first launched Jalview)</li>
- <li>Select <strong>Calculations→Execute Groovy
+ <li>Select <strong>Calculations→Run Groovy Console
Script</strong> from the alignment window's menu bar to run the script on
the current view.
</li>
--- /dev/null
+<html>
+<!--
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ -->
+<head>
+<title>Supported Formats for Predicted Alignment Error Matrices</title>
+</head>
+
+<body>
+ <p>
+ <strong>Supported Formats for Predicted Alignment Error
+ Matrices</strong>
+ </p>
+ <p>
+ Predicted Alignment Error matrices are square matrices produced as
+ part of deep-learning based 3D-structure prediction pipelines such as
+ AlphaFold. They can be imported via <a
+ href="../features/structurechooser.html">Jalview's structure
+ chooser</a> GUI and the <a href="../features/clarguments-basic.html">Command
+ Line Interface</a>. See <a href="../features/paematrices.html">Working
+ with PAE Matrices</a> for information on how they are visualised and
+ analysed in Jalview.
+ </p>
+ <p>
+ <strong>Supported Formats</strong>
+ </p>
+ <p>Jalview supports import of PAE matrix data as provided by the
+ EBI-AlphaFold database. This resource provides PAE matrices as a JSON
+ files structured in one of the following ways:</p>
+ <pre>
+ # Version 1 format PAE file - deprecated 28th July 2022
+ {
+ residue1:[1,1,... total number of residues]
+ residue2:[1,2,... total number of residues]
+ distance:[0.1,0.3,... list of PAE matrix elements as doubles]
+ }
+ </pre>
+ <pre>
+ # Version 2 format PAE file - see https://alphafold.ebi.ac.uk/faq
+ {
+ max_predicted_alignment_error: 4.0, # may also be max_pae
+ predicted_alignment_error: [[1,2,0,0,3,...],...] # may also be pae
+ }
+ </pre>
+ <p>
+ Variants of the version 2 format include using 'pae' instead of
+ 'predicted_alignment_error' in the names of keys. Jalview copes both.<br />
+ Once imported, Jalview stores PAE matrices as float arrays along with
+ any associated tree and partition set resultant from clustering the
+ matrix. <br/><br/><em>PAE Matrix import support was added in Jalview 2.11.3
+ </em>
+ </p>
+</body>
+</html>
highly variable regions.</em></li>
<li>
+ </li>
<li><strong>Copy Consensus Sequence</strong><br>
Copies the consensus sequence to the clipboard in Fasta
format, to allow the consensus sequence to be added to an
---
version: 2.11.3.0
-date: 2023-07-19
+date: 2023-10-25
channel: "release"
---
## New Features
- <!-- JAL-4064 --> Native M1 build for macOS using Adoptium JRE 11 macos-aarch64
-- <!-- JAL-4054 --> Installers built with install4j10
-- <!-- JAL-3676 --> Allow log level configuration via Jalview's Java Console, and a Copy to Clipboard button
-- <!-- JAL-3416 --> FlatLAF default look and feel on Linux, OSX and everywhere else
-
+- <!-- JAL-3416 --> Jalview now uses a standard 'look and feel' (FlatLaf) on Linux, OSX and everywhere else
- <!-- JAL-4019 --> Ambiguous Base Colourscheme
- <!-- JAL-4061 --> Find can search sequence features' type and description
- <!-- JAL-4062 --> Hold down Shift + CMD/CTRL C to copy highlighted regions as new sequences
-- <!-- JAL-1556 --> Quickly enable select and/or colour by for displayed annotation row via its popup menu
+- <!-- JAL-1556 --> Quickly enable select and/or colour by for displayed annotation row via annotation panel popup menu
- <!-- JAL-4094 --> Shift+Click+Drag to adjust height of all annotation tracks of same type
- <!-- JAL-4190 --> Pressing escape in tree panel clears any current selection
-
- <!-- JAL-4089 --> Use selected columns for superposition
- <!-- JAL-4086 --> Highlight aligned positions on all associated structures when mousing over a column
-
- <!-- JAL-4221 --> sequence descriptions are updated from database reference sources if not already defined
- <!-- JAL-4273 --> Visible adjuster marks to grab and adjust annotation panel height and id width
- <!-- JAL-4260 --> Adjustable ID margin when alignment is wrapped
-
- <!-- JAL-4274 --> Command line options and configurable bitmap export preferences for height, width and scale factor
+- <!-- JAL-4307 --> Show or hide ligands in a Jmol structure view via View Ligands submenu
### Improved support for working with computationally determined models
-
- <!-- JAL-3895 --> Alphafold red/orange/yellow/green colourscheme for structures
- <!-- JAL-4095 --> Interactive picking of low pAE score regions
- <!-- JAL-4027 --> contact matrix datatype in Jalview
- <!-- JAL-4033 --> Selections with visual feedback via contact matrix annotation
-
- <!-- JAL-3855 --> Discover and import alphafold2 models and metadata from https://alphafold.ebi.ac.uk/
-
- <!-- JAL-4091 --> Visual indication of relationship with associated sequence to distinguish different sequence associated annotation rows
- <!-- JAL-4123 --> GUI and command line allows configuration of how temperature factor in imported 3D structure data should be interpreted
- <!-- JAL-3914 --> Import model reliability scores encoded as temperature factor annotation with their correct name and semantics
- <!-- JAL-4124 --> Store/Restore PAE data and visualisation settings from Jalview Project
- <!-- JAL-4083 --> Multiple residue sidechain highlighting in structure viewers from PAE mouseovers
-
### Jalview on the command line
-
-- <!-- JAL-4160,JAL-629 --> New command line argument framework allowing flexible batch processing, figure generation, and import of structures, pae matrices and other sequence associated data
+- <!-- JAL-4160,JAL-629,JAL-4262,JAL-4265, --> New command line argument framework allowing flexible batch processing, import of structures, pae matrices and other sequence associated data, and alignment and structure figure generation.
+- <!-- JAL-3830 --> Command-line wrapper script for macOS bundle, linux and Windows installations (bash, powershell and .bat wrappers)
- <!-- JAL-4121 --> Assume --headless when jalview is run with a command line argument that generates output
- <!-- JAL-244 --> Automatically adjust Left margin on import to avoid cropping of annotation labels & sequence IDs
- <!-- JAL-901 --> Specify alignment title on import via --title argument
+- <!-- JAL-4195,JAL-4194,JAL-4193 --> sensible responses from the CLI when things go wrong during image export
+- Add a command line option to set Jalview properties for this session only
+- Add a command line option to suppress opening the startup file for this session
### Other improvements
-
-
- <!-- JAL-4250 --> Secondary structure annotation glyphs are rendered anti-aliasing when enabled
- <!-- JAL-325 --> Helix and Sheet glyphs vertically centered with respect to grey coil secondary structure annotation track
- <!-- JAL-4253 --> Lower line of the sequence group border does not align with vertical and background residue box
- <!-- JAL-3119 --> Name of alignment and view included in overview window's title
- <!-- JAL-4213 --> "add reference annotation" add all positions in reference annotation tracks, not just positions in the currently highlighted columns/selection range
- <!-- JAL-4119 --> EMBL-EBI SIFTS file downloads now use split directories
-
-- <!-- JAL-4195,JAL-4194,JAL-4193 --> sensible responses from the CLI when things go wrong during image export
-Add a command line option to set Jalview properties for this session only
-Add a command line option to suppress opening the startup file for this session
-
-
-JAL-4187 Powershell launcher script fails when given no arguments with the old ArgsParser
-
-known issue ? <!-- JAL-4127 --> 'Reload' for a jalview project results in all windows being duplicated
-
-
-- <!-- JAL-3830 --> Command-line wrapper script for macOS bundle, linux and Windows installations (bash, powershell and .bat wrappers)
- <!-- JAL-3820 --> In Linux desktops' task-managers, the grouped Jalview windows get a generic name
- <!-- JAL-4206 --> Improved file chooser's 'recent files' view and added filter for 'All known alignment files'
- <!-- JAL-4206 --> Relative files added to recent files list via import from command line are selected when Jalview opened from same location
-
-
-## Still in progress (delete on release)
-
-- <!-- JAL-2382 --> Import and display sequence-associated contact predictions in CASP-RR format
-- <!-- JAL-2349 --> Contact prediction visualisation
-- <!-- JAL-2348 --> modularise annotation renderer
+- <!-- JAL-4308 --> Reduce number of database crossreferences shown in tooltip
+- <!-- JAL-3676 --> Allow log level configuration via Jalview's Java Console, and a Copy to Clipboard button
### Development and Deployment
-
+- <!-- JAL-4054 --> Installers built with install4j10
- <!-- JAL-4167 --> Create separate gradle test task for some tests
- <!-- JAL-4212 --> Prevent gradle test on macOS continuously grabbing focus
- <!-- JAL-4111 --> Allow gradle build to create suffixed DEVELOP-... builds with channel appbase
- <!-- JAL-4243 --> Jalview bio.tools description maintained under jalview's git repo and bundled with source release
-
## Issues Resolved
- <!-- JAL-2961 --> Jmol view not always centred on structures when multiple structures are viewed
- <!-- JAL-3776 --> Cancelling interactive calculation leaves empty progress bar.
- <!-- JAL-4189 --> macOS Dock and KDE taskbar names Jalview icon "java" when running
- <!-- JAL-2910 --> HeadlessException in console in headless mode (actually fixed in 2.11.{0,1,2))
-
## New Known defects
+- <!-- JAL-4303 --> EBI-AlphaFold PLDDT colours cannot be overlaid on alignment via 'Colour by annotation' unless the alignment's colourscheme has been set to 'None' via the Colours menu.
+- <!-- JAL-4302 --> Tree renderer doesn't show bottom-most leaves of tree when Fit-To-Window is enabled.
- <!-- JAL-4178 --> Cannot cancel structure view open action once it has been started via the structure chooser dialog
- <!-- JAL-4142 --> Example project's multiple views do not open in distinct locations when eXpand views is used to show them all separately
+- <!-- JAL-4127 --> 'Reload' for a jalview project results in all windows being duplicated
- <!-- JAL-4165 --> Missing last letter when copying consensus sequence from alignment if first column is hidden
- <!-- JAL-4261 --> Last sequence ID in alignment not shown and annotation labels are misaligned in HTML export
- <!-- JAL-3024 --> Files opened via command line with a relative path are added as relative paths to Recent files list (since 2.0.x)
+- <!-- JAL-4291 --> Test coverage for ID width adjustment disabled pending fix for new annotation label geometry and width calculation
-The 2.11.3 series includes support for in-depth exploration of predicted alignment error matrices from AlphaFold in the context of multiple alignments, along with support for standard colourschemes for shading models according to their pLDDT.
+The 2.11.3 Jalview release features a new and more powerful command line interface, support for in-depth exploration of predicted alignment error (PAE) matrices from AlphaFold in the context of multiple alignments, AlphaFold's standard Blue-Orange-Red confidence colourscheme, and a host of [minor improvements and bug fixes](releases.html#Jalview.2.11.3.0)
-We're launching this release at ISMB 2023 - come find us !
+**Interactive exploration of AlphaFold Predicted Alignment Error Matrices**
-It also introduces new support for native ARM-based OSX architectures, and a few other goodies!
+Predicted alignment error (PAE) matrices are JSON files produced by AlphaFold and other 3D structure prediction tools, which reflect how well any two positions in a predicted structure are positioned correctly relative to each other. Jalview automatically imports PAE matrices when retrieving protein structures from the EBI-AlphaFold database. A PAE matrix file can also be provided when manually importing 3D structure data.
+Once imported, PAE matrices are shown in annotation tracks as a heat map shaded pale to dark green, where darker shades indicate higher confidence in relative positioning. Right-clicking a PAE Matrix's annotation label provides the option to cluster the columns of the matrix, producing a tree where regions of well arranged structure are grouped together, allowing columns containing those regions to be selected and manipulated further.
+
+**Jalview's Next Generation Command Line Interface**
+
+Jalview 2's original command line interface (CLI) allowed alignments to be imported, annotated and overlaid with sequence features, coloured, associated with trees, and exported either as figures (EPS, PNG, SVG, HTML SVG or an interactive BioJS page) or with one of Jalview's supported alignment export file formats. The new command line interface provides all this, as well as a range of additional functionality previously only available via the GUI:
+
+ * 3D structures can be associated with sequences in alignments and shown in Jmol or external viewers
+ * Secondary structure, Model Reliability and Temperature factor can be shown and used to colour alignments
+ * PAE Matrices can be imported and shown as annotation
+ * 3D structure data shown in Jmol can be exported as PNG
+ * Scale factors and dimensions can be specified, allowing high resolution image exports
+
+In addition to these new functionality, next generation CLI operations can be applied to a range of files and directories through the use of wild-cards. This allows faster and more efficient processing of large numbers of alignments. It also facilitates modularisation of operations through the use of ['command-line argument files'](features/clarguments-argfiles.html).
+
+All new CLI parameters are preceded by '--', as opposed to an optional single '-' which was used in Jalview's old CLI. Old style arguments can still be used, so existing scripts will still work as before, but old-style operations cannot be mixed with new operations in the same CLI call. Use of old command line operations will also raise a warning, and we plan to completely remove support in Jalview's next major release (2.12).
+
+As usual, please let us via [Jalview's Discussion forum](https://discourse.jalview.org) of any issues you encounter using the new CLI, and of course any requests for improvement or new functionality !
<strong>Welcome to Jalview Version __VERSION__ (released __DISPLAY_DATE__)!!</strong><br/>
</p>
__WHATS_NEW__
- <p>
- The 2.11.2 release series provides support for two popular 3D
- structure visualisation tools, new features for discovery of 3D
- structures, improved platform integration and a new command line
- tool allowing Jalview to be more easily called from scripts.</p>
-
- <p>
- <strong>View predicted protein structures via 3D-Beacons</strong> <br>
- Jalview 2.11.2's <a href="features/structurechooser.html">Structure
- Chooser includes a client for the 3D-Beacons Network</a>. Launched in
- 2021, the 3D-Beacons network (<a
- href="https://www.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/">www.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/</a>)
- provides a central point for the retrieval of predicted and observed
- 3D structures for sequences in Uniprot, including homology models
- from Swiss-model and deep learning based predictions from the EBI's
- Alphafold database (Orengo et al. 2020, <a
- href="https://doi.org/10.12688/f1000research.20559.1">doi:10.12688/f1000research.20559.1</a>).<br>
- </p>
-
- <p>
- <strong>Support for viewing structures with ChimeraX and
- Pymol</strong><br> Jalview's 3D structure viewer system has been
- re-architected to allow easier integration of external structure
- viewers, and takes advantage of the strucViz2 Chimera communications
- library developed by Scooter Morris (<a
- href="https://doi.org/10.1093/bioinformatics/btm329">doi:10.1093/bioinformatics/btm329</a>).<br /> <br />
- The <a href="features/preferences.html#structure">Structures
- Preferences tab</a> provides new options allowing ChimeraX and
- Pymol to be used for visualising external 3D structures. Views
- from all structure viewers are saved in Jalview Projects, allowing
- them to be shared with others using Jalview 2.11.2 or later,
- providing they have the same viewer installed and configured to be
- used with Jalview.<br/><br/>Jalview
- 2.11.2 has been tested with <strong>Pymol 2.5.0 (community)</strong> and <strong>2.5.2
- (incentive)</strong>. For <strong>ChimeraX, we recommend using v1.3 or later</strong>.
- </p>
- <p>Other highlights include:</p>
- <ul>
- <li>Import of annotated DNA and RNA loci via GenBank and EMBL
- style flatfile</li>
- <li><strong>Easier configuration of <a
- href="features/preferences.html#startup">Jalview's memory
- allocation</a></strong></li>
- <li>Scripts for <a href="features/commandline.html">running
- Jalview via the command line</a> on macOS, Linux/Unix and Windows.
- </li>
- </ul>
-
-
- <p>
- For the full details, see <a
- href="releases.html#Jalview.2.11.2">the Jalview 2.11.2 series
- release notes</a>.
- </p>
- <p>
- <strong>Known Issues</strong> <br />The following known issues will
- be addressed in a minor patch release.
-
- <ul>
- <li>Display of RESNUM sequence features are not suppressed when
- structures associated with a sequence are viewed with an external
- viewer (Regression from 2.11.1 series)</li>
- </ul>
- <p></p>
</body>
</html>
status.cancelled_image_export_operation = Cancelled {0} export operation
info.error_creating_file = Error creating {0} file
exception.outofmemory_loading_mmcif_file = Out of memory loading mmCIF File
-label.run_groovy = Run Groovy console script
-label.run_groovy_tip = Run the script in the Groovy console over this alignment
+label.run_groovy = Run Groovy Console Script
+label.run_groovy_tip = Run the script in the Groovy Console over this alignment
label.couldnt_run_groovy_script = Failed to run Groovy script
label.uniprot_sequence_fetcher = UniProt Sequence Fetcher
action.next_page= >>
action.clustering_matrix_for = Calculating tree for matrix {0} and clustering at {1}
action.cluster_matrix_tooltip = Computes an average distance tree for the matrix and displays it
label.all_known_alignment_files = All known alignment files
+label.command_line_arguments = Command Line Arguments
+warning.using_old_command_line_arguments = It looks like you are using old command line arguments. These are now deprecated and will be removed in a future release of Jalview.\nFind out about the new command line arguments at\n
+warning.using_mixed_command_line_arguments = Jalview cannot use both old (-arg) and new (--arg) command line arguments. Please check your command line arguments.\ne.g. {0} and {1}
+warning.the_following_errors = The following errors and warnings occurred whilst processing files:
+action.show_hetatm = Show Ligands (HETATM)
prompt.analytics_title = Jalview EstadÃsticas de Uso
prompt.analytics = ¿Quiere ayudar a mejorar Jalview habilitando la recopilación de estadÃsticas de uso con análisis Plausible?\nPuede habilitar o deshabilitar el seguimiento de uso en las preferencias.
label.all_known_alignment_files = Todos los archivos de alineación conocidos
+label.command_line_arguments = Argumentos de lÃnea de comando
+warning.using_old_command_line_arguments = Parece que estás utilizando argumentos antiguos de lÃnea de comando. Estos ahora están en desuso y se eliminarán en una versión futura de Jalview.\nObtenga más información sobre los nuevos argumentos de la lÃnea de comando en\n
+warning.using_mixed_command_line_arguments = Jalview no puede utilizar argumentos de lÃnea de comando antiguos (-arg) y nuevos (--arg). Verifique los argumentos de su lÃnea de comando.\ne.g. {0} y {1}
+warning.the_following_errors = Se produjeron los siguientes errores y advertencias al procesar archivos:
xjc schemas/jalview.xsd -d src -p jalview.xml.binding.jalview
Note this also generates code for included schemas
-->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:vamsas="www.vamsas.ac.uk/jalview/version2" targetNamespace="www.vamsas.ac.uk/jalview/version2" elementFormDefault="qualified" attributeFormDefault="unqualified">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:vamsas="www.vamsas.ac.uk/jalview/version2"
+ targetNamespace="www.vamsas.ac.uk/jalview/version2"
+ elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:complexType name="VAMSAS">
<xs:sequence>
- <xs:element name="Tree" type="xs:string" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element ref="vamsas:SequenceSet" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="Tree" type="xs:string" minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element ref="vamsas:SequenceSet" minOccurs="0"
+ maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>
<xs:complexType name="mapListType">
<xs:annotation>
- <xs:documentation>
- developed after mapRangeType from http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes
+ <xs:documentation>
+ developed after mapRangeType from
+ http://www.vamsas.ac.uk/schemas/1.0/vamsasTypes
</xs:documentation>
<xs:documentation>
- This effectively represents a java.util.MapList object
+ This effectively represents a java.util.MapList
+ object
</xs:documentation>
</xs:annotation>
<xs:sequence>
- <xs:element name="mapListFrom" minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="mapListFrom" minOccurs="0"
+ maxOccurs="unbounded">
<xs:annotation>
- <xs:documentation> a region from start to end inclusive</xs:documentation>
+ <xs:documentation> a region from start to end inclusive
+ </xs:documentation>
</xs:annotation>
<xs:complexType>
- <xs:attribute name="start" type="xs:int" use="required"/>
- <xs:attribute name="end" type="xs:int" use="required"/>
+ <xs:attribute name="start" type="xs:int"
+ use="required" />
+ <xs:attribute name="end" type="xs:int" use="required" />
</xs:complexType>
- </xs:element>
- <xs:element name="mapListTo" minOccurs="0" maxOccurs="unbounded">
+ </xs:element>
+ <xs:element name="mapListTo" minOccurs="0"
+ maxOccurs="unbounded">
<xs:annotation>
- <xs:documentation> a region from start to end inclusive</xs:documentation>
+ <xs:documentation> a region from start to end inclusive
+ </xs:documentation>
</xs:annotation>
<xs:complexType>
- <xs:attribute name="start" type="xs:int" use="required"/>
- <xs:attribute name="end" type="xs:int" use="required"/>
+ <xs:attribute name="start" type="xs:int"
+ use="required" />
+ <xs:attribute name="end" type="xs:int" use="required" />
</xs:complexType>
- </xs:element>
+ </xs:element>
</xs:sequence>
- <xs:attribute name="mapFromUnit" type="xs:positiveInteger" use="required">
+ <xs:attribute name="mapFromUnit"
+ type="xs:positiveInteger" use="required">
<xs:annotation>
- <xs:documentation>number of dictionary symbol widths involved in each
- mapped position on this sequence (for example, 3 for a dna sequence exon
- region that is being mapped to a protein sequence). This is optional,
- since the unit can be usually be inferred from the dictionary type of
- each sequence involved in the mapping. </xs:documentation>
+ <xs:documentation>number of dictionary symbol widths involved in
+ each
+ mapped position on this sequence (for example, 3 for a dna
+ sequence exon
+ region that is being mapped to a protein sequence).
+ This is optional,
+ since the unit can be usually be inferred from the
+ dictionary type of
+ each sequence involved in the mapping.
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="mapToUnit" type="xs:positiveInteger" use="required">
+ <xs:attribute name="mapToUnit" type="xs:positiveInteger"
+ use="required">
<xs:annotation>
- <xs:documentation>number of dictionary symbol widths involved in each
- mapped position on this sequence (for example, 3 for a dna sequence exon
- region that is being mapped to a protein sequence). This is optional,
- since the unit can be usually be inferred from the dictionary type of
- each sequence involved in the mapping. </xs:documentation>
+ <xs:documentation>number of dictionary symbol widths involved in
+ each
+ mapped position on this sequence (for example, 3 for a dna
+ sequence exon
+ region that is being mapped to a protein sequence).
+ This is optional,
+ since the unit can be usually be inferred from the
+ dictionary type of
+ each sequence involved in the mapping.
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
<xs:complexType>
<xs:annotation>
<xs:documentation>
- Represent the jalview.datamodel.Mapping object - it also provides
- a way of storing sequences that are mapped 'to' without adding them
- to the sequence set (which will mean they are then added to the alignment too).
+ Represent the jalview.datamodel.Mapping object -
+ it also provides
+ a way of storing sequences that are mapped 'to'
+ without adding them
+ to the sequence set (which will mean they are
+ then added to the alignment too).
</xs:documentation>
</xs:annotation>
<xs:complexContent>
<xs:extension base="vamsas:mapListType">
<xs:sequence>
<xs:choice minOccurs="0" maxOccurs="1">
- <xs:element ref="vamsas:Sequence"/>
+ <xs:element ref="vamsas:Sequence" />
<xs:element name="dseqFor">
<xs:simpleType>
<xs:restriction base="xs:string">
<xs:annotation>
- <xs:documentation>The sequence whose dataset sequence is to be referenced here</xs:documentation>
+ <xs:documentation>The sequence whose dataset sequence is to
+ be referenced here
+ </xs:documentation>
</xs:annotation>
</xs:restriction>
</xs:simpleType>
</xs:element>
</xs:choice>
</xs:sequence>
- <xs:attribute name="mappingType" type="xs:string" use="optional">
+ <xs:attribute name="mappingType" type="xs:string"
+ use="optional">
<xs:annotation>
- <xs:documentation>Biotype of the mapping e.g. CdsToPeptide</xs:documentation>
+ <xs:documentation>Biotype of the mapping e.g. CdsToPeptide
+ </xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:extension>
- </xs:complexContent>
+ </xs:complexContent>
</xs:complexType>
</xs:element>
<xs:element name="AlcodonFrame">
<xs:complexType>
<xs:sequence>
- <xs:element name="alcodon" minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="alcodon" minOccurs="0"
+ maxOccurs="unbounded">
<xs:complexType>
<xs:annotation>
<xs:documentation>
- specifies a series of aligned codons from an associated DNA sequence alignment that when translated correspond to columns of a peptide alignment.
- Element may have either all pos1,2,3 attributes specified, or none at all (indicating a gapped column with no translated peptide).
+ specifies a series of aligned codons from an
+ associated DNA sequence alignment that when translated
+ correspond to columns of a peptide alignment.
+ Element may have
+ either all pos1,2,3 attributes specified, or none at all
+ (indicating a gapped column with no translated peptide).
</xs:documentation>
</xs:annotation>
- <xs:attribute name="pos1" type="xs:integer" use="optional"/>
- <xs:attribute name="pos2" type="xs:integer" use="optional"/>
- <xs:attribute name="pos3" type="xs:integer" use="optional"/>
+ <xs:attribute name="pos1" type="xs:integer"
+ use="optional" />
+ <xs:attribute name="pos2" type="xs:integer"
+ use="optional" />
+ <xs:attribute name="pos3" type="xs:integer"
+ use="optional" />
</xs:complexType>
</xs:element>
- <xs:element name="alcodMap" minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="alcodMap" minOccurs="0"
+ maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
- <xs:element ref="vamsas:Mapping" maxOccurs="1" minOccurs="1">
+ <xs:element ref="vamsas:Mapping" maxOccurs="1"
+ minOccurs="1">
<xs:annotation>
<xs:documentation>
- a Mapping entry and an associated protein sequence
+ a Mapping entry and an associated protein
+ sequence
</xs:documentation>
</xs:annotation>
</xs:element>
</xs:sequence>
- <xs:attribute name="dnasq" type="xs:string" use="required">
+ <xs:attribute name="dnasq" type="xs:string"
+ use="required">
<xs:annotation>
<xs:documentation>
- internal jalview id for the dnasq for this mapping.
+ internal jalview id for the dnasq for this
+ mapping.
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
-
+
</xs:element>
-
+
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:complexContent>
<xs:extension base="vamsas:SequenceType">
<xs:sequence>
- <xs:element name="DBRef" minOccurs="0" maxOccurs="unbounded">
+ <xs:element name="DBRef" minOccurs="0"
+ maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
- <xs:element ref="vamsas:Mapping" minOccurs="0" maxOccurs="1"/>
- </xs:sequence>
- <xs:attribute name="source" type="xs:string"/>
- <xs:attribute name="version" type="xs:string"/>
- <xs:attribute name="accessionId" type="xs:string"/>
- <xs:attribute name="locus" type="xs:boolean" default="false">
+ <xs:element ref="vamsas:Mapping" minOccurs="0"
+ maxOccurs="1" />
+ </xs:sequence>
+ <xs:attribute name="source" type="xs:string" />
+ <xs:attribute name="version" type="xs:string" />
+ <xs:attribute name="accessionId" type="xs:string" />
+ <xs:attribute name="locus" type="xs:boolean"
+ default="false">
<xs:annotation>
<xs:documentation>
- true for gene locus mapping, source=species, version=assembly, accession=chromosome
+ true for gene locus mapping, source=species,
+ version=assembly, accession=chromosome
</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="canonical" type="xs:boolean" default="false">
+ <xs:attribute name="canonical" type="xs:boolean"
+ default="false">
<xs:annotation>
<xs:documentation>
- true for the representative accession for databases where multiple accessions map to the same entry (eg. Uniprot)
+ true for the representative accession for
+ databases where multiple accessions map to the same entry
+ (eg. Uniprot)
</xs:documentation>
</xs:annotation>
</xs:attribute>
</xs:complexType>
</xs:element>
</xs:sequence>
- <xs:attribute name="dsseqid" type="xs:string" use="optional">
+ <xs:attribute name="dsseqid" type="xs:string"
+ use="optional">
<xs:annotation>
<xs:documentation>
- dataset sequence id for this sequence. Will be created as union of sequences.
+ dataset sequence id for this sequence. Will be
+ created as union of sequences.
</xs:documentation>
</xs:annotation>
</xs:attribute>
- <xs:attribute name="biotype" type="xs:string" use="optional">
+ <xs:attribute name="biotype" type="xs:string"
+ use="optional">
<xs:annotation>
<xs:documentation>
Biotype of the sequence (if known)
<xs:attribute name="colour" type="xs:int" />
</xs:complexType>
</xs:element>
- <xs:element name="contactmatrix" type="vamsas:MatrixType"
- maxOccurs="unbounded" minOccurs="0">
+ <xs:element name="contactmatrix"
+ type="vamsas:MapOnAMatrixType" maxOccurs="unbounded" minOccurs="0">
</xs:element>
- <xs:element name="property" type="vamsas:property" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element name="property" type="vamsas:property"
+ minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
- <xs:attribute name="graph" type="xs:boolean" use="required" />
- <xs:attribute name="graphType" type="xs:int" use="optional" />
+ <xs:attribute name="graph" type="xs:boolean"
+ use="required" />
+ <xs:attribute name="graphType" type="xs:int"
+ use="optional" />
<xs:attribute name="sequenceRef" type="xs:string"
use="optional" />
<xs:attribute name="groupRef" type="xs:string"
use="optional" />
<xs:attribute name="graphGroup" type="xs:int"
use="optional" />
- <xs:attribute name="graphHeight" type="xs:int" use="optional">
- <xs:annotation><xs:documentation>height in pixels for the graph if this is a graph-type annotation.</xs:documentation></xs:annotation></xs:attribute>
+ <xs:attribute name="graphHeight" type="xs:int"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation>height in pixels for the graph if this is a
+ graph-type annotation.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
<xs:attribute name="id" type="xs:string" use="optional" />
<xs:attribute name="scoreOnly" type="xs:boolean"
use="optional" default="false" />
- <xs:attribute name="score" type="xs:double" use="optional" />
+ <xs:attribute name="score" type="xs:double"
+ use="optional" />
<xs:attribute name="visible" type="xs:boolean"
use="optional" />
<xs:attribute name="centreColLabels" type="xs:boolean"
use="optional" />
- <xs:attribute name="autoCalculated" type="xs:boolean" use="optional" default="false">
- <xs:annotation><xs:documentation>is an autocalculated annotation row</xs:documentation>
- </xs:annotation></xs:attribute>
- <xs:attribute name="belowAlignment" type="xs:boolean" use="optional" default="true">
- <xs:annotation><xs:documentation>is to be shown below the alignment - introduced in Jalview 2.8 for visualizing T-COFFEE alignment scores</xs:documentation></xs:annotation></xs:attribute>
- <xs:attribute name="calcId" type="xs:string" use="optional">
- <xs:annotation><xs:documentation>Optional string identifier used to group sets of annotation produced by a particular calculation. Values are opaque strings but have semantic meaning to Jalview's renderer, data importer and calculation system.</xs:documentation></xs:annotation>
+ <xs:attribute name="autoCalculated" type="xs:boolean"
+ use="optional" default="false">
+ <xs:annotation>
+ <xs:documentation>is an autocalculated annotation row
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="belowAlignment" type="xs:boolean"
+ use="optional" default="true">
+ <xs:annotation>
+ <xs:documentation>is to be shown below the alignment - introduced
+ in Jalview 2.8 for visualizing T-COFFEE alignment scores
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="calcId" type="xs:string"
+ use="optional">
+ <xs:annotation>
+ <xs:documentation>Optional string identifier used to group sets of
+ annotation produced by a particular calculation. Values are opaque
+ strings but have semantic meaning to Jalview's renderer, data
+ importer and calculation system.
+ </xs:documentation>
+ </xs:annotation>
</xs:attribute>
</xs:complexType>
- </xs:element>
+ </xs:element>
<xs:element name="SequenceSet">
<xs:complexType>
<xs:sequence>
- <xs:element ref="vamsas:Sequence" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element ref="vamsas:Annotation" minOccurs="0" maxOccurs="unbounded"/>
- <xs:element name="sequenceSetProperties" minOccurs="0" maxOccurs="unbounded">
+ <xs:element ref="vamsas:Sequence" minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element ref="vamsas:Annotation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element name="sequenceSetProperties" minOccurs="0"
+ maxOccurs="unbounded">
<xs:complexType>
- <xs:attribute name="key" type="xs:string"/>
- <xs:attribute name="value" type="xs:string"/>
+ <xs:attribute name="key" type="xs:string" />
+ <xs:attribute name="value" type="xs:string" />
</xs:complexType>
</xs:element>
- <xs:element ref="vamsas:AlcodonFrame" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:element ref="vamsas:AlcodonFrame" minOccurs="0"
+ maxOccurs="unbounded" />
+ <xs:element name="Matrix" type="vamsas:MatrixType"
+ minOccurs="0" maxOccurs="unbounded">
+ <xs:annotation>
+ <xs:documentation>Matrices referred to by this set of sequences.
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
</xs:sequence>
- <xs:attribute name="gapChar" type="xs:string" use="required"/>
- <xs:attribute name="datasetId" type="xs:string" use="optional">
+ <xs:attribute name="gapChar" type="xs:string"
+ use="required" />
+ <xs:attribute name="datasetId" type="xs:string"
+ use="optional">
<xs:annotation>
<xs:documentation>
- reference to set where jalview will gather the dataset sequences for all sequences in the set.
+ reference to set where jalview will gather the
+ dataset sequences for all sequences in the set.
</xs:documentation>
</xs:annotation>
</xs:attribute>
<xs:element name="annotationElement">
<xs:complexType>
<xs:sequence>
- <xs:element name="displayCharacter" type="xs:string" minOccurs="0"/>
- <xs:element name="description" type="xs:string" minOccurs="0"/>
+ <xs:element name="displayCharacter" type="xs:string"
+ minOccurs="0" />
+ <xs:element name="description" type="xs:string"
+ minOccurs="0" />
<xs:element name="secondaryStructure" minOccurs="0">
<xs:simpleType>
<xs:restriction base="xs:string">
- <xs:length value="1"/>
+ <xs:length value="1" />
</xs:restriction>
</xs:simpleType>
</xs:element>
- <xs:element name="value" type="xs:float" minOccurs="0"/>
+ <xs:element name="value" type="xs:float" minOccurs="0" />
</xs:sequence>
- <xs:attribute name="position" type="xs:int" use="required"/>
- <xs:attribute name="colour" type="xs:int" use="optional"/>
+ <xs:attribute name="position" type="xs:int"
+ use="required" />
+ <xs:attribute name="colour" type="xs:int" use="optional" />
</xs:complexType>
</xs:element>
<xs:complexType name="SequenceType">
<xs:sequence>
- <xs:element name="sequence" type="xs:string" minOccurs="0"/>
- <xs:element name="name" type="xs:string" minOccurs="0"/>
+ <xs:element name="sequence" type="xs:string" minOccurs="0" />
+ <xs:element name="name" type="xs:string" minOccurs="0" />
</xs:sequence>
- <xs:attribute name="id" type="xs:string"/>
- <xs:attribute name="description" type="xs:string"/>
+ <xs:attribute name="id" type="xs:string" />
+ <xs:attribute name="description" type="xs:string" />
</xs:complexType>
<xs:complexType name="MatrixType">
+ <xs:annotation>
+ <xs:documentation>Represents matrix data imported to Jalview, and the
+ results of any derived calculations (independent of a particular
+ view
+ on the matrix).
+ </xs:documentation>
+ </xs:annotation>
<xs:sequence>
<xs:element name="elements" type="xs:string" minOccurs="1"
maxOccurs="1">
<xs:annotation>
<xs:documentation>serialised representation of matrix as one or
- more sets of comma separated values</xs:documentation>
+ more sets of comma separated values
+ </xs:documentation>
</xs:annotation>
</xs:element>
<xs:element name="groups" type="xs:string" minOccurs="0"
</xs:element>
<xs:element name="property" type="vamsas:property"
minOccurs="0" maxOccurs="unbounded" />
- <xs:element name="mapping" type="vamsas:mapListType"
- minOccurs="0" maxOccurs="1">
- <xs:annotation>
- <xs:documentation>mapping from the matrix row and column positions to
- associated reference frame</xs:documentation>
- </xs:annotation>
- </xs:element>
</xs:sequence>
<xs:attribute name="type" type="xs:string" use="required" />
use="optional" />
<xs:attribute name="cutHeight" type="xs:double"
use="optional" />
- <xs:attribute name="id" type="xs:string" use="optional" />
+ <xs:attribute name="id" type="xs:string" use="required" />
</xs:complexType>
+ <xs:complexType name="MapOnAMatrixType">
+ <xs:annotation>
+ <xs:documentation>Defines a mapping from the local frame to a matrix
+ and its associated data specified by MatrixType
+ </xs:documentation>
+ </xs:annotation>
+ <xs:sequence>
+ <xs:element name="property" type="vamsas:property"
+ minOccurs="0" maxOccurs="unbounded" />
+ <xs:element name="mapping" type="vamsas:mapListType"
+ minOccurs="0" maxOccurs="1">
+ <xs:annotation>
+ <xs:documentation>mapping from the matrix row and column positions
+ to
+ associated reference frame
+ </xs:documentation>
+ </xs:annotation>
+ </xs:element>
+ </xs:sequence>
+
+ <xs:attribute name="matrix" type="xs:string"
+ use="required">
+
+ <xs:annotation>
+ <xs:documentation>reference to the matrix type this Map refers to
+ </xs:documentation>
+ </xs:annotation>
+ </xs:attribute>
+ <xs:attribute name="id" type="xs:string" use="optional" />
+ </xs:complexType>
<xs:complexType name="property">
<xs:attribute name="name" type="xs:string" />
<xs:attribute name="value" type="xs:string" />
</xs:complexType>
-
-
+
+
</xs:schema>
if ((nd.left() == null) && (nd.right() == null))
{
+ // TODO FIX FOR COLUMN TREES
jalview.bin.Console.outPrintln("Leaf = " + ((SequenceI) nd.element()).getName());
jalview.bin.Console.outPrintln("Dist " + nd.dist);
jalview.bin.Console.outPrintln("Boot " + nd.getBootstrap());
if ((nd.left() == null) && (nd.right() == null))
{
- nd.height = ((BinaryNode) nd.parent()).height + nd.dist;
+ nd.height = nd.parent().height + nd.dist;
if (nd.height > maxheight)
{
{
if (nd.parent() != null)
{
- nd.height = ((BinaryNode) nd.parent()).height + nd.dist;
+ nd.height = nd.parent().height + nd.dist;
}
else
{
package jalview.api.structures;
import java.io.File;
+import java.util.Collections;
+import java.util.List;
import jalview.api.AlignmentViewPanel;
import jalview.datamodel.PDBEntry;
File saveSession();
+ /**
+ *
+ * @return heteroatoms in a form suitable for display and passing to command generator to display hetatms
+ */
+ default List<String> getHetatms() {
+ return Collections.EMPTY_LIST;
+ }
+
}
import javax.swing.UIManager;
import jalview.analytics.Plausible;
+import jalview.bin.argparser.Arg;
+import jalview.bin.argparser.ArgParser;
import jalview.datamodel.PDBEntry;
import jalview.gui.Preferences;
import jalview.gui.UserDefinedColours;
* <li>WRAP_ALIGNMENT</li>
* <li>EPS_RENDERING (Prompt each time|Lineart|Text) default for EPS rendering
* style check</li>
- * <li>BITMAP_SCALE - scale factor for PNG export - default 0 - native resolution</li>
+ * <li>BITMAP_SCALE - scale factor for PNG export - default 0.0 - native
+ * resolution</li>
* <li>BITMAP_HEIGHT - height bound for PNG export or 0 for unbound</li>
* <li>BITMAP_WIDTH - width bound for PNG export or 0 for unbound</li>
* <li>SORT_ALIGNMENT (No sort|Id|Pairwise Identity)</li>
{
if (!Jalview.quiet())
{
- jalview.bin.Console.outPrintln(
+ jalview.bin.Console.errPrintln(
"Non-fatal exception when checking version at "
+ remoteBuildPropertiesUrl + ":");
jalview.bin.Console.printStackTrace(ex);
url = Cache.class.getResource(resourcePath).toString();
} catch (Exception ex)
{
- jalview.bin.Console.errPrintln("Failed to resolve resource " + resourcePath
- + ": " + ex.getMessage());
+ jalview.bin.Console.errPrintln("Failed to resolve resource "
+ + resourcePath + ": " + ex.getMessage());
}
}
else
} catch (NumberFormatException e)
{
if (!Jalview.quiet())
- jalview.bin.Console.outPrintln("Error parsing int property '"
+ jalview.bin.Console.errPrintln("Error parsing int property '"
+ + property + "' with value '" + string + "'");
+ }
+ }
+
+ return def;
+ }
+
+ public static float getDefault(String property, float def)
+ {
+ String string = getProperty(property);
+ if (string != null)
+ {
+ try
+ {
+ def = Float.parseFloat(string);
+ } catch (NumberFormatException e)
+ {
+ if (!Jalview.quiet())
+ jalview.bin.Console.errPrintln("Error parsing float property '"
+ property + "' with value '" + string + "'");
}
}
} catch (Exception ex)
{
if (!Jalview.quiet())
- jalview.bin.Console.outPrintln(
+ jalview.bin.Console.errPrintln(
"Error setting property: " + key + " " + obj + "\n" + ex);
}
return oldValue;
} catch (Exception ex)
{
if (!Jalview.quiet())
- jalview.bin.Console.outPrintln("Error saving properties: " + ex);
+ jalview.bin.Console.errPrintln("Error saving properties: " + ex);
}
}
}
return date_format.parse(val);
} catch (Exception ex)
{
- jalview.bin.Console.errPrintln("Invalid or corrupt date in property '"
- + propertyName + "' : value was '" + val + "'");
+ jalview.bin.Console
+ .errPrintln("Invalid or corrupt date in property '"
+ + propertyName + "' : value was '" + val + "'");
}
}
return null;
return Integer.valueOf(val);
} catch (NumberFormatException x)
{
- jalview.bin.Console.errPrintln("Invalid integer in property '" + property
- + "' (value was '" + val + "')");
+ jalview.bin.Console.errPrintln("Invalid integer in property '"
+ + property + "' (value was '" + val + "')");
}
}
return null;
private static final Collection<String> bootstrapProperties = new ArrayList<>(
Arrays.asList(JALVIEWLOGLEVEL, BOOTSTRAP_TEST));
-
public static Properties bootstrapProperties(String filename)
{
Properties bootstrapProps = new Properties();
}
if (file == null || !file.exists())
{
+ if (file != null)
+ {
+ jalview.bin.Console
+ .errPrintln("Could not load bootstrap preferences file '"
+ + file.getPath() + "'");
+ }
String channelPrefsFilename = ChannelProperties
.getProperty("preferences.filename");
String propertiesFilename = System.getProperty("user.home")
+ File.separatorChar + channelPrefsFilename;
+ jalview.bin.Console.errPrintln(
+ "Using default properties file '" + propertiesFilename + "'");
file = new File(propertiesFilename);
}
if (file == null || !file.exists())
+
{
String releasePrefsFilename = fallbackPropertiesFile;
String releasePropertiesFilename = System.getProperty("user.home")
+ File.separatorChar + releasePrefsFilename;
+ jalview.bin.Console.errPrintln("Falling back to properties file '"
+ + releasePropertiesFilename + "'");
file = new File(releasePropertiesFilename);
}
- if (filename == null)
- return null;
if (!file.exists())
{
- jalview.bin.Console.errPrintln("Could not load bootstrap preferences file '"
- + filename + "'");
+ jalview.bin.Console
+ .errPrintln("Could not load bootstrap preferences file '"
+ + file.getPath() + "'");
return null;
}
}
} catch (FileNotFoundException e)
{
- jalview.bin.Console.errPrintln("Could not find bootstrap preferences file '"
- + file.getAbsolutePath() + "'");
+ jalview.bin.Console
+ .errPrintln("Could not find bootstrap preferences file '"
+ + file.getAbsolutePath() + "'");
} catch (IOException e)
{
jalview.bin.Console.errPrintln(
{
return key == null ? null : sessionProperties.get(key);
}
+
+ public static boolean getArgCacheDefault(Arg a, String pref, boolean def)
+ {
+ ArgParser ap = Jalview.getInstance().getArgParser();
+ return ap.isSet(a) ? ap.getBoolean(a) : getDefault(pref, def);
+ }
}
package jalview.bin;
+import java.awt.Color;
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Locale;
import java.util.Map;
+import javax.swing.SwingUtilities;
+
import jalview.analysis.AlignmentUtils;
import jalview.api.structures.JalviewStructureDisplayI;
+import jalview.bin.Jalview.ExitCode;
import jalview.bin.argparser.Arg;
import jalview.bin.argparser.ArgParser;
-import jalview.bin.argparser.ArgParser.Position;
import jalview.bin.argparser.ArgValue;
import jalview.bin.argparser.ArgValuesMap;
import jalview.bin.argparser.SubVals;
import jalview.io.exceptions.ImageOutputException;
import jalview.schemes.ColourSchemeI;
import jalview.schemes.ColourSchemeProperty;
+import jalview.structure.StructureCommandI;
import jalview.structure.StructureImportSettings.TFType;
import jalview.structure.StructureSelectionManager;
+import jalview.util.ColorUtils;
import jalview.util.FileUtils;
import jalview.util.HttpUtils;
import jalview.util.ImageMaker;
import jalview.util.ImageMaker.TYPE;
import jalview.util.MessageManager;
import jalview.util.Platform;
+import jalview.util.StringUtils;
import jalview.util.imagemaker.BitmapImageSizing;
public class Commands
private boolean argsWereParsed = false;
+ private List<String> errors = new ArrayList<>();
+
public Commands(ArgParser argparser, boolean headless)
{
this(Desktop.instance, argparser, headless);
}
}
+
+ // report errors - if any
+ String errorsRaised = errorsToString();
+ if (errorsRaised.trim().length() > 0)
+ {
+ Console.warn(
+ "The following errors and warnings occurred whilst processing files:\n"
+ + errorsRaised);
+ }
+ // gui errors reported in Jalview
+
if (argParser.getBoolean(Arg.QUIT))
{
- Jalview.getInstance().quit();
+ Jalview.getInstance().exit(
+ "Exiting due to " + Arg.QUIT.argString() + " argument.",
+ ExitCode.OK);
return true;
}
// carry on with jalview.bin.Jalview
boolean theseArgsWereParsed = false;
ArgValuesMap avm = argParser.getLinkedArgs(id);
if (avm == null)
+ {
return true;
+ }
+
+ Boolean isError = Boolean.valueOf(false);
// set wrap scope here so it can be applied after structures are opened
boolean wrap = false;
{
if (!(new File(openFile)).exists())
{
- Console.warn("Can't find file '" + openFile + "'");
+ addError("Can't find file '" + openFile + "'");
+ isError = true;
continue;
}
}
format = new IdentifyFile().identify(openFile, protocol);
} catch (FileFormatException e1)
{
- Console.error("Unknown file format for '" + openFile + "'");
+ addError("Unknown file format for '" + openFile + "'");
+ isError = true;
continue;
}
Console.debug(
"Opening '" + openFile + "' in new alignment frame");
FileLoader fileLoader = new FileLoader(!headless);
- boolean xception=false;
- try {
+ boolean xception = false;
+ try
+ {
af = fileLoader.LoadFileWaitTillLoaded(openFile, protocol,
format);
} catch (Throwable thr)
{
- xception=true;
- Console.error("Couldn't open '"+openFile+"' as "+format+" "+thr.getLocalizedMessage()+ " (Enable debug for full stack trace)");
- Console.debug("Exception when opening '"+openFile+"'",thr);
- }
- finally
+ xception = true;
+ addError("Couldn't open '" + openFile + "' as " + format + " "
+ + thr.getLocalizedMessage()
+ + " (Enable debug for full stack trace)");
+ isError = true;
+ Console.debug("Exception when opening '" + openFile + "'", thr);
+ } finally
{
- if (af==null && !xception)
+ if (af == null && !xception)
{
- Console.info("Ignoring '"+openFile+"' - no alignment data found.");
+ addInfo("Ignoring '" + openFile
+ + "' - no alignment data found.");
continue;
}
}
- // colour alignment?
- String colour = ArgParser.getFromSubValArgOrPref(avm, av,
- Arg.COLOUR, sv, null, "DEFAULT_COLOUR_PROT", "");
- if ("" != colour)
- {
- ColourSchemeI cs = ColourSchemeProperty.getColourScheme(
- af.getViewport(), af.getViewport().getAlignment(),
- colour);
-
- if (cs == null && !"None".equals(colour))
- {
- Console.warn(
- "Couldn't parse '" + colour + "' as a colourscheme.");
- }
- else
- {
- af.changeColour(cs);
- }
- Jalview.testoutput(argParser, Arg.COLOUR, "zappo", colour);
- }
+ // colour alignment
+ String colour = avm.getFromSubValArgOrPref(av, Arg.COLOUR, sv,
+ null, "DEFAULT_COLOUR_PROT", "");
+ this.colourAlignFrame(af, colour);
// Change alignment frame title
- String title = ArgParser.getFromSubValArgOrPref(avm, av,
- Arg.TITLE, sv, null, null, null);
+ String title = avm.getFromSubValArgOrPref(av, Arg.TITLE, sv, null,
+ null, null);
if (title != null)
{
af.setTitle(title);
}
// Add features
- String featuresfile = ArgParser.getValueFromSubValOrArg(avm, av,
+ String featuresfile = avm.getValueFromSubValOrArg(av,
Arg.FEATURES, sv);
if (featuresfile != null)
{
}
// Add annotations from file
- String annotationsfile = ArgParser.getValueFromSubValOrArg(avm,
- av, Arg.ANNOTATIONS, sv);
+ String annotationsfile = avm.getValueFromSubValOrArg(av,
+ Arg.ANNOTATIONS, sv);
if (annotationsfile != null)
{
af.loadJalviewDataFile(annotationsfile, null, null, null);
}
// Set or clear the sortbytree flag
- boolean sortbytree = ArgParser.getBoolFromSubValOrArg(avm,
- Arg.SORTBYTREE, sv);
+ boolean sortbytree = avm.getBoolFromSubValOrArg(Arg.SORTBYTREE,
+ sv);
if (sortbytree)
{
af.getViewport().setSortByTree(true);
}
// Load tree from file
- String treefile = ArgParser.getValueFromSubValOrArg(avm, av,
- Arg.TREE, sv);
+ String treefile = avm.getValueFromSubValOrArg(av, Arg.TREE, sv);
if (treefile != null)
{
try
"examples/testdata/uniref50_test_tree", treefile);
} catch (IOException e)
{
- Console.warn("Couldn't add tree " + treefile, e);
+ addError("Couldn't add tree " + treefile, e);
+ isError = true;
}
}
+
// Show secondary structure annotations?
- boolean showSSAnnotations = ArgParser.getFromSubValArgOrPref(avm,
+ boolean showSSAnnotations = avm.getFromSubValArgOrPref(
Arg.SHOWSSANNOTATIONS, av.getSubVals(), null,
"STRUCT_FROM_PDB", true);
- af.setAnnotationsVisibility(showSSAnnotations, true, false);
-
+
// Show sequence annotations?
- boolean showAnnotations = ArgParser.getFromSubValArgOrPref(avm,
+ boolean showAnnotations = avm.getFromSubValArgOrPref(
Arg.SHOWANNOTATIONS, av.getSubVals(), null,
"SHOW_ANNOTATIONS", true);
- af.setAnnotationsVisibility(showAnnotations, false, true);
+
+ boolean hideTFrows = (avm.getBoolean(Arg.NOTEMPFAC));
+ final AlignFrame _af = af;
+ // many of jalview's format/layout methods are only thread safe on the swingworker thread.
+ // all these methods should be on the alignViewController so it can coordinate such details
+ try
+ {
+ SwingUtilities.invokeAndWait(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ _af.setAnnotationsVisibility(showSSAnnotations, true,
+ false);
- // show temperature factor annotations?
- if (avm.getBoolean(Arg.NOTEMPFAC))
+ _af.setAnnotationsVisibility(showAnnotations, false, true);
+
+ // show temperature factor annotations?
+ if (hideTFrows)
+ {
+ // do this better (annotation types?)
+ List<String> hideThese = new ArrayList<>();
+ hideThese.add("Temperature Factor");
+ hideThese.add(AlphaFoldAnnotationRowBuilder.LABEL);
+ AlignmentUtils.showOrHideSequenceAnnotations(
+ _af.getCurrentView().getAlignment(), hideThese,
+ null, false, false);
+ }
+ }
+ });
+ } catch (Exception x)
{
- // do this better (annotation types?)
- List<String> hideThese = new ArrayList<>();
- hideThese.add("Temperature Factor");
- hideThese.add(AlphaFoldAnnotationRowBuilder.LABEL);
- AlignmentUtils.showOrHideSequenceAnnotations(
- af.getCurrentView().getAlignment(), hideThese, null,
- false, false);
+ Console.warn(
+ "Unexpected exception adjusting annotation row visibility.",
+ x);
}
// wrap alignment? do this last for formatting reasons
- wrap = ArgParser.getFromSubValArgOrPref(avm, Arg.WRAP, sv, null,
+ wrap = avm.getFromSubValArgOrPref(Arg.WRAP, sv, null,
"WRAP_ALIGNMENT", false);
// af.setWrapFormat(wrap) is applied after structures are opened for
// annotation reasons
{
if (headless)
{
- Jalview.exit("Could not open any files in headless mode", 1);
+ Jalview.exit("Could not open any files in headless mode",
+ ExitCode.NO_FILES);
}
else
{
- Console.warn("No more files to open");
+ Console.info("No more files to open");
}
}
if (progressBarSet && desktop != null)
commandArgsProvided = true;
for (ArgValue av : avm.getArgValueList(Arg.STRUCTURE))
{
+ argParser.setStructureFilename(null);
String val = av.getValue();
SubVals subVals = av.getSubVals();
+ int argIndex = av.getArgIndex();
SequenceI seq = getSpecifiedSequence(af, avm, av);
if (seq == null)
{
if (seq == null)
{
- Console.warn("Could not find sequence for argument "
+ addWarn("Could not find sequence for argument "
+ Arg.STRUCTURE.argString() + "=" + val);
- // you probably want to continue here, not break
- // break;
continue;
}
+ String structureFilename = null;
File structureFile = null;
if (subVals.getContent() != null
&& subVals.getContent().length() != 0)
{
- structureFile = new File(subVals.getContent());
+ structureFilename = subVals.getContent();
Console.debug("Using structure file (from argument) '"
- + structureFile.getAbsolutePath() + "'");
+ + structureFilename + "'");
+ structureFile = new File(structureFilename);
}
- // TRY THIS
- /*
- * PDBEntry fileEntry = new AssociatePdbFileWithSeq()
- * .associatePdbWithSeq(selectedPdbFileName, DataSourceType.FILE,
- * selectedSequence, true, Desktop.instance);
- *
- * sViewer = launchStructureViewer(ssm, new PDBEntry[] { fileEntry }, ap, new
- * SequenceI[] { selectedSequence });
- *
- */
/* THIS DOESN'T WORK */
else if (seq.getAllPDBEntries() != null
&& seq.getAllPDBEntries().size() > 0)
{
structureFile = new File(
seq.getAllPDBEntries().elementAt(0).getFile());
- Console.debug("Using structure file (from sequence) '"
- + structureFile.getAbsolutePath() + "'");
+ if (structureFile != null)
+ {
+ Console.debug("Using structure file (from sequence) '"
+ + structureFile.getAbsolutePath() + "'");
+ }
+ structureFilename = structureFile.getAbsolutePath();
}
- if (structureFile == null)
+ if (structureFilename == null || structureFile == null)
{
- Console.warn("Not provided structure file with '" + val + "'");
+ addWarn("Not provided structure file with '" + val + "'");
continue;
}
if (!structureFile.exists())
{
- Console.warn("Structure file '"
- + structureFile.getAbsoluteFile() + "' not found.");
+ addWarn("Structure file '" + structureFile.getAbsoluteFile()
+ + "' not found.");
continue;
}
Console.debug("Using structure file "
+ structureFile.getAbsolutePath());
+ argParser.setStructureFilename(structureFilename);
+
// open structure view
AlignmentPanel ap = af.alignPanel;
if (headless)
String structureFilepath = structureFile.getAbsolutePath();
// get PAEMATRIX file and label from subvals or Arg.PAEMATRIX
- String paeFilepath = ArgParser
- .getFromSubValArgOrPrefWithSubstitutions(argParser, avm,
- Arg.PAEMATRIX, Position.AFTER, av, subVals, null,
- null, null);
+ String paeFilepath = avm.getFromSubValArgOrPrefWithSubstitutions(
+ argParser, Arg.PAEMATRIX, ArgValuesMap.Position.AFTER, av,
+ subVals, null, null, null);
if (paeFilepath != null)
{
File paeFile = new File(paeFilepath);
} catch (IOException e)
{
paeFilepath = paeFile.getAbsolutePath();
- Console.warn("Problem with the PAE file path: '"
+ addWarn("Problem with the PAE file path: '"
+ paeFile.getPath() + "'");
}
}
// showing annotations from structure file or not
- boolean ssFromStructure = ArgParser.getFromSubValArgOrPref(avm,
+ boolean ssFromStructure = avm.getFromSubValArgOrPref(
Arg.SHOWSSANNOTATIONS, subVals, null, "STRUCT_FROM_PDB",
true);
// get TEMPFAC type from subvals or Arg.TEMPFAC in case user Adds
// reference annotations
- String tftString = ArgParser
- .getFromSubValArgOrPrefWithSubstitutions(argParser, avm,
- Arg.TEMPFAC, Position.AFTER, av, subVals, null,
- null, null);
- boolean notempfac = ArgParser.getFromSubValArgOrPref(avm,
- Arg.NOTEMPFAC, subVals, null, "ADD_TEMPFACT_ANN", false,
- true);
+ String tftString = avm.getFromSubValArgOrPrefWithSubstitutions(
+ argParser, Arg.TEMPFAC, ArgValuesMap.Position.AFTER, av,
+ subVals, null, null, null);
+ boolean notempfac = avm.getFromSubValArgOrPref(Arg.NOTEMPFAC,
+ subVals, null, "ADD_TEMPFACT_ANN", false, true);
TFType tft = notempfac ? null : TFType.DEFAULT;
if (tftString != null && !notempfac)
{
if (it.hasNext())
sb.append(", ");
}
- Console.warn(sb.toString());
+ addWarn(sb.toString());
}
}
- String sViewer = ArgParser.getFromSubValArgOrPref(avm,
- Arg.STRUCTUREVIEWER, Position.AFTER, av, subVals, null,
- null, "jmol");
- ViewerType viewerType = ViewerType.getFromString(sViewer);
+ String sViewerName = avm.getFromSubValArgOrPref(
+ Arg.STRUCTUREVIEWER, ArgValuesMap.Position.AFTER, av,
+ subVals, null, null, "jmol");
+ ViewerType viewerType = ViewerType.getFromString(sViewerName);
// TODO use ssFromStructure
- StructureViewer sv = StructureChooser
+ StructureViewer structureViewer = StructureChooser
.openStructureFileForSequence(null, null, ap, seq, false,
structureFilepath, tft, paeFilepath, false,
ssFromStructure, false, viewerType);
- if (sv == null)
+ if (structureViewer == null)
{
- Console.error("Failed to import and open structure view.");
+ if (!StringUtils.equalsIgnoreCase(sViewerName, "none"))
+ {
+ addError("Failed to import and open structure view for file '"
+ + structureFile + "'.");
+ }
continue;
}
try
{
long tries = 1000;
- while (sv.isBusy() && tries > 0)
+ while (structureViewer.isBusy() && tries > 0)
{
Thread.sleep(25);
- if (sv.isBusy())
+ if (structureViewer.isBusy())
{
tries--;
Console.debug(
"Waiting for viewer for " + structureFilepath);
}
}
- if (tries == 0 && sv.isBusy())
+ if (tries == 0 && structureViewer.isBusy())
{
- Console.warn(
- "Gave up waiting for structure viewer to load. Something may have gone wrong.");
+ addWarn("Gave up waiting for structure viewer to load file '"
+ + structureFile
+ + "'. Something may have gone wrong.");
}
} catch (Exception x)
{
- Console.warn("Exception whilst waiting for structure viewer "
+ addError("Exception whilst waiting for structure viewer "
+ structureFilepath, x);
+ isError = true;
}
// add StructureViewer to svMap list
{
svMap.put(id, new ArrayList<>());
}
- svMap.get(id).add(sv);
+ svMap.get(id).add(structureViewer);
Console.debug(
"Successfully opened viewer for " + structureFilepath);
- String structureImageFilename = ArgParser.getValueFromSubValOrArg(
- avm, av, Arg.STRUCTUREIMAGE, subVals);
- if (sv != null && structureImageFilename != null)
+
+ if (avm.containsArg(Arg.STRUCTUREIMAGE))
{
- ArgValue siAv = avm.getClosestNextArgValueOfArg(av,
- Arg.STRUCTUREIMAGE);
- SubVals sisv = null;
- if (structureImageFilename.equals(siAv.getValue()))
- {
- sisv = siAv.getSubVals();
- }
- File structureImageFile = new File(structureImageFilename);
- String width = ArgParser.getValueFromSubValOrArg(avm, av,
- Arg.STRUCTUREIMAGEWIDTH, sisv);
- String height = ArgParser.getValueFromSubValOrArg(avm, av,
- Arg.STRUCTUREIMAGEHEIGHT, sisv);
- String scale = ArgParser.getValueFromSubValOrArg(avm, av,
- Arg.STRUCTUREIMAGESCALE, sisv);
- String renderer = ArgParser.getValueFromSubValOrArg(avm, av,
- Arg.STRUCTUREIMAGETEXTRENDERER, sisv);
- String typeS = ArgParser.getValueFromSubValOrArg(avm, av,
- Arg.STRUCTUREIMAGETYPE, sisv);
- if (typeS == null || typeS.length() == 0)
+ for (ArgValue structureImageArgValue : avm
+ .getArgValueList(Arg.STRUCTUREIMAGE))
{
- typeS = FileUtils.getExtension(structureImageFile);
- }
- TYPE imageType;
- try
- {
- imageType = Enum.valueOf(TYPE.class,
- typeS.toUpperCase(Locale.ROOT));
- } catch (IllegalArgumentException e)
- {
- Console.warn("Do not know image format '" + typeS
- + "', using PNG");
- imageType = TYPE.PNG;
- }
- BitmapImageSizing userBis = ImageMaker
- .parseScaleWidthHeightStrings(scale, width, height);
- // TODO MAKE THIS VIEWER INDEPENDENT!!
- switch (StructureViewer.getViewerType())
- {
- case JMOL:
- JalviewStructureDisplayI sview = sv
- .getJalviewStructureDisplay();
- if (sview instanceof AppJmol)
+ String structureImageFilename = argParser.makeSubstitutions(
+ structureImageArgValue.getValue(), id, true);
+ if (structureViewer != null && structureImageFilename != null)
{
- AppJmol jmol = (AppJmol) sview;
+ SubVals structureImageSubVals = null;
+ structureImageSubVals = structureImageArgValue.getSubVals();
+ File structureImageFile = new File(structureImageFilename);
+ String width = avm.getValueFromSubValOrArg(
+ structureImageArgValue, Arg.WIDTH,
+ structureImageSubVals);
+ String height = avm.getValueFromSubValOrArg(
+ structureImageArgValue, Arg.HEIGHT,
+ structureImageSubVals);
+ String scale = avm.getValueFromSubValOrArg(
+ structureImageArgValue, Arg.SCALE,
+ structureImageSubVals);
+ String renderer = avm.getValueFromSubValOrArg(
+ structureImageArgValue, Arg.TEXTRENDERER,
+ structureImageSubVals);
+ String typeS = avm.getValueFromSubValOrArg(
+ structureImageArgValue, Arg.TYPE,
+ structureImageSubVals);
+ if (typeS == null || typeS.length() == 0)
+ {
+ typeS = FileUtils.getExtension(structureImageFile);
+ }
+ TYPE imageType;
try
{
- Console.debug("Rendering image to " + structureImageFile);
+ imageType = Enum.valueOf(TYPE.class,
+ typeS.toUpperCase(Locale.ROOT));
+ } catch (IllegalArgumentException e)
+ {
+ addWarn("Do not know image format '" + typeS
+ + "', using PNG");
+ imageType = TYPE.PNG;
+ }
+ BitmapImageSizing userBis = ImageMaker
+ .parseScaleWidthHeightStrings(scale, width, height);
+
+ /////
+ // DON'T TRY TO EXPORT IF VIEWER IS UNSUPPORTED
+ if (viewerType != ViewerType.JMOL)
+ {
+ addWarn("Cannot export image for structure viewer "
+ + viewerType.name() + " yet");
+ continue;
+ }
+
+ /////
+ // Apply the temporary colourscheme to the linked alignment
+ // TODO: enhance for multiple linked alignments.
+
+ String imageColour = avm.getValueFromSubValOrArg(
+ structureImageArgValue, Arg.IMAGECOLOUR,
+ structureImageSubVals);
+ ColourSchemeI originalColourScheme = this
+ .getColourScheme(af);
+ this.colourAlignFrame(af, imageColour);
+
+ /////
+ // custom image background colour
+
+ String bgcolourstring = avm.getValueFromSubValOrArg(
+ structureImageArgValue, Arg.BGCOLOUR,
+ structureImageSubVals);
+ Color bgcolour = null;
+ if (bgcolourstring != null && bgcolourstring.length() > 0)
+ {
+ bgcolour = ColorUtils.parseColourString(bgcolourstring);
+ if (bgcolour == null)
+ {
+ Console.warn(
+ "Background colour string '" + bgcolourstring
+ + "' not recognised -- using default");
+ }
+ }
+
+ JalviewStructureDisplayI sview = structureViewer
+ .getJalviewStructureDisplay();
+
+ File sessionToRestore = null;
+
+ List<StructureCommandI> extraCommands = new ArrayList<>();
+
+ if (extraCommands.size() > 0 || bgcolour != null)
+ {
+ try
+ {
+ sessionToRestore = sview.saveSession();
+ } catch (Throwable t)
+ {
+ Console.warn(
+ "Unable to save temporary session file before custom structure view export operation.");
+ }
+ }
+
+ ////
+ // Do temporary ops
+
+ if (bgcolour != null)
+ {
+ sview.getBinding().setBackgroundColour(bgcolour);
+ }
+
+ sview.getBinding().executeCommands(extraCommands, false,
+ "Executing Custom Commands");
+
+ // and export the view as an image
+ boolean success = this.checksBeforeWritingToFile(avm,
+ subVals, false, structureImageFilename,
+ "structure image", isError);
+
+ if (!success)
+ {
+ continue;
+ }
+ Console.debug("Rendering image to " + structureImageFile);
+ //
+ // TODO - extend StructureViewer / Binding with makePDBImage so
+ // we can do this with every viewer
+ //
+
+ try
+ {
+ // We don't expect class cast exception
+ AppJmol jmol = (AppJmol) sview;
jmol.makePDBImage(structureImageFile, imageType, renderer,
userBis);
- Console.debug("Finished Rendering image to "
+ Console.info("Exported structure image to "
+ structureImageFile);
- } catch (ImageOutputException ioexc)
+ // RESTORE SESSION AFTER EXPORT IF NEED BE
+ if (sessionToRestore != null)
+ {
+ Console.debug(
+ "Restoring session from " + sessionToRestore);
+
+ sview.getBinding().restoreSession(
+ sessionToRestore.getAbsolutePath());
+
+ }
+ } catch (ImageOutputException ioexec)
+ {
+ addError(
+ "Unexpected error when restoring structure viewer session after custom view operations.");
+ isError = true;
+ continue;
+ } finally
{
- Console.warn("Unexpected error whilst exporting image to "
- + structureImageFile, ioexc);
+ try
+ {
+ this.colourAlignFrame(af, originalColourScheme);
+ } catch (Exception t)
+ {
+ addError(
+ "Unexpected error when restoring colourscheme to alignment after temporary change for export.",
+ t);
+ }
}
-
}
- break;
- default:
- Console.warn("Cannot export image for structure viewer "
- + sv.getViewerType() + " yet");
- break;
}
}
+ argParser.setStructureFilename(null);
}
}
}
}
*/
- return theseArgsWereParsed;
+ return theseArgsWereParsed && !isError;
}
protected void processGroovyScript(String id)
ArgValuesMap avm = argParser.getLinkedArgs(id);
AlignFrame af = afMap.get(id);
- if (af == null)
+ if (avm != null && !avm.containsArg(Arg.GROOVY))
{
- Console.warn("Did not have an alignment window for id=" + id);
+ // nothing to do
return;
}
+ if (af == null)
+ {
+ addWarn("Groovy script does not have an alignment window. Proceeding with caution!");
+ }
+
if (avm.containsArg(Arg.GROOVY))
{
- String groovyscript = avm.getValue(Arg.GROOVY);
- if (groovyscript != null)
+ for (ArgValue groovyAv : avm.getArgValueList(Arg.GROOVY))
{
- // Execute the groovy script after we've done all the rendering stuff
- // and before any images or figures are generated.
- Console.info("Executing script " + groovyscript);
- Jalview.getInstance().executeGroovyScript(groovyscript, af);
+ String groovyscript = groovyAv.getValue();
+ if (groovyscript != null)
+ {
+ // Execute the groovy script after we've done all the rendering stuff
+ // and before any images or figures are generated.
+ Console.info("Executing script " + groovyscript);
+ Jalview.getInstance().executeGroovyScript(groovyscript, af);
+ }
}
}
}
ArgValuesMap avm = argParser.getLinkedArgs(id);
AlignFrame af = afMap.get(id);
+ if (avm != null && !avm.containsArg(Arg.IMAGE))
+ {
+ // nothing to do
+ return true;
+ }
+
if (af == null)
{
- Console.warn("Did not have an alignment window for id=" + id);
+ addWarn("Do not have an alignment window to create image from (id="
+ + id + "). Not proceeding.");
return false;
}
+ Boolean isError = Boolean.valueOf(false);
if (avm.containsArg(Arg.IMAGE))
{
- for (ArgValue av : avm.getArgValueList(Arg.IMAGE))
+ for (ArgValue imageAv : avm.getArgValueList(Arg.IMAGE))
{
- String val = av.getValue();
- SubVals subVal = av.getSubVals();
- String fileName = subVal.getContent();
+ String val = imageAv.getValue();
+ SubVals imageSubVals = imageAv.getSubVals();
+ String fileName = imageSubVals.getContent();
File file = new File(fileName);
String name = af.getName();
- String renderer = ArgParser.getValueFromSubValOrArg(avm, av,
- Arg.TEXTRENDERER, subVal);
+ String renderer = avm.getValueFromSubValOrArg(imageAv,
+ Arg.TEXTRENDERER, imageSubVals);
if (renderer == null)
renderer = "text";
String type = "png"; // default
- String scale = ArgParser.getValueFromSubValOrArg(avm, av, Arg.SCALE,
- subVal);
- String width = ArgParser.getValueFromSubValOrArg(avm, av, Arg.WIDTH,
- subVal);
- String height = ArgParser.getValueFromSubValOrArg(avm, av,
- Arg.HEIGHT, subVal);
+ String scale = avm.getValueFromSubValOrArg(imageAv, Arg.SCALE,
+ imageSubVals);
+ String width = avm.getValueFromSubValOrArg(imageAv, Arg.WIDTH,
+ imageSubVals);
+ String height = avm.getValueFromSubValOrArg(imageAv, Arg.HEIGHT,
+ imageSubVals);
BitmapImageSizing userBis = ImageMaker
.parseScaleWidthHeightStrings(scale, width, height);
- type = ArgParser.getValueFromSubValOrArg(avm, av, Arg.TYPE, subVal);
+ type = avm.getValueFromSubValOrArg(imageAv, Arg.TYPE, imageSubVals);
if (type == null && fileName != null)
{
for (String ext : new String[] { "svg", "png", "html", "eps" })
Cache.setPropsAreReadOnly(true);
Cache.setProperty("EXPORT_EMBBED_BIOJSON", "false");
+ String imageColour = avm.getValueFromSubValOrArg(imageAv,
+ Arg.IMAGECOLOUR, imageSubVals);
+ ColourSchemeI originalColourScheme = this.getColourScheme(af);
+ this.colourAlignFrame(af, imageColour);
+
Console.info("Writing " + file);
+
+ boolean success = checksBeforeWritingToFile(avm, imageSubVals,
+ false, fileName, "image", isError);
+ if (!success)
+ {
+ continue;
+ }
+
try
{
switch (type)
break;
default:
- Console.warn(Arg.IMAGE.argString() + " type '" + type
+ addWarn(Arg.IMAGE.argString() + " type '" + type
+ "' not known. Ignoring");
break;
}
} catch (Exception ioex)
{
- Console.warn("Unexpected error during export", ioex);
+ addError("Unexpected error during export to '" + fileName + "'",
+ ioex);
+ isError = true;
}
+
+ this.colourAlignFrame(af, originalColourScheme);
}
}
- return true;
+ return !isError;
}
protected boolean processOutput(String id)
ArgValuesMap avm = argParser.getLinkedArgs(id);
AlignFrame af = afMap.get(id);
+ if (avm != null && !avm.containsArg(Arg.OUTPUT))
+ {
+ // nothing to do
+ return true;
+ }
+
if (af == null)
{
- Console.warn("Did not have an alignment window for id=" + id);
+ addWarn("Do not have an alignment window (id=" + id
+ + "). Not proceeding.");
return false;
}
+ Boolean isError = Boolean.valueOf(false);
+
if (avm.containsArg(Arg.OUTPUT))
{
for (ArgValue av : avm.getArgValueList(Arg.OUTPUT))
String fileName = subVals.getContent();
boolean stdout = ArgParser.STDOUTFILENAME.equals(fileName);
File file = new File(fileName);
- boolean overwrite = ArgParser.getFromSubValArgOrPref(avm,
- Arg.OVERWRITE, subVals, null, "OVERWRITE_OUTPUT", false);
- // backups. Use the Arg.BACKUPS or subval "backups" setting first,
- // otherwise if headless assume false, if not headless use the user
- // preference with default true.
- boolean backups = ArgParser.getFromSubValArgOrPref(avm, Arg.BACKUPS,
- subVals, null,
- Platform.isHeadless() ? null : BackupFiles.ENABLED,
- !Platform.isHeadless());
-
- // if backups is not true then --overwrite must be specified
- if (file.exists() && !(overwrite || backups || stdout))
- {
- Console.error("Won't overwrite file '" + fileName + "' without "
- + Arg.OVERWRITE.argString() + " or "
- + Arg.BACKUPS.argString() + " set");
- return false;
- }
String name = af.getName();
- String format = ArgParser.getValueFromSubValOrArg(avm, av,
- Arg.FORMAT, subVals);
+ String format = avm.getValueFromSubValOrArg(av, Arg.FORMAT,
+ subVals);
FileFormats ffs = FileFormats.getInstance();
List<String> validFormats = ffs.getWritableFormats(false);
validSB.append(")");
}
- Jalview.exit("No valid format specified for "
+ addError("No valid format specified for "
+ Arg.OUTPUT.argString() + ". Valid formats are "
- + validSB.toString() + ".", 1);
- // this return really shouldn't happen
- return false;
+ + validSB.toString() + ".");
+ continue;
}
}
- String savedBackupsPreference = Cache
- .getDefault(BackupFiles.ENABLED, null);
- Console.debug("Setting backups to " + backups);
- Cache.applicationProperties.put(BackupFiles.ENABLED,
- Boolean.toString(backups));
+ boolean success = checksBeforeWritingToFile(avm, subVals, true,
+ fileName, ff.getName(), isError);
+ if (!success)
+ {
+ continue;
+ }
+
+ boolean backups = avm.getFromSubValArgOrPref(Arg.BACKUPS, subVals,
+ null, Platform.isHeadless() ? null : BackupFiles.ENABLED,
+ !Platform.isHeadless());
Console.info("Writing " + fileName);
- af.saveAlignment(fileName, ff, stdout);
- Console.debug("Returning backups to " + savedBackupsPreference);
- if (savedBackupsPreference != null)
- Cache.applicationProperties.put(BackupFiles.ENABLED,
- savedBackupsPreference);
+ af.saveAlignment(fileName, ff, stdout, backups);
if (af.isSaveAlignmentSuccessful())
{
Console.debug("Written alignment '" + name + "' in "
- + ff.getName() + " format to " + file);
+ + ff.getName() + " format to '" + file + "'");
}
else
{
- Console.warn("Error writing file " + file + " in " + ff.getName()
+ addError("Error writing file '" + file + "' in " + ff.getName()
+ " format!");
+ isError = true;
+ continue;
}
}
}
- return true;
+ return !isError;
}
private SequenceI getSpecifiedSequence(AlignFrame af, ArgValuesMap avm,
ArgValue av)
{
SubVals subVals = av.getSubVals();
- ArgValue idAv = avm.getClosestNextArgValueOfArg(av, Arg.SEQID);
+ ArgValue idAv = avm.getClosestNextArgValueOfArg(av, Arg.SEQID, true);
SequenceI seq = null;
if (subVals == null && idAv == null)
return null;
}
return svs;
}
+
+ private void colourAlignFrame(AlignFrame af, String colour)
+ {
+ // use string "none" to remove colour scheme
+ if (colour != null && "" != colour)
+ {
+ ColourSchemeI cs = ColourSchemeProperty.getColourScheme(
+ af.getViewport(), af.getViewport().getAlignment(), colour);
+ if (cs == null && !StringUtils.equalsIgnoreCase(colour, "none"))
+ {
+ addWarn("Couldn't parse '" + colour + "' as a colourscheme.");
+ }
+ else
+ {
+ Jalview.testoutput(argParser, Arg.COLOUR, "zappo", colour);
+ colourAlignFrame(af, cs);
+ }
+ }
+ }
+
+ private void colourAlignFrame(AlignFrame af, ColourSchemeI cs)
+ {
+ // Note that cs == null removes colour scheme from af
+ af.changeColour(cs);
+ }
+
+ private ColourSchemeI getColourScheme(AlignFrame af)
+ {
+ return af.getViewport().getGlobalColourScheme();
+ }
+
+ private void addInfo(String errorMessage)
+ {
+ Console.info(errorMessage);
+ errors.add(errorMessage);
+ }
+
+ private void addWarn(String errorMessage)
+ {
+ Console.warn(errorMessage);
+ errors.add(errorMessage);
+ }
+
+ private void addError(String errorMessage)
+ {
+ addError(errorMessage, null);
+ }
+
+ private void addError(String errorMessage, Exception e)
+ {
+ Console.error(errorMessage, e);
+ errors.add(errorMessage);
+ }
+
+ private boolean checksBeforeWritingToFile(ArgValuesMap avm,
+ SubVals subVal, boolean includeBackups, String filename,
+ String adjective, Boolean isError)
+ {
+ File file = new File(filename);
+
+ boolean overwrite = avm.getFromSubValArgOrPref(Arg.OVERWRITE, subVal,
+ null, "OVERWRITE_OUTPUT", false);
+ boolean stdout = false;
+ boolean backups = false;
+ if (includeBackups)
+ {
+ stdout = ArgParser.STDOUTFILENAME.equals(filename);
+ // backups. Use the Arg.BACKUPS or subval "backups" setting first,
+ // otherwise if headless assume false, if not headless use the user
+ // preference with default true.
+ backups = avm.getFromSubValArgOrPref(Arg.BACKUPS, subVal, null,
+ Platform.isHeadless() ? null : BackupFiles.ENABLED,
+ !Platform.isHeadless());
+ }
+
+ if (file.exists() && !(overwrite || backups || stdout))
+ {
+ addWarn("Won't overwrite file '" + filename + "' without "
+ + Arg.OVERWRITE.argString()
+ + (includeBackups ? " or " + Arg.BACKUPS.argString() : "")
+ + " set");
+ return false;
+ }
+
+ boolean mkdirs = avm.getFromSubValArgOrPref(Arg.MKDIRS, subVal, null,
+ "MKDIRS_OUTPUT", false);
+
+ if (!FileUtils.checkParentDir(file, mkdirs))
+ {
+ addError("Directory '"
+ + FileUtils.getParentDir(file).getAbsolutePath()
+ + "' does not exist for " + adjective + " file '" + filename
+ + "'."
+ + (mkdirs ? "" : " Try using " + Arg.MKDIRS.argString()));
+ isError = true;
+ return false;
+ }
+
+ return true;
+ }
+
+ public List<String> getErrors()
+ {
+ return errors;
+ }
+
+ public String errorsToString()
+ {
+ StringBuilder sb = new StringBuilder();
+ for (String error : errors)
+ {
+ if (sb.length() > 0)
+ sb.append("\n");
+ sb.append("- " + error);
+ }
+ return sb.toString();
+ }
}
package jalview.bin;
import java.io.PrintStream;
-import java.util.Locale;
import jalview.log.JLogger;
-import jalview.log.JLoggerI;
import jalview.log.JLoggerI.LogLevel;
import jalview.log.JLoggerLog4j;
import jalview.util.ChannelProperties;
{
JLogger.LogLevel logLevel = JLogger.LogLevel.INFO;
- if (JLogger.isLevel(providedLogLevel))
+ if (providedLogLevel != null && JLogger.isLevel(providedLogLevel))
{
logLevel = Console.getLogLevel(providedLogLevel);
}
public static void setLogLevel(String logLevelString)
{
- for (LogLevel logLevel : JLoggerI.LogLevel.values())
+ LogLevel l = null;
+ try
+ {
+ l = LogLevel.valueOf(logLevelString);
+ } catch (IllegalArgumentException | NullPointerException e1)
+ {
+ Console.debug("Invalid log level '" + logLevelString + "'");
+ return;
+ }
+ if (l != null)
{
- if (logLevel.toString().toLowerCase(Locale.ROOT)
- .equals(logLevelString.toLowerCase(Locale.ROOT)))
+ log.setLevel(l);
+ if (!Platform.isJS())
{
- log.setLevel(logLevel);
- if (!Platform.isJS())
- {
- Log4j.init(logLevel);
- }
- JLoggerLog4j.getLogger("org.apache.axis", logLevel);
- break;
+ Log4j.init(l);
}
+ JLoggerLog4j.getLogger("org.apache.axis", l);
}
}
import jalview.bin.argparser.Arg.Type;
import jalview.bin.argparser.ArgParser;
import jalview.bin.argparser.BootstrapArgs;
+import jalview.bin.groovy.JalviewObject;
+import jalview.bin.groovy.JalviewObjectI;
import jalview.ext.so.SequenceOntology;
import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
+import jalview.gui.JvOptionPane;
import jalview.gui.PromptUserConfig;
import jalview.gui.QuitHandler;
import jalview.gui.QuitHandler.QResponse;
* @author $author$
* @version $Revision$
*/
-public class Jalview
+public class Jalview implements JalviewObjectI
{
static
{
protected Commands cmds;
- public static AlignFrame currentAlignFrame;
+ public AlignFrame currentAlignFrame = null;
private ArgParser argparser = null;
// stop now if only after --version
if (bootstrapArgs.contains(Arg.VERSION))
{
- Jalview.exit(null, 0);
+ Jalview.exit(null, ExitCode.OK);
}
// old ArgsParser
}
else if (bootstrapArgs.contains(Arg.DEBUG))
{
- logLevel = "DEBUG";
+ logLevel = bootstrapArgs.getBoolean(Arg.DEBUG) ? "DEBUG" : "INFO";
}
if (logLevel == null && !(bootstrapProperties == null))
{
error.printStackTrace();
String message = "\nEssential logging libraries not found."
+ "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview";
- Jalview.exit(message, 0);
+ Jalview.exit(message, ExitCode.OK);
}
// register SIGTERM listener
.getList(Arg.HELP);
Console.outPrintln(Arg.usage(helpArgs.stream().map(e -> e.getKey())
.collect(Collectors.toList())));
- Jalview.exit(null, 0);
+ Jalview.exit(null, ExitCode.OK);
}
if (aparser.contains("help") || aparser.contains("h"))
{
showUsage();
*/
Console.outPrintln(Arg.usage());
- Jalview.exit(null, 0);
+ Jalview.exit(null, ExitCode.OK);
}
// new CLI
try
{
Console.initLogger();
- } catch (
-
- NoClassDefFoundError error)
+ } catch (NoClassDefFoundError error)
{
error.printStackTrace();
String message = "\nEssential logging libraries not found."
+ "\nUse: java -classpath \"$PATH_TO_LIB$/*:$PATH_TO_CLASSES$\" jalview.bin.Jalview";
- Jalview.exit(message, 0);
+ Jalview.exit(message, ExitCode.NO_LOGGING);
}
desktop = null;
desktop = new Desktop();
desktop.setInBatchMode(true); // indicate we are starting up
+ mixedCliWarning();
+
try
{
JalviewTaskbar.setTaskbar(this);
}
}
}
+ else
+ {
+
+ if (getArgParser().isMixedStyle())
+ {
+ String warning = MessageManager.formatMessage(
+ "warning.using_mixed_command_line_arguments",
+ getArgParser().getMixedExamples());
+ Console.warn(warning);
+ Jalview.exit(
+ "Exiting due to mixed old and new command line arguments",
+ ExitCode.INVALID_ARGUMENT);
+ }
+ if (getArgParser().isOldStyle())
+ {
+ String warning = MessageManager
+ .getString("warning.using_old_command_line_arguments")
+ .replace("\n", " ")
+ + "https://www.jalview.org/help/html/features/commandline.html";
+ Console.warn(warning);
+ }
+
+ }
+
// Run Commands from cli
cmds = new Commands(argparser, headlessArg);
cmds.processArgs();
else
{
Jalview.exit("Successfully completed commands in headless mode",
- 0);
+ ExitCode.OK);
}
}
Console.info("Successfully completed commands");
{
if (headlessArg)
{
- Jalview.exit("Error when running Commands in headless mode", 1);
+ Jalview.exit("Error when running Commands in headless mode",
+ ExitCode.ERROR_RUNNING_COMMANDS);
}
Console.warn("Error when running commands");
}
if (file == null && desktop == null && !commandsSuccess)
{
- Jalview.exit("No files to open!", 1);
+ Jalview.exit("No files to open!", ExitCode.NO_FILES);
}
long progress = -1;
if (headless)
{
Jalview.exit(
- "Can't find file '" + file + "' in headless mode", 1);
+ "Can't find file '" + file + "' in headless mode",
+ ExitCode.FILE_NOT_FOUND);
}
Console.warn("Can't find file'" + file + "'");
}
}
desktop.setInBatchMode(false);
}
+
+ cliWarning();
}
private static void setLookAndFeel()
*/
PromptUserConfig prompter = new PromptUserConfig(Desktop.desktop,
"USAGESTATS",
- MessageManager.getString("prompt.plausible_analytics_title"),
- MessageManager.getString("prompt.plausible_analytics"),
- new Runnable()
+ MessageManager.getString("prompt.analytics_title"),
+ MessageManager.getString("prompt.analytics"), new Runnable()
{
@Override
public void run()
}
try
{
+ JalviewObjectI j = new JalviewObject(this);
Map<String, java.lang.Object> vbinding = new HashMap<>();
- vbinding.put("Jalview", this);
- if (af != null)
- {
- vbinding.put("currentAlFrame", af);
- }
+ vbinding.put(JalviewObjectI.jalviewObjectName, j);
+ vbinding.put(JalviewObjectI.currentAlFrameName,
+ af != null ? af : getCurrentAlignFrame());
Binding gbinding = new Binding(vbinding);
GroovyScriptEngine gse = new GroovyScriptEngine(new URL[] { sfile });
gse.run(sfile.toString(), gbinding);
.errPrintln("Exception Whilst trying to execute file " + sfile
+ " as a groovy script.");
e.printStackTrace(System.err);
-
}
}
return false;
}
+ @Override
public AlignFrame[] getAlignFrames()
{
return desktop == null ? new AlignFrame[] { getCurrentAlignFrame() }
- : Desktop.getAlignFrames();
-
+ : Desktop.getDesktopAlignFrames();
}
/**
* jalview.bin.Jalview.quit() will just run the non-GUI shutdownHook and exit
*/
+ @Override
public void quit()
{
// System.exit will run the shutdownHook first
- Jalview.exit("Quitting now. Bye!", 0);
+ Jalview.exit("Quitting now. Bye!", ExitCode.OK);
}
- public static AlignFrame getCurrentAlignFrame()
+ @Override
+ public AlignFrame getCurrentAlignFrame()
{
- return Jalview.currentAlignFrame;
+ return currentAlignFrame;
}
- public static void setCurrentAlignFrame(AlignFrame currentAlignFrame)
+ public void setCurrentAlignFrame(AlignFrame af)
{
- Jalview.currentAlignFrame = currentAlignFrame;
+ this.currentAlignFrame = af;
}
public Commands getCommands()
return cmds;
}
- public static void exit(String message, int exitcode)
+ public static void exit(String message, ExitCode ec)
{
+ int exitcode = ec == ExitCode.OK ? 0 : ec.ordinal() + 1;
if (Console.log == null)
{
// Don't start the logger just to exit!
}
}
+ public enum ExitCode
+ {
+ // only add new ones to the end of the list (to preserve ordinal values)
+ OK, FILE_NOT_FOUND, FILE_NOT_READABLE, NO_FILES, INVALID_FORMAT,
+ INVALID_ARGUMENT, INVALID_VALUE, MIXED_CLI_ARGUMENTS,
+ ERROR_RUNNING_COMMANDS, NO_LOGGING, GROOVY_ERROR;
+ }
+
/******************************
*
* TEST OUTPUT METHODS
* @param a
* - Arg currently being processed
* @param s1
- * - expected
+ * - expected
* @param s2
*/
protected static void testoutput(ArgParser ap, Arg a, String s1,
}
/**
- * conditionally (on @param yes) report that expected value s1 was set during CommandsTest tests
+ * conditionally (on @param yes) report that expected value s1 was set during
+ * CommandsTest tests
*/
private static void testoutput(boolean yes, Arg a, String s1, String s2)
{
public static boolean isBatchMode()
{
- return getInstance()!=null && (getInstance().desktop == null || getInstance().desktop.isInBatchMode());
+ return getInstance() != null && (getInstance().desktop == null
+ || getInstance().desktop.isInBatchMode());
+ }
+
+ /**
+ * Warning about old or mixed command line arguments
+ */
+ private void mixedCliWarning()
+ {
+ Jalview j = Jalview.getInstance();
+ boolean mixedStyle = j.getArgParser() != null
+ && j.getArgParser().isMixedStyle();
+ String title = MessageManager.getString("label.command_line_arguments");
+ if (mixedStyle)
+ {
+ String warning = MessageManager.formatMessage(
+ "warning.using_mixed_command_line_arguments",
+ j.getArgParser().getMixedExamples());
+ String quit = MessageManager.getString("action.quit");
+
+ Desktop.instance.nonBlockingDialog(title, warning, null, quit,
+ JvOptionPane.WARNING_MESSAGE, false, false, true, 30000);
+
+ Jalview.exit(
+ "Exiting due to mixed old and new command line arguments.",
+ ExitCode.MIXED_CLI_ARGUMENTS);
+ }
+ }
+
+ private void cliWarning()
+ {
+ Jalview j = Jalview.getInstance();
+ Commands c = j.getCommands();
+ boolean oldStyle = j.getArgParser() != null
+ && j.getArgParser().isOldStyle();
+ String title = MessageManager.getString("label.command_line_arguments");
+ if (oldStyle)
+ {
+ String warning = MessageManager
+ .getString("warning.using_old_command_line_arguments");
+ String url = "<a href=\"https://www.jalview.org/help/html/features/commandline.html\">https://www.jalview.org/help/html/features/commandline.html</a>";
+ if (Desktop.instance != null)
+ {
+ String cont = MessageManager.getString("label.continue");
+
+ Desktop.instance.nonBlockingDialog(title, warning, url, cont,
+ JvOptionPane.WARNING_MESSAGE, false, true, true, 30000);
+ }
+ }
+ if (j.getCommands() != null && j.getCommands().getErrors().size() > 0)
+ {
+ if (Desktop.instance != null)
+ {
+ String message = MessageManager
+ .getString("warning.the_following_errors");
+ String ok = MessageManager.getString("action.ok");
+ int shortest = 60;
+ List<String> errors = j.getCommands().getErrors();
+ for (int i = 0; i < errors.size(); i++)
+ {
+ shortest = Math.min(shortest, errors.get(i).length());
+ }
+ Desktop.instance.nonBlockingDialog(
+ Math.max(message.length(), Math.min(60, shortest)),
+ Math.min(errors.size(), 20), title, message,
+ j.getCommands().errorsToString(), ok,
+ JvOptionPane.WARNING_MESSAGE, true, false, true, -1);
+ }
+ }
}
}
// Initialising arguments (BOOTSTRAP)
HELP(Type.HELP, "h", "Display basic help", Opt.UNARY, Opt.BOOTSTRAP,
- Opt.HASTYPE, Opt.MULTI),
+ Opt.HASTYPE, Opt.MULTIVALUE),
/*
* Other --help-type Args will be added by the static block.
*/
QUESTIONNAIRE(Type.CONFIG,
"Show (or don't show) the questionnaire if one is available.",
true, Opt.BOOLEAN, Opt.BOOTSTRAP),
+ JAVACONSOLE(Type.CONFIG, "Show (or don't show) the Java Console.", false,
+ Opt.BOOLEAN, Opt.BOOTSTRAP),
NOUSAGESTATS(Type.CONFIG, "Don't send initial launch usage stats.",
Opt.UNARY, Opt.BOOTSTRAP),
NOSTARTUPFILE(Type.CONFIG, "Don't show the default startup file.",
Opt.BOOTSTRAP, Opt.SECRET),
QUIET(Type.CONFIG, "q",
"Stop all output to STDOUT (after the Java Virtual Machine has started). Use ‑‑quiet a second time to stop all output to STDERR.",
- Opt.UNARY, Opt.MULTI, Opt.BOOTSTRAP),
+ Opt.UNARY, Opt.MULTIVALUE, Opt.BOOTSTRAP),
INITSUBSTITUTIONS(Type.CONFIG,
"Set ‑‑substitutions to be initially enabled (or initially disabled).",
true, Opt.BOOLEAN, Opt.BOOTSTRAP, Opt.NOACTION, Opt.SECRET),
P(Type.CONFIG, "Set a Jalview preference value for this session.",
Opt.PREFIXKEV, Opt.PRESERVECASE, Opt.STRING, Opt.BOOTSTRAP,
- Opt.MULTI, Opt.NOACTION, Opt.SECRET), // keep this secret for now.
+ Opt.MULTIVALUE, Opt.NOACTION, Opt.SECRET), // keep this secret for
+ // now.
// Opening an alignment
OPEN(Type.OPENING,
"Opens one or more alignment files or URLs in new alignment windows.",
- Opt.STRING, Opt.LINKED, Opt.INCREMENTDEFAULTCOUNTER, Opt.MULTI,
- Opt.GLOB, Opt.ALLOWSUBSTITUTIONS, Opt.INPUT, Opt.STORED,
- Opt.PRIMARY),
+ Opt.STRING, Opt.LINKED, Opt.INCREMENTDEFAULTCOUNTER,
+ Opt.MULTIVALUE, Opt.GLOB, Opt.ALLOWSUBSTITUTIONS, Opt.INPUT,
+ Opt.STORED, Opt.PRIMARY),
APPEND(Type.OPENING,
"Appends one or more alignment files or URLs to the open alignment window (or opens a new alignment if none already open).",
- Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.GLOB,
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.GLOB,
Opt.ALLOWSUBSTITUTIONS, Opt.INPUT, Opt.PRIMARY),
TITLE(Type.OPENING,
"Specifies the title for the open alignment window as string.",
- Opt.STRING, Opt.LINKED),
+ Opt.STRING, Opt.LINKED, Opt.ALLOWMULTIID),
COLOUR(Type.OPENING, "color", // being a bit soft on the Americans!
"Applies the colour scheme to the open alignment window. Valid values include:\n"
+ "clustal,\n" + "blosum62,\n" + "pc-identity,\n"
+ "Names of user defined colourschemes will also work,\n"
+ "and jalview colourscheme specifications like\n"
+ "--colour=\"D,E=red; K,R,H=0022FF; C,c=yellow\"",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+ Opt.STRING, Opt.LINKED, Opt.ALLOWMULTIID),
FEATURES(Type.OPENING, "Add a feature file or URL to the open alignment.",
- Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWSUBSTITUTIONS,
+ Opt.ALLOWMULTIID),
TREE(Type.OPENING, "Add a tree file or URL to the open alignment.",
- Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWSUBSTITUTIONS,
+ Opt.ALLOWMULTIID),
SORTBYTREE(Type.OPENING,
"Enforces sorting (or not sorting) the open alignment in the order of an attached phylogenetic tree.",
- true, Opt.LINKED, Opt.BOOLEAN, Opt.ALLOWALL),
+ true, Opt.LINKED, Opt.BOOLEAN, Opt.ALLOWMULTIID),
ANNOTATIONS(Type.OPENING,
"Add an annotations file or URL to the open alignment.",
- Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWSUBSTITUTIONS,
+ Opt.ALLOWMULTIID),
SHOWANNOTATIONS(Type.OPENING,
"Enforces showing (or not showing) alignment annotations.",
- Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWALL),
+ Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWMULTIID, Opt.ALLOWMULTIID),
WRAP(Type.OPENING,
"Enforces wrapped (or not wrapped) alignment formatting.",
- Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWALL),
+ Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWMULTIID, Opt.ALLOWMULTIID),
NOSTRUCTURE(Type.OPENING,
"Do not open or process any 3D structure in the ‑‑open or ‑‑append files.",
- Opt.UNARY, Opt.LINKED, Opt.ALLOWALL),
+ Opt.UNARY, Opt.LINKED, Opt.ALLOWMULTIID, Opt.ALLOWMULTIID),
// Adding a 3D structure
STRUCTURE(Type.STRUCTURE,
"Load a structure file or URL associated with a sequence in the open alignment.\n"
+ "The sequence to be associated with can be specified with a following --seqid argument, or the subval modifier seqid=ID can be used. A subval INDEX can also be used to specify the INDEX-th sequence in the open alignment.",
- Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS,
- Opt.PRIMARY),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWSUBSTITUTIONS,
+ Opt.PRIMARY, Opt.ALLOWMULTIID),
SEQID(Type.STRUCTURE,
"Specify the sequence name for the preceding --structure to be associated with.",
- Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWSUBSTITUTIONS,
+ Opt.ALLOWMULTIID),
PAEMATRIX(Type.STRUCTURE,
"Add a PAE json matrix file to the preceding --structure.",
- Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWSUBSTITUTIONS,
+ Opt.ALLOWMULTIID),
TEMPFAC(Type.STRUCTURE,
"Set the type of temperature factor. Possible values are:\n"
+ "default,\n" + "plddt.",
- Opt.STRING, Opt.LINKED),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWMULTIID),
STRUCTUREVIEWER(Type.STRUCTURE,
"Set the structure viewer to use to open the 3D structure file specified in previous --structure to name. Possible values of name are:\n"
+ "none,\n" + "jmol,\n" + "chimera,\n" + "chimerax,\n"
+ "pymol.",
- Opt.STRING, Opt.LINKED, Opt.MULTI),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWMULTIID),
NOTEMPFAC(Type.STRUCTURE,
"Do not show the temperature factor annotation for the preceding --structure.",
- Opt.UNARY, Opt.LINKED, Opt.ALLOWALL, Opt.SECRET), // keep this secret
- // until it works!
+ Opt.UNARY, Opt.LINKED, Opt.ALLOWMULTIID, Opt.SECRET), // keep this
+ // secret until
+ // it works!
SHOWSSANNOTATIONS(Type.STRUCTURE, null, Opt.BOOLEAN, Opt.LINKED,
- Opt.ALLOWALL),
+ Opt.ALLOWMULTIID),
// Outputting files
IMAGE(Type.IMAGE,
"Output an image of the open alignment window. Format is specified by the subval modifier, a following --type argument or guessed from the file extension. Valid formats/extensions are:\n"
+ "svg,\n" + "png,\n" + "eps,\n" + "html,\n" + "biojs.",
- Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS, Opt.ALLOWALL,
- Opt.REQUIREINPUT, Opt.OUTPUTFILE, Opt.PRIMARY),
+ Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS, Opt.MULTIVALUE,
+ Opt.ALLOWMULTIID, Opt.REQUIREINPUT, Opt.OUTPUTFILE, Opt.PRIMARY),
+ STRUCTUREIMAGE(Type.IMAGE,
+ "Export an image of a 3D structure opened in JMOL", Opt.STRING,
+ Opt.LINKED, Opt.MULTIVALUE, Opt.OUTPUTFILE, Opt.ALLOWMULTIID,
+ Opt.PRIMARY),
TYPE(Type.IMAGE,
- "Set the image format for the preceding --image. Valid values are:\n"
- + "svg,\n" + "png,\n" + "eps,\n" + "html,\n" + "biojs.",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+ "Set the image format for the preceding " + Arg.IMAGE.argString()
+ + " or " + Arg.STRUCTUREIMAGE.argString()
+ + ". Valid values are:\n" + "svg,\n" + "png,\n" + "eps,\n"
+ + "html,\n" + "biojs.",
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWMULTIID),
TEXTRENDERER(Type.IMAGE,
"Sets whether text in a vector image format (SVG, HTML, EPS) should be rendered as text or vector line-art. Possible values are:\n"
+ "text,\n" + "lineart.",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWMULTIID),
SCALE(Type.IMAGE,
"Sets a scaling for bitmap image format (PNG). Should be given as a floating point number. If used in conjunction with --width and --height then the smallest scaling will be used (scale, width and height provide bounds for the image).",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWMULTIID),
WIDTH(Type.IMAGE,
"Sets a width for bitmap image format (PNG) with the height maintaining the aspect ratio. Should be given as a positive integer. If used in conjunction with --scale and --height then the smallest scaling will be used (scale, width and height provide bounds for the image).",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWMULTIID),
HEIGHT(Type.IMAGE,
"Sets a height for bitmap image format (PNG) with the width maintaining the aspect ratio. Should be given as a positive integer. If used in conjunction with --scale and --width then the smallest scaling will be used (scale, width and height provide bounds for the image).",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
- STRUCTUREIMAGE(Type.STRUCTUREIMAGE,
- "Export an image of a 3D structure opened in JMOL", Opt.STRING,
- Opt.LINKED, Opt.MULTI, Opt.OUTPUTFILE),
- STRUCTUREIMAGETYPE(Type.STRUCTUREIMAGE,
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWMULTIID),
+ IMAGECOLOUR(Type.IMAGE, "imagecolor", // being a bit soft on the Americans!
+ "Applies the colour scheme to the open alignment window for this image, otherwise the value of "
+ + Arg.COLOUR.argString()
+ + " (or none) will apply. Valid values are the same as "
+ + Arg.COLOUR.argString() + ".",
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWMULTIID),
+ BGCOLOUR(Type.IMAGE, "bgcolor", // being a bit soft on the Americans!
+ "Applies a background colour to the structure image. Valid values are named colours known to Java or RRGGBB 6 digit hex-string.",
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWMULTIID),
+ /*
+ STRUCTUREIMAGETYPE(Type.IMAGE,
"Set the structure image format for the preceding --structureimage. Valid values are:\n"
+ "svg,\n" + "png,\n" + "eps,\n" + "html,\n" + "biojs.",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
- STRUCTUREIMAGETEXTRENDERER(Type.STRUCTUREIMAGE,
+ Opt.STRING, Opt.LINKED, Opt.ALLOWMULTIID),
+ STRUCTUREIMAGETEXTRENDERER(Type.IMAGE,
"Sets whether text in a vector structure image format (SVG, EPS) should be rendered as text or vector line-art. Possible values are:\n"
+ "text,\n" + "lineart.",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
- STRUCTUREIMAGESCALE(Type.STRUCTUREIMAGE,
+ Opt.STRING, Opt.LINKED, Opt.ALLOWMULTIID),
+ STRUCTUREIMAGESCALE(Type.IMAGE,
"Sets a scaling for bitmap structure image format (PNG). Should be given as a floating point number. If used in conjunction with --structureimagewidth and --structureimageheight then the smallest scaling will be used (structureimagescale, structureimagewidth and structureimageheight provide bounds for the structure image).",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
- STRUCTUREIMAGEWIDTH(Type.STRUCTUREIMAGE,
+ Opt.STRING, Opt.LINKED, Opt.ALLOWMULTIID),
+ STRUCTUREIMAGEWIDTH(Type.IMAGE,
"Sets a width for bitmap structure image format (PNG) with the height maintaining the aspect ratio. Should be given as a positive integer. If used in conjunction with --structureimagescale and --structureimageheight then the smallest scaling will be used (structureimagescale, structureimagewidth and structureimageheight provide bounds for the structure image).",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
- STRUCTUREIMAGEHEIGHT(Type.STRUCTUREIMAGE,
+ Opt.STRING, Opt.LINKED, Opt.ALLOWMULTIID),
+ STRUCTUREIMAGEHEIGHT(Type.IMAGE,
"Sets a height for bitmap structure image format (PNG) with the width maintaining the aspect ratio. Should be given as a positive integer. If used in conjunction with --structureimagescale and --structureimagewidth then the smallest scaling will be used (structureimagescale, structureimagewidth and structureimageheight provide bounds for the structure image).",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+ Opt.STRING, Opt.LINKED, Opt.ALLOWMULTIID),
+ */
OUTPUT(Type.OUTPUT,
"Export the open alignment to file filename. The format name is specified by the subval modifier format=name, a following --format name argument or guessed from the file extension. Valid format names (and file extensions) are:\n"
+ "pileup (pileup),\n" + "msf (msf),\n"
+ "clustal (aln),\n" + "phylip (phy),\n"
+ "jalview (jvp, jar).",
- Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS, Opt.ALLOWALL,
+ Opt.STRING, Opt.LINKED, Opt.ALLOWSUBSTITUTIONS, Opt.ALLOWMULTIID,
Opt.REQUIREINPUT, Opt.OUTPUTFILE, Opt.STDOUT, Opt.PRIMARY),
FORMAT(Type.OUTPUT,
"Sets the format for the preceding --output file. Valid formats are:\n"
+ "fasta,\n" + "pfam,\n" + "stockholm,\n" + "pir,\n"
+ "blc,\n" + "amsa,\n" + "json,\n" + "pileup,\n"
+ "msf,\n" + "clustal,\n" + "phylip,\n" + "jalview.",
- Opt.STRING, Opt.LINKED, Opt.ALLOWALL),
+ Opt.STRING, Opt.LINKED, Opt.ALLOWMULTIID),
GROOVY(Type.PROCESS,
"Process a groovy script in the file for the open alignment.",
- Opt.STRING, Opt.LINKED, Opt.MULTI, Opt.ALLOWSUBSTITUTIONS,
- Opt.ALLOWALL),
+ Opt.STRING, Opt.LINKED, Opt.MULTIVALUE, Opt.ALLOWSUBSTITUTIONS,
+ Opt.ALLOWMULTIID),
BACKUPS(Type.OUTPUT,
"Enable (or disable) writing backup files when saving an ‑‑output file. This applies to the current open alignment. To apply to all ‑‑output and ‑‑image files, use after ‑‑all.",
- true, Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWALL),
+ true, Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWMULTIID),
OVERWRITE(Type.OUTPUT,
"Enable (or disable) overwriting of output files without backups enabled. This applies to the current open alignment. To apply to all ‑‑output and ‑‑image files, use after ‑‑all.",
- Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWALL),
+ Opt.BOOLEAN, Opt.LINKED, Opt.ALLOWMULTIID),
CLOSE(Type.OPENING,
"Close the current open alignment window. This occurs after other output arguments. This applies to the current open alignment. To apply to all ‑‑output and ‑‑image files, use after ‑‑all.",
- Opt.UNARY, Opt.LINKED, Opt.ALLOWALL),
+ Opt.UNARY, Opt.LINKED, Opt.ALLOWMULTIID),
+ MKDIRS(Type.OUTPUT,
+ "Automatically create directories when outputting a file to a new directory.",
+ Opt.UNARY, Opt.LINKED, Opt.ALLOWMULTIID),
// controlling flow of arguments
NEW(Type.FLOW,
"Move on to a new alignment window. This will ensure --append will start a new alignment window and other linked arguments will apply to the new alignment window.",
- Opt.UNARY, Opt.MULTI, Opt.NOACTION, Opt.INCREMENTDEFAULTCOUNTER),
+ Opt.UNARY, Opt.MULTIVALUE, Opt.NOACTION,
+ Opt.INCREMENTDEFAULTCOUNTER),
SUBSTITUTIONS(Type.FLOW,
"The following argument values allow (or don't allow) subsituting filename parts. This is initially true. Valid substitutions are:\n"
+ "{basename} - the filename-without-extension of the currently --opened file (or first --appended file),\n"
+ "{n} - the value of the index counter (starting at 0).\n"
+ "{++n} - increase and substitute the value of the index counter,\n"
+ "{} - the value of the current alignment window default index.",
- true, Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION),
+ true, Opt.BOOLEAN, Opt.MULTIVALUE, Opt.NOACTION),
ARGFILE(Type.FLOW,
"Open one or more files filename and read, line-by-line, as arguments to Jalview.\n"
+ "Values in an argfile should be given with an equals sign (\"=\") separator with no spaces.\n"
+ "Note that if you use one or more --argfile arguments then all other non-initialising arguments will be ignored.",
- Opt.STRING, Opt.MULTI, Opt.BOOTSTRAP, Opt.GLOB,
+ Opt.STRING, Opt.MULTIVALUE, Opt.BOOTSTRAP, Opt.GLOB,
Opt.ALLOWSUBSTITUTIONS),
NPP(Type.FLOW, "n++",
"Increase the index counter used in argument value substitutions.",
- Opt.UNARY, Opt.MULTI, Opt.NOACTION),
+ Opt.UNARY, Opt.MULTIVALUE, Opt.NOACTION),
ALL(Type.FLOW,
"Apply the following output arguments to all sets of linked arguments.",
- Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION),
+ Opt.BOOLEAN, Opt.MULTIVALUE, Opt.NOACTION),
OPENED(Type.FLOW,
"Apply the following output arguments to all of the last --open'ed set of linked arguments.",
- Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION),
+ Opt.BOOLEAN, Opt.MULTIVALUE, Opt.NOACTION),
QUIT(Type.FLOW,
"After all files have been opened, appended and output, quit Jalview. In ‑‑headless mode this already happens.",
Opt.UNARY),
Opt.UNARY, Opt.SECRET),
ALLSTRUCTURES(Type.FLOW,
"Apply the following 3D structure formatting arguments to all structures within the open alignment.",
- Opt.BOOLEAN, Opt.MULTI, Opt.NOACTION),
+ Opt.BOOLEAN, Opt.MULTIVALUE, Opt.NOACTION),
// secret options
TESTOUTPUT(Type.CONFIG,
"Allow specific stdout information. For testing purposes only.",
Opt.UNARY, Opt.BOOTSTRAP, Opt.SECRET), // do not show this to the user
SETPROP(Type.CONFIG, "Set an individual Java System property.",
- Opt.STRING, Opt.MULTI, Opt.BOOTSTRAP, Opt.SECRET), // not in use yet
+ Opt.STRING, Opt.MULTIVALUE, Opt.BOOTSTRAP, Opt.SECRET), // not in use
+ // yet
NIL(Type.FLOW,
"This argument does nothing on its own, but can be used with linkedIds.",
- Opt.UNARY, Opt.LINKED, Opt.MULTI, Opt.NOACTION, Opt.SECRET),
+ Opt.UNARY, Opt.LINKED, Opt.MULTIVALUE, Opt.NOACTION, Opt.SECRET),
// private options (inserted during arg processing)
SETARGFILE(Type.FLOW,
"Sets the current value of the argfilename. Inserted before argfilecontents.",
- Opt.UNARY, Opt.LINKED, Opt.STRING, Opt.MULTI, Opt.PRIVATE,
+ Opt.UNARY, Opt.LINKED, Opt.STRING, Opt.MULTIVALUE, Opt.PRIVATE,
Opt.NOACTION),
UNSETARGFILE(Type.FLOW,
"Unsets the current value of the argfilename. Inserted after argfile contents.",
- Opt.UNARY, Opt.LINKED, Opt.MULTI, Opt.PRIVATE, Opt.NOACTION),
+ Opt.UNARY, Opt.LINKED, Opt.MULTIVALUE, Opt.PRIVATE, Opt.NOACTION),
// these last two have no purpose in the normal Jalview application but are
// used by jalview.bin.Launcher to set memory settings. They are not used by
* A MULTI Arg can be specified multiple times.
* Multiple values are stored in the ArgValuesMap (along with their positional index) for each linkedId.
*/
- MULTI("can be specified multiple times"),
+ MULTIVALUE("can be specified multiple times"),
/*
* A Linked Arg can be linked to others through a --arg[linkedId] or --arg[linkedId]=value.
* If no linkedId is specified then the current default linkedId will be used.
/*
* An ALLOWALL Arg can use the '*' linkedId to apply to all known linkedIds
*/
- ALLOWALL("can be used with " + ArgParser.DOUBLEDASH + "all"),
+ ALLOWMULTIID("can be used with " + ArgParser.DOUBLEDASH + "all"),
/*
* If an Arg has the INCREMENTDEFAULTCOUNTER option and the default linkedId is used,
* the defaultLinkedIdCounter is incremented *first*.
STRUCTURE("arguments used to add and format 3D structure data"),
PROCESS("arguments used to process an alignment once opened"),
OUTPUT("arguments used to save data from a processed alignment"),
- IMAGE("arguments used to export an image of an alignment"),
- STRUCTUREIMAGE("arguments used to export an image of an structure"),
+ IMAGE("arguments used to export an image of an alignment or structure"),
+ // IMAGE("arguments used to export an image of an alignment"),
+ // STRUCTUREIMAGE("arguments used to export an image of an structure"),
FLOW("arguments that control processing of the other arguments"), //
ALL("all arguments"), // mostly just a place-holder for --help-all
NONE, // mostly a place-holder for --help
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
-import java.util.Locale;
import java.util.Map;
-import jalview.bin.Cache;
import jalview.bin.Console;
import jalview.bin.Jalview;
+import jalview.bin.Jalview.ExitCode;
import jalview.bin.argparser.Arg.Opt;
import jalview.bin.argparser.Arg.Type;
import jalview.util.FileUtils;
private static final String LINKEDIDDIRNAME = "{dirname}";
/**
+ * On-the-fly substitution (not made at argument parsing time)! the current
+ * structure filename extension
+ */
+ private static final String STRUCTUREEXTENSION = "{structureextension}";
+
+ /**
+ * On-the-fly substitution (not made at argument parsing time)! the current
+ * structure filename base
+ */
+ private static final String STRUCTUREBASENAME = "{structurebasename}";
+
+ /**
+ * On-the-fly substitution (not made at argument parsing time)! the current
+ * structure filename dir path
+ */
+ private static final String STRUCTUREDIRNAME = "{structuredirname}";
+
+ /**
+ * On-the-fly substitution (not made at argument parsing time)! increment the
+ * on-the-fly counter and substitute the incremented value
+ */
+ private static final String INCREMENTONTHEFLYCOUNTER = "{++m}";
+
+ /**
+ * On-the-fly substitution (not made at argument parsing time)! the current
+ * substitute with the on-the-fly counter
+ */
+ private static final String ONTHEFLYCOUNTER = "{m}";
+
+ /**
+ * the string used for on-the-fly structure filename substitutions
+ */
+ private String currentStructureFilename = null;
+
+ /**
+ * the counter used for on-the-fly {m} substitutions
+ */
+ private int ontheflyCounter = 0;
+
+ /**
* the current argfile
*/
private String argFile = null;
private boolean allLinkedIds = false;
/**
- * flag to say whether the default linkedId is the current default linked id
- * or OPENED linkedIds
- */
- private boolean openedLinkedIds = false;
-
- /**
* flag to say whether the structure arguments should be applied to all
* structures with this linked id
*/
private BootstrapArgs bootstrapArgs = null;
+ private boolean oldArguments = false;
+
+ private boolean mixedArguments = false;
+
+ /**
+ * saved examples of mixed arguments
+ */
+ private String[] mixedExamples = new String[] { null, null };
+
static
{
argMap = new HashMap<>();
if (arg.startsWith(DOUBLEDASH))
{
dd = true;
- break;
+ if (mixedExamples[1] == null)
+ {
+ mixedExamples[1] = arg;
+ }
}
- else if (arg.startsWith("-") || arg.equals("open"))
+ else if ((arg.startsWith("-") && !arg.equals(STDOUTFILENAME))
+ || arg.equals("open"))
{
d = true;
+ if (mixedExamples[0] == null)
+ {
+ mixedExamples[0] = arg;
+ }
+ }
+ }
+ if (d)
+ {
+ if (dd)
+ {
+ mixedArguments = true;
+ }
+ else
+ {
+ oldArguments = true;
}
}
- if (d && !dd)
+
+ if (oldArguments || mixedArguments)
{
// leave it to the old style -- parse an empty list
parse(new ArrayList<String>(), false, false);
return;
}
+
if (bsa != null)
+ {
this.bootstrapArgs = bsa;
+ }
else
+ {
this.bootstrapArgs = BootstrapArgs.getBootstrapArgs(args);
+ }
parse(args, initsubstitutions, allowPrivate);
}
{
// arg not found
Console.error("Argument '" + arg + "' not recognised. Exiting.");
- Jalview.exit("Invalid argument used." + System.lineSeparator()
- + "Use" + System.lineSeparator() + "jalview "
- + Arg.HELP.argString() + System.lineSeparator()
- + "for a usage statement.", 13);
+ Jalview.exit(
+ "Invalid argument used." + System.lineSeparator() + "Use"
+ + System.lineSeparator() + "jalview "
+ + Arg.HELP.argString() + System.lineSeparator()
+ + "for a usage statement.",
+ ExitCode.INVALID_ARGUMENT);
continue;
}
if (a.hasOption(Opt.PRIVATE) && !allowPrivate)
else if (a == Arg.ALL)
{
allLinkedIds = !negated;
- openedLinkedIds = false;
- }
- else if (a == Arg.OPENED)
- {
- openedLinkedIds = !negated;
- allLinkedIds = false;
}
else if (a == Arg.ALLSTRUCTURES)
{
{
if (linkedId == null)
{
- if (a.hasOption(Opt.OUTPUTFILE) && a.hasOption(Opt.ALLOWALL)
- && val.startsWith(MATCHALLLINKEDIDS))
+ if (a.hasOption(Opt.OUTPUTFILE) && a.hasOption(Opt.ALLOWMULTIID)
+ && val.contains(MATCHALLLINKEDIDS))
{
- // --output=*.ext is shorthand for --all --output {basename}.ext
+ // --output=*.ext is shorthand for --output {basename}.ext
+ // --output=*/*.ext is shorthand for
+ // --output {dirname}/{basename}.ext
// (or --image=*.ext)
- allLinkedIds = true;
- openedLinkedIds = false;
- linkedId = MATCHALLLINKEDIDS;
- val = LINKEDIDDIRNAME + File.separator + LINKEDIDBASENAME
- + val.substring(MATCHALLLINKEDIDS.length());
+ linkedId = allLinkedIds ? MATCHALLLINKEDIDS
+ : MATCHOPENEDLINKEDIDS;
+ val = FileUtils.convertWildcardsToPath(val, MATCHALLLINKEDIDS,
+ LINKEDIDDIRNAME, LINKEDIDBASENAME);
}
- else if (a.hasOption(Opt.OUTPUTFILE)
- && a.hasOption(Opt.ALLOWALL)
- && val.startsWith(MATCHOPENEDLINKEDIDS))
- {
- // --output=open*.ext is shorthand for --opened --output
- // {basename}.ext
- // (or --image=open*.ext)
- openedLinkedIds = true;
- allLinkedIds = false;
- linkedId = MATCHOPENEDLINKEDIDS;
- val = LINKEDIDDIRNAME + File.separator + LINKEDIDBASENAME
- + val.substring(MATCHOPENEDLINKEDIDS.length());
- }
- else if (allLinkedIds && a.hasOption(Opt.ALLOWALL))
+ else if (allLinkedIds && a.hasOption(Opt.ALLOWMULTIID))
{
linkedId = MATCHALLLINKEDIDS;
}
- else if (openedLinkedIds && a.hasOption(Opt.ALLOWALL))
+ else if (a.hasOption(Opt.ALLOWMULTIID)
+ && this.storedLinkedIds != null
+ && this.storedLinkedIds.size() > 0)
{
linkedId = MATCHOPENEDLINKEDIDS;
}
// set allstructures to all non-primary structure options in this linked
// id if --allstructures has been set
- if (allStructures
- && (a.getType() == Type.STRUCTURE
- || a.getType() == Type.STRUCTUREIMAGE)
- && !a.hasOption(Opt.PRIMARY))
+ if (allStructures && (a.getType() == Type.STRUCTURE
+ // || a.getType() == Type.STRUCTUREIMAGE)
+ ) && !a.hasOption(Opt.PRIMARY))
{
if (!subvals.has(Arg.ALLSTRUCTURES.getName()))
// && !subvals.has("structureid"))
// remove the '*' or 'open*' linkedId that should be empty if it was
// created
if ((MATCHALLLINKEDIDS.equals(linkedId)
+ || MATCHOPENEDLINKEDIDS.equals(linkedId))
&& linkedArgs.containsKey(linkedId))
- || (MATCHOPENEDLINKEDIDS.equals(linkedId)
- && linkedArgs.containsKey(linkedId)))
{
linkedArgs.remove(linkedId);
}
public String makeSubstitutions(String val, String linkedId)
{
+ return makeSubstitutions(val, linkedId, false);
+ }
+
+ public String makeSubstitutions(String val, String linkedId,
+ boolean onthefly)
+ {
if (!this.substitutions || val == null)
return val;
rest = val;
}
if (rest.contains(LINKEDIDAUTOCOUNTER))
+ {
rest = rest.replace(LINKEDIDAUTOCOUNTER,
String.valueOf(linkedIdAutoCounter));
+ }
if (rest.contains(INCREMENTLINKEDIDAUTOCOUNTER))
+ {
rest = rest.replace(INCREMENTLINKEDIDAUTOCOUNTER,
String.valueOf(++linkedIdAutoCounter));
+ }
if (rest.contains(DEFAULTLINKEDIDCOUNTER))
+ {
rest = rest.replace(DEFAULTLINKEDIDCOUNTER,
String.valueOf(defaultLinkedIdCounter));
+ }
ArgValuesMap avm = linkedArgs.get(linkedId);
if (avm != null)
{
FileUtils.getDirname(new File(argFile)));
}
}
+ if (onthefly)
+ {
+ if (rest.contains(ONTHEFLYCOUNTER))
+ {
+ rest = rest.replace(ONTHEFLYCOUNTER,
+ String.valueOf(ontheflyCounter));
+ }
+ if (rest.contains(INCREMENTONTHEFLYCOUNTER))
+ {
+ rest = rest.replace(INCREMENTONTHEFLYCOUNTER,
+ String.valueOf(++ontheflyCounter));
+ }
+ if (currentStructureFilename != null)
+ {
+ if (rest.contains(STRUCTUREBASENAME))
+ {
+ rest = rest.replace(STRUCTUREBASENAME, FileUtils
+ .getBasename(new File(currentStructureFilename)));
+ }
+ if (rest.contains(STRUCTUREDIRNAME))
+ {
+ rest = rest.replace(STRUCTUREDIRNAME,
+ FileUtils.getDirname(new File(currentStructureFilename)));
+ }
+ }
+ }
return new StringBuilder(subvals).append(rest).toString();
}
{
String message = Arg.ARGFILE.argString() + EQUALS + "\""
+ argFile.getPath() + "\": File does not exist.";
- Jalview.exit(message, 2);
+ Jalview.exit(message, ExitCode.FILE_NOT_FOUND);
}
try
{
{
String message = Arg.ARGFILE.argString() + "=\"" + argFile.getPath()
+ "\": File could not be read.";
- Jalview.exit(message, 3);
+ Jalview.exit(message, ExitCode.FILE_NOT_READABLE);
}
}
// Third param "true" uses Opt.PRIVATE args --setargile=argfile and
String message = Arg.ARGFILE.argString() + "=\"" + argFile.getPath()
+ "\": File could not be read.";
Console.debug(message, e);
- Jalview.exit(message, 3);
+ Jalview.exit(message, ExitCode.FILE_NOT_READABLE);
}
}
return args;
}
- public static enum Position
- {
- FIRST, BEFORE, AFTER
- }
-
- /**
- * get from following Arg of type a or subval of same name (lowercase)
- */
- public static String getValueFromSubValOrArg(ArgValuesMap avm,
- ArgValue av, Arg a, SubVals sv)
- {
- return getFromSubValArgOrPref(avm, av, a, sv, null, null, null);
- }
-
- /**
- * get from following Arg of type a or subval key or preference pref or
- * default def
- */
- public static String getFromSubValArgOrPref(ArgValuesMap avm, ArgValue av,
- Arg a, SubVals sv, String key, String pref, String def)
- {
- return getFromSubValArgOrPref(avm, a, Position.AFTER, av, sv, key, pref,
- def);
- }
-
- /**
- * get from following(AFTER), first occurence of (FIRST) or previous (BEFORE)
- * Arg of type a or subval key or preference pref or default def
- */
- public static String getFromSubValArgOrPref(ArgValuesMap avm, Arg a,
- Position pos, ArgValue av, SubVals sv, String key, String pref,
- String def)
- {
- return getFromSubValArgOrPrefWithSubstitutions(null, avm, a, pos, av,
- sv, key, pref, def);
- }
-
- public static String getFromSubValArgOrPrefWithSubstitutions(ArgParser ap,
- ArgValuesMap avm, Arg a, Position pos, ArgValue av, SubVals sv,
- String key, String pref, String def)
- {
- if (key == null)
- key = a.getName();
- String value = null;
- if (sv != null && sv.has(key) && sv.get(key) != null)
- {
- value = ap == null ? sv.get(key)
- : sv.getWithSubstitutions(ap, avm.getLinkedId(), key);
- }
- else if (avm != null && avm.containsArg(a))
- {
- if (pos == Position.FIRST && avm.getValue(a) != null)
- value = avm.getValue(a);
- else if (pos == Position.BEFORE
- && avm.getClosestPreviousArgValueOfArg(av, a) != null)
- value = avm.getClosestPreviousArgValueOfArg(av, a).getValue();
- else if (pos == Position.AFTER
- && avm.getClosestNextArgValueOfArg(av, a) != null)
- value = avm.getClosestNextArgValueOfArg(av, a).getValue();
-
- // look for allstructures subval for Type.STRUCTURE*
- Arg arg = av.getArg();
- if (value == null && arg.hasOption(Opt.PRIMARY)
- && arg.getType() == Type.STRUCTURE
- && !a.hasOption(Opt.PRIMARY) && (a.getType() == Type.STRUCTURE
- || a.getType() == Type.STRUCTUREIMAGE))
- {
- ArgValue av2 = avm.getArgValueOfArgWithSubValKey(a,
- Arg.ALLSTRUCTURES.getName());
- if (av2 != null)
- {
- value = av2.getValue();
- }
- }
- }
- if (value == null)
- {
- value = pref != null ? Cache.getDefault(pref, def) : def;
- }
- return value;
- }
-
- public static boolean getBoolFromSubValOrArg(ArgValuesMap avm, Arg a,
- SubVals sv)
- {
- return getFromSubValArgOrPref(avm, a, sv, null, null, false);
- }
-
- public static boolean getFromSubValArgOrPref(ArgValuesMap avm, Arg a,
- SubVals sv, String key, String pref, boolean def)
- {
- return getFromSubValArgOrPref(avm, a, sv, key, pref, def, false);
- }
-
- public static boolean getFromSubValArgOrPref(ArgValuesMap avm, Arg a,
- SubVals sv, String key, String pref, boolean def,
- boolean invertPref)
- {
- if ((key == null && a == null) || (sv == null && a == null))
- return false;
-
- boolean usingArgKey = false;
- if (key == null)
- {
- key = a.getName();
- usingArgKey = true;
- }
-
- String nokey = ArgParser.NEGATESTRING + key;
-
- // look for key or nokey in subvals first (if using Arg check options)
- if (sv != null)
- {
- // check for true boolean
- if (sv.has(key) && sv.get(key) != null)
- {
- if (usingArgKey)
- {
- if (!(a.hasOption(Opt.BOOLEAN) || a.hasOption(Opt.UNARY)))
- {
- Console.debug(
- "Looking for boolean in subval from non-boolean/non-unary Arg "
- + a.getName());
- return false;
- }
- }
- return sv.get(key).toLowerCase(Locale.ROOT).equals("true");
- }
-
- // check for negative boolean (subval "no..." will be "true")
- if (sv.has(nokey) && sv.get(nokey) != null)
- {
- if (usingArgKey)
- {
- if (!(a.hasOption(Opt.BOOLEAN)))
- {
- Console.debug(
- "Looking for negative boolean in subval from non-boolean Arg "
- + a.getName());
- return false;
- }
- }
- return !sv.get(nokey).toLowerCase(Locale.ROOT).equals("true");
- }
- }
-
- // check argvalues
- if (avm != null && avm.containsArg(a))
- return avm.getBoolean(a);
-
- // return preference or default
- boolean prefVal = pref != null ? Cache.getDefault(pref, def) : false;
- return pref != null ? (invertPref ? !prefVal : prefVal) : def;
- }
-
// the following methods look for the "*" linkedId and add the argvalue to all
// linkedId ArgValues if it does.
/**
argIndex, doSubs);
}
- private void addValue(String linkedId, Type type, ArgValues avs, String v,
- int argIndex, boolean doSubs)
- {
- this.argValueOperation(Op.ADDVALUE, linkedId, type, avs, null, v, false,
- argIndex, doSubs);
- }
-
private void setBoolean(String linkedId, Type type, ArgValues avs,
boolean b, int argIndex)
{
Arg a = avs.arg();
List<String> wildcardLinkedIds = null;
- if (a.hasOption(Opt.ALLOWALL))
+ if (a.hasOption(Opt.ALLOWMULTIID))
{
switch (linkedId)
{
// skip incorrectly stored wildcard ids!
if (id == null || MATCHALLLINKEDIDS.equals(id)
|| MATCHOPENEDLINKEDIDS.equals(id))
+ {
continue;
+ }
ArgValuesMap avm = linkedArgs.get(id);
// don't set an output if there isn't an input
if (a.hasOption(Opt.REQUIREINPUT)
return linkedArgs.get(linkedId);
}
+ public boolean isOldStyle()
+ {
+ return oldArguments;
+ }
+
+ public boolean isMixedStyle()
+ {
+ return mixedArguments;
+ }
+
+ public String[] getMixedExamples()
+ {
+ return mixedExamples;
+ }
+
+ public void setStructureFilename(String s)
+ {
+ this.currentStructureFilename = s;
+ }
+
}
\ No newline at end of file
protected void addArgValue(ArgValue av, boolean beingSetByWildcard)
{
// allow a non-wildcard value to overwrite a wildcard set single value
- boolean overwrite = !arg.hasOption(Opt.MULTI) && setByWildcard
+ boolean overwrite = !arg.hasOption(Opt.MULTIVALUE) && setByWildcard
&& !beingSetByWildcard;
- if ((!arg.hasOption(Opt.MULTI) && argValueList.size() > 0)
+ if ((!arg.hasOption(Opt.MULTIVALUE) && argValueList.size() > 0)
&& !overwrite)
return;
if (arg.hasOption(Opt.NODUPLICATEVALUES)
protected ArgValue getArgValue()
{
- if (arg.hasOption(Opt.MULTI))
+ if (arg.hasOption(Opt.MULTIVALUE))
Console.warn("Requesting single value for multi value argument");
return argValueList.size() > 0 ? argValueList.get(0) : null;
}
import java.io.File;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.HashMap;
import java.util.List;
+import java.util.Locale;
import java.util.Map;
import java.util.Set;
+import jalview.bin.Cache;
+import jalview.bin.Console;
import jalview.bin.argparser.Arg.Opt;
+import jalview.bin.argparser.Arg.Type;
import jalview.util.FileUtils;
/**
*/
public class ArgValuesMap
{
+ private List<ArgInfo> argInfoList = new ArrayList<>();
+
protected Map<Arg, ArgValues> m;
private String linkedId;
return closestAv;
}
- public ArgValue getClosestNextArgValueOfArg(ArgValue thisAv, Arg a)
+ public ArgValue getClosestNextArgValueOfArg(ArgValue thisAv, Arg a,
+ boolean withinType)
{
// this looks for the *next* arg that *might* be referring back to
// a thisAv. Such an arg would have no subValues (if it does it should
closestAv = av;
}
}
+
+ // check if withinType this closestAv doesn't belong to the next primary arg
+ // of this type
+ if (withinType && closestAv != null)
+ {
+ int nextPrimaryArgOfSameTypeIndex = Integer.MAX_VALUE;
+ for (Arg tmpA : this.getArgKeys())
+ {
+ // interested in Opt.PRIMARY args of the same type
+ if (tmpA.getType() == a.getType() && tmpA.hasOption(Opt.PRIMARY))
+ {
+ for (ArgValue tmpAv : getArgValueList(tmpA))
+ {
+ int tmpArgIndex = tmpAv.getArgIndex();
+ if (tmpArgIndex > thisArgIndex
+ && tmpArgIndex < nextPrimaryArgOfSameTypeIndex)
+ {
+ nextPrimaryArgOfSameTypeIndex = tmpArgIndex;
+ }
+ }
+ }
+ }
+ if (nextPrimaryArgOfSameTypeIndex < closestAv.getArgIndex())
+ {
+ // looks licke closestAv actually belongs to a different primary Arg
+ return null;
+ }
+ }
+
return closestAv;
}
*/
public String getBasename()
{
- return getDirBasenameOrExtension(false, false);
+ return getDirBasenameOrExtension(false, false, false);
}
/*
*/
public String getExtension()
{
- return getDirBasenameOrExtension(false, true);
+ return getDirBasenameOrExtension(false, true, false);
}
/*
*/
public String getDirname()
{
- return getDirBasenameOrExtension(true, false);
+ return getDirBasenameOrExtension(true, false, false);
}
public String getDirBasenameOrExtension(boolean dirname,
- boolean extension)
+ boolean extension, boolean absoluteDirname)
{
String filename = null;
String appendVal = getValue(Arg.APPEND);
}
return false;
}
+
+ /*
+ * ArgInfo is a more straightforward list of arguments and their info
+ */
+
+ public void addArgInfo(Arg arg, String value, SubVals subVals,
+ int argIndex)
+ {
+ argInfoList.add(new ArgInfo(arg, value, subVals, argIndex));
+ }
+
+ public List<ArgInfo> getArgInfoList()
+ {
+ Collections.sort(argInfoList);
+ return argInfoList;
+ }
+
+ /**
+ * get from following Arg of type a or subval of same name (lowercase)
+ */
+ public String getValueFromSubValOrArg(ArgValue av, Arg a, SubVals sv)
+ {
+ return getFromSubValArgOrPref(av, a, sv, null, null, null);
+ }
+
+ /**
+ * get from following Arg of type a or subval key or preference pref or
+ * default def
+ */
+ public String getFromSubValArgOrPref(ArgValue av, Arg a, SubVals sv,
+ String key, String pref, String def)
+ {
+ return getFromSubValArgOrPref(a, ArgValuesMap.Position.AFTER, av, sv,
+ key, pref, def);
+ }
+
+ /**
+ * get from following(AFTER), first occurence of (FIRST) or previous (BEFORE)
+ * Arg of type a or subval key or preference pref or default def
+ */
+ public String getFromSubValArgOrPref(Arg a, ArgValuesMap.Position pos,
+ ArgValue av, SubVals sv, String key, String pref, String def)
+ {
+ return getFromSubValArgOrPrefWithSubstitutions(null, a, pos, av, sv,
+ key, pref, def);
+ }
+
+ public String getFromSubValArgOrPrefWithSubstitutions(ArgParser ap, Arg a,
+ ArgValuesMap.Position pos, ArgValue av, SubVals sv, String key,
+ String pref, String def)
+ {
+ return getFromSubValArgOrPrefWithSubstitutionsWithinType(ap, a, pos, av,
+ sv, key, pref, def, true);
+ }
+
+ public String getFromSubValArgOrPrefWithSubstitutionsWithinType(
+ ArgParser ap, Arg a, ArgValuesMap.Position pos, ArgValue av,
+ SubVals sv, String key, String pref, String def,
+ boolean withinType)
+ {
+ if (key == null)
+ key = a.getName();
+ String value = null;
+ if (sv != null && sv.has(key) && sv.get(key) != null)
+ {
+ value = ap == null ? sv.get(key)
+ : sv.getWithSubstitutions(ap, getLinkedId(), key);
+ }
+ else if (containsArg(a))
+ {
+ if (pos == ArgValuesMap.Position.FIRST && getValue(a) != null)
+ value = getValue(a);
+ else if (pos == ArgValuesMap.Position.BEFORE
+ && getClosestPreviousArgValueOfArg(av, a) != null)
+ value = getClosestPreviousArgValueOfArg(av, a).getValue();
+ else if (pos == ArgValuesMap.Position.AFTER
+ && getClosestNextArgValueOfArg(av, a, withinType) != null)
+ value = getClosestNextArgValueOfArg(av, a, withinType).getValue();
+
+ // look for allstructures subval for Type.STRUCTURE
+ Arg arg = av.getArg();
+ if (value == null && arg.hasOption(Opt.PRIMARY)
+ && arg.getType() == Type.STRUCTURE
+ && !a.hasOption(Opt.PRIMARY) && (a.getType() == Type.STRUCTURE
+ // || a.getType() == Type.STRUCTUREIMAGE))
+ ))
+ {
+ ArgValue av2 = getArgValueOfArgWithSubValKey(a,
+ Arg.ALLSTRUCTURES.getName());
+ if (av2 != null)
+ {
+ value = av2.getValue();
+ }
+ }
+ }
+ if (value == null)
+ {
+ value = pref != null ? Cache.getDefault(pref, def) : def;
+ }
+ return value;
+ }
+
+ public boolean getBoolFromSubValOrArg(Arg a, SubVals sv)
+ {
+ return getFromSubValArgOrPref(a, sv, null, null, false);
+ }
+
+ public boolean getFromSubValArgOrPref(Arg a, SubVals sv, String key,
+ String pref, boolean def)
+ {
+ return getFromSubValArgOrPref(a, sv, key, pref, def, false);
+ }
+
+ public boolean getFromSubValArgOrPref(Arg a, SubVals sv, String key,
+ String pref, boolean def, boolean invertPref)
+ {
+ if ((key == null && a == null) || (sv == null && a == null))
+ return false;
+
+ boolean usingArgKey = false;
+ if (key == null)
+ {
+ key = a.getName();
+ usingArgKey = true;
+ }
+
+ String nokey = ArgParser.NEGATESTRING + key;
+
+ // look for key or nokey in subvals first (if using Arg check options)
+ if (sv != null)
+ {
+ // check for true boolean
+ if (sv.has(key) && sv.get(key) != null)
+ {
+ if (usingArgKey)
+ {
+ if (!(a.hasOption(Opt.BOOLEAN) || a.hasOption(Opt.UNARY)))
+ {
+ Console.debug(
+ "Looking for boolean in subval from non-boolean/non-unary Arg "
+ + a.getName());
+ return false;
+ }
+ }
+ return sv.get(key).toLowerCase(Locale.ROOT).equals("true");
+ }
+
+ // check for negative boolean (subval "no..." will be "true")
+ if (sv.has(nokey) && sv.get(nokey) != null)
+ {
+ if (usingArgKey)
+ {
+ if (!(a.hasOption(Opt.BOOLEAN)))
+ {
+ Console.debug(
+ "Looking for negative boolean in subval from non-boolean Arg "
+ + a.getName());
+ return false;
+ }
+ }
+ return !sv.get(nokey).toLowerCase(Locale.ROOT).equals("true");
+ }
+ }
+
+ // check argvalues
+ if (containsArg(a))
+ return getBoolean(a);
+
+ // return preference or default
+ boolean prefVal = pref != null ? Cache.getDefault(pref, def) : false;
+ return pref != null ? (invertPref ? !prefVal : prefVal) : def;
+ }
+
+ public class ArgInfo implements Comparable<ArgInfo>
+ {
+ private Arg arg;
+
+ private String value;
+
+ private SubVals subVals;
+
+ private int argIndex;
+
+ public ArgInfo(Arg arg, String value, SubVals subVals, int argIndex)
+ {
+ this.arg = arg;
+ this.value = value;
+ this.subVals = subVals;
+ this.argIndex = argIndex;
+ }
+
+ public Arg arg()
+ {
+ return arg;
+ }
+
+ public String value()
+ {
+ return value;
+ }
+
+ public SubVals subVals()
+ {
+ return subVals;
+ }
+
+ public int argIndex()
+ {
+ return argIndex;
+ }
+
+ @Override
+ public int compareTo(ArgInfo ai2)
+ {
+ return Integer.compare(this.argIndex(), ai2.argIndex());
+ }
+ }
+
+ public static enum Position
+ {
+ FIRST, BEFORE, AFTER
+ }
}
}
}
}
+
+ // if in an argfile, remove it from the hashset so it can be re-used in
+ // another argfile
+ if (inArgFile != null)
+ {
+ argFiles.remove(inArgFile);
+ }
}
public boolean contains(Arg a)
private void add(Arg a, Type t, String s)
{
List<Map.Entry<Type, String>> l = getOrCreateList(a);
- if (a.hasOption(Opt.MULTI) || l.size() == 0)
+ if (a.hasOption(Opt.MULTIVALUE) || l.size() == 0)
{
l.add(entry(t, s));
}
private void addAll(Arg a, Type t, List<String> al)
{
List<Map.Entry<Type, String>> l = getOrCreateList(a);
- if (a.hasOption(Opt.MULTI))
+ if (a.hasOption(Opt.MULTIVALUE))
{
for (String s : al)
{
--- /dev/null
+package jalview.bin.groovy;
+
+import jalview.bin.Jalview.ExitCode;
+import jalview.gui.AlignFrame;
+
+public class JalviewObject implements JalviewObjectI
+{
+ private JalviewObjectI object = null;
+
+ public JalviewObject(JalviewObjectI j)
+ {
+ this.object = j;
+ }
+
+ @Override
+ public AlignFrame[] getAlignFrames()
+ {
+ return object == null ? null : object.getAlignFrames();
+ }
+
+ @Override
+ public AlignFrame getCurrentAlignFrame()
+ {
+ return object == null ? null : object.getCurrentAlignFrame();
+ }
+
+ @Override
+ public void quit()
+ {
+ if (object != null)
+ {
+ object.quit();
+ }
+ else
+ {
+ jalview.bin.Jalview.exit(
+ "Groovy console quit without Jalview object.",
+ ExitCode.GROOVY_ERROR);
+ }
+ }
+
+}
--- /dev/null
+package jalview.bin.groovy;
+
+import jalview.gui.AlignFrame;
+
+public interface JalviewObjectI
+{
+ public AlignFrame[] getAlignFrames();
+
+ public AlignFrame getCurrentAlignFrame();
+
+ public final static String currentAlFrameName = "currentAlFrame";
+
+ public final static String jalviewObjectName = "Jalview";
+
+ public void quit();
+}
if (cm == null && _aa.sequenceRef != null)
{
cm = _aa.sequenceRef.getContactMatrixFor(_aa);
- if (cm == null)
+ if (cm == null && _aa.sequenceRef.getDatasetSequence()!=null)
{
// TODO fix up this logic and unify with getContactListFor
cm = _aa.sequenceRef.getDatasetSequence().getContactMatrixFor(_aa);
@Override
public ContactListI getContactListFor(AlignmentAnnotation _aa, int column)
{
+ if (_aa.annotations==null || column>=_aa.annotations.length || column<0)
+ {
+ return null;
+ }
ContactListI cl = cmholder.getContactListFor(_aa, column);
if (cl == null && _aa.groupRef != null)
{
/**
* Returns a read-only view of the (possibly empty) list of selected columns
+ * (base 1)
* <p>
- * The list contains no duplicates but is not necessarily ordered. It also may
- * include columns hidden from the current view. To modify (for example sort)
- * the list, you should first make a copy.
+ * The list contains no duplicates but is not necessarily ordered. Columns are
+ * reported in alignment coordinates (base 1), so may also include columns
+ * hidden from the current view. To modify (for example sort) the list, you
+ * should first make a copy.
* <p>
* The list is not thread-safe: iterating over it could result in
* ConcurrentModificationException if it is modified by another thread.
}
}
}
- if (tot > 0)
+ if (tot > 0 && to_column>from_column)
{
cr.setMean(tot / (1 + to_column - from_column));
}
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Map;
import jalview.ws.datamodel.MappableContactMatrixI;
{
if (contactmaps != null && contactmaps.size() > 0)
{
- return contactmaps.values();
+ // defensive copy, and return non redundant set of ContactMatrixI instances
+ return new HashSet<ContactMatrixI>(contactmaps.values());
}
return Collections.EMPTY_LIST;
}
package jalview.datamodel;
-import java.awt.Color;
-import java.math.BigInteger;
import java.util.ArrayList;
-import java.util.BitSet;
-import java.util.HashMap;
import java.util.List;
-import java.util.Spliterator;
import java.util.StringTokenizer;
import jalview.bin.Console;
-public abstract class ContactMatrix implements ContactMatrixI
+public abstract class ContactMatrix extends GroupSetHolder implements ContactMatrixI
{
/**
* are contacts reflexive ?
@Override
public double getContactAt(int column)
{
- List<Float> clist;
- Float cl = null;
- if (symmetric)
- {
- if (p < column)
- {
- clist = contacts.get(p);
- cl = clist.get(column);
- }
- else
- {
- clist = contacts.get(column);
- cl = clist.get(p);
- }
- }
- else
- {
- clist = contacts.get(p);
- cl = clist.get(column);
- }
+ Float cl = getFloatElementAt(column, p);
if (cl == null)
{
// return 0 not NaN ?
}
});
}
-
+ private Float getFloatElementAt(int column, int p)
+ {
+
+ List<Float> clist;
+ Float cl = null;
+ if (symmetric)
+ {
+ if (p < column)
+ {
+ clist = contacts.get(p);
+ cl = clist.get(column);
+ }
+ else
+ {
+ clist = contacts.get(column);
+ cl = clist.get(p);
+ }
+ }
+ else
+ {
+ clist = contacts.get(p);
+ cl = clist.get(column);
+ }
+ return cl;
+ }
+ @Override
+ public double getElementAt(int column, int row)
+ {
+ Float cl = getFloatElementAt(column, row);
+ if (cl!=null)
+ {
+ return cl;
+ }
+ throw(new RuntimeException("Out of Bounds "+column+","+row));
+ }
@Override
public float getMin()
{
{
return "Contact Matrix";
}
- GroupSet grps = new GroupSet();
- @Override
- public GroupSetI getGroupSet()
- {
- return grps;
- }
- @Override
- public void setGroupSet(GroupSet makeGroups)
- {
- grps = makeGroups;
- }
public static String contactToFloatString(ContactMatrixI cm)
{
StringBuilder sb = new StringBuilder();
for (int c = 0; c < cm.getWidth(); c++)
{
ContactListI cl = cm.getContactList(c);
+ long lastsb=-1;
if (cl != null)
{
for (int h = 0; h <= cl.getContactHeight(); h++)
{
if (sb.length() > 0)
{
- sb.append('\t');
+ if (sb.length()-lastsb>320)
+ {
+ // newline
+ sb.append('\n');
+ lastsb=sb.length();
+ } else {
+ sb.append('\t');
+ }
}
sb.append(cl.getContactAt(h));
}
int rows)
{
float[][] vals = new float[cols][rows];
- StringTokenizer tabsep = new StringTokenizer(values, "" + '\t');
+ StringTokenizer tabsep = new StringTokenizer(values, "" + '\t'+'\n');
int c = 0, r = 0;
while (tabsep.hasMoreTokens())
{
}
return Color.white;
}
+
+ /**
+ * direct access to column and row position of matrix
+
+ * Implementations are allowed to throw
+ * RunTimeExceptions if _column/i are out of bounds
+ *
+ * @param column
+ * @param row
+ * @return
+ */
+ double getElementAt(int column, int row);
}
--- /dev/null
+package jalview.datamodel;
+
+public class FloatContactMatrix extends GroupSetHolder implements ContactMatrixI
+{
+
+ int maxrow = 0, maxcol = 0;
+
+
+ float[][] elements;
+
+ float maxscore;
+
+
+ public FloatContactMatrix(float[][] matrix)
+ {
+ maxcol = 0;
+ for (float[] row : matrix)
+ {
+ if (row.length > maxcol)
+ {
+ maxcol = row.length;
+ }
+ maxscore = row[0];
+ for (float f : row)
+ {
+ if (maxscore < f)
+ {
+ maxscore = f;
+ }
+ }
+ }
+ maxrow = matrix.length;
+ elements = matrix;
+ }
+
+ public FloatContactMatrix(float[][] elements2, GroupSet grps2)
+ {
+ this(elements2);
+ setGroupSet(grps2);
+ }
+
+ /**
+ * getContactList(column) @returns the vector of predicted alignment errors
+ * for reference position given by column
+ */
+ @Override
+ public ContactListI getContactList(final int column)
+ {
+ if (column < 0 || column >= elements.length)
+ {
+ return null;
+ }
+
+ return new ContactListImpl(new ContactListProviderI()
+ {
+ @Override
+ public int getPosition()
+ {
+ return column;
+ }
+
+ @Override
+ public int getContactHeight()
+ {
+ return maxcol - 1;
+ }
+
+ @Override
+ public double getContactAt(int mcolumn)
+ {
+ if (mcolumn < 0 || mcolumn >= elements[column].length)
+ {
+ return -1;
+ }
+ return elements[column][mcolumn];
+ }
+ });
+ }
+
+ /**
+ * getElementAt(column, i) @returns the predicted superposition error for the
+ * ith position when column is used as reference
+ */
+ @Override
+ public double getElementAt(int _column, int i)
+ {
+ return elements[_column][i];
+ }
+
+ @Override
+ public float getMin()
+ {
+ return 0;
+ }
+
+ @Override
+ public float getMax()
+ {
+ return maxscore;
+ }
+
+ @Override
+ public String getAnnotDescr()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getAnnotLabel()
+ {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String getType()
+ {
+ return null;
+ }
+
+ @Override
+ public int getWidth()
+ {
+ return maxcol;
+ }
+
+ @Override
+ public int getHeight()
+ {
+ return maxrow;
+ }
+}
--- /dev/null
+package jalview.datamodel;
+
+/**
+ * holds a group set and provides getters and setters for ContactMatrixI
+ * implementations
+ *
+ * @author jprocter
+ */
+public class GroupSetHolder
+{
+
+ GroupSet grps = new GroupSet();
+
+ public GroupSetI getGroupSet()
+ {
+ return grps;
+ }
+
+ public void setGroupSet(GroupSet makeGroups)
+ {
+ grps = makeGroups;
+ }
+
+}
* @return
*/
boolean contains(SequenceI seq, int start, int end);
+
+ /**
+ *
+ * @param seq
+ * @param from - first position to highlight
+ * @param to - last position to highlight (assumed higher than from)
+ * @return true iff from-to intersects or marks positions either side of start/end
+ */
+ boolean adjacent(SequenceI seq, int from, int to);
}
\ No newline at end of file
{
private int count;
- private List<SearchResultMatchI> matches = new ArrayList<>();
+ private ArrayList<SearchResultMatchI> matches = new ArrayList<>();
/**
* One match consists of a sequence reference, start and end positions.
* Discontiguous ranges in a sequence require two or more Match objects.
*/
- public class Match implements SearchResultMatchI
+ public class Match implements SearchResultMatchI, Comparable<SearchResultMatchI>
{
final SequenceI sequence;
{
return (sequence == seq && start <= from && end >= to);
}
+ @Override
+ public boolean adjacent(SequenceI seq, int from, int to)
+ {
+ return (sequence == seq && ((start <= from && end >= to) || (from<=(end+1) && to >=(end+1)) || (from<=(start-1) && to>=(start-1))));
+ }
+
+ @Override
+ public int compareTo(SearchResultMatchI o)
+ {
+ if (start<o.getStart())
+ {
+ return -1;
+ }
+ if (start > o.getStart())
+ {
+ return +1;
+ }
+ if (end < o.getEnd())
+ {
+ return -1;
+ }
+ if (end > o.getEnd())
+ {
+ return +1;
+ }
+ if (sequence!=o.getSequence())
+ {
+ int hashc =sequence.hashCode(),oseq=o.getSequence().hashCode();
+ return (hashc < oseq) ? -1 : 1;
+ }
+ return 0;
+ }
+
}
@Override
count = beforeCount + 1;
}
}
+
@Override
+ public boolean appendResult(SequenceI sequence, int start, int end)
+ {
+
+ Match m = new Match(sequence, start, end);
+
+ boolean appending=false;
+
+ // we dynamically maintain an interval to add as we test each range in the list
+
+ int cstart=start,cend=end;
+ List<SearchResultMatchI> toRemove=new ArrayList<>();
+ for (SearchResultMatchI thatm:matches)
+ {
+ if (thatm.getSequence()==sequence)
+ {
+ if (thatm.contains(sequence,cstart,cend))
+ {
+ // found a match containing the current range. nothing else to do except report if we operated on the list
+ return appending;
+ }
+ if (thatm.adjacent(sequence, cstart, cend))
+ {
+ // update the match to add with the adjacent start/end
+ start = Math.min(m.start, thatm.getStart());
+ end = Math.max(m.end, thatm.getEnd());
+ // and check if we keep or remove the old one
+ if (thatm.getStart()!=start || thatm.getEnd()!=end)
+ {
+ toRemove.add(thatm);
+ count--;
+ cstart = start;
+ cend = end;
+ appending=true;
+ } else {
+ return false;
+ }
+ }
+ }
+ }
+ matches.removeAll(toRemove);
+ {
+ matches.add(new Match(sequence,cstart,cend));
+ count++;
+ }
+ return appending;
+ }
+ @Override
public boolean involvesSequence(SequenceI sequence)
{
final int start = sequence.getStart();
}
return seqs;
}
+
}
*/
void addResult(SequenceI seq, int[] positions);
+
+ /**
+ * Adds the given start/end region to this search result. If sequence already
+ * has a search result and the range is adjacent to already highlighted
+ * positions, they will be merged
+ *
+ * @param sequence
+ * @param start
+ * @param end
+ * @return true if an existing range was updated with this one
+ */
+ boolean appendResult(SequenceI sequence, int start, int end);
+
/**
* adds all match results in the argument to this set
*
return width;
}
@Override
- protected double getElementAt(int _column, int i)
+ public double getElementAt(int _column, int i)
{
return Math.abs(_column - i);
}
import java.io.File;
import java.net.URL;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
// End StructureListener
// //////////////////////////
-
+
+ ////////////////////////////
+ // HETATM get
+ //
+
+ @Override
+ public Map<String,String> getHetatmNames()
+ {
+ HashMap<String,String> hetlist=new HashMap();
+ for (int mc=0;mc<jmolViewer.ms.mc; mc++)
+ {
+ Map<String,String> hets = jmolViewer.ms.getHeteroList(mc);
+ if (hets!=null)
+ {
+ hetlist.putAll(hets);
+ }
+ }
+ return hetlist;
+ }
+ //
+ ////////////////////////////
+
@Override
public float[][] functionXY(String functionName, int x, int y)
{
{
if (atoms != null)
{
- boolean useScriptWait = atoms.size() > 1;
if (resetLastRes.length() > 0)
{
- jmolScript(resetLastRes.toString(), useScriptWait);
+ jmolScript(resetLastRes.toString());
resetLastRes.setLength(0);
}
+ StringBuilder highlightCommands=null;
for (AtomSpec atom : atoms)
{
- highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(),
- atom.getChain(), atom.getPdbFile(), useScriptWait);
+ StringBuilder thisAtom = highlightAtom(atom.getAtomIndex(), atom.getPdbResNum(),
+ atom.getChain(), atom.getPdbFile());
+ if (thisAtom!=null) {
+ if (highlightCommands==null)
+ {
+ highlightCommands=thisAtom;
+ } else {
+ highlightCommands.append(thisAtom);
+ }
+ }
+ }
+ if (highlightCommands!=null)
+ {
+ jmolHistory(false);
+ jmolScript(highlightCommands.toString());
+ jmolHistory(true);
}
// Highlight distances between atoms with a 'measure' command - not yet
// working
}
// jmol/ssm only
- public void highlightAtom(int atomIndex, int pdbResNum, String chain,
- String pdbfile, boolean useScriptWait)
+ private StringBuilder highlightAtom(int atomIndex, int pdbResNum, String chain,
+ String pdbfile)
{
String modelId = getModelIdForFile(pdbfile);
if (modelId.isEmpty())
{
- return;
+ return null;
}
- jmolHistory(false, useScriptWait);
-
StringBuilder selection = new StringBuilder(32);
StringBuilder cmd = new StringBuilder(64);
selection.append("select ").append(String.valueOf(pdbResNum));
resetLastRes.append(selection).append(";wireframe 0;").append(selection)
.append(" and not hetero; spacefill 0;");
- jmolScript(cmd.toString(), useScriptWait);
- jmolHistory(true, useScriptWait);
+ return cmd;
}
private boolean debug = true;
return new StructureCommand(
"load FILES \"" + Platform.escapeBackslashes(file) + "\"");
}
+ @Override
+ public StructureCommandI restoreSession(String filePath)
+ {
+ return new StructureCommand(
+ "restore STATE \"" + Platform.escapeBackslashes(filePath) + "\"");
+ }
+ @Override
+ public List<StructureCommandI> showHetatms(List<String> toShow)
+ {
+ // always clear the current hetero cpk display
+
+ StringBuilder sb = new StringBuilder();
+ sb.append("select hetero; cpk off;");
+
+ if (toShow != null && !toShow.isEmpty())
+ {
+ // select what was requested
+ sb.append("select ");
+ boolean or = false;
+ for (String k : toShow)
+ {
+ sb.append(or ? " or " : " ");
+ sb.append(k);
+ or = true;
+ }
+ // and show as
+ sb.append("; cpk;");
+ }
+
+ return Arrays.asList(new StructureCommand(sb.toString()));
+ }
/**
* Obsolete method, only referenced from
* jalview.javascript.MouseOverStructureListener
{
return (String) getField(Model_id);
}
+
+ public String getConfidenceScoreType()
+ {
+ return (String) getField(Confidence_Score_Type);
+ }
+ public String getConfidenceScoreVersion()
+ {
+ return (String) getField(Confidence_Score_Version);
+ }
}
import jalview.bin.Cache;
import jalview.bin.Console;
import jalview.bin.Jalview;
+import jalview.bin.groovy.JalviewObjectI;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
import jalview.commands.EditCommand.Action;
@Override
public void focusGained(FocusEvent e)
{
- Jalview.setCurrentAlignFrame(AlignFrame.this);
+ Jalview.getInstance().setCurrentAlignFrame(AlignFrame.this);
}
});
*/
public void saveAlignment(String file, FileFormatI format)
{
- saveAlignment(file, format, false);
+ saveAlignment(file, format, false, false);
}
- public void saveAlignment(String file, FileFormatI format, boolean stdout)
+ public void saveAlignment(String file, FileFormatI format, boolean stdout,
+ boolean forceBackup)
{
lastSaveSuccessful = true;
if (!stdout)
else
{
// create backupfiles object and get new temp filename destination
- boolean doBackup = BackupFiles.getEnabled() && !stdout;
+ boolean doBackup = forceBackup
+ || (BackupFiles.getEnabled() && !stdout);
BackupFiles backupfiles = null;
if (doBackup)
{
}
}
alignPanel.validateAnnotationDimensions(true);
+ // TODO this triggers relayout of annotation panel - otherwise annotation label height is different to panel height
+ alignPanel.fontChanged();
alignPanel.alignmentChanged();
}
@Override
protected void runGroovy_actionPerformed()
{
- Jalview.setCurrentAlignFrame(this);
- groovy.ui.Console console = Desktop.getGroovyConsole();
+ Jalview.getInstance().setCurrentAlignFrame(this);
+ groovy.console.ui.Console console = Desktop.getGroovyConsole();
if (console != null)
{
try
{
+ console.setVariable(JalviewObjectI.currentAlFrameName, this);
console.runScript();
} catch (Exception ex)
{
*/
protected boolean noReferencesTo(AlignedCodonFrame acf)
{
- AlignFrame[] frames = Desktop.getAlignFrames();
+ AlignFrame[] frames = Desktop.getDesktopAlignFrames();
if (frames == null)
{
return true;
/**
* Calculate the width of the alignment labels based on the displayed names
- * and any bounds on label width set in preferences.
+ * and any bounds on label width set in preferences. Also includes annotations
+ * not actually visible.
+ *
+ * FIXME JAL-244 JAL-4091 - doesn't include sequence associated annotation
+ * label decorators and only called during tests
*
* @param maxwidth
* -1 or maximum width allowed for IdWidth
{
return calculateIdWidth(maxwidth, true, false);
}
-
/**
* Calculate the width of the alignment labels based on the displayed names
* and any bounds on label width set in preferences.
*
* @param maxwidth
* -1 or maximum width allowed for IdWidth
- * @param includeAnnotations - when true, annotation label widths are also accounted for
+ * @param includeAnnotations - when true includes width of any additional marks in annotation id panel
* @param visibleOnly - when true, ignore label widths for hidden annotation rows
* @return Dimension giving the maximum width of the alignment label panel
* that should be used.
if (!legacy || Jalview.isHeadlessMode())
{
AnnotationLabels aal = getAlabels();
- int stringWidth = aal.drawLabels(null, false, idWidth, false, false, fm);
+ int stringWidth = aal.drawLabels(null, false, idWidth, false, false,
+ fm, !visibleOnly);
idWidth = Math.max(idWidth, stringWidth);
}
else
Graphics idGraphics, Graphics alignmentGraphics)
throws PrinterException
{
- final int idWidth = getVisibleIdWidth(false);
-
+ final int idWidth, idWidthForGui;
+ // otherwise calculate it
+ idWidth = getVisibleIdWidth(false);
+// if (getIdPanel()!=null && getIdPanel().getWidth()>0)
+// {
+// // use the current IdPanel's width, if its set and non-zero
+// idWidthForGui = getIdPanel().getWidth();
+// } else {
+// idWidthForGui=0;
+// }
/*
* Get the horizontal offset to where we draw the sequences.
* This is idWidth if using a single Graphics context, else zero.
}
final int alignmentDrawnHeight = (endSeq - startSeq) * charHeight + 3;
+ alignmentGraphics.setColor(Color.white);
+ alignmentGraphics.fillRect(0, 0, pageWidth, pageHeight+scaleHeight);
+
/*
* draw the Scale at horizontal offset, then reset to top left (0, 0)
*/
IdCanvas idCanvas = getIdPanel().getIdCanvas();
List<SequenceI> selection = av.getSelectionGroup() == null ? null
: av.getSelectionGroup().getSequences(null);
+
idCanvas.drawIds((Graphics2D) idGraphics, av, startSeq, endSeq - 1,
- selection, false);
+ selection, false,idWidth);
idGraphics.setFont(av.getFont());
idGraphics.translate(0, -scaleHeight);
// see if rendering offscreen - check preferences and calc width accordingly
if (!onscreen && Cache.getDefault("FIGURE_AUTOIDWIDTH", false))
{
- return calculateIdWidth(-1).width;
+ return calculateIdWidth(-1,true,true).width;
}
Integer idwidth = onscreen ? null
: Cache.getIntegerProperty("FIGURE_FIXEDIDWIDTH");
throws ImageOutputException
{
makeAlignmentImage(type, file, renderer,
- BitmapImageSizing.nullBitmapImageSizing());
+ BitmapImageSizing.defaultBitmapImageSizing());
}
/**
Graphics2D g2d = (Graphics2D) g;
Graphics dummy = g2d.create();
int newAnnotationIdWidth = drawLabels(dummy, clip, width, false, forGUI,
- null);
+ null, false);
dummy.dispose();
Dimension d = ap.calculateDefaultAlignmentIdWidth();
int alignmentIdWidth = d.width;
}
else
{
- int newAnnotationIdWidth = drawLabels(g, clip, width, false, forGUI, null);
- width = Math.max(newAnnotationIdWidth, givenWidth);
+ int newAnnotationIdWidth = drawLabels(g, clip, width, false, forGUI, null, false);
+ width = newAnnotationIdWidth<givenWidth ? givenWidth: Math.min(newAnnotationIdWidth, givenWidth);
}
- drawLabels(g, clip, width, true, forGUI, null);
+ drawLabels(g, clip, width, true, forGUI, null, false);
}
/**
* occur, but the widest label width will be returned. If g is null then
* fmetrics must be supplied.
*
- * Returns the width of the annotation labels.
- *
* @param g
* Graphics2D instance (used for rendering and font scaling if no fmetrics supplied)
* @param clip
* @param forGUI - when false, GUI relevant marks like indicators for dragging annotation panel height are not rendered
* @param fmetrics
* FontMetrics if Graphics object g is null
+ * @param includeHidden - when true returned width includes labels in hidden row width calculation
+ * @return the width of the annotation labels.
*/
public int drawLabels(Graphics g0, boolean clip, int width,
- boolean actuallyDraw, boolean forGUI, FontMetrics fmetrics)
+ boolean actuallyDraw, boolean forGUI, FontMetrics fmetrics, boolean includeHidden)
{
if (clip)
{
for (int i = 0; i < aa.length; i++)
{
visible = true;
- if (!aa[i].visible)
+ if (!aa[i].visible && !includeHidden)
{
hasHiddenRows = true;
continue;
olY = y;
// look ahead to next annotation
for (nexAA = i + 1; nexAA < aa.length
- && !aa[nexAA].visible; nexAA++)
+ && (!aa[nexAA].visible && includeHidden); nexAA++)
;
y += aa[i].height;
if (clip)
}
}
- if (!resizePanel && dragEvent != null && aa != null)
+ if (!resizePanel && dragEvent != null && aa != null && selectedRow>-1 && selectedRow<aa.length)
{
if (actuallyDraw && g != null)
{
import jalview.renderer.ContactGeometry;
import jalview.schemes.ResidueProperties;
import jalview.util.Comparison;
+import jalview.util.Format;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.viewmodel.ViewportListenerI;
return false;
}
int yOffset = rowIndex[1];
-
+ AlignmentAnnotation[] allAnnotation = av.getAlignment()
+ .getAlignmentAnnotation();
+ if (allAnnotation==null || rowIndex[0]<0 || rowIndex[0]>=allAnnotation.length)
+ {
+ return false;
+ }
AlignmentAnnotation clicked = av.getAlignment()
.getAlignmentAnnotation()[rowIndex[0]];
if (clicked.graph != AlignmentAnnotation.CONTACT_MAP)
{
ContactGeometry cXcgeom = new ContactGeometry(forCurrentX,
clicked.graphHeight);
- ContactGeometry.contactInterval cXci = cXcgeom.mapFor(yOffset,
- yOffset);
- /**
- * start and end range corresponding to the row range under the mouse at
- * column currentX
- */
- int fr, to;
- fr = Math.min(cXci.cStart, cXci.cEnd);
- to = Math.max(cXci.cStart, cXci.cEnd);
-
- // double click selects the whole group
- if (evt.getClickCount() == 2)
+ ContactGeometry.contactInterval cXci = cXcgeom.mapFor(yOffset);
+ if (cXci != null)
{
- ContactMatrixI matrix = av.getContactMatrix(clicked);
+ /**
+ * start and end range corresponding to the row range under the mouse at
+ * column currentX
+ */
+ int fr, to;
+ fr = Math.min(cXci.cStart, cXci.cEnd);
+ to = Math.max(cXci.cStart, cXci.cEnd);
- if (matrix != null)
+ // double click selects the whole group
+ if (evt.getClickCount() == 2)
{
- // simplest approach is to select all group containing column
- if (matrix.hasGroups())
+ ContactMatrixI matrix = av.getContactMatrix(clicked);
+
+ if (matrix != null)
{
- SequenceI rseq = clicked.sequenceRef;
- BitSet grp = new BitSet();
- grp.or(matrix.getGroupsFor(currentX));
- // TODO: cXci needs to be mapped to real groups
- for (int c = fr; c <= to; c++)
+ // simplest approach is to select all group containing column
+ if (matrix.hasGroups())
{
- BitSet additionalGrp = matrix.getGroupsFor(c);
- grp.or(additionalGrp);
- }
+ SequenceI rseq = clicked.sequenceRef;
+ BitSet grp = new BitSet();
+ grp.or(matrix.getGroupsFor(currentX));
+ // TODO: cXci needs to be mapped to real groups
+ for (int c = fr; c <= to; c++)
+ {
+ BitSet additionalGrp = matrix.getGroupsFor(c);
+ grp.or(additionalGrp);
+ }
- HiddenColumns hc = av.getAlignment().getHiddenColumns();
- ColumnSelection cs = av.getColumnSelection();
-
- for (int p=grp.nextSetBit(0); p >= 0; p = grp
- .nextSetBit(p + 1))
- {
- if (matrix instanceof MappableContactMatrixI)
+ HiddenColumns hc = av.getAlignment().getHiddenColumns();
+ ColumnSelection cs = av.getColumnSelection();
+
+ for (int p = grp.nextSetBit(0); p >= 0; p = grp
+ .nextSetBit(p + 1))
{
- // find the end of this run of set bits
- int nextp = grp.nextClearBit(p)-1;
- int[] pos = ((MappableContactMatrixI)matrix).getMappedPositionsFor(rseq, p,nextp);
- p=nextp;
-
- if (pos!=null)
+ if (matrix instanceof MappableContactMatrixI)
{
- for (int pos_p = pos[0];pos_p<=pos[1];pos_p++)
+ // find the end of this run of set bits
+ int nextp = grp.nextClearBit(p) - 1;
+ int[] pos = ((MappableContactMatrixI) matrix)
+ .getMappedPositionsFor(rseq, p, nextp);
+ p = nextp;
+
+ if (pos != null)
{
- int col = rseq.findIndex(pos_p)-1;
- if (col>=0 && (!av.hasHiddenColumns() || hc.isVisible(col)))
+ for (int pos_p = pos[0]; pos_p <= pos[1]; pos_p++)
{
- cs.addElement(col);
+ int col = rseq.findIndex(pos_p) - 1;
+ if (col >= 0 && (!av.hasHiddenColumns()
+ || hc.isVisible(col)))
+ {
+ cs.addElement(col);
+ }
}
}
}
- } else {
- int offp = (rseq != null)
- ? rseq.findIndex(rseq.getStart() - 1 + p)
- : p;
-
- if (!av.hasHiddenColumns() || hc.isVisible(offp))
+ else
{
- cs.addElement(offp);
+ int offp = (rseq != null)
+ ? rseq.findIndex(rseq.getStart() - 1 + p)
+ : p;
+
+ if (!av.hasHiddenColumns() || hc.isVisible(offp))
+ {
+ cs.addElement(offp);
+ }
}
}
}
- }
- // possible alternative for interactive selection - threshold
- // gives 'ceiling' for forming a cluster
- // when a row+column is selected, farthest common ancestor less
- // than thr is used to compute cluster
+ // possible alternative for interactive selection - threshold
+ // gives 'ceiling' for forming a cluster
+ // when a row+column is selected, farthest common ancestor less
+ // than thr is used to compute cluster
- }
- }
- else
- {
- // select corresponding range in segment under mouse
- {
- int[] rng = forCurrentX.getMappedPositionsFor(fr, to);
- if (rng != null)
- {
- av.getColumnSelection().addRangeOfElements(rng, true);
}
- av.getColumnSelection().addElement(currentX);
}
- // PAE SPECIFIC
- // and also select everything lower than the max range adjacent
- // (kind of works)
- if (evt.isControlDown()
- && PAEContactMatrix.PAEMATRIX.equals(clicked.getCalcId()))
+ else
{
- int c = fr;
- ContactRange cr = forCurrentX.getRangeFor(fr, to);
- double cval;
- // TODO: could use GraphLine instead of arbitrary picking
- // TODO: could report mean/median/variance for partitions
- // (contiguous selected vs unselected regions and inter-contig
- // regions)
- // controls feathering - what other elements in row/column
- // should we select
- double thresh = cr.getMean() + (cr.getMax() - cr.getMean()) * .15;
- while (c >= 0)
+ // select corresponding range in segment under mouse
{
- cval = forCurrentX.getContactAt(c);
- if (// cr.getMin() <= cval &&
- cval <= thresh)
+ int[] rng = forCurrentX.getMappedPositionsFor(fr, to);
+ if (rng != null)
{
- int[] cols = forCurrentX.getMappedPositionsFor(c, c);
- if (cols != null)
- {
- av.getColumnSelection().addRangeOfElements(cols, true);
- }
- else
- {
- break;
- }
+ av.getColumnSelection().addRangeOfElements(rng, true);
}
- c--;
+ av.getColumnSelection().addElement(currentX);
}
- c = to;
- while (c < forCurrentX.getContactHeight())
+ // PAE SPECIFIC
+ // and also select everything lower than the max range adjacent
+ // (kind of works)
+ if (evt.isControlDown()
+ && PAEContactMatrix.PAEMATRIX.equals(clicked.getCalcId()))
{
- cval = forCurrentX.getContactAt(c);
- if (// cr.getMin() <= cval &&
- cval <= thresh)
+ int c = fr;
+ ContactRange cr = forCurrentX.getRangeFor(fr, to);
+ double cval;
+ // TODO: could use GraphLine instead of arbitrary picking
+ // TODO: could report mean/median/variance for partitions
+ // (contiguous selected vs unselected regions and inter-contig
+ // regions)
+ // controls feathering - what other elements in row/column
+ // should we select
+ double thresh = cr.getMean()
+ + (cr.getMax() - cr.getMean()) * .15;
+ while (c >= 0)
{
- int[] cols = forCurrentX.getMappedPositionsFor(c, c);
- if (cols != null)
+ cval = forCurrentX.getContactAt(c);
+ if (// cr.getMin() <= cval &&
+ cval <= thresh)
{
- av.getColumnSelection().addRangeOfElements(cols, true);
+ int[] cols = forCurrentX.getMappedPositionsFor(c, c);
+ if (cols != null)
+ {
+ av.getColumnSelection().addRangeOfElements(cols, true);
+ }
+ else
+ {
+ break;
+ }
}
+ c--;
}
- else
+ c = to;
+ while (c < forCurrentX.getContactHeight())
{
- break;
- }
- c++;
+ cval = forCurrentX.getContactAt(c);
+ if (// cr.getMin() <= cval &&
+ cval <= thresh)
+ {
+ int[] cols = forCurrentX.getMappedPositionsFor(c, c);
+ if (cols != null)
+ {
+ av.getColumnSelection().addRangeOfElements(cols, true);
+ }
+ }
+ else
+ {
+ break;
+ }
+ c++;
+ }
}
+
}
}
}
if (forFromX != null && forToX != null)
{
- ContactGeometry lastXcgeom = new ContactGeometry(forFromX,
- cma.graphHeight);
- ContactGeometry.contactInterval lastXci = lastXcgeom
- .mapFor(rowIndex[1], rowIndex[1] + deltaY);
-
- ContactGeometry cXcgeom = new ContactGeometry(forToX,
+ // FIXME will need two ContactGeometry objects when handling contact matrices with differing numbers of rows at each
+ // column
+ ContactGeometry xcgeom = new ContactGeometry(forFromX,
cma.graphHeight);
- ContactGeometry.contactInterval cXci = cXcgeom.mapFor(rowIndex[1],
- rowIndex[1] + deltaY);
+ ContactGeometry.contactInterval lastXci = xcgeom
+ .mapFor(rowIndex[1]);
+ ContactGeometry.contactInterval cXci = xcgeom.mapFor(rowIndex[1] + deltaY);
// mark rectangular region formed by drag
jalview.bin.Console.trace("Matrix Selection from last(" + fromXc
+ ",[" + lastXci.cStart + "," + lastXci.cEnd + "]) to cur("
+ toXc + ",[" + cXci.cStart + "," + cXci.cEnd + "])");
int fr, to;
- fr = Math.min(lastXci.cStart, lastXci.cEnd);
- to = Math.max(lastXci.cStart, lastXci.cEnd);
+ fr = Math.min(lastXci.cStart, cXci.cStart);
+ to = Math.max(lastXci.cEnd, cXci.cEnd);
int[] mappedPos = forFromX.getMappedPositionsFor(fr, to);
if (mappedPos != null)
{
// }
// else
{
- av.getColumnSelection().addElement(c);
- }
- }
- }
- // and again for most recent corner of drag
- fr = Math.min(cXci.cStart, cXci.cEnd);
- to = Math.max(cXci.cStart, cXci.cEnd);
- mappedPos = forFromX.getMappedPositionsFor(fr, to);
- if (mappedPos != null)
- {
- for (int pair = 0; pair < mappedPos.length; pair += 2)
- {
- jalview.bin.Console.trace("Marking " + fr + " to " + to
- + " mapping to sequence positions " + mappedPos[pair]
- + " to " + mappedPos[pair + 1]);
- for (int c = mappedPos[pair]; c <= mappedPos[pair + 1]; c++)
- {
- // if (cma.sequenceRef != null)
- // {
- // int col =
- // cma.sequenceRef.findIndex(cma.sequenceRef.getStart()+c);
- // av.getColumnSelection().addElement(col);
- // }
- // else
- {
- av.getColumnSelection().addElement(c);
- }
+ av.getColumnSelection().addElement(c-1);
}
}
}
ContactGeometry cgeom = new ContactGeometry(clist, ann.graphHeight);
ContactGeometry.contactInterval ci = cgeom.mapFor(rowAndOffset);
ContactRange cr = clist.getRangeFor(ci.cStart, ci.cEnd);
- tooltip = "Contact from " + clist.getPosition() + ", [" + ci.cStart
- + " - " + ci.cEnd + "]" + "<br/>Mean:" + cr.getMean();
-
+ StringBuilder tooltipb = new StringBuilder();
+ tooltipb.append("Contact from ")
+ .append(clist.getPosition()).append(", [").append(ci.cStart).append(" - ").append(ci.cEnd).append("]").append("<br/>Mean:");
+ Format.appendPercentage(tooltipb, (float)cr.getMean(),2);
+ tooltip = tooltipb.toString();
int col = ann.sequenceRef.findPosition(column);
int[][] highlightPos;
int[] mappedPos = clist.getMappedPositionsFor(ci.cStart, ci.cEnd);
import java.awt.Graphics2D;
import java.awt.RenderingHints;
import java.io.File;
-import java.lang.reflect.InvocationTargetException;
import java.util.List;
import java.util.Locale;
import java.util.Map;
-import java.util.concurrent.Callable;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.FutureTask;
import javax.swing.JPanel;
import javax.swing.JSplitPane;
}
jmb.executeCommand(new StructureCommand(command), false);
jmb.executeCommand(new StructureCommand("set hoverDelay=0.1"), false);
+ jmb.executeCommand(new StructureCommand("set antialiasdisplay on"),
+ false);
jmb.setFinishedInit(true);
}
}
if (waitTotal > waitMax)
{
- jalview.bin.Console.errPrintln("Timed out waiting for Jmol to load files after "
- + waitTotal + "ms");
+ jalview.bin.Console.errPrintln(
+ "Timed out waiting for Jmol to load files after "
+ + waitTotal + "ms");
// jalview.bin.Console.errPrintln("finished: " + jmb.isFinishedInit()
// + "; loaded: " + Arrays.toString(jmb.getPdbFile())
// + "; files: " + files.toString());
@Override
public void makePDBImage(ImageMaker.TYPE type)
{
- try {
- makePDBImage(null, type, null,
- BitmapImageSizing.nullBitmapImageSizing());
- } catch (ImageOutputException ioex) {
- Console.error("Unexpected error whilst writing "+type.toString(),ioex);
+ try
+ {
+ makePDBImage(null, type, null,
+ BitmapImageSizing.defaultBitmapImageSizing());
+ } catch (ImageOutputException ioex)
+ {
+ Console.error("Unexpected error whilst writing " + type.toString(),
+ ioex);
}
}
BitmapImageSizing bis = ImageMaker.getScaleWidthHeight(width, height,
userBis);
- float usescale = bis.scale;
- int usewidth = bis.width;
- int useheight = bis.height;
+ float usescale = bis.scale();
+ int usewidth = bis.width();
+ int useheight = bis.height();
ImageWriterI writer = new ImageWriterI()
{
}
}
- jmb.jmolViewer.antialiased = true;
jmb.jmolViewer.requestRepaintAndWait("image export");
jmb.jmolViewer.renderScreenImage(ig2, usewidth, useheight);
}
.toLowerCase(Locale.ROOT);
final ImageExporter exporter = new ImageExporter(writer,
getProgressIndicator(), type, getTitle());
-
+
final Throwable[] exceptions = new Throwable[1];
exceptions[0] = null;
final AppJmol us = this;
try
{
- Thread runner = Executors.defaultThreadFactory().newThread(new Runnable()
- {
- @Override
- public void run()
- {
- try
- {
- exporter.doExport(file, us, width, height, view, renderer,
- userBis);
- } catch (Throwable t)
- {
- exceptions[0] = t;
- }
- }
- });
+ Thread runner = Executors.defaultThreadFactory()
+ .newThread(new Runnable()
+ {
+ @Override
+ public void run()
+ {
+ try
+ {
+ exporter.doExport(file, us, width, height, view,
+ renderer, userBis);
+ } catch (Throwable t)
+ {
+ exceptions[0] = t;
+ }
+ }
+ });
runner.start();
- do { Thread.sleep(25); } while (runner.isAlive());
+ do
+ {
+ Thread.sleep(25);
+ } while (runner.isAlive());
} catch (Throwable e)
{
throw new ImageOutputException(
.openURL("http://wiki.jmol.org");// http://jmol.sourceforge.net/docs/JmolUserGuide/");
} catch (Exception ex)
{
- jalview.bin.Console.errPrintln("Show Jmol help failed with: " + ex.getMessage());
+ jalview.bin.Console
+ .errPrintln("Show Jmol help failed with: " + ex.getMessage());
}
}
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;
+import javax.swing.SwingUtilities;
import javax.swing.border.Border;
import javax.swing.text.DefaultCaret;
private JComboBox<LogLevel> logLevelCombo = new JComboBox<LogLevel>();
- protected LogLevel startingLogLevel = LogLevel.INFO;
+ protected LogLevel startingLogLevel = null;
public Console()
{
scrollPane.setBorder(noBorder);
textArea.addMouseListener(new MouseAdapter()
{
+ @Override
public void mouseClicked(MouseEvent e)
{
if (e.getButton() == MouseEvent.BUTTON1)
MessageManager.getString("label.copy_to_clipboard"));
copyToClipboardButton.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
copyConsoleTextToClipboard();
private Color fg = textArea.getForeground();
+ @Override
public void mousePressed(MouseEvent e)
{
textArea.setBackground(textArea.getSelectionColor());
textArea.setForeground(textArea.getSelectedTextColor());
}
+ @Override
public void mouseReleased(MouseEvent e)
{
textArea.setBackground(bg);
// logLevelCombo.addItem(LogLevel.ERROR);
// logLevelCombo.addItem(LogLevel.OFF);
// set startingLogLevel
- startingLogLevel = jalview.bin.Console.log == null ? LogLevel.INFO
- : jalview.bin.Console.log.getLevel();
+
+ if (jalview.bin.Console.getLogger() == null)
+ {
+ startingLogLevel = jalview.bin.Console.getCachedLogLevel();
+ }
+ else
+ {
+ startingLogLevel = jalview.bin.Console.getLogger().getLevel();
+ }
setChosenLogLevelCombo();
logLevelCombo.addActionListener(new ActionListener()
{
+ @Override
public void actionPerformed(ActionEvent e)
{
if (jalview.bin.Console.log != null)
boolean added = false;
for (int i = 0; i < logLevelCombo.getItemCount(); i++)
{
- LogLevel l = (LogLevel) logLevelCombo.getItemAt(i);
+ LogLevel l = logLevelCombo.getItemAt(i);
if (l.compareTo(setLogLevel) >= 0)
{
logLevelCombo.insertItemAt(setLogLevel, i);
*/
public Console(Desktop desktop)
{
- this(desktop, true);
- }
-
- /**
- * attach a console to the desktop - the desktop will open it if requested.
- *
- * @param desktop
- * @param showjconsole
- * - if true, then redirect stdout immediately
- */
- public Console(Desktop desktop, boolean showjconsole)
- {
parent = desktop;
// window name - get x,y,width, height possibly scaled
- Rectangle bounds = desktop.getLastKnownDimensions("JAVA_CONSOLE_");
- if (bounds == null)
+ Rectangle bounds = parent == null ? null
+ : parent.getLastKnownDimensions("JAVA_CONSOLE_");
+ if (bounds != null)
{
frame = initFrame(
ChannelProperties.getProperty("app_name") + " Java Console",
- desktop.getWidth() / 2, desktop.getHeight() / 4,
- desktop.getX(), desktop.getY());
+ bounds.width, bounds.height, bounds.x, bounds.y);
+ }
+ else if (parent != null && parent.getWidth() > 0
+ && parent.getHeight() > 0)
+ {
+ frame = initFrame(
+ ChannelProperties.getProperty("app_name") + " Java Console",
+ parent.getWidth() / 2, parent.getHeight() / 4, parent.getX(),
+ parent.getY());
}
else
{
frame = initFrame(
ChannelProperties.getProperty("app_name") + " Java Console",
- bounds.width, bounds.height, bounds.x, bounds.y);
+ MIN_WIDTH, MIN_HEIGHT, 10, 10);
}
frame.setMinimumSize(new Dimension(MIN_WIDTH, MIN_HEIGHT));
- // desktop.add(frame);
+ // parent.add(frame);
initConsole(false);
LogLevel level = (LogLevel) logLevelCombo.getSelectedItem();
if (!Platform.isJS())
pin.close();
} catch (Exception e)
{
+ jalview.bin.Console.debug("pin.close() error", e);
}
try
{
pin2.close();
} catch (Exception e)
{
+ jalview.bin.Console.debug("pin2.close() error", e);
}
try
{
textAppender.join(10);
} catch (Exception e)
{
+ jalview.bin.Console.debug("textAppender.join(10) error", e);
}
}
/*
try
{
this.wait(100);
- if (pin.available() == 0)
- {
- trimBuffer(false);
- }
} catch (InterruptedException ie)
{
+ jalview.bin.Console.debug("pin.available() error", ie);
}
}
{
try
{
- this.wait(100);
+ this.wait(100); // ##### implicated BLOCKED
if (pin2.available() == 0)
{
trimBuffer(false);
}
} catch (InterruptedException ie)
{
+ jalview.bin.Console.debug("pin.available() error", ie);
}
}
while (pin2.available() != 0)
// check string buffer - if greater than console, clear console and
// replace with last segment of content, otherwise, append all to
// content.
- long count;
while (displayPipe.length() > 0)
{
- count = 0;
StringBuffer tmp = new StringBuffer(), replace;
synchronized (displayPipe)
{
replace = displayPipe;
displayPipe = tmp;
}
- // simply append whole buffer
- textArea.append(replace.toString());
- count += replace.length();
- if (count > byteslim)
+ // Append formatted message to textarea using the Swing Thread.
+ SwingUtilities.invokeLater(new Runnable()
{
- trimBuffer(false);
- }
+ public void run()
+ {
+ textArea.append(replace.toString());
+ trimBuffer(false);
+ }
+ });
}
if (displayPipe.length() == 0)
{
this.wait(100);
if (displayPipe.length() == 0)
{
- trimBuffer(false);
+ // post a trim on Swing Thread.
+ SwingUtilities.invokeLater(new Runnable()
+ {
+ public void run()
+ {
+ trimBuffer(false);
+ }
+ });
}
} catch (InterruptedException e)
{
+ jalview.bin.Console.debug("displayPipe.length() error", e);
}
}
}
this.wait(100);
} catch (InterruptedException e)
{
-
+ jalview.bin.Console.debug("this.wait(100) error", e);
}
}
if (quit)
this.wait(1000);
} catch (InterruptedException ie)
{
+ jalview.bin.Console.debug("this.wait(1000) error", ie);
}
throw new NullPointerException(
MessageManager.getString("exception.application_test_npe"));
@Override
public void run()
{
- displayPipe.append(input); // change to stringBuffer
- // displayPipe.flush();
-
+ displayPipe.append(input);
}
});
// stderr.println("Time taken to Spawnappend:\t" + (System.nanoTime() -
+ "\nTruncated...\n";
} catch (Exception e)
{
- e.printStackTrace();
+ jalview.bin.Console.warn("textArea Exception", e);
}
}
// trim the buffer
}
} catch (Exception e)
{
- e.printStackTrace();
+ jalview.bin.Console.warn("textArea Exception", e);
}
// lines = textArea.getLineCount();
}
import java.awt.BorderLayout;
import java.awt.Color;
+import java.awt.Component;
import java.awt.Dimension;
import java.awt.FontMetrics;
import java.awt.Graphics;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JMenuItem;
+import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
import javax.swing.JProgressBar;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
import javax.swing.JTextField;
+import javax.swing.JTextPane;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;
import javax.swing.event.HyperlinkEvent.EventType;
import javax.swing.event.InternalFrameAdapter;
import javax.swing.event.InternalFrameEvent;
+import javax.swing.text.JTextComponent;
import org.stackoverflowusers.file.WindowsShortcut;
import jalview.api.structures.JalviewStructureDisplayI;
import jalview.bin.Cache;
import jalview.bin.Jalview;
+import jalview.bin.Jalview.ExitCode;
+import jalview.bin.argparser.Arg;
+import jalview.bin.groovy.JalviewObject;
+import jalview.bin.groovy.JalviewObjectI;
import jalview.datamodel.Alignment;
import jalview.datamodel.HiddenColumns;
import jalview.datamodel.Sequence;
*/
public class Desktop extends jalview.jbgui.GDesktop
implements DropTargetListener, ClipboardOwner, IProgressIndicator,
- jalview.api.StructureSelectionManagerProvider
+ jalview.api.StructureSelectionManagerProvider, JalviewObjectI
{
private static final String CITATION;
static
boolean selmemusage = Cache.getDefault("SHOW_MEMUSAGE", false);
- boolean showjconsole = Cache.getDefault("SHOW_JAVA_CONSOLE", false);
+ boolean showjconsole = Cache.getArgCacheDefault(Arg.JAVACONSOLE,
+ "SHOW_JAVA_CONSOLE", false);
+
+ // start dialogue queue for single dialogues
+ startDialogQueue();
+
+ if (!Platform.isJS())
+ /**
+ * Java only
+ *
+ * @j2sIgnore
+ */
+ {
+ Desktop.instance.acquireDialogQueue();
+
+ jconsole = new Console(this);
+ jconsole.setHeader(Cache.getVersionDetailsForConsole());
+ showConsole(showjconsole);
+
+ Desktop.instance.releaseDialogQueue();
+ }
+
desktop = new MyDesktopPane(selmemusage);
showMemusage.setSelected(selmemusage);
setBounds(xPos, yPos, 900, 650);
}
- // start dialogue queue for single dialogues
- startDialogQueue();
-
if (!Platform.isJS())
/**
* Java only
* @j2sIgnore
*/
{
- jconsole = new Console(this, showjconsole);
- jconsole.setHeader(Cache.getVersionDetailsForConsole());
- showConsole(showjconsole);
-
showNews.setVisible(false);
experimentalFeatures.setSelected(showExperimental());
// used for jalviewjsTest
jalview.bin.Console.info("JALVIEWJS: CREATED DESKTOP");
}
+
}
/**
iw = (int) (iw * sw);
iy = (int) (iy * sh);
ih = (int) (ih * sh);
- while (ix >= screenSize.width)
+ if (ix >= screenSize.width)
{
jalview.bin.Console.debug(
"Window geometry location recall error: shifting horizontal to within screenbounds.");
- ix -= screenSize.width;
+ ix = ix % screenSize.width;
}
- while (iy >= screenSize.height)
+ if (iy >= screenSize.height)
{
jalview.bin.Console.debug(
"Window geometry location recall error: shifting vertical to within screenbounds.");
- iy -= screenSize.height;
+ iy = iy % screenSize.height;
}
jalview.bin.Console.debug(
"Got last known dimensions for " + windowName + ": x:" + ix
{
if (itf instanceof AlignFrame)
{
- Jalview.setCurrentAlignFrame((AlignFrame) itf);
+ Jalview.getInstance().setCurrentAlignFrame((AlignFrame) itf);
}
itf.requestFocus();
}
setKeyBindings(frame);
- // Since the latest FlatLaf patch, we occasionally have problems showing structureViewer frames...
- int tries=3;
- boolean shown=false;
- Exception last=null;
+ // Since the latest FlatLaf patch, we occasionally have problems showing
+ // structureViewer frames...
+ int tries = 3;
+ boolean shown = false;
+ Exception last = null;
do
{
try
{
desktop.add(frame);
- shown=true;
+ shown = true;
} catch (IllegalArgumentException iaex)
{
- last=iaex;
+ last = iaex;
tries--;
- jalview.bin.Console.info(
- "Squashed IllegalArgument Exception (" + tries + " left) for "+frame.getTitle(),
- iaex);
+ jalview.bin.Console.info("Squashed IllegalArgument Exception ("
+ + tries + " left) for " + frame.getTitle(), iaex);
try
{
Thread.sleep(5);
} while (!shown && tries > 0);
if (!shown)
{
- jalview.bin.Console.error("Serious Problem whilst showing window "+frame.getTitle(),last);
+ jalview.bin.Console.error(
+ "Serious Problem whilst showing window " + frame.getTitle(),
+ last);
}
windowMenu.add(menuItem);
desktopQuit(true, false);
}
- public QuitHandler.QResponse desktopQuit(boolean ui, boolean disposeFlag)
- {
- final Runnable doDesktopQuit = () -> {
- Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
- Cache.setProperty("SCREENGEOMETRY_WIDTH", screen.width + "");
- Cache.setProperty("SCREENGEOMETRY_HEIGHT", screen.height + "");
- storeLastKnownDimensions("", new Rectangle(getBounds().x,
- getBounds().y, getWidth(), getHeight()));
+ /**
+ * close everything, stash window geometries, and shut down all associated threads/workers
+ * @param dispose - sets the dispose on close flag - JVM may terminate when set
+ * @param terminateJvm - quit with prejudice - stops the JVM.
+ */
+ public void quitTheDesktop(boolean dispose, boolean terminateJvm) {
+ Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
+ Cache.setProperty("SCREENGEOMETRY_WIDTH", screen.width + "");
+ Cache.setProperty("SCREENGEOMETRY_HEIGHT", screen.height + "");
+ storeLastKnownDimensions("", new Rectangle(getBounds().x,
+ getBounds().y, getWidth(), getHeight()));
- if (jconsole != null)
- {
- storeLastKnownDimensions("JAVA_CONSOLE_", jconsole.getBounds());
- jconsole.stopConsole();
- }
+ if (jconsole != null)
+ {
+ storeLastKnownDimensions("JAVA_CONSOLE_", jconsole.getBounds());
+ jconsole.stopConsole();
+ }
- if (jvnews != null)
- {
- storeLastKnownDimensions("JALVIEW_RSS_WINDOW_", jvnews.getBounds());
- }
+ if (jvnews != null)
+ {
+ storeLastKnownDimensions("JALVIEW_RSS_WINDOW_", jvnews.getBounds());
+ }
- // Frames should all close automatically. Keeping external
- // viewers open should already be decided by user.
- closeAll_actionPerformed(null);
+ // Frames should all close automatically. Keeping external
+ // viewers open should already be decided by user.
+ closeAll_actionPerformed(null);
- // check for aborted quit
- if (QuitHandler.quitCancelled())
- {
- jalview.bin.Console.debug("Desktop aborting quit");
- return;
- }
+ if (dialogExecutor != null)
+ {
+ dialogExecutor.shutdownNow();
+ }
- if (dialogExecutor != null)
- {
- dialogExecutor.shutdownNow();
- }
+ if (groovyConsole != null)
+ {
+ // suppress a possible repeat prompt to save script
+ groovyConsole.setDirty(false);
+ groovyConsole.exit();
+ }
- if (groovyConsole != null)
- {
- // suppress a possible repeat prompt to save script
- groovyConsole.setDirty(false);
- groovyConsole.exit();
- }
+ if (terminateJvm)
+ {
+ // note that shutdown hook will not be run
+ jalview.bin.Console.debug("Force Quit selected by user");
+ Runtime.getRuntime().halt(0);
+ }
- if (QuitHandler.gotQuitResponse() == QResponse.FORCE_QUIT)
- {
- // note that shutdown hook will not be run
- jalview.bin.Console.debug("Force Quit selected by user");
- Runtime.getRuntime().halt(0);
- }
+ jalview.bin.Console.debug("Quit selected by user");
+ if (dispose)
+ {
+ instance.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
+ // instance.dispose();
+ }
+ }
+ public QuitHandler.QResponse desktopQuit(boolean ui, boolean disposeFlag)
+ {
+ final Runnable doDesktopQuit = () -> {
- jalview.bin.Console.debug("Quit selected by user");
- if (disposeFlag)
+ // FIRST !! check for aborted quit
+ if (QuitHandler.quitCancelled())
{
- instance.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
- // instance.dispose();
+ jalview.bin.Console.debug("Quit was cancelled - Desktop aborting quit");
+ return;
}
+
+ // Proceed with quitting
+ quitTheDesktop(disposeFlag, QuitHandler.gotQuitResponse() == QResponse.FORCE_QUIT);
+ // and exit the JVM
instance.quit();
};
}
/**
- * Don't call this directly, use desktopQuit() above. Exits the program.
+ * Exits the program and the JVM.
+ *
+ * Don't call this directly
+ *
+ * - use desktopQuit() above to tidy up first.
+ *
+ * - use closeDesktop() to shutdown Jalview without shutting down the JVM
+ *
*/
@Override
public void quit()
// this will run the shutdownHook but QuitHandler.getQuitResponse() should
// not run a second time if gotQuitResponse flag has been set (i.e. user
// confirmed quit of some kind).
- Jalview.exit("Desktop exiting.", 0);
+ Jalview.exit("Desktop exiting.", ExitCode.OK);
}
private void storeLastKnownDimensions(String string, Rectangle jc)
}
} catch (Exception ex)
{
- jalview.bin.Console.errPrintln("Error opening help: " + ex.getMessage());
+ jalview.bin.Console
+ .errPrintln("Error opening help: " + ex.getMessage());
}
}
{
}
}
- Jalview.setCurrentAlignFrame(null);
+ Jalview.getInstance().setCurrentAlignFrame(null);
jalview.bin.Console.info("ALL CLOSED");
/*
boolean autoSave = projectFile != null && !saveAs
&& BackupFiles.getEnabled();
- // jalview.bin.Console.outPrintln("autoSave="+autoSave+", projectFile='"+projectFile+"',
+ // jalview.bin.Console.outPrintln("autoSave="+autoSave+",
+ // projectFile='"+projectFile+"',
// saveAs="+saveAs+", Backups
// "+(BackupFiles.getEnabled()?"enabled":"disabled"));
return null;
}
List<AlignmentPanel> aps = new ArrayList<>();
- AlignFrame[] frames = getAlignFrames();
+ AlignFrame[] frames = Desktop.getDesktopAlignFrames();
if (frames == null)
{
return null;
List<AlignmentViewport> viewp = new ArrayList<>();
if (desktop != null)
{
- AlignFrame[] frames = Desktop.getAlignFrames();
+ AlignFrame[] frames = Desktop.getDesktopAlignFrames();
for (AlignFrame afr : frames)
{
*
* @return an array of AlignFrame, or null if none found
*/
- public static AlignFrame[] getAlignFrames()
+ @Override
+ public AlignFrame[] getAlignFrames()
{
- if (Jalview.isHeadlessMode())
+ if (desktop == null)
{
- // Desktop.desktop is null in headless mode
- return new AlignFrame[] { Jalview.currentAlignFrame };
+ return null;
}
JInternalFrame[] frames = Desktop.desktop.getAllFrames();
}
/**
+ * static version
+ */
+ public static AlignFrame[] getDesktopAlignFrames()
+ {
+ if (Jalview.isHeadlessMode())
+ {
+ // Desktop.desktop is null in headless mode
+ return Jalview.getInstance().getAlignFrames();
+ }
+
+ if (instance != null && desktop != null)
+ {
+ return instance.getAlignFrames();
+ }
+
+ return null;
+ }
+
+ /**
* Returns an array of any AppJmol frames in the Desktop (or null if none).
*
* @return
openGroovyConsole();
} catch (Exception ex)
{
- jalview.bin.Console.error("Groovy Shell Creation failed.", ex);
+ jalview.bin.Console.error("Groovy Console creation failed.", ex);
JvOptionPane.showInternalMessageDialog(Desktop.desktop,
MessageManager.getString("label.couldnt_create_groovy_shell"),
{
if (groovyConsole == null)
{
- groovyConsole = new groovy.ui.Console();
- groovyConsole.setVariable("Jalview", this);
+ JalviewObjectI j = new JalviewObject(this);
+ groovyConsole = new groovy.console.ui.Console();
+ groovyConsole.setVariable(JalviewObjectI.jalviewObjectName, j);
+ groovyConsole.setVariable(JalviewObjectI.currentAlFrameName,
+ getCurrentAlignFrame());
groovyConsole.run();
/*
*/
groovyShell.setEnabled(!enabled);
- AlignFrame[] alignFrames = getAlignFrames();
+ AlignFrame[] alignFrames = getDesktopAlignFrames();
if (alignFrames != null)
{
for (AlignFrame af : alignFrames)
*/
public static void showUrl(final String url)
{
- showUrl(url, Desktop.instance);
+ if (url!=null && !url.trim().equals("")) {
+ jalview.bin.Console.info("Opening URL: "+url);
+ showUrl(url, Desktop.instance);
+ } else {
+ jalview.bin.Console.warn("Ignoring attempt to show an empty URL.");
+ }
+
}
/**
*/
private Semaphore block = new Semaphore(0);
- private static groovy.ui.Console groovyConsole;
+ private static groovy.console.ui.Console groovyConsole;
/**
* add another dialog thread to the queue
myTopFrame.setDisplayedView(myTopFrame.alignPanel);
}
- public static groovy.ui.Console getGroovyConsole()
+ public static groovy.console.ui.Console getGroovyConsole()
{
return groovyConsole;
}
}
/**
- * closes the current instance window, disposes and forgets about it.
+ * closes the current instance window, but leaves the JVM running.
+ * Bypasses any shutdown prompts, but does not set window dispose on close in case JVM terminates.
*/
public static void closeDesktop()
{
if (Desktop.instance != null)
{
- Desktop.instance.closeAll_actionPerformed(null);
- Desktop.instance.setVisible(false);
Desktop us = Desktop.instance;
- Desktop.instance = null;
+ Desktop.instance.quitTheDesktop(false, false);
// call dispose in a separate thread - try to avoid indirect deadlocks
- new Thread(new Runnable() {
- @Override
- public void run()
+ if (us != null)
+ {
+ new Thread(new Runnable()
{
- ExecutorService dex = us.dialogExecutor;
- if (dex!=null) {
- dex.shutdownNow();
- us.dialogExecutor=null;
- us.block.drainPermits();
+ @Override
+ public void run()
+ {
+ ExecutorService dex = us.dialogExecutor;
+ if (dex != null)
+ {
+ dex.shutdownNow();
+ us.dialogExecutor = null;
+ us.block.drainPermits();
+ }
+ us.dispose();
}
- us.dispose();
- }
- }).start();
+ }).start();
+ }
}
}
alignFrameModalMap.remove(af);
}
+ public void nonBlockingDialog(String title, String message, String button,
+ int type, boolean scrollable, boolean modal)
+ {
+ nonBlockingDialog(title, message, null, button, type, scrollable, false,
+ modal, -1);
+ }
+
+ public void nonBlockingDialog(String title, String message,
+ String boxtext, String button, int type, boolean scrollable,
+ boolean html, boolean modal, int timeout)
+ {
+ nonBlockingDialog(32, 2, title, message, boxtext, button, type,
+ scrollable, html, modal, timeout);
+ }
+
+ public void nonBlockingDialog(int width, int height, String title,
+ String message, String boxtext, String button, int type,
+ boolean scrollable, boolean html, boolean modal, int timeout)
+ {
+ if (type < 0)
+ {
+ type = JvOptionPane.WARNING_MESSAGE;
+ }
+ JLabel jl = new JLabel(message);
+
+ JTextComponent jtc = null;
+ if (html)
+ {
+ JTextPane jtp = new JTextPane();
+ jtp.setContentType("text/html");
+ jtp.setEditable(false);
+ jtp.setAutoscrolls(true);
+ jtp.setText(boxtext);
+
+ jtc = jtp;
+ }
+ else
+ {
+ JTextArea jta = new JTextArea(height, width);
+ // jta.setLineWrap(true);
+ jta.setEditable(false);
+ jta.setWrapStyleWord(true);
+ jta.setAutoscrolls(true);
+ jta.setText(boxtext);
+
+ jtc = jta;
+ }
+
+ JScrollPane jsp = scrollable
+ ? new JScrollPane(jtc, JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
+ JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED)
+ : null;
+
+ JvOptionPane jvp = JvOptionPane.newOptionDialog(this);
+
+ JPanel jp = new JPanel();
+ jp.setLayout(new BoxLayout(jp, BoxLayout.Y_AXIS));
+
+ if (message != null)
+ {
+ jl.setAlignmentX(Component.LEFT_ALIGNMENT);
+ jp.add(jl);
+ }
+ if (boxtext != null)
+ {
+ if (scrollable)
+ {
+ jsp.setAlignmentX(Component.LEFT_ALIGNMENT);
+ jp.add(jsp);
+ }
+ else
+ {
+ jtc.setAlignmentX(Component.LEFT_ALIGNMENT);
+ jp.add(jtc);
+ }
+ }
+
+ jvp.setResponseHandler(JOptionPane.YES_OPTION, () -> {
+ });
+ jvp.setTimeout(timeout);
+ JButton jb = new JButton(button);
+ jvp.showDialogOnTopAsync(this, jp, title, JOptionPane.YES_OPTION, type,
+ null, new Object[]
+ { button }, button, modal, new JButton[] { jb }, false);
+ }
+
+ @Override
+ public AlignFrame getCurrentAlignFrame()
+ {
+ return Jalview.getInstance().getCurrentAlignFrame();
+ }
}
{
FeatureMatcherSetI theFilter = (FeatureMatcherSetI) filter;
setOpaque(true);
- String asText = theFilter.toString();
setBackground(tbl.getBackground());
- this.setText(asText);
this.setIcon(null);
+ if (theFilter != null)
+ {
+ String asText = theFilter.toString();
+ this.setText(asText);
+ }
+
if (isSelected)
{
if (selectedBorder == null)
gg.translate(0, transY);
- drawIds(gg, av, ss, es, searchResults,true);
+ drawIds(gg, av, ss, es, searchResults, true, getWidth());
gg.translate(0, -transY);
gg.fillRect(0, 0, getWidth(), imgHeight);
drawIds(gg, av, av.getRanges().getStartSeq(),
- av.getRanges().getEndSeq(), searchResults,true);
+ av.getRanges().getEndSeq(), searchResults,true, getWidth());
gg.dispose();
* @param startSeq
* @param endSeq
* @param selection
+ * @param forGUI when false rendering for print
+ * @param panelWidth width used to calculate righthand margin - usually idCanvas.getWidth()
+ *
*/
void drawIds(Graphics2D g, AlignViewport alignViewport,
- final int startSeq, final int endSeq, List<SequenceI> selection, boolean forGUI)
+ final int startSeq, final int endSeq, List<SequenceI> selection, boolean forGUI, int panelWidth)
{
Font font = alignViewport.getFont();
if (alignViewport.isSeqNameItalics())
if (alignViewport.getWrapAlignment())
{
- drawIdsWrapped(g, alignViewport, startSeq, getHeight());
+ drawIdsWrapped(g, alignViewport, startSeq, getHeight(), manuallyAdjusted ? panelWidth : -1,forGUI);
return;
}
// Now draw the id strings
- int panelWidth = getWidth();
int xPos = 0;
// Now draw the id strings
drawIdsWrapped(g, av2, totalHeight, totalHeight, i,false);
}
- void drawIdsWrapped(Graphics2D g, AlignViewport alignViewport,
+ public void drawIdsWrapped(Graphics2D g, AlignViewport alignViewport,
int startSeq, int pageHeight, int idWidth, boolean forGUI)
{
int alignmentWidth = alignViewport.getAlignment().getWidth();
AnnotationLabels labels = null;
if (alignViewport.isShowAnnotation())
{
+ // in wrapped mode, no alignPanel reference is available
+ // FIXME: make the renderer not create a new object in wrapped mode everytime!
labels = new AnnotationLabels(alignViewport);
}
if (!isManuallyAdjusted())
{
int getAnnotationsIdWidth = labels.drawLabels(g, false, -1, false,forGUI,
- null);
+ null, false);
thisIdWidth = idWidth < 0 ? getAnnotationsIdWidth : idWidth;
if (thisIdWidth > getWidth)
{
String imageSource) throws ImageOutputException
{
doExport(file, parent, width, height, imageSource, null,
- BitmapImageSizing.nullBitmapImageSizing());
+ BitmapImageSizing.defaultBitmapImageSizing());
}
public void doExport(File file, Component parent, int width, int height,
private Map<Object, Runnable> callbacks = new HashMap<>();
+ private int timeout = -1;
+
+ public void setTimeout(int i)
+ {
+ timeout = i;
+ }
+
/*
* JalviewJS reports user choice in the dialog as the selected option (text);
* this list allows conversion to index (int)
private static void outputMessage(Object message)
{
- jalview.bin.Console.outPrintln(">>> JOption Message : " + message.toString());
+ jalview.bin.Console
+ .outPrintln(">>> JOption Message : " + message.toString());
}
public static Object getMockResponse()
"Supplied buttons array not the same length as supplied options array.");
break NOTNULL;
}
+
+ // run through buttons for initialValue first so we can set (and start)
+ // a final timeoutThreadF to include (and interrupt) in the button
+ // actions
+ Thread timeoutThread = null;
+ for (int i = 0; i < options.length; i++)
+ {
+ Object o = options[i];
+ JButton jb = buttons[i];
+ if (o.equals(initialValue))
+ {
+ if (timeout > 0 && jb != null && jb instanceof JButton)
+ {
+ // after timeout ms click the default button
+ timeoutThread = new Thread(() -> {
+ try
+ {
+ Thread.sleep(timeout);
+ } catch (InterruptedException e)
+ {
+ Console.debug(
+ "Dialog timeout interrupted. Probably a button pressed.");
+ }
+ jb.doClick();
+ });
+ }
+ initialValueButton = jb;
+ break;
+ }
+ }
+ final Thread timeoutThreadF = timeoutThread;
+ if (timeoutThreadF != null)
+ {
+ timeoutThreadF.start();
+ }
+
int[] buttonActions = { JOptionPane.YES_OPTION,
JOptionPane.NO_OPTION, JOptionPane.CANCEL_OPTION };
for (int i = 0; i < options.length; i++)
"Setting button " + i + " to '" + o.toString() + "'");
JButton jb = buttons[i];
- if (o.equals(initialValue))
- initialValueButton = jb;
-
int buttonAction = buttonActions[i];
Runnable action = callbacks.get(buttonAction);
jb.setText((String) o);
@Override
public void actionPerformed(ActionEvent e)
{
+ if (timeoutThreadF != null)
+ {
+ timeoutThreadF.interrupt();
+ }
Object obj = e.getSource();
if (obj == null || !(obj instanceof Component))
int JOPTIONPANE_MESSAGETYPE, Icon icon, Object[] options,
Object initialValue, boolean modal, JButton[] buttons)
{
+ showDialogOnTopAsync(dialogParent, label, actionString,
+ JOPTIONPANE_OPTION, JOPTIONPANE_MESSAGETYPE, icon, options,
+ initialValue, modal, buttons, true);
+ }
+
+ public void showDialogOnTopAsync(JFrame dialogParent, Object label,
+ String actionString, int JOPTIONPANE_OPTION,
+ int JOPTIONPANE_MESSAGETYPE, Icon icon, Object[] options,
+ Object initialValue, boolean modal, JButton[] buttons,
+ boolean dispose)
+ {
if (!isInteractiveMode())
{
handleResponse(getMockResponse());
// A better hack which works is to create a new JFrame parent with
// setAlwaysOnTop(true)
+ boolean parentOnTop = dialogParent.isAlwaysOnTop();
dialogParent.setAlwaysOnTop(true);
parentComponent = dialogParent;
JOPTIONPANE_MESSAGETYPE, icon, options, initialValue, modal,
buttons);
- dialogParent.setAlwaysOnTop(false);
- dialogParent.dispose();
+ dialogParent.setAlwaysOnTop(parentOnTop);
+
+ if (dispose)
+ {
+ dialogParent.setAlwaysOnTop(false);
+ dialogParent.dispose();
+ }
}
/**
return QResponse.QUIT;
int size = 0;
- AlignFrame[] afArray = Desktop.getAlignFrames();
+ AlignFrame[] afArray = Desktop.getDesktopAlignFrames();
if (!(afArray == null || afArray.length == 0))
{
for (int i = 0; i < afArray.length; i++)
@Override
public void mousePressed(MouseEvent evt)
{
- int x = (evt.getX() / av.getCharWidth()) + av.getRanges().getStartRes();
- final int res;
-
- if (av.hasHiddenColumns())
- {
- x = av.getAlignment().getHiddenColumns().visibleToAbsoluteColumn(x);
- }
- res = Math.min(x, av.getAlignment().getWidth() - 1);
+ int res = ap.getSeqPanel().findAlignmentColumn(evt);
min = res;
max = res;
mouseDragging = false;
ap.getSeqPanel().stopScrolling();
- // todo res calculation should be a method on AlignViewport
- int xCords = Math.max(0, evt.getX()); // prevent negative X coordinates
- ViewportRanges ranges = av.getRanges();
- int res = (xCords / av.getCharWidth()) + ranges.getStartRes();
- res = Math.min(res, ranges.getEndRes());
- if (av.hasHiddenColumns())
- {
- res = av.getAlignment().getHiddenColumns()
- .visibleToAbsoluteColumn(res);
- }
- res = Math.max(0, res);
-
+ int res = ap.getSeqPanel().findAlignmentColumn(evt);
+
if (!stretchingGroup)
{
if (evt.isPopupTrigger()) // Windows: mouseReleased
@Override
public void mouseDragged(MouseEvent evt)
{
- mouseDragging = true;
+ mouseDragging = true;
+ int res = ap.getSeqPanel().findAlignmentColumn(evt);
+
ColumnSelection cs = av.getColumnSelection();
- HiddenColumns hidden = av.getAlignment().getHiddenColumns();
-
- int res = (evt.getX() / av.getCharWidth())
- + av.getRanges().getStartRes();
- res = Math.max(0, res);
- res = hidden.visibleToAbsoluteColumn(res);
- res = Math.min(res, av.getAlignment().getWidth() - 1);
- min = Math.min(res, min);
+
+ min = Math.min(res,min);
max = Math.max(res, max);
SequenceGroup sg = av.getSelectionGroup();
{
this.setToolTipText(null);
reveal = null;
- if (!av.hasHiddenColumns())
- {
- int res = (evt.getX() / av.getCharWidth())
- + av.getRanges().getStartRes();
- highlightAllStructPos(res);
+ final int res = ap.getSeqPanel().findAlignmentColumn(evt);
+
+ highlightAllStructPos(res);
+ if (!av.hasHiddenColumns()) {
return;
}
-
- int res = (evt.getX() / av.getCharWidth())
- + av.getRanges().getStartRes();
-
reveal = av.getAlignment().getHiddenColumns()
- .getRegionWithEdgeAtRes(res);
-
- res = av.getAlignment().getHiddenColumns().visibleToAbsoluteColumn(res);
- highlightAllStructPos(res);
+ .getRegionWithEdgeAtRes(av.getAlignment().getHiddenColumns().absoluteToVisibleColumn(res));
+ if (reveal==null)
+ {
+ return;
+ }
ToolTipManager.sharedInstance().registerComponent(this);
this.setToolTipText(
MessageManager.getString("label.reveal_hidden_columns"));
if (vertical > 0) // scroll down
{
- startSeq = endSeq - vertical;
+ startSeq = endSeq - vertical + 1;
if (startSeq < ranges.getStartSeq())
{ // ie scrolling too fast, more than a page at a time
}
else
{
- transY = img.getHeight() - ((vertical + 1) * charHeight);
+ transY = img.getHeight() - (vertical * charHeight);
}
}
- else if (vertical < 0)
+ else if (vertical < 0) // scroll up
{
- endSeq = startSeq - vertical;
+ endSeq = startSeq - vertical - 1;
if (endSeq > ranges.getEndSeq())
{
}
}
- // jalview.bin.Console.errPrintln(">>> FastPaint to " + transX + " " + transY + " "
+ // jalview.bin.Console.errPrintln(">>> FastPaint to " + transX + " " +
+ // transY + " "
// + horizontal + " " + vertical + " " + startRes + " " + endRes
// + " " + startSeq + " " + endSeq);
// Call repaint on alignment panel so that repaints from other alignment
// panel components can be aggregated. Otherwise performance of the
// overview window and others may be adversely affected.
- // jalview.bin.Console.outPrintln("SeqCanvas fastPaint() repaint() request...");
+ // jalview.bin.Console.outPrintln("SeqCanvas fastPaint() repaint()
+ // request...");
av.getAlignPanel().repaint();
} finally
{
if (av.getWrapAlignment())
{
- drawWrappedPanel(seqRdr, gg, getWidth(), getHeight(), ranges.getStartRes());
+ drawWrappedPanel(seqRdr, gg, getWidth(), getHeight(),
+ ranges.getStartRes());
}
else
{
- drawPanel(seqRdr,gg, startRes, endRes, startSeq, endSeq, 0);
+ drawPanel(seqRdr, gg, startRes, endRes, startSeq, endSeq, 0);
}
drawSelectionGroup(gg, startRes, endRes, startSeq, endSeq);
int startSeq, int endSeq)
{
SequenceRenderer localSeqR = new jalview.gui.SequenceRenderer(av);
- drawPanel(localSeqR,g1, startRes, endRes, startSeq, endSeq, 0);
+ drawPanel(localSeqR, g1, startRes, endRes, startSeq, endSeq, 0);
drawSelectionGroup((Graphics2D) g1, startRes, endRes, startSeq, endSeq);
}
* @param startColumn
* the first column (0...) of the alignment to draw
*/
- public void drawWrappedPanel(SequenceRenderer seqRdr, Graphics g, int canvasWidth,
- int canvasHeight, final int startColumn)
+ public void drawWrappedPanel(SequenceRenderer seqRdr, Graphics g,
+ int canvasWidth, int canvasHeight, final int startColumn)
{
int wrappedWidthInResidues = calculateWrappedGeometry(canvasWidth,
canvasHeight);
* @param endColumn
* @param canvasHeight
*/
- protected void drawWrappedWidth(SequenceRenderer seqRdr, Graphics g, final int ypos,
- final int startColumn, final int endColumn,
+ protected void drawWrappedWidth(SequenceRenderer seqRdr, Graphics g,
+ final int ypos, final int startColumn, final int endColumn,
final int canvasHeight)
{
ViewportRanges ranges = av.getRanges();
g.fillRect(0, ypos, (endx - startColumn + 1) * charWidth,
wrappedRepeatHeightPx);
- drawPanel(seqRdr, g, startColumn, endx, 0, av.getAlignment().getHeight() - 1,
- ypos);
+ drawPanel(seqRdr, g, startColumn, endx, 0,
+ av.getAlignment().getHeight() - 1, ypos);
int cHeight = av.getAlignment().getHeight() * av.getCharHeight();
* are hidden column markers in the visible region, then each sub-region
* between the markers is drawn separately, followed by the hidden column
* marker.
- * @param localSeqR - sequence renderer implementation - when null, uses the one used for rendering interactive GUI
+ *
+ * @param localSeqR
+ * - sequence renderer implementation - when null, uses the one used
+ * for rendering interactive GUI
*
* @param g1
* the graphics context, positioned at the first residue to be drawn
* @param yOffset
* vertical offset at which to draw (for wrapped alignments)
*/
- public void drawPanel(SequenceRenderer localSeqR, Graphics g1, final int startRes, final int endRes,
- final int startSeq, final int endSeq, final int yOffset)
+ public void drawPanel(SequenceRenderer localSeqR, Graphics g1,
+ final int startRes, final int endRes, final int startSeq,
+ final int endSeq, final int yOffset)
{
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
- if (localSeqR==null)
+ if (localSeqR == null)
{
localSeqR = seqRdr;
}
*/
g1.translate(screenY * charWidth, 0);
- draw(localSeqR, g1, blockStart, blockEnd, startSeq, endSeq, yOffset);
+ draw(localSeqR, g1, blockStart, blockEnd, startSeq, endSeq,
+ yOffset);
/*
* draw the downline of the hidden column marker (ScalePanel draws the
/**
* Draws a region of the visible alignment
- * @param seqRdr
+ *
+ * @param seqRdr
*
* @param g1
* @param startRes
* @param yOffset
* vertical offset at which to draw (for wrapped alignments)
*/
- private void draw(SequenceRenderer seqRdr, Graphics g, int startRes, int endRes, int startSeq,
- int endSeq, int offset)
+ private void draw(SequenceRenderer seqRdr, Graphics g, int startRes,
+ int endRes, int startSeq, int endSeq, int offset)
{
int charHeight = av.getCharHeight();
int charWidth = av.getCharWidth();
else if (inGroup)
{
drawVerticals(g, sx, xwidth, visWidth, oldY, bottom);
- drawHorizontals(g, sx, xwidth, visWidth, top, bottom+1);
+ drawHorizontals(g, sx, xwidth, visWidth, top, bottom);
// reset top and bottom
top = -1;
if (inGroup)
{
sy = verticalOffset + ((i - startSeq) * charHeight);
- drawVerticals(g, sx, xwidth, visWidth, oldY, bottom);
- drawHorizontals(g, sx, xwidth, visWidth, top, bottom+1);
+ drawVerticals(g, sx, xwidth, visWidth, oldY,
+ bottom == -1 ? sy : bottom);
+ drawHorizontals(g, sx, xwidth, visWidth, top, bottom);
}
}
}
public void propertyChange(PropertyChangeEvent evt)
{
String eventName = evt.getPropertyName();
- // jalview.bin.Console.errPrintln(">>SeqCanvas propertyChange " + eventName);
+ // jalview.bin.Console.errPrintln(">>SeqCanvas propertyChange " +
+ // eventName);
if (eventName.equals(SequenceGroup.SEQ_GROUP_CHANGED))
{
fastPaint = true;
else if (eventName.equals(ViewportRanges.MOVE_VIEWPORT))
{
fastPaint = false;
- // jalview.bin.Console.errPrintln("!!!! fastPaint false from MOVE_VIEWPORT");
+ // jalview.bin.Console.errPrintln("!!!! fastPaint false from
+ // MOVE_VIEWPORT");
repaint();
return;
}
if (scrollX < 0)
{
int startRes = ranges.getStartRes();
- drawWrappedWidth(seqRdr,gg, wrappedSpaceAboveAlignment, startRes,
+ drawWrappedWidth(seqRdr, gg, wrappedSpaceAboveAlignment, startRes,
startRes - scrollX - 1, getHeight());
}
else
{
matchFound = true;
gg.translate(transX, transY);
- drawPanel(seqRdr,gg, displayColumn, displayColumn, seqNo, seqNo,
- yOffset);
+ drawPanel(seqRdr, gg, displayColumn, displayColumn, seqNo,
+ seqNo, yOffset);
gg.translate(-transX, -transY);
}
}
}
/**
+ * @param evt
+ * @return absolute column in alignment nearest to the mouse pointer
+ */
+ int findAlignmentColumn(MouseEvent evt)
+ {
+ return findNearestColumn(evt,true);
+ }
+ /**
* Returns the aligned sequence position (base 0) at the mouse position, or
* the closest visible one
* <p>
*/
int findColumn(MouseEvent evt)
{
+ return findNearestColumn(evt, false);
+ }
+
+ /**
+ * @param nearestColumn when false returns negative values for out of bound positions - -1 for scale left/right, <-1 if far to right
+ * @return nearest absolute column to mouse pointer
+ */
+ private int findNearestColumn(MouseEvent evt, boolean nearestColumn)
+ {
int res = 0;
int x = evt.getX();
if (x < 0)
{
// mouse is over left scale
- return -1;
+ if (!nearestColumn) {
+ return -1;
+ } else {
+ x = 0;
+ }
}
int cwidth = seqCanvas.getWrappedCanvasWidth(this.getWidth());
}
if (x >= cwidth * charWidth)
{
- // mouse is over right scale
- return -1;
+ if (!nearestColumn) {
+ // mouse is over right scale
+ return -1;
+ } else {
+ x = cwidth*charWidth -1;
+ }
}
wrappedBlock = y / cHeight;
* rather than right-hand gutter
*/
x = Math.min(x, seqCanvas.getX() + seqCanvas.getWidth());
+ if (nearestColumn)
+ {
+ x = Math.max(x, 0);
+ }
+
res = (x / charWidth) + startRes;
res = Math.min(res, av.getRanges().getEndRes());
+
}
+
if (av.hasHiddenColumns())
{
*/
public SplashScreen(boolean isTransient)
{
- Desktop.instance.acquireDialogQueue();
this.transientDialog = isTransient;
+ if (this.transientDialog)
+ {
+ Desktop.instance.acquireDialogQueue();
+ }
if (Platform.isJS()) // BH 2019
{
protected boolean refreshText()
{
String newtext = Desktop.instance.getAboutMessage();
- // jalview.bin.Console.errPrintln("Text found: \n"+newtext+"\nEnd of newtext.");
+ // jalview.bin.Console.errPrintln("Text found: \n"+newtext+"\nEnd of
+ // newtext.");
if (oldTextLength != newtext.length())
{
iframe.setVisible(false);
}
closeSplash();
- Desktop.instance.releaseDialogQueue();
}
/**
*/
public void closeSplash()
{
+ if (this.transientDialog)
+ {
+ Desktop.instance.releaseDialogQueue();
+ }
try
{
- iframe.setClosed(true);
+ iframe.setClosed(true); // ##### implicated BLOCKED
} catch (Exception ex)
{
}
.getFTSDataFor(getResultTable(), selectedRow,
discoveredStructuresSet);
String pageUrl = row.getModelViewUrl();
+
JPopupMenu popup = new JPopupMenu("3D Beacons");
JMenuItem viewUrl = new JMenuItem("View model web page");
+ if (pageUrl == null || "".equals(pageUrl.trim())) {
+ viewUrl.setEnabled(false);
+ viewUrl.setText("No model page available.");
+ }
viewUrl.addActionListener(new ActionListener()
{
@Override
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.List;
+import java.util.Map;
import java.util.Random;
import java.util.Vector;
protected boolean allChainsSelected = false;
+ protected boolean allHetatmBeingSelected = false;
+
protected JMenu viewSelectionMenu;
/**
chainMenu.add(menuItem);
}
}
+ void setHetatmMenuItems(Map<String,String> hetatmNames)
+ {
+ hetatmMenu.removeAll();
+ if (hetatmNames == null || hetatmNames.isEmpty())
+ {
+ hetatmMenu.setVisible(false);
+ return;
+ }
+ hetatmMenu.setVisible(true);
+ allHetatmBeingSelected=false;
+ JMenuItem allMenuItem = new JMenuItem(
+ MessageManager.getString("label.all"));
+ JMenuItem noneMenuItem = new JMenuItem(
+ MessageManager.getString("label.none"));
+ allMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ {
+ allHetatmBeingSelected=true;
+ // Toggle state of everything - on
+ for (int i = 0; i < hetatmMenu.getItemCount(); i++)
+ {
+ if (hetatmMenu.getItem(i) instanceof JCheckBoxMenuItem)
+ {
+ ((JCheckBoxMenuItem) hetatmMenu.getItem(i)).setSelected(true);
+ }
+ }
+ allHetatmBeingSelected=false;
+ showSelectedHetatms();
+ }
+ }});
+
+ noneMenuItem.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e) {
+ {
+ allHetatmBeingSelected=true;
+ // Toggle state of everything off
+ for (int i = 0; i < hetatmMenu.getItemCount(); i++)
+ {
+ if (hetatmMenu.getItem(i) instanceof JCheckBoxMenuItem)
+ {
+ ((JCheckBoxMenuItem) hetatmMenu.getItem(i)).setSelected(false);
+ }
+ }
+ allHetatmBeingSelected=false;
+ showSelectedHetatms();
+ }
+ }});
+ hetatmMenu.add(noneMenuItem);
+ hetatmMenu.add(allMenuItem);
+
+ for (Map.Entry<String, String> chain : hetatmNames.entrySet())
+ {
+ JCheckBoxMenuItem menuItem = new JCheckBoxMenuItem(chain.getKey(), false);
+ menuItem.setToolTipText(chain.getValue());
+ menuItem.addItemListener(new ItemListener()
+ {
+ @Override
+ public void itemStateChanged(ItemEvent evt)
+ {
+ if (!allHetatmBeingSelected)
+ {
+ // update viewer only when we were clicked, not programmatically
+ // checked/unchecked
+ showSelectedHetatms();
+ }
+ }
+ });
+
+ hetatmMenu.add(menuItem);
+ }
+ }
/**
* Action on selecting one of Jalview's registered colour schemes
return;
}
setChainMenuItems(binding.getChainNames());
+ setHetatmMenuItems(binding.getHetatmNames());
this.setTitle(binding.getViewerTitle(getViewerName(), true));
}
getBinding().showChains(toshow);
}
-
+ /**
+ * Display selected hetatms in viewer
+ */
+ protected void showSelectedHetatms()
+ {
+ List<String> toshow = new ArrayList<>();
+ for (int i = 0; i < hetatmMenu.getItemCount(); i++)
+ {
+ if (hetatmMenu.getItem(i) instanceof JCheckBoxMenuItem)
+ {
+ JCheckBoxMenuItem item = (JCheckBoxMenuItem) hetatmMenu.getItem(i);
+ if (item.isSelected())
+ {
+ toshow.add(item.getText());
+ }
+ }
+ }
+ getBinding().showHetatms(toshow);
+ }
/**
* Tries to fetch a PDB file and save to a temporary local file. Returns the
* saved file path if successful, or null if not.
}
int ystart = (node.left() == null ? 0
- : (int) (((BinaryNode) node.left()).ycount * chunk)) + offy;
+ : (int) (node.left().ycount * chunk)) + offy;
int yend = (node.right() == null ? 0
- : (int) (((BinaryNode) node.right()).ycount * chunk)) + offy;
+ : (int) (node.right().ycount * chunk)) + offy;
Rectangle pos = new Rectangle(xend - 2, ypos - 2, 5, 5);
nodeHash.put(node, pos);
if (top.count == 0)
{
- top.count = ((BinaryNode) top.left()).count
- + ((BinaryNode) top.right()).count;
+ top.count = top.left().count
+ + top.right().count;
}
- double chunk = (double) (height - (offy)) / (double)top.count;
+ float chunk = (float) (height - (offy)) / top.count;
drawNode(g2, tree.getTopNode(), chunk, wscale, width, offx, offy);
*/
protected void updateWebServiceMenus()
{
- for (AlignFrame alignFrame : Desktop.getAlignFrames())
+ for (AlignFrame alignFrame : Desktop.getDesktopAlignFrames())
{
alignFrame.BuildWebServiceMenu();
}
if (!o1_qualtype.equals(o2_qualtype))
{
// prefer LDDT measure over others
- return "pLDDT".equals(o1_prov) ? -1
- : "pLDDT".equals(o2_prov) ? 1 : 0;
+ return "pLDDT".equals(o1_qualtype) ? -1
+ : "pLDDT".equals(o2_qualtype) ? 1 : 0;
}
// OR NO VALUE FOR THE QUALITY
if (eitherNull(idx_mqual, o1data, o2data))
// models, so rank on qmean - b
double o1_mq = (Double) o1data[idx_mqual];
double o2_mq = (Double) o2data[idx_mqual];
- return (o2_mq < o1_mq) ? 1 : (o2_mq == o1_mq) ? 0 : -1;
+ int res = (o2_mq < o1_mq) ? 1 : (o2_mq == o1_mq) ? 0 : -1;
+ return ("pLDDT".equals(o1_qualtype)) ? -res : res;
}
}
else
&& tdBeaconsFilters.contains(fieldToFilterBy);
}
- private String remove_prefix(String fieldToFilterBy)
+ protected String remove_prefix(String fieldToFilterBy)
{
if (tdBeaconsFilters != null
&& tdBeaconsFilters.contains(fieldToFilterBy)
{
return this != FILE;
}
+
+ public boolean isUrl()
+ {
+ return this == URL || this == RELATIVE_URL;
+ }
}
// We read the data anyway - it might make sense.
}
// BH 2018 switch to File object here instead of filename
- alignFrame = new Jalview2XML(raiseGUI && !Jalview.isBatchMode()).loadJalviewAlign(
- selectedFile == null ? file : selectedFile);
+ alignFrame = new Jalview2XML(raiseGUI && !Jalview.isBatchMode())
+ .loadJalviewAlign(
+ selectedFile == null ? file : selectedFile);
}
else
{
} catch (Exception er)
{
- jalview.bin.Console.errPrintln("Exception whilst opening file '" + file);
+ jalview.bin.Console
+ .errPrintln("Exception whilst opening file '" + file);
er.printStackTrace();
if (raiseGUI && !Jalview.isBatchMode())
{
}
});
}
- jalview.bin.Console.errPrintln("Out of memory loading file " + file + "!!");
+ jalview.bin.Console
+ .errPrintln("Out of memory loading file " + file + "!!");
}
loadtime += System.currentTimeMillis();
AlignViewport avp = af.getViewport();
if (avp == null)
return;
- avp.setSavedUpToDate(!protocol.isDynamic(),
- QuitHandler.Message.UNSAVED_ALIGNMENTS);
+ boolean upToDate = !protocol.isDynamic();
+ if (protocol.isUrl() && !Cache
+ .getDefault(PROMPT_SAVE_UNCHANGED_URL_ALIGNMENTS, true))
+ {
+ upToDate = true;
+ }
+ avp.setSavedUpToDate(upToDate,
+ upToDate ? null : QuitHandler.Message.UNSAVED_ALIGNMENTS);
}
+ public static final String PROMPT_SAVE_UNCHANGED_URL_ALIGNMENTS = "PROMPT_SAVE_UNCHANGED_URL_ALIGNMENTS";
+
public static boolean getUseDefaultFileFormat()
{
return useDefaultFileFormat;
import com.stevesoft.pat.Regex;
import jalview.bin.Jalview;
+import jalview.bin.Jalview.ExitCode;
import jalview.datamodel.BinaryNode;
import jalview.datamodel.SequenceNode;
import jalview.util.MessageManager;
{
c.setRight(new SequenceNode(null, c, null, DefDistance,
DefBootstrap, false));
- c = (BinaryNode) c.right();
+ c = c.right();
}
else
{
c.setLeft(new SequenceNode(null, c, null, DefDistance,
DefBootstrap, false));
- c = (BinaryNode) c.left();
+ c = c.left();
}
if (realroot == null)
// Just advance focus, if we need to
if ((c.left() != null) && (!c.left().isLeaf()))
{
- c = (BinaryNode) c.left();
+ c = c.left();
}
}
}
}
// THe next line is failing for topali trees - not sure why yet. if
// (root.right()!=null && root.isDummy())
- root = (SequenceNode) root.right().detach(); // remove the imaginary root.
+ root = root.right().detach(); // remove the imaginary root.
if (!RootHasDistance)
{
if (args == null || args.length != 1)
{
Jalview.exit(
- "Takes one argument - file name of a newick tree file.", 0);
+ "Takes one argument - file name of a newick tree file.",
+ ExitCode.INVALID_ARGUMENT);
}
File fn = new File(args[0]);
jalview.bin.Console.outPrintln("Original file :\n");
Regex nonl = new Regex("\n+", "");
- jalview.bin.Console.outPrintln(nonl.replaceAll(newickfile.toString()) + "\n");
+ jalview.bin.Console
+ .outPrintln(nonl.replaceAll(newickfile.toString()) + "\n");
jalview.bin.Console.outPrintln("Parsed file.\n");
- jalview.bin.Console.outPrintln("Default output type for original input.\n");
+ jalview.bin.Console
+ .outPrintln("Default output type for original input.\n");
jalview.bin.Console.outPrintln(trf.print());
jalview.bin.Console.outPrintln("Without bootstraps.\n");
jalview.bin.Console.outPrintln(trf.print(false));
jalview.bin.Console.outPrintln("Without distances.\n");
jalview.bin.Console.outPrintln(trf.print(true, false));
- jalview.bin.Console.outPrintln("Without bootstraps but with distanecs.\n");
+ jalview.bin.Console
+ .outPrintln("Without bootstraps but with distanecs.\n");
jalview.bin.Console.outPrintln(trf.print(false, true));
jalview.bin.Console.outPrintln("Without bootstraps or distanecs.\n");
jalview.bin.Console.outPrintln(trf.print(false, false));
- jalview.bin.Console.outPrintln("With bootstraps and with distances.\n");
+ jalview.bin.Console
+ .outPrintln("With bootstraps and with distances.\n");
jalview.bin.Console.outPrintln(trf.print(true, true));
} catch (java.io.IOException e)
{
private static final int MAX_REFS_PER_SOURCE = 4;
- private static final int MAX_SOURCES = 40;
+ private static final int MAX_SOURCES = 5;
private static String linkImageURL;
{
return 1;
}
+
String s1 = ref1.getSource();
String s2 = ref2.getSource();
boolean s1Primary = DBRefSource.isPrimarySource(s1);
boolean s2Primary = DBRefSource.isPrimarySource(s2);
+ if (ref1.isCanonical() && !ref2.isCanonical())
+ {
+ return -1;
+ }
+ if (!ref1.isCanonical() && ref2.isCanonical())
+ {
+ return 1;
+ }
if (s1Primary && !s2Primary)
{
return -1;
private void buildSkipList()
{
skipList = new Hashtable();
- AlignFrame[] al = Desktop.getAlignFrames();
+ AlignFrame[] al = Desktop.getDesktopAlignFrames();
for (int f = 0; al != null && f < al.length; f++)
{
skipList.put(al[f].getViewport().getSequenceSetId(), al[f]);
protected JMenu chainMenu;
+ protected JMenu hetatmMenu;
+
protected JMenu viewerActionMenu;
protected JMenuItem alignStructs;
chainMenu = new JMenu();
chainMenu.setText(MessageManager.getString("action.show_chain"));
+ hetatmMenu = new JMenu();
+ hetatmMenu.setText(MessageManager.getString("action.show_hetatm"));
+
fitToWindow = new JMenuItem();
fitToWindow.setText(MessageManager.getString("label.fit_to_window"));
fitToWindow.addActionListener(new ActionListener()
savemenu.add(png);
savemenu.add(eps);
viewMenu.add(chainMenu);
+ viewMenu.add(hetatmMenu);
helpMenu.add(helpItem);
menuBar.add(fileMenu);
import jalview.datamodel.Alignment;
import jalview.datamodel.AlignmentAnnotation;
import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ContactListI;
import jalview.datamodel.ContactMatrix;
import jalview.datamodel.ContactMatrixI;
import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.FloatContactMatrix;
import jalview.datamodel.GeneLocus;
import jalview.datamodel.GraphLine;
import jalview.datamodel.GroupSet;
+import jalview.datamodel.GroupSetI;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.Point;
import jalview.datamodel.RnaViewerModel;
import jalview.xml.binding.jalview.MapListType;
import jalview.xml.binding.jalview.MapListType.MapListFrom;
import jalview.xml.binding.jalview.MapListType.MapListTo;
+import jalview.xml.binding.jalview.MapOnAMatrixType;
import jalview.xml.binding.jalview.Mapping;
import jalview.xml.binding.jalview.MatrixType;
import jalview.xml.binding.jalview.NoValueColour;
Map<String, SequenceI> incompleteSeqs = null;
- List<SeqFref> frefedSequence = null;
+ List<forwardRef> frefedSequence = null;
boolean raiseGUI = true; // whether errors are raised in dialog boxes or not
* entry names
*/
private Map<RnaModel, String> rnaSessions = new HashMap<>();
+
+ /**
+ * map from contact matrices to their XML ids
+ */
+ private Map<ContactMatrixI,String> contactMatrices = new HashMap<>();
+ private Map<String, ContactMatrixI> contactMatrixRefs = new HashMap<>();
+ private List<jalview.xml.binding.jalview.MatrixType> xmlMatrices= new ArrayList<>();
/**
* A helper method for safely using the value of an optional attribute that
}
/**
- * base class for resolving forward references to sequences by their ID
+ * base class for resolving forward references to an as-yet unmarshalled object referenced by already unmarshalled objects
*
* @author jprocter
*
*/
- abstract class SeqFref
- {
+ abstract class forwardRef {
String sref;
String type;
- public SeqFref(String _sref, String type)
+ public forwardRef(String _sref, String type)
{
sref = _sref;
this.type = type;
return sref;
}
+ public abstract boolean isResolvable();
+ /**
+ * @return true if the forward reference was fully resolved
+ */
+ abstract boolean resolve();
+
+ @Override
+ public String toString()
+ {
+ return type + " reference to " + sref;
+ }
+ }
+ /**
+ * resolve forward references to sequences by their ID
+ * @author jprocter
+ */
+ abstract class SeqFref extends forwardRef
+ {
+ public SeqFref(String _sref, String type)
+ {
+ super(_sref, type);
+ }
public SequenceI getSrefSeq()
{
return seqRefIds.get(sref);
}
return sq;
}
-
- /**
- * @return true if the forward reference was fully resolved
- */
- abstract boolean resolve();
-
- @Override
- public String toString()
- {
- return type + " reference to " + sref;
- }
}
/**
};
return fref;
}
+
+ public forwardRef newMatrixFref(final String matRef,
+ final jalview.util.MapList mapping, final AlignmentAnnotation jaa)
+ {
+ forwardRef fref = new forwardRef(matRef,
+ "Matrix Reference for sequence and annotation")
+ {
+
+ @Override
+ boolean resolve()
+ {
+ ContactMatrixI cm = contactMatrixRefs.get(matRef);
+ PAEContactMatrix newpae = new PAEContactMatrix(jaa.sequenceRef,
+ mapping, cm);
+
+ jaa.sequenceRef.addContactListFor(jaa, newpae);
+ return true;
+ }
+
+ @Override
+ public boolean isResolvable()
+ {
+ return (contactMatrixRefs.get(matRef) != null);
+ }
+ };
+ return fref;
+ }
public void resolveFrefedSequences()
{
- Iterator<SeqFref> nextFref = frefedSequence.iterator();
+ Iterator<forwardRef> nextFref = frefedSequence.iterator();
int toresolve = frefedSequence.size();
int unresolved = 0, failedtoresolve = 0;
while (nextFref.hasNext())
{
- SeqFref ref = nextFref.next();
+ forwardRef ref = nextFref.next();
if (ref.isResolvable())
{
try
*/
public void saveState(JarOutputStream jout)
{
- AlignFrame[] frames = Desktop.getAlignFrames();
+ AlignFrame[] frames = Desktop.getDesktopAlignFrames();
setStateSavedUpToDate(true);
// jms.addViewport(view);
object.getViewport().add(view);
}
+
+
+ if (storeDS)
+ {
+ // store matrices referenced by any views or annotation in this dataset
+ if (xmlMatrices!=null && xmlMatrices.size()>0)
+ {
+ Console.debug("Adding "+xmlMatrices.size()+" matrices to dataset.");
+ vamsasSet.getMatrix().addAll(xmlMatrices);
+ xmlMatrices.clear();
+ }
+ }
+
+
// object.setJalviewModelSequence(jms);
// object.getVamsasModel().addSequenceSet(vamsasSet);
object.getVamsasModel().getSequenceSet().add(vamsasSet);
.getContactMatrixFor(annotation);
if (cm != null)
{
- MatrixType xmlmat = new MatrixType();
- xmlmat.setType(cm.getType());
- xmlmat.setRows(BigInteger.valueOf(cm.getWidth()));
- xmlmat.setCols(BigInteger.valueOf(cm.getHeight()));
- // consider using an opaque to/from -> allow instance to control
- // its representation ?
- xmlmat.setElements(ContactMatrix.contactToFloatString(cm));
- if (cm.hasGroups())
- {
- for (BitSet gp : cm.getGroups())
- {
- xmlmat.getGroups().add(stringifyBitset(gp));
- }
- }
- if (cm.hasTree())
- {
- // provenance object for tree ?
- xmlmat.getNewick().add(cm.getNewick());
- xmlmat.setTreeMethod(cm.getTreeMethod());
- }
- if (cm.hasCutHeight())
- {
- xmlmat.setCutHeight(cm.getCutHeight());
- }
- // set/get properties
- if (cm instanceof MappableContactMatrixI)
- {
- jalview.util.MapList mlst = ((MappableContactMatrixI) cm)
- .getMapFor(annotation.sequenceRef);
- if (mlst != null)
- {
- MapListType mp = new MapListType();
- List<int[]> r = mlst.getFromRanges();
- for (int[] range : r)
- {
- MapListFrom mfrom = new MapListFrom();
- mfrom.setStart(range[0]);
- mfrom.setEnd(range[1]);
- // mp.addMapListFrom(mfrom);
- mp.getMapListFrom().add(mfrom);
- }
- r = mlst.getToRanges();
- for (int[] range : r)
- {
- MapListTo mto = new MapListTo();
- mto.setStart(range[0]);
- mto.setEnd(range[1]);
- // mp.addMapListTo(mto);
- mp.getMapListTo().add(mto);
- }
- mp.setMapFromUnit(
- BigInteger.valueOf(mlst.getFromRatio()));
- mp.setMapToUnit(BigInteger.valueOf(mlst.getToRatio()));
- xmlmat.setMapping(mp);
- }
- }
- // and add to model
- an.getContactmatrix().add(xmlmat);
+ storeMatrixFor(vamsasSet, an,annotation, cm);
}
}
}
}
+ private void storeMatrixFor(SequenceSet root, Annotation an, AlignmentAnnotation annotation, ContactMatrixI cm)
+ {
+ String cmId = contactMatrices.get(cm);
+ MatrixType xmlmat=null;
+
+ // first create an xml ref for the matrix data, if none exist
+ if (cmId == null)
+ {
+ xmlmat = new MatrixType();
+ xmlmat.setType(cm.getType());
+ xmlmat.setRows(BigInteger.valueOf(cm.getWidth()));
+ xmlmat.setCols(BigInteger.valueOf(cm.getHeight()));
+ // consider using an opaque to/from -> allow instance to control
+ // its representation ?
+ xmlmat.setElements(ContactMatrix.contactToFloatString(cm));
+ if (cm.hasGroups())
+ {
+ for (BitSet gp : cm.getGroups())
+ {
+ xmlmat.getGroups().add(stringifyBitset(gp));
+ }
+ }
+ if (cm.hasTree())
+ {
+ // provenance object for tree ?
+ xmlmat.getNewick().add(cm.getNewick());
+ xmlmat.setTreeMethod(cm.getTreeMethod());
+ }
+ if (cm.hasCutHeight())
+ {
+ xmlmat.setCutHeight(cm.getCutHeight());
+ }
+ xmlmat.setId(cmId = "m"+contactMatrices.size()+System.currentTimeMillis());
+ Console.trace("Matrix data stored :"+cmId);
+ contactMatrices.put(cm, cmId);
+ contactMatrixRefs.put(cmId, cm);
+ xmlMatrices.add(xmlmat);
+ } else {
+ Console.trace("Existing Matrix stored :"+cmId);
+ }
+
+ // now store mapping
+
+ MapOnAMatrixType xmlmatmapping = new MapOnAMatrixType();
+ xmlmatmapping.setMatrix(cmId);
+
+ // Pretty much all matrices currently managed in this way are
+ // mappableContactMatrixI implementations - but check anyway
+ if (cm instanceof MappableContactMatrixI)
+ {
+ jalview.util.MapList mlst = ((MappableContactMatrixI) cm)
+ .getMapFor(annotation.sequenceRef);
+ if (mlst != null)
+ {
+ MapListType mp = new MapListType();
+ List<int[]> r = mlst.getFromRanges();
+ for (int[] range : r)
+ {
+ MapListFrom mfrom = new MapListFrom();
+ mfrom.setStart(range[0]);
+ mfrom.setEnd(range[1]);
+ // mp.addMapListFrom(mfrom);
+ mp.getMapListFrom().add(mfrom);
+ }
+ r = mlst.getToRanges();
+ for (int[] range : r)
+ {
+ MapListTo mto = new MapListTo();
+ mto.setStart(range[0]);
+ mto.setEnd(range[1]);
+ // mp.addMapListTo(mto);
+ mp.getMapListTo().add(mto);
+ }
+ mp.setMapFromUnit(BigInteger.valueOf(mlst.getFromRatio()));
+ mp.setMapToUnit(BigInteger.valueOf(mlst.getToRatio()));
+ xmlmatmapping.setMapping(mp);
+ }
+ }
+ // and add to model
+ an.getContactmatrix().add(xmlmatmapping);
+ }
+
private String stringifyBitset(BitSet gp)
{
StringBuilder sb = new StringBuilder();
initSeqRefs();
}
AlignFrame af = null, _af = null;
+ List<AlignFrame> toRepaint=new ArrayList<AlignFrame>();
IdentityHashMap<AlignmentI, AlignmentI> importedDatasets = new IdentityHashMap<>();
Map<String, AlignFrame> gatherToThisFrame = new HashMap<>();
final String file = jprovider.getFilename();
if (_af != null && object.getViewport().size() > 0)
// getJalviewModelSequence().getViewportCount() > 0)
{
+ toRepaint.add(_af);
if (af == null)
{
// store a reference to the first view
} while (jarentry != null);
jin.close();
resolveFrefedSequences();
+ for (AlignFrame alignFrame:toRepaint)
+ {
+ alignFrame.repaint();
+ }
} catch (IOException ex)
{
ex.printStackTrace();
}
// ////////////////////////////////
+ // LOAD MATRICES (IF ANY)
+
+ if (vamsasSet.getMatrix()!=null && vamsasSet.getMatrix().size()>0)
+ {
+ importMatrixData(vamsasSet.getMatrix());
+ }
+
+ // ////////////////////////////////
// LOAD SEQUENCES
List<SequenceI> hiddenSeqs = null;
if (annotation.getContactmatrix() != null
&& annotation.getContactmatrix().size() > 0)
{
- for (MatrixType xmlmat : annotation.getContactmatrix())
+ for (MapOnAMatrixType xmlmat : annotation.getContactmatrix())
{
- if (PAEContactMatrix.PAEMATRIX.equals(xmlmat.getType()))
- {
- if (!xmlmat.getRows().equals(xmlmat.getCols()))
- {
- Console.error("Can't handle non square PAE Matrices");
- }
- else
- {
- float[][] elements = ContactMatrix
- .fromFloatStringToContacts(xmlmat.getElements(),
- xmlmat.getCols().intValue(),
- xmlmat.getRows().intValue());
- jalview.util.MapList mapping = null;
- if (xmlmat.getMapping() != null)
- {
- MapListType m = xmlmat.getMapping();
- // Mapping m = dr.getMapping();
- int fr[] = new int[m.getMapListFrom().size() * 2];
- Iterator<MapListFrom> from = m.getMapListFrom()
- .iterator();// enumerateMapListFrom();
- for (int _i = 0; from.hasNext(); _i += 2)
- {
- MapListFrom mf = from.next();
- fr[_i] = mf.getStart();
- fr[_i + 1] = mf.getEnd();
- }
- int fto[] = new int[m.getMapListTo().size() * 2];
- Iterator<MapListTo> to = m.getMapListTo().iterator();// enumerateMapListTo();
- for (int _i = 0; to.hasNext(); _i += 2)
- {
- MapListTo mf = to.next();
- fto[_i] = mf.getStart();
- fto[_i + 1] = mf.getEnd();
- }
-
- mapping = new jalview.util.MapList(fr, fto,
- m.getMapFromUnit().intValue(),
- m.getMapToUnit().intValue());
- }
- List<BitSet> newgroups = new ArrayList<BitSet>();
- if (xmlmat.getGroups().size() > 0)
- {
- for (String sgroup : xmlmat.getGroups())
- {
- newgroups.add(deStringifyBitset(sgroup));
- }
- }
- String nwk = xmlmat.getNewick().size() > 0
- ? xmlmat.getNewick().get(0)
- : null;
- if (xmlmat.getNewick().size() > 1)
- {
- Console.log.info(
- "Ignoring additional clusterings for contact matrix");
- }
- String treeMethod = xmlmat.getTreeMethod();
- double thresh = xmlmat.getCutHeight() != null
- ? xmlmat.getCutHeight()
- : 0;
- GroupSet grpset = new GroupSet();
- grpset.restoreGroups(newgroups, treeMethod, nwk, thresh);
- PAEContactMatrix newpae = new PAEContactMatrix(
- jaa.sequenceRef, mapping, elements, grpset);
- jaa.sequenceRef.addContactListFor(jaa, newpae);
- }
- }
- else
- {
- Console.error("Ignoring CONTACT_MAP annotation with type "
- + xmlmat.getType());
- }
- }
+ restoreMatrixFor(jaa.sequenceRef, jaa, xmlmat);
+ }
}
}
return af;
}
+ private void importMatrixData(List<MatrixType> xmlmatrices)
+ {
+ for (MatrixType xmlmat:xmlmatrices)
+ {
+ if (!PAEContactMatrix.PAEMATRIX.equals(xmlmat.getType()))
+ {
+ Console.error("Ignoring matrix '"+xmlmat.getId()+"' of type '"+xmlmat.getType());
+ continue;
+ }
+
+ if (!xmlmat.getRows().equals(xmlmat.getCols()))
+ {
+ Console.error("Can't handle non square matrices");
+ continue;
+ }
+
+ float[][] elements = ContactMatrix
+ .fromFloatStringToContacts(xmlmat.getElements(),
+ xmlmat.getCols().intValue(),
+ xmlmat.getRows().intValue());
+
+ List<BitSet> newgroups = new ArrayList<BitSet>();
+ if (xmlmat.getGroups().size() > 0)
+ {
+ for (String sgroup : xmlmat.getGroups())
+ {
+ newgroups.add(deStringifyBitset(sgroup));
+ }
+ }
+ String nwk = xmlmat.getNewick().size() > 0
+ ? xmlmat.getNewick().get(0)
+ : null;
+ if (xmlmat.getNewick().size() > 1)
+ {
+ Console.log.info(
+ "Ignoring additional clusterings for contact matrix");
+ }
+ String treeMethod = xmlmat.getTreeMethod();
+ double thresh = xmlmat.getCutHeight() != null
+ ? xmlmat.getCutHeight()
+ : 0;
+ GroupSet grpset = new GroupSet();
+ grpset.restoreGroups(newgroups, treeMethod, nwk, thresh);
+
+ FloatContactMatrix newcm = new FloatContactMatrix(elements, grpset);
+ contactMatrixRefs.put(xmlmat.getId(), newcm);
+ Console.trace("Restored base contact matrix "+xmlmat.getId());
+ }
+ }
+
+ private void restoreMatrixFor(SequenceI sequenceRef,
+ AlignmentAnnotation jaa, MapOnAMatrixType xmlmatmapping)
+ {
+ // restore mapping data to matrix data
+ jalview.util.MapList mapping = null;
+ if (xmlmatmapping.getMapping() != null)
+ {
+ MapListType m = xmlmatmapping.getMapping();
+ // Mapping m = dr.getMapping();
+ int fr[] = new int[m.getMapListFrom().size() * 2];
+ Iterator<MapListFrom> from = m.getMapListFrom().iterator();// enumerateMapListFrom();
+ for (int _i = 0; from.hasNext(); _i += 2)
+ {
+ MapListFrom mf = from.next();
+ fr[_i] = mf.getStart();
+ fr[_i + 1] = mf.getEnd();
+ }
+ int fto[] = new int[m.getMapListTo().size() * 2];
+ Iterator<MapListTo> to = m.getMapListTo().iterator();// enumerateMapListTo();
+ for (int _i = 0; to.hasNext(); _i += 2)
+ {
+ MapListTo mf = to.next();
+ fto[_i] = mf.getStart();
+ fto[_i + 1] = mf.getEnd();
+ }
+
+ mapping = new jalview.util.MapList(fr, fto,
+ m.getMapFromUnit().intValue(), m.getMapToUnit().intValue());
+ }
+
+ // locate matrix data in project XML and import
+ ContactMatrixI cm = contactMatrixRefs.get(xmlmatmapping.getMatrix());
+ if (cm == null)
+ {
+ frefedSequence
+ .add(newMatrixFref(xmlmatmapping.getMatrix(), mapping, jaa));
+ }
+ else
+ {
+ // create the PAEMatrix now
+ PAEContactMatrix newpae = new PAEContactMatrix(jaa.sequenceRef,
+ mapping, cm);
+
+ jaa.sequenceRef.addContactListFor(jaa, newpae);
+ }
+
+ return;
+ }
+
/**
* Load Overview window, restoring colours, 'show hidden regions' flag, title
* and geometry as saved
if (stateSavedUpToDate()) // nothing happened since last project save
return true;
- AlignFrame[] frames = Desktop.getAlignFrames();
+ AlignFrame[] frames = Desktop.getDesktopAlignFrames();
if (frames != null)
{
for (int i = 0; i < frames.length; i++)
int x, int y, int iconOffset, int startRes, int column,
boolean validRes, boolean validEnd)
{
- g.setColor(STEM_COLOUR);
int sCol = (lastSSX / charWidth)
+ hiddenColumns.visibleToAbsoluteColumn(startRes);
int x1 = lastSSX;
|| row_annotations[column] == null
|| dc != row_annotations[column].secondaryStructure;
+ if (diffupstream || diffdownstream)
+ {
+ // draw glyphline under arrow
+ drawGlyphLine(g, lastSSX, x, y, iconOffset);
+ }
+ g.setColor(STEM_COLOUR);
+
if (column > 0 && Rna.isClosingParenthesis(dc))
{
if (diffupstream)
*/
fillPolygon(g, new int[] { lastSSX + 5, lastSSX + 5, lastSSX },
new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset },
+ { y + iconOffset + 1, y + 13 + iconOffset,
+ y + 7 + iconOffset },
3);
x1 += 5;
}
* if annotation ending with an opeing base pair half of the stem,
* display a forward arrow
*/
- fillPolygon(g, new int[] { x2 - 5, x2 - 5, x2 },
+ fillPolygon(g, new int[] { x2 - 6, x2 - 6, x2 - 1 },
new int[]
- { y + iconOffset, y + 14 + iconOffset, y + 8 + iconOffset },
+ { y + iconOffset + 1, y + 13 + iconOffset,
+ y + 7 + iconOffset },
3);
x2 -= 5;
}
}
}
// draw arrow body
- fillRect(g, x1, y + 4 + iconOffset, x2 - x1, 7);
+ unsetAntialias(g);
+ fillRect(g, x1, y + 4 + iconOffset, x2 - x1, 6);
}
void drawNotCanonicalAnnot(Graphics g, Color nonCanColor,
}
else
{
- // g.setColor(Color.orange);
fillRoundRect(g, lastSSX, y + 3 + iconOffset, x2 - x1 - ofs, 8, 0,
0);
}
}
else
{
- // g.setColor(Color.magenta);
fillRoundRect(g, lastSSX + ofs, y + 3 + iconOffset, x2 - x1 - ofs,
8, 0, 0);
}
package jalview.renderer;
+import java.util.Arrays;
import java.util.Iterator;
+import java.util.List;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.ContactListI;
final ContactListI contacts;
+ /**
+ * how many pixels per contact (1..many)
+ */
final int pixels_step;
+ /**
+ * how many contacts per pixel (many > 0)
+ */
final double contacts_per_pixel;
+ /**
+ * number of contacts being mapped
+ */
final int contact_height;
+ /**
+ * number of pixels to map contact_height to
+ */
final int graphHeight;
+ /**
+ * number of contacts for each pixel_step - to last whole contact
+ */
+ final double contacts_step;
+
+ final int lastStep;
+
+ /**
+ * Bean used to map from a range of contacts to a range of pixels
+ * @param contacts
+ * @param graphHeight Number of pixels to map given range of contacts
+ */
public ContactGeometry(final ContactListI contacts, int graphHeight)
{
this.contacts = contacts;
this.graphHeight = graphHeight;
contact_height = contacts.getContactHeight();
// fractional number of contacts covering each pixel
- contacts_per_pixel = (graphHeight < 1) ? contact_height
+ contacts_per_pixel = (graphHeight <= 1) ? contact_height
: ((double) contact_height) / ((double) graphHeight);
if (contacts_per_pixel >= 1)
pixels_step = (int) Math
.ceil(((double) graphHeight) / (double) contact_height);
}
+ contacts_step = pixels_step*contacts_per_pixel;
+ lastStep = (int) Math.min((double)graphHeight, ((double)graphHeight)/((double)pixels_step));
}
public class contactInterval
public final int pEnd;
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null || !(obj instanceof contactInterval))
+ {
+ return false;
+ }
+ contactInterval them = (contactInterval) obj;
+ return cStart == them.cStart && cEnd == them.cEnd && pEnd == them.pEnd
+ && pStart == them.pStart;
+ }
+ @Override
+ public String toString()
+ {
+ return "Contacts ["+cStart+","+cEnd+"] : Pixels ["+pStart+","+pEnd+"]";
+ }
}
/**
{
// TODO: turn into function on hiddenColumns and create test !!
Iterator<int[]> viscont = hiddenColumns.getVisContigsIterator(
- mappedRange[p], mappedRange[p + 1], false);
+ -1+mappedRange[p], -1+mappedRange[p + 1], false);
containsHidden = !viscont.hasNext();
if (!containsHidden)
{
}
else
{
- rowsel = columnSelection.intersects(mappedRange[p],
- mappedRange[p + 1]);
+ rowsel = columnSelection.intersects(-1+mappedRange[p],
+ -1+mappedRange[p + 1]);
}
}
return rowsel;
}
/**
+ * Return mapped cell intersecting pStart \
+ *
+ * FIXME: REDUNDANT METHOD - COULD DELETE FIXME: OR RE-IMPLEMENT AS EFFICIENT
+ * RANGE QUERY
*
* @param pStart
+ * [0..)
* @param pEnd
- * @return range for
+ * @return nearest full cell containing pStart - does not set
+ * contactInterval.pEnd or cEnd to equivalent position on pEnd !
*/
public contactInterval mapFor(int pStart, int pEnd)
{
- int cStart = (int) Math.floor(pStart * contacts_per_pixel);
- contactInterval ci = new contactInterval(cStart,
- (int) Math.min(contact_height,
- Math.ceil(
- cStart + (pEnd - pStart) * contacts_per_pixel)),
- pStart, pEnd);
-
- return ci;
+ if (pStart < 0)
+ {
+ pStart = 0;
+ }
+ if (pEnd < pStart)
+ {
+ pEnd = pStart;
+ }
+ if (pEnd >= graphHeight)
+ {
+ pEnd = graphHeight - 1;
+ }
+ if (pStart >= graphHeight)
+ {
+ pStart = graphHeight - pixels_step;
+ }
+ int step = Math.floorDiv(pStart, pixels_step);
+ return findStep(step);
+ }
+
+ /**
+ *
+ * @param step
+ * [0..) n steps covering height and contactHeight
+ * @return contactInterval for step, or null if out of bounds
+ */
+ contactInterval findStep(int step)
+ {
+ if (step < 0 || step > lastStep)
+ {
+ return null;
+ }
+ return new contactInterval((int) Math.floor(contacts_step * step),
+ -1 + (int) Math.min(contact_height,
+ Math.floor(contacts_step * (step + 1))),
+ pixels_step * step,
+ Math.min(graphHeight, (step + 1) * pixels_step) - 1);
}
/**
*/
public contactInterval mapFor(int pCentre)
{
- int pStart = Math.max(pCentre - pixels_step, 0);
- int pEnd = Math.min(pStart + pixels_step, graphHeight);
- int cStart = (int) Math.floor(pStart * contacts_per_pixel);
- contactInterval ci = new contactInterval(cStart,
- (int) Math.min(contact_height,
- Math.ceil(cStart + (pixels_step) * contacts_per_pixel)),
- pStart, pEnd);
-
- return ci;
+ if (pCentre >= graphHeight + pixels_step)
+ {
+ return null;
+ }
+ int step = Math.floorDiv(pCentre, pixels_step);
+ return findStep(step);
+ }
+
+ public List<contactInterval> allSteps()
+ {
+ contactInterval[] array = new contactInterval[lastStep + 1];
+ int csum = 0, psum = 0;
+ for (int i = 0; i <= lastStep; i++)
+ {
+ array[i] = findStep(i);
+ csum += 1 + array[i].cEnd - array[i].cStart;
+ psum += 1 + array[i].pEnd - array[i].pStart;
+ }
+ if (csum != contact_height || psum != graphHeight)
+ {
+ System.err.println("csum = " + csum + " not " + contact_height + "\n"
+ + "psum = " + psum + " not " + graphHeight);
+ return null;
+ }
+ return Arrays.asList(array);
}
public Iterator<contactInterval> iterateOverContactIntervals(
*/
Color selMinColor, selMaxColor;
+ /**
+ *
+ * @param no_data - colour when no data available
+ * @param hidden - colour if this row is hidden
+ * @param maxColor - colour for maximum value of contact
+ * @param minColor - colour for minimum value of contact
+ * @param selMinColor - min colour if the contact has been selected
+ * @param selMaxColor - max colour if contact is selected
+ */
public Shading(Color no_data, Color hidden, Color maxColor,
Color minColor, Color selMinColor, Color selMaxColor)
{
{
return new Shading(Color.pink, Color.red,
- new Color(246, 252, 243), new Color(0, 60, 26),
- new Color(26, 0, 60), new Color(243, 246, 252));
+ new Color(247, 252, 245), new Color(0, 68, 28),
+ new Color(28, 0, 68), new Color(245,247,252));
}
};
}
int column;
int aaMax = aa_annotations.length - 1;
ContactMatrixI cm = viewport.getContactMatrix(_aa);
+ if (cm==null)
+ {
+ return;
+ }
while (x < eRes - sRes)
{
column = sRes + x;
for (int ht = 0, botY = topY
- _aa.height; ht < _aa.graphHeight; ht += cgeom.pixels_step)
{
- ContactGeometry.contactInterval ci = cgeom.mapFor(ht,
- ht + cgeom.pixels_step);
+ ContactGeometry.contactInterval ci = cgeom.mapFor(ht);
// cstart = (int) Math.floor(((double) y2 - ht) * contacts_per_pixel);
// cend = (int) Math.min(contact_height,
// Math.ceil(cstart + contacts_per_pixel * pixels_step));
Color col;
- boolean rowsel = false, containsHidden = false;
+ boolean rowsel = false;
+ boolean containsHidden = false;
if (columnSelection != null)
{
rowsel = cgeom.intersects(ci, columnSelection, hiddenColumns,
g.setColor(col);
if (cgeom.pixels_step > 1)
{
- g.fillRect(x * charWidth, botY+ht, charWidth, 1 + cgeom.pixels_step);
+ g.fillRect(x * charWidth, botY+ht, charWidth, cgeom.pixels_step);
}
else
{
{
ContactRange cr = cl.getRangeFor(i, j);
// average for moment - probably more interested in maxIntProj though
- return jalview.util.ColorUtils.getGraduatedColour((float) cr.getMean(),
+ return jalview.util.ColorUtils.getGraduatedColour((float) cr.getMin(),
0, shade.selMinColor, max, shade.selMaxColor);
}
import java.util.Map;
import java.util.Map.Entry;
+import jalview.bin.Console;
+
/**
* A base class holding methods useful to all classes that implement commands
* for structure viewers
{
return null;
}
+
+ @Override
+ public StructureCommandI restoreSession(String filePath)
+ {
+ return loadFile(filePath);
+ }
}
package jalview.structure;
import java.awt.Color;
+import java.util.Collections;
import java.util.List;
import java.util.Map;
* @return
*/
StructureCommandI openSession(String filepath);
+
+ /**
+ * Returns command to restore a previously saved version of an existing structure viewer session file.
+ * Default implementation calls 'openSession'
+ * @param filePath
+ * @return
+ */
+ StructureCommandI restoreSession(String filePath);
+
/**
* Returns a command to ask the viewer to close down
StructureCommandI getResidueAttributes(String attName);
List<StructureCommandI> centerViewOn(List<AtomSpecModel> residues);
+
+ default List<StructureCommandI> showHetatms(List<String> toShow) {
+ return Collections.EMPTY_LIST;
+ }
}
int indexpos = sm.getSeqPos(atom.getPdbResNum());
if (lastipos != indexpos || lastseq != sm.sequence)
{
- results.addResult(sm.sequence, indexpos, indexpos);
+ results.appendResult(sm.sequence, indexpos, indexpos);
lastipos = indexpos;
lastseq = sm.sequence;
// construct highlighted sequence list
import java.util.ArrayList;
import java.util.Arrays;
import java.util.BitSet;
+import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
{
for (int s : cs.getSelected())
{
- if (hiddenCols == null)
- {
matched.set(s);
- }
- else
- {
- matched.set(hiddenCols.visibleToAbsoluteColumn(s));
- }
}
}
else
* @param getReply
* @param msg
*/
- protected List<String> executeCommands(List<StructureCommandI> commands,
+ public List<String> executeCommands(List<StructureCommandI> commands,
boolean getReply, String msg)
{
return executeCommand(getReply, msg,
return f;
}
+
+ /**
+ * Use restoreSession when you want to restore a previously saved sesssion to
+ * the running viewer instance.
+ *
+ * @param absolutePath
+ */
+ public void restoreSession(String absolutePath)
+ {
+ String prefix = getViewerType().toString();
+ try {
+
+ StructureCommandI cmd = commandGenerator.restoreSession(absolutePath);
+ if (cmd != null)
+ {
+ executeCommand(cmd, false);
+ }
+ } catch (Throwable e)
+ {
+ Console.error(String.format("Error restoring %s session: %s", prefix,
+ e.toString()));
+ }
+
+ }
+
/**
* Saves the structure viewer session to the given file
*
{
return 0;
}
+
+ /**
+ * list the ligands available for display/hiding in the current view
+ * @return HETATM CODE:Molecule name
+ */
+ public Map<String, String> getHetatmNames() {
+ return Collections.EMPTY_MAP;
+ }
+ /**
+ * Generates and executes a command to show the given hetatm types as CPK
+ *
+ * @param toShow - one or more of strings from getHetatmNames
+ */
+ public void showHetatms(List<String> toShow)
+ {
+ executeCommands(commandGenerator.showHetatms(toShow), false, "Adjusting hetatm visibility");
+ }
+
}
import java.io.PrintStream;
import jalview.bin.Jalview;
+import jalview.bin.Jalview.ExitCode;
public class AWTConsole extends WindowAdapter
implements WindowListener, ActionListener, Runnable
} catch (Exception e)
{
}
- Jalview.exit("Window closing. Bye!", 0);
+ Jalview.exit("Window closing. Bye!", ExitCode.OK);
}
@Override
boolean allowSingleFilenameThatDoesNotExist)
{
pattern = substituteHomeDir(pattern);
+ String relativePattern = pattern.startsWith(File.separator) ? null
+ : pattern;
List<File> files = new ArrayList<>();
/*
* For efficiency of the Files.walkFileTree(), let's find the longest path that doesn't need globbing.
{
String pS = pattern.substring(0, lastFS + 1);
String rest = pattern.substring(lastFS + 1);
- Path parentDir = Paths.get(pS).toAbsolutePath();
+ if ("".equals(pS))
+ {
+ pS = ".";
+ }
+ Path parentDir = Paths.get(pS);
if (parentDir.toFile().exists())
{
try
return null;
String dirname = null;
- try
- {
- File p = file.getParentFile();
- File d = new File(substituteHomeDir(p.getPath()));
- dirname = d.getCanonicalPath();
- } catch (IOException e)
+ File p = file.getParentFile();
+ if (p == null)
{
- Console.debug(
- "Exception when getting dirname of '" + file.getPath() + "'",
- e);
- dirname = "";
+ p = new File(".");
}
+ File d = new File(substituteHomeDir(p.getPath()));
+ dirname = d.getPath();
return dirname;
}
+
+ public static String convertWildcardsToPath(String value, String wildcard,
+ String dirname, String basename)
+ {
+ if (value == null)
+ {
+ return null;
+ }
+ StringBuilder path = new StringBuilder();
+ int lastFileSeparatorIndex = value.lastIndexOf(File.separatorChar);
+ int wildcardBeforeIndex = value.indexOf(wildcard);
+ if (lastFileSeparatorIndex > wildcard.length() - 1
+ && wildcardBeforeIndex < lastFileSeparatorIndex)
+ {
+ path.append(value.substring(0, wildcardBeforeIndex));
+ path.append(dirname);
+ path.append(value.substring(wildcardBeforeIndex + wildcard.length(),
+ lastFileSeparatorIndex + 1));
+ }
+ else
+ {
+ path.append(value.substring(0, lastFileSeparatorIndex + 1));
+ }
+ int wildcardAfterIndex = value.indexOf(wildcard,
+ lastFileSeparatorIndex);
+ if (wildcardAfterIndex > lastFileSeparatorIndex)
+ {
+ path.append(value.substring(lastFileSeparatorIndex + 1,
+ wildcardAfterIndex));
+ path.append(basename);
+ path.append(value.substring(wildcardAfterIndex + wildcard.length()));
+ }
+ else
+ {
+ path.append(value.substring(lastFileSeparatorIndex + 1));
+ }
+ return path.toString();
+ }
+
+ public static File getParentDir(File file)
+ {
+ if (file == null)
+ {
+ return null;
+ }
+ File parentDir = file.getAbsoluteFile().getParentFile();
+ return parentDir;
+ }
+
+ public static boolean checkParentDir(File file, boolean mkdirs)
+ {
+ if (file == null)
+ {
+ return false;
+ }
+ File parentDir = getParentDir(file);
+ if (parentDir.exists())
+ {
+ // already exists, nothing to do so nothing to worry about!
+ return true;
+ }
+
+ if (!mkdirs)
+ {
+ return false;
+ }
+
+ Path path = file.toPath();
+ for (int i = 0; i < path.getNameCount(); i++)
+ {
+ Path p = path.getName(i);
+ if ("..".equals(p.toString()))
+ {
+ Console.warn("Cautiously not running mkdirs on " + file.toString()
+ + " because the path to be made contains '..'");
+ return false;
+ }
+ }
+
+ return parentDir.mkdirs();
+ }
}
}
/**
- * Bespoke method to format percentage float value to the specified number of
+ * Bespoke method to format a percentage (or any other) float value to the specified number of
* decimal places. Avoids use of general-purpose format parsers as a
* processing hotspot.
*
BitmapImageSizing bis = ImageMaker.getScaleWidthHeight(width, height,
userBis);
- float usescale = bis.scale;
- int usewidth = bis.width;
- int useheight = bis.height;
+ float usescale = bis.scale();
+ int usewidth = bis.width();
+ int useheight = bis.height();
bi = new BufferedImage(usewidth, useheight, BufferedImage.TYPE_INT_RGB);
graphics = bi.getGraphics();
}
/**
- * Takes suggested float scale, int width, int height and create a bounding
- * box returned as a BitmapImageSizing object with consistent scale, width,
- * height fields.
+ * Takes initial width and height, and suggested float scale, int width, int
+ * height and create a bounding box returned as a BitmapImageSizing object
+ * with consistent scale, width, height fields.
*
+ * @param width
+ * The unscaled image width
+ * @param height
+ * The unscaled image height
* @param scale
+ * The suggested scaling
* @param bitmapwidth
+ * The suggested width
* @param bitmapheight
- * @return BitmapImageSizing
+ * The suggested height
+ * @return BitmapImageSizing A consistent scale,width and height for the final
+ * image
*/
public static BitmapImageSizing getScaleWidthHeight(int width, int height,
float scale, int bitmapwidth, int bitmapheight)
int usewidth = width;
int useheight = height;
+ if ((width == 0 && bitmapwidth > 0)
+ || (height == 0 && bitmapheight > 0))
+ {
+ // original image is zero sized! Avoid dividing by zero!
+ return BitmapImageSizing.nullBitmapImageSizing();
+ }
+
// use the smallest positive scale (i.e. fit in the box)
if (scale > 0.0f)
{
useheight = bitmapheight;
}
}
- return new BitmapImageSizing(usescale, usewidth, useheight);
+ return new BitmapImageSizing(usescale, usewidth, useheight, false);
}
/**
public static BitmapImageSizing getScaleWidthHeight(int width, int height,
BitmapImageSizing bis)
{
- return ImageMaker.getScaleWidthHeight(width, height, bis.scale,
- bis.width, bis.height);
+ return ImageMaker.getScaleWidthHeight(width, height, bis.scale(),
+ bis.width(), bis.height());
}
/**
public static BitmapImageSizing parseScaleWidthHeightStrings(
String scaleS, String widthS, String heightS)
{
+ if (scaleS == null && widthS == null && heightS == null)
+ {
+ // if all items are null (i.e. not provided) we use the dynamic
+ // preferences set BIS
+ return BitmapImageSizing.defaultBitmapImageSizing();
+ }
+
float scale = 0.0f;
int width = 0;
int height = 0;
}
}
- return new BitmapImageSizing(scale, width, height);
+ return new BitmapImageSizing(scale, width, height, false);
}
}
public class MapUtils
{
- /*
- * Return the value of the first key that exists in the map
+ /**
+ * Return the value of the first key that exists in the map and has a non-null
+ * value
*/
public static <K, V> V getFirst(Map<K, V> map, K... keys)
{
return getFirst(false, map, keys);
}
+ /**
+ * Return the value of the first key that exists in the map - optionally
+ * limiting to only returning non-null values for first extant key encountered
+ */
public static <K, V> V getFirst(boolean nonNull, Map<K, V> map, K... keys)
{
for (K key : keys)
return null;
}
+ /**
+ * peeks in to the map and returns true if one of a bunch of keys is contained
+ * in it
+ *
+ * @param <K>
+ * @param map
+ * @param keys
+ * @return
+ */
public static <K> boolean containsAKey(Map<K, ?> map, K... keys)
{
for (K key : keys)
public class BitmapImageSizing
{
- public final float scale;
+ private final float scale;
- public final int width;
+ private final int width;
- public final int height;
+ private final int height;
- public BitmapImageSizing(float scale, int width, int height)
+ private boolean isDefault = false;
+
+ public BitmapImageSizing(float scale, int width, int height,
+ boolean isDefault)
{
this.scale = scale;
this.width = width;
this.height = height;
+ this.isDefault = isDefault;
+ }
+
+ public boolean isNull()
+ {
+ return scale == 0.0f && width == 0 && height == 0;
}
public static BitmapImageSizing nullBitmapImageSizing()
{
- return new BitmapImageSizing(0.0f, 0, 0);
+ return new BitmapImageSizing(0.0f, 0, 0, false);
}
-
+
public static final String BITMAP_SCALE = "BITMAP_SCALE";
public static final String BITMAP_HEIGHT = "BITMAP_HEIGHT";
*/
public static BitmapImageSizing defaultBitmapImageSizing()
{
-
- return new BitmapImageSizing(Cache.getDefault(BITMAP_SCALE,0)/10f,Cache.getDefault(BITMAP_WIDTH,0),Cache.getDefault(BITMAP_HEIGHT,0));
-
+ return new BitmapImageSizing(0f, 0, 0, true);
+ }
+
+ private float defaultScale()
+ {
+ return Cache.getDefault(BITMAP_SCALE, 0f);
+ }
+
+ private int defaultWidth()
+ {
+ return Cache.getDefault(BITMAP_WIDTH, 0);
+ }
+
+ private int defaultHeight()
+ {
+ return Cache.getDefault(BITMAP_HEIGHT, 0);
+ }
+
+ public float scale()
+ {
+ return isDefault() ? defaultScale() : scale;
+ }
+
+ public int width()
+ {
+ return isDefault() ? defaultWidth() : width;
+ }
+
+ public int height()
+ {
+ return isDefault() ? defaultHeight() : height;
+ }
+
+ public boolean isDefault()
+ {
+ return isDefault;
}
}
Class<? extends AlignCalcWorkerI> workerClass)
{
List<AlignCalcWorkerI> workingClass = new ArrayList<AlignCalcWorkerI>();
+ AlignCalcWorkerI[] workers;
synchronized (canUpdate)
{
- for (AlignCalcWorkerI worker : canUpdate)
+ workers = canUpdate.toArray(new AlignCalcWorkerI[0]);
+ }
+ for (AlignCalcWorkerI worker : workers)
+ {
+ if (workerClass.equals(worker.getClass()))
{
- if (workerClass.equals(worker.getClass()))
- {
- workingClass.add(worker);
- }
+ workingClass.add(worker);
}
}
return (workingClass.size() == 0) ? null : workingClass;
*/
package jalview.workers;
+import java.awt.Color;
+
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.bin.Jalview;
import jalview.datamodel.Annotation;
import jalview.gui.AlignFrame;
-import java.awt.Color;
-
/**
* Factory class with methods which allow clients (including external scripts
* such as Groovy) to 'register and forget' an alignment annotation calculator.
*/
public static void newCalculator(FeatureSetCounterI counter)
{
- AlignmentViewPanel currentAlignFrame = Jalview
+ AlignmentViewPanel currentAlignFrame = Jalview.getInstance()
.getCurrentAlignFrame().alignPanel;
if (currentAlignFrame == null)
{
{
// TODO need an interface for AlignFrame by which to access
// its AlignViewportI and AlignmentViewPanel
- AlignFrame currentAlignFrame = Jalview.getCurrentAlignFrame();
+ AlignFrame currentAlignFrame = Jalview.getInstance()
+ .getCurrentAlignFrame();
if (currentAlignFrame != null)
{
new AnnotationWorker(currentAlignFrame.getViewport(),
addDBRefSourceImpl(PfamFull.class);
addDBRefSourceImpl(PfamSeed.class);
addDBRefSourceImpl(RfamSeed.class);
- addDBRefSourceImpl(EBIAlfaFold.class);
+ // Technically not a database cross reference we fetch directly
+ // Useful for AlphaFold debugging
+ // addDBRefSourceImpl(EBIAlfaFold.class);
}
/**
* @return sequence position(s) corresponding to column in contact matrix
*/
int[] getMappedPositionsFor(SequenceI localFrame, int from, int to);
+
+ ContactMatrixI getMappedMatrix();
}
import jalview.datamodel.ContactListI;
import jalview.datamodel.ContactListImpl;
import jalview.datamodel.ContactListProviderI;
+import jalview.datamodel.ContactMatrixI;
import jalview.datamodel.GroupSet;
import jalview.datamodel.GroupSetI;
import jalview.datamodel.Mapping;
public abstract class MappableContactMatrix<T extends MappableContactMatrix<T>>
implements MappableContactMatrixI
{
- SequenceI refSeq = null;
-
- MapList toSeq = null;
-
/**
- * the length that refSeq is expected to be (excluding gaps, of course)
+ * the matrix that is being mapped to
*/
- int length;
+ protected ContactMatrixI mappedMatrix=null;
+
+ public ContactListI getContactList(int column)
+ {
+ return mappedMatrix.getContactList(column);
+ }
+
+ public float getMin()
+ {
+ return mappedMatrix.getMin();
+ }
+
+ public float getMax()
+ {
+ return mappedMatrix.getMax();
+ }
+
+ public int getWidth()
+ {
+ return mappedMatrix.getWidth();
+ }
+
+ public int getHeight()
+ {
+ return mappedMatrix.getHeight();
+ }
@Override
- public boolean hasReferenceSeq()
+ public ContactMatrixI getMappedMatrix()
{
- return (refSeq != null);
+ return mappedMatrix;
}
+
+ @Override
+ public GroupSetI getGroupSet()
+ {
+ return mappedMatrix.getGroupSet();
+ };
@Override
- public SequenceI getReferenceSeq()
+ public void setGroupSet(GroupSet makeGroups)
{
- return refSeq;
+ mappedMatrix.setGroupSet(makeGroups);
}
+
+ /**
+ * the sequence and how it is mapped to the matrix
+ */
+
+ SequenceI refSeq = null;
+
+ MapList toSeq = null;
/**
- * container for groups - defined on matrix columns
+ * the length that refSeq is expected to be (excluding gaps, of course)
*/
- GroupSet grps = new GroupSet();
+ int length;
@Override
- public GroupSetI getGroupSet()
+ public boolean hasReferenceSeq()
{
- return grps;
- };
+ return (refSeq != null);
+ }
@Override
- public void setGroupSet(GroupSet makeGroups)
+ public SequenceI getReferenceSeq()
{
- grps = makeGroups;
+ return refSeq;
}
@Override
}
/**
- * get a specific element of the contact matrix in its data-local coordinates
+ * get a specific element of the underlying contact matrix in its data-local coordinates
* rather than the mapped frame. Implementations are allowed to throw
* RunTimeExceptions if _column/i are out of bounds
*
* @param i
* @return
*/
- protected abstract double getElementAt(int _column, int i);
+ public double getElementAt(int _column, int i) {
+ return mappedMatrix.getElementAt(_column, i);
+ }
+
+ @Override
+ public int hashCode()
+ {
+ return 7 * (refSeq != null ? refSeq.hashCode() : 0)
+ + 11 * (toSeq != null ? toSeq.hashCode() : 0)
+ + 13 * (mappedMatrix != null ? mappedMatrix.hashCode() : 0)
+ + length * 3;
+ }
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (obj == null || !(obj.getClass().equals(getClass())))
+ {
+ return false;
+ }
+ T them = (T) obj;
+ return mappedMatrix == them.mappedMatrix && length == them.length
+ && refSeq == them.refSeq && toSeq.equals(them.toSeq);
+
+ }
}
import jalview.datamodel.ContactListImpl;
import jalview.datamodel.ContactListProviderI;
import jalview.datamodel.ContactMatrixI;
+import jalview.datamodel.FloatContactMatrix;
import jalview.datamodel.GroupSet;
import jalview.datamodel.SequenceDummy;
import jalview.datamodel.SequenceI;
{
- int maxrow = 0, maxcol = 0;
-
-
- float[][] elements;
-
- float maxscore;
-
-
@SuppressWarnings("unchecked")
public PAEContactMatrix(SequenceI _refSeq, Map<String, Object> pae_obj)
throws FileFormatException
*/
public PAEContactMatrix(SequenceI _refSeq, float[][] matrix)
{
+ mappedMatrix=new FloatContactMatrix(matrix);
setRefSeq(_refSeq);
- maxcol = 0;
- for (float[] row : matrix)
- {
- if (row.length > maxcol)
- {
- maxcol = row.length;
- }
- maxscore = row[0];
- for (float f : row)
- {
- if (maxscore < f)
- {
- maxscore = f;
- }
- }
- }
- maxrow = matrix.length;
- elements = matrix;
-
}
/**
public PAEContactMatrix(SequenceI newRefSeq, MapList newFromMapList,
float[][] elements2, GroupSet grps2)
{
- this(newRefSeq, elements2);
+ this(newRefSeq, new FloatContactMatrix(elements2,grps2));
+ toSeq = newFromMapList;
+ }
+
+ public PAEContactMatrix(SequenceI _refSeq,
+ ContactMatrixI floatContactMatrix)
+ {
+ mappedMatrix = floatContactMatrix;
+ setRefSeq(_refSeq);
+ }
+ public PAEContactMatrix(SequenceI _refSeq, MapList newFromMapList,
+ ContactMatrixI floatContactMatrix)
+ {
+ mappedMatrix = floatContactMatrix;
+ setRefSeq(_refSeq);
toSeq = newFromMapList;
- grps = grps2;
+ }
+
+ @Override
+ protected PAEContactMatrix newMappableContactMatrix(SequenceI newRefSeq,
+ MapList newFromMapList)
+ {
+ return new PAEContactMatrix(newRefSeq, newFromMapList, mappedMatrix);
}
/**
- * parse a sane JSON representation of the pAE
+ * parse a sane JSON representation of the pAE and update the mappedMatrix
*
* @param pae_obj
*/
@SuppressWarnings("unchecked")
private void parse_version_2_pAE(Map<String, Object> pae_obj)
{
- maxscore = -1;
+ float maxscore = -1;
// look for a maxscore element - if there is one...
try
{
}
List<List<Long>> scoreRows = ((List<List<Long>>) MapUtils
.getFirst(pae_obj, "predicted_aligned_error", "pae"));
- elements = new float[scoreRows.size()][scoreRows.size()];
+ float[][] elements = new float[scoreRows.size()][scoreRows.size()];
int row = 0, col = 0;
for (List<Long> scoreRow : scoreRows)
{
row++;
col = 0;
}
- maxcol = length;
- maxrow = length;
+ mappedMatrix=new FloatContactMatrix(elements);
}
/**
Iterator<Long> rows = ((List<Long>) pae_obj.get("residue1")).iterator();
Iterator<Long> cols = ((List<Long>) pae_obj.get("residue2")).iterator();
// two pass - to allocate the elements array
+
+ int maxrow=-1,maxcol=-1;
while (rows.hasNext())
{
int row = rows.next().intValue();
cols = ((List<Long>) pae_obj.get("residue2")).iterator();
Iterator<Double> scores = ((List<Double>) pae_obj.get("distance"))
.iterator();
- elements = new float[maxcol][maxrow];
+ float[][] elements = new float[maxcol][maxrow];
while (scores.hasNext())
{
float escore = scores.next().floatValue();
elements[col - 1][row-1] = escore;
}
- maxscore = ((Double) MapUtils.getFirst(pae_obj,
- "max_predicted_aligned_error", "max_pae")).floatValue();
- }
-
- /**
- * getContactList(column) @returns the vector of predicted alignment errors
- * for reference position given by column
- */
- @Override
- public ContactListI getContactList(final int column)
- {
- if (column < 0 || column >= elements.length)
- {
- return null;
- }
-
- return new ContactListImpl(new ContactListProviderI()
- {
- @Override
- public int getPosition()
- {
- return column;
- }
-
- @Override
- public int getContactHeight()
- {
- return maxcol - 1;
- }
-
- @Override
- public double getContactAt(int mcolumn)
- {
- if (mcolumn < 0 || mcolumn >= elements[column].length)
- {
- return -1;
- }
- return elements[column][mcolumn];
- }
- });
- }
-
- /**
- * getElementAt(column, i) @returns the predicted superposition error for the
- * ith position when column is used as reference
- */
- @Override
- protected double getElementAt(int _column, int i)
- {
- return elements[_column][i];
- }
-
- @Override
- public float getMin()
- {
- return 0;
- }
-
- @Override
- public float getMax()
- {
- return maxscore;
+ mappedMatrix=new FloatContactMatrix(elements);
}
@Override
return PAEMATRIX;
}
- @Override
- public int getWidth()
- {
- return maxcol;
- }
- @Override
- public int getHeight()
- {
- return maxrow;
- }
public static void validateContactMatrixFile(String fileName)
throws FileFormatException, IOException
{
}
}
@Override
- protected PAEContactMatrix newMappableContactMatrix(SequenceI newRefSeq,
- MapList newFromMapList)
+ public boolean equals(Object obj)
+ {
+ return super.equals(obj);
+ }
+ @Override
+ public int hashCode()
{
- PAEContactMatrix pae = new PAEContactMatrix(newRefSeq, newFromMapList,
- elements, new GroupSet(grps));
- return pae;
+ return super.hashCode();
}
}
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
/**
*
- * a Mapping entry and an associated protein sequence
+ * a Mapping entry and an associated protein
+ * sequence
*
*
* @return
/**
*
- * specifies a series of aligned codons from an associated DNA sequence alignment that when translated correspond to columns of a peptide alignment.
- * Element may have either all pos1,2,3 attributes specified, or none at all (indicating a gapped column with no translated peptide).
+ * specifies a series of aligned codons from an
+ * associated DNA sequence alignment that when translated
+ * correspond to columns of a peptide alignment.
+ * Element may have
+ * either all pos1,2,3 attributes specified, or none at all
+ * (indicating a gapped column with no translated peptide).
*
*
* <p>Java class for anonymous complex type.
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
* &lt;/element&gt;
- * &lt;element name="contactmatrix" type="{www.vamsas.ac.uk/jalview/version2}MatrixType" maxOccurs="unbounded" minOccurs="0"/&gt;
+ * &lt;element name="contactmatrix" type="{www.vamsas.ac.uk/jalview/version2}MapOnAMatrixType" maxOccurs="unbounded" minOccurs="0"/&gt;
* &lt;element name="property" type="{www.vamsas.ac.uk/jalview/version2}property" maxOccurs="unbounded" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;attribute name="graph" use="required" type="{http://www.w3.org/2001/XMLSchema}boolean" /&gt;
protected String label;
protected String description;
protected Annotation.ThresholdLine thresholdLine;
- protected List<MatrixType> contactmatrix;
+ protected List<MapOnAMatrixType> contactmatrix;
protected List<Property> property;
@XmlAttribute(name = "graph", required = true)
protected boolean graph;
*
* <p>
* Objects of the following type(s) are allowed in the list
- * {@link MatrixType }
+ * {@link MapOnAMatrixType }
*
*
*/
- public List<MatrixType> getContactmatrix() {
+ public List<MapOnAMatrixType> getContactmatrix() {
if (contactmatrix == null) {
- contactmatrix = new ArrayList<MatrixType>();
+ contactmatrix = new ArrayList<MapOnAMatrixType>();
}
return this.contactmatrix;
}
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
/**
*
- * This effectively represents a java.util.MapList object
+ * This effectively represents a java.util.MapList
+ * object
*
*
* <p>Java class for mapListType complex type.
--- /dev/null
+//
+// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
+// See https://eclipse-ee4j.github.io/jaxb-ri
+// Any modifications to this file will be lost upon recompilation of the source schema.
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
+//
+
+
+package jalview.xml.binding.jalview;
+
+import java.util.ArrayList;
+import java.util.List;
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * Defines a mapping from the local frame to a matrix
+ * and its associated data specified by MatrixType
+ *
+ *
+ * <p>Java class for MapOnAMatrixType complex type.
+ *
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ *
+ * <pre>
+ * &lt;complexType name="MapOnAMatrixType"&gt;
+ * &lt;complexContent&gt;
+ * &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType"&gt;
+ * &lt;sequence&gt;
+ * &lt;element name="property" type="{www.vamsas.ac.uk/jalview/version2}property" maxOccurs="unbounded" minOccurs="0"/&gt;
+ * &lt;element name="mapping" type="{www.vamsas.ac.uk/jalview/version2}mapListType" minOccurs="0"/&gt;
+ * &lt;/sequence&gt;
+ * &lt;attribute name="matrix" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /&gt;
+ * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" /&gt;
+ * &lt;/restriction&gt;
+ * &lt;/complexContent&gt;
+ * &lt;/complexType&gt;
+ * </pre>
+ *
+ *
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "MapOnAMatrixType", propOrder = {
+ "property",
+ "mapping"
+})
+public class MapOnAMatrixType {
+
+ protected List<Property> property;
+ protected MapListType mapping;
+ @XmlAttribute(name = "matrix", required = true)
+ protected String matrix;
+ @XmlAttribute(name = "id")
+ protected String id;
+
+ /**
+ * Gets the value of the property property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the property property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getProperty().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link Property }
+ *
+ *
+ */
+ public List<Property> getProperty() {
+ if (property == null) {
+ property = new ArrayList<Property>();
+ }
+ return this.property;
+ }
+
+ /**
+ * Gets the value of the mapping property.
+ *
+ * @return
+ * possible object is
+ * {@link MapListType }
+ *
+ */
+ public MapListType getMapping() {
+ return mapping;
+ }
+
+ /**
+ * Sets the value of the mapping property.
+ *
+ * @param value
+ * allowed object is
+ * {@link MapListType }
+ *
+ */
+ public void setMapping(MapListType value) {
+ this.mapping = value;
+ }
+
+ /**
+ * Gets the value of the matrix property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getMatrix() {
+ return matrix;
+ }
+
+ /**
+ * Sets the value of the matrix property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setMatrix(String value) {
+ this.matrix = value;
+ }
+
+ /**
+ * Gets the value of the id property.
+ *
+ * @return
+ * possible object is
+ * {@link String }
+ *
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Sets the value of the id property.
+ *
+ * @param value
+ * allowed object is
+ * {@link String }
+ *
+ */
+ public void setId(String value) {
+ this.id = value;
+ }
+
+}
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
/**
*
- * Represent the jalview.datamodel.Mapping object - it also provides
- * a way of storing sequences that are mapped 'to' without adding them
- * to the sequence set (which will mean they are then added to the alignment too).
+ * Represent the jalview.datamodel.Mapping object -
+ * it also provides
+ * a way of storing sequences that are mapped 'to'
+ * without adding them
+ * to the sequence set (which will mean they are
+ * then added to the alignment too).
*
*
* <p>Java class for anonymous complex type.
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
/**
+ * Represents matrix data imported to Jalview, and the
+ * results of any derived calculations (independent of a particular
+ * view
+ * on the matrix).
+ *
+ *
* <p>Java class for MatrixType complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
* &lt;element name="groups" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/&gt;
* &lt;element name="newick" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/&gt;
* &lt;element name="property" type="{www.vamsas.ac.uk/jalview/version2}property" maxOccurs="unbounded" minOccurs="0"/&gt;
- * &lt;element name="mapping" type="{www.vamsas.ac.uk/jalview/version2}mapListType" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;attribute name="type" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /&gt;
* &lt;attribute name="rows" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" /&gt;
* &lt;attribute name="cols" use="required" type="{http://www.w3.org/2001/XMLSchema}integer" /&gt;
* &lt;attribute name="treeMethod" type="{http://www.w3.org/2001/XMLSchema}string" /&gt;
* &lt;attribute name="cutHeight" type="{http://www.w3.org/2001/XMLSchema}double" /&gt;
- * &lt;attribute name="id" type="{http://www.w3.org/2001/XMLSchema}string" /&gt;
+ * &lt;attribute name="id" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /&gt;
* &lt;/restriction&gt;
* &lt;/complexContent&gt;
* &lt;/complexType&gt;
"elements",
"groups",
"newick",
- "property",
- "mapping"
+ "property"
})
public class MatrixType {
protected List<String> groups;
protected List<String> newick;
protected List<Property> property;
- protected MapListType mapping;
@XmlAttribute(name = "type", required = true)
protected String type;
@XmlAttribute(name = "rows", required = true)
protected String treeMethod;
@XmlAttribute(name = "cutHeight")
protected Double cutHeight;
- @XmlAttribute(name = "id")
+ @XmlAttribute(name = "id", required = true)
protected String id;
/**
}
/**
- * Gets the value of the mapping property.
- *
- * @return
- * possible object is
- * {@link MapListType }
- *
- */
- public MapListType getMapping() {
- return mapping;
- }
-
- /**
- * Sets the value of the mapping property.
- *
- * @param value
- * allowed object is
- * {@link MapListType }
- *
- */
- public void setMapping(MapListType value) {
- this.mapping = value;
- }
-
- /**
* Gets the value of the type property.
*
* @return
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
}
/**
- * Create an instance of {@link MatrixType }
+ * Create an instance of {@link MapOnAMatrixType }
*
*/
- public MatrixType createMatrixType() {
- return new MatrixType();
+ public MapOnAMatrixType createMapOnAMatrixType() {
+ return new MapOnAMatrixType();
}
/**
}
/**
+ * Create an instance of {@link MatrixType }
+ *
+ */
+ public MatrixType createMatrixType() {
+ return new MatrixType();
+ }
+
+ /**
* Create an instance of {@link VAMSAS }
*
*/
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
* &lt;/complexType&gt;
* &lt;/element&gt;
* &lt;element ref="{www.vamsas.ac.uk/jalview/version2}AlcodonFrame" maxOccurs="unbounded" minOccurs="0"/&gt;
+ * &lt;element name="Matrix" type="{www.vamsas.ac.uk/jalview/version2}MatrixType" maxOccurs="unbounded" minOccurs="0"/&gt;
* &lt;/sequence&gt;
* &lt;attribute name="gapChar" use="required" type="{http://www.w3.org/2001/XMLSchema}string" /&gt;
* &lt;attribute name="datasetId" type="{http://www.w3.org/2001/XMLSchema}string" /&gt;
"sequence",
"annotation",
"sequenceSetProperties",
- "alcodonFrame"
+ "alcodonFrame",
+ "matrix"
})
@XmlRootElement(name = "SequenceSet")
public class SequenceSet {
protected List<SequenceSet.SequenceSetProperties> sequenceSetProperties;
@XmlElement(name = "AlcodonFrame")
protected List<AlcodonFrame> alcodonFrame;
+ @XmlElement(name = "Matrix")
+ protected List<MatrixType> matrix;
@XmlAttribute(name = "gapChar", required = true)
protected String gapChar;
@XmlAttribute(name = "datasetId")
}
/**
+ * Gets the value of the matrix property.
+ *
+ * <p>
+ * This accessor method returns a reference to the live list,
+ * not a snapshot. Therefore any modification you make to the
+ * returned list will be present inside the JAXB object.
+ * This is why there is not a <CODE>set</CODE> method for the matrix property.
+ *
+ * <p>
+ * For example, to add a new item, do as follows:
+ * <pre>
+ * getMatrix().add(newItem);
+ * </pre>
+ *
+ *
+ * <p>
+ * Objects of the following type(s) are allowed in the list
+ * {@link MatrixType }
+ *
+ *
+ */
+ public List<MatrixType> getMatrix() {
+ if (matrix == null) {
+ matrix = new ArrayList<MatrixType>();
+ }
+ return this.matrix;
+ }
+
+ /**
* Gets the value of the gapChar property.
*
* @return
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
// This file was generated by the Eclipse Implementation of JAXB, v2.3.3
// See https://eclipse-ee4j.github.io/jaxb-ri
// Any modifications to this file will be lost upon recompilation of the source schema.
-// Generated on: 2023.09.08 at 03:55:49 PM BST
+// Generated on: 2023.11.01 at 07:03:09 PM GMT
//
@javax.xml.bind.annotation.XmlSchema(namespace = "www.vamsas.ac.uk/jalview/version2", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
import java.io.File;
import java.io.IOException;
+import java.lang.reflect.InvocationTargetException;
import java.nio.file.Files;
import java.util.Date;
import java.util.HashSet;
import java.util.Set;
+import javax.swing.SwingUtilities;
+
import org.testng.Assert;
import org.testng.annotations.AfterClass;
import org.testng.annotations.AfterMethod;
}
@AfterMethod(alwaysRun = true)
- public void tearDown()
+ public void tearDown()
{
- Desktop.closeDesktop();
+ try
+ {
+ // occasionally we are blocked by Jmol redraws
+ SwingUtilities.invokeAndWait(new Runnable()
+ {
+
+ @Override
+ public void run()
+ {
+ Desktop.closeDesktop();
+ }
+ });
+ } catch (Exception foo)
+ {
+ System.err.println("Failed during teardown with exception");
+ foo.printStackTrace();
+ }
+
}
public static void callJalviewMain(String[] args)
}
*/
- @Test(groups = "Functional", dataProvider = "cmdLines")
+ @Test(groups = {"Functional","testTask3"}, dataProvider = "cmdLines")
public void commandsOpenTest(String cmdLine, boolean cmdArgs,
int numFrames, String[] sequences)
{
Assert.assertEquals(cmds.argsWereParsed(), cmdArgs,
"Overall command parse and operation is false");
- Assert.assertEquals(Desktop.getAlignFrames().length, numFrames,
+ Assert.assertEquals(Desktop.getDesktopAlignFrames().length, numFrames,
"Wrong number of AlignFrames");
if (sequences != null)
{
Set<String> openedSequenceNames = new HashSet<>();
- AlignFrame[] afs = Desktop.getAlignFrames();
+ AlignFrame[] afs = Desktop.getDesktopAlignFrames();
for (AlignFrame af : afs)
{
openedSequenceNames.addAll(
@Test(
groups =
- { "Functional", "testTask1" },
+ { "Functional", "testTask3" },
dataProvider = "structureImageOutputFiles")
public void structureImageOutputTest(String cmdLine, String[] filenames)
throws IOException
+ "--open=./examples/test_fab41.result/sample.a2m "
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
+ "--structureimage=" + testfiles
- + "/structureimage2.png --structureimagescale=1.5"
+ + "/structureimage2.png --scale=1.5 "
+ "--open=./examples/test_fab41.result/sample.a2m "
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
+ "--structureimage=" + testfiles
- + "/structureimage3.png --structureimagescale=2.0",
+ + "/structureimage3.png --scale=2.0 ",
new String[]
{ testfiles + "/structureimage1.png",
testfiles + "/structureimage2.png",
+ "--open=./examples/test_fab41.result/sample.a2m "
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
+ "--structureimage=" + testfiles
- + "/structureimage2.png --structureimagescale=1.5"
+ + "/structureimage2.png --scale=1.5 "
+ "--open=./examples/test_fab41.result/sample.a2m "
+ "--structure=./examples/test_fab41.result/test_fab41_unrelaxed_rank_1_model_3.pdb "
+ "--structureimage=" + testfiles
- + "/structureimage3.png --structureimagescale=2.0",
+ + "/structureimage3.png --scale=2.0 ",
new String[]
{ testfiles + "/structureimage1.png",
testfiles + "/structureimage2.png",
public static boolean lookForSequenceName(String sequenceName)
{
- AlignFrame[] afs = Desktop.getAlignFrames();
+ AlignFrame[] afs = Desktop.getDesktopAlignFrames();
for (AlignFrame af : afs)
{
for (String name : af.getViewport().getAlignment().getSequenceNames())
}
}
+ private final String deleteDir = "test/deleteAfter";
+
@Test(
groups = "Functional",
dataProvider = "allLinkedIdsData",
"File " + nonfilename + " exists when it shouldn't!");
}
}
+
+ File deleteDirF = new File(deleteDir);
+ if (deleteDirF.exists())
+ {
+ deleteDirF.delete();
+ }
}
@DataProvider(name = "allLinkedIdsData")
{
return new Object[][] {
//
- /*
- */
{ "--gui --open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --output={dirname}/{basename}.stk --close",
new String[]
{ "test/jalview/bin/argparser/testfiles/test1.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", },
null },
- { "--gui --open=test/jalview/bin/argparser/**/*.fa --output=*.stk --close",
+ { "--gui --open=test/jalview/bin/argparser/**/*.fa --output=*/*.stk --close",
new String[]
{ "test/jalview/bin/argparser/testfiles/test1.stk",
"test/jalview/bin/argparser/testfiles/test2.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", },
null },
- { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=*.stk --close",
+ { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --all --output=*/*.stk --close",
new String[]
{ "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
"test/jalview/bin/argparser/testfiles/dir1/test2.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
- { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=open*.stk --close",
+ { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=*/*.stk --close",
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test3.stk", },
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.stk",
+ "test/jalview/bin/argparser/testfiles/test2.stk",
+ "test/jalview/bin/argparser/testfiles/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
+ { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output={dirname}/{basename}.stk --close",
new String[]
{ "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
"test/jalview/bin/argparser/testfiles/dir2/test2.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
- { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --opened --output={dirname}/{basename}.stk --close",
+ { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output={dirname}/{basename}.stk --close",
new String[]
{ "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
"test/jalview/bin/argparser/testfiles/dir2/test2.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk", }, },
- { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --output open*.stk --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output=open*.aln --close",
+ { "--gui --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --output {dirname}/{basename}.stk --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output={dirname}/{basename}.aln --close",
new String[]
{ "test/jalview/bin/argparser/testfiles/dir1/test1.stk",
"test/jalview/bin/argparser/testfiles/dir1/test2.stk",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test1.aln",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test2.aln",
"test/jalview/bin/argparser/testfiles/dir3/subdir/test3.aln", }, },
+ // --mkdirs
+ { "--headless --open=test/jalview/bin/argparser/testfiles/dir1/*.fa --output "
+ + deleteDir
+ + "/{dirname}/{basename}.stk --open=test/jalview/bin/argparser/testfiles/dir2/*.fa --output="
+ + deleteDir
+ + "/{dirname}/{basename}.aln --close --all --mkdirs",
+ new String[]
+ { deleteDir
+ + "/test/jalview/bin/argparser/testfiles/dir1/test1.stk",
+ deleteDir
+ + "/test/jalview/bin/argparser/testfiles/dir1/test2.stk",
+ deleteDir
+ + "/test/jalview/bin/argparser/testfiles/dir2/test1.aln",
+ deleteDir
+ + "/test/jalview/bin/argparser/testfiles/dir2/test2.aln",
+ deleteDir
+ + "/test/jalview/bin/argparser/testfiles/dir2/test3.aln", },
+ new String[]
+ { "test/jalview/bin/argparser/testfiles/test1.stk",
+ "test/jalview/bin/argparser/testfiles/test2.stk",
+ "test/jalview/bin/argparser/testfiles/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk",
+ "test/jalview/bin/argparser/testfiles/test1.aln",
+ "test/jalview/bin/argparser/testfiles/test2.aln",
+ "test/jalview/bin/argparser/testfiles/test3.aln",
+ "test/jalview/bin/argparser/testfiles/dir1/test1.aln",
+ "test/jalview/bin/argparser/testfiles/dir1/test2.aln",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.aln",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.aln",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.aln",
+ "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.aln",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/test1.stk",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/test2.stk",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/test3.stk",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir2/test1.stk",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir2/test2.stk",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir2/test3.stk",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.stk",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.stk",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.stk",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.stk",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/test1.aln",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/test2.aln",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/test3.aln",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir1/test1.aln",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir1/test2.aln",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir3/subdir/test0.aln",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir3/subdir/test1.aln",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir3/subdir/test2.aln",
+ deleteDir
+ + "test/jalview/bin/argparser/testfiles/dir3/subdir/test3.aln", }, },
//
};
}
String[] args = cmdLine.split("\\s+");
CommandsTest.callJalviewMain(args);
- while (Desktop.instance!=null && Desktop.instance.operationsAreInProgress())
+ while (Desktop.instance != null
+ && Desktop.instance.operationsAreInProgress())
{
try
{
}
;
- AlignFrame[] afs = Desktop.getAlignFrames();
+ AlignFrame[] afs = Desktop.getDesktopAlignFrames();
Assert.assertNotNull(afs);
Assert.assertTrue(afs.length > 0);
Cache.loadProperties("test/jalview/bin/hidpiTestProps.jvprops");
Jalview.main(
new String[]
- { "-nosplash", "-nonews", "-noquestionnaire",
- "-nowebservicediscovery" });
+ { "--nosplash", "--nonews", "--noquestionnaire",
+ "--nowebservicediscovery" });
af = new FileLoader().LoadFileWaitTillLoaded("examples/uniref50.fa",
DataSourceType.FILE);
String jvmArgs = HiDPISetting.getScalePropertyArg(scale);
- String appArgs = " -open examples/uniref50.fa -nosplash -nonews -noquestionnaire -nousagestats -nowebservicediscovery";
+ String appArgs = " --open examples/uniref50.fa --nosplash --nonews --noquestionnaire --nousagestats --nowebservicediscovery";
Worker worker = getJalviewDesktopRunner(jvmArgs, appArgs);
assertNotNull(worker, "worker is null");
{
while ((ln = worker.getErrorReader().readLine()) != null)
{
- if (++count > 100)
+ if (++count > 150)
{
break;
}
}
@Test(groups = "Functional", dataProvider = "allLinkedIdsData")
- public void allLinkedIdsTest(String commandLineArgs, Arg a,
+ public void allLinkedIdsTest(String pwd, String commandLineArgs, Arg a,
String[] values, String[] nonvalues)
{
+ String userDir = System.getProperty("user.dir");
+ if (pwd != null)
+ {
+ File pwdFile = new File(pwd);
+ System.setProperty("user.dir", pwdFile.getAbsolutePath());
+ }
String[] args = commandLineArgs.split("\\s+");
ArgParser argparser = new ArgParser(args);
ArgValues avs = avm.getArgValues(a);
ArgValue av = avs.getArgValue();
String v = av.getValue();
- value = new File(value).getAbsolutePath();
+ value = new File(value).getPath();
Assert.assertEquals(v, value, "Arg value for " + a.argString()
+ " not applied correctly to linkedId '" + linkedId + "'");
}
}
+ System.setProperty("user.dir", userDir);
}
@DataProvider(name = "allLinkedIdsData")
//
/*
*/
- { "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close",
+ { null,
+ "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close",
Arg.CLOSE, new String[]
{ null, null, null },
null },
- { "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --output={dirname}/{basename}.stk --close",
+ { null,
+ "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --output={dirname}/{basename}.stk --close",
Arg.OUTPUT, new String[]
{ "test/jalview/bin/argparser/testfiles/test1.stk",
"test/jalview/bin/argparser/testfiles/test2.stk",
"test/jalview/bin/argparser/testfiles/test3.stk", },
null },
- { "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close",
+ { null,
+ "--open=test/jalview/bin/argparser/testfiles/*.fa --substitutions --all --image={dirname}/{basename}.png --close",
Arg.IMAGE, new String[]
{ "test/jalview/bin/argparser/testfiles/test1.png",
"test/jalview/bin/argparser/testfiles/test2.png",
"test/jalview/bin/argparser/testfiles/test3.png", },
null },
+ /*
+ * Find a way to change pwd reliably -- need to match "*.fa" against some files!
+ { "test/jalview/bin/argparser/testfiles",
+
+ "--open=*.fa --image={dirname}/{basename}.png --close",
+ Arg.IMAGE, new String[]
+ { "./test1.png", "./test2.png", "./test3.png", }, null },
+ */
//
};
}
};
}
-}
+}
\ No newline at end of file
---substitutions
--append=examples/test_fab41.result/sample.a2m
--showannotations
--showssannotations
--colour=gecos-flower
---structure=[viewer=jmol,tempfac=plddt,paematrix={dirname}/test_fab41_unrelaxed_rank_1_model_3_scores.json]{dirname}/test_fab41_unrelaxed_rank_1_model_3.pdb
+--structure=[structureviewer=jmol,tempfac=plddt,paematrix={dirname}/test_fab41_unrelaxed_rank_1_model_3_scores.json]{dirname}/test_fab41_unrelaxed_rank_1_model_3.pdb
--structure={dirname}/test_fab41_unrelaxed_rank_2_model_4.pdb
--structureviewer=jmol
--paematrix={dirname}/test_fab41_unrelaxed_rank_2_model_4_scores.json
--structureviewer=jmol
--paematrix={dirname}/test_fab41_unrelaxed_rank_3_model_2_scores.json
--tempfac=plddt
---structure=[viewer=none]{dirname}/test_fab41_unrelaxed_rank_4_model_5.pdb
+--structure=[structureviewer=none]{dirname}/test_fab41_unrelaxed_rank_4_model_5.pdb
--paematrix={dirname}/test_fab41_unrelaxed_rank_4_model_5_scores.json
--tempfac=plddt
--structure={dirname}/test_fab41_unrelaxed_rank_5_model_1.pdb
AlignmentI alForSeq = new Alignment(new SequenceI[] { alseq });
newaa = AlignmentUtils.addReferenceAnnotationTo(alForSeq, alseq, newaa,
null);
- ContactListI alcl = alForSeq.getContactListFor(newaa, 1);
+ // check for null on out of bounds
+ ContactListI alcl = alForSeq.getContactListFor(newaa, newaa.annotations.length);
+ assertNull(alcl,"Should've gotten null!");
+ // now check for mapping
+ alcl = alForSeq.getContactListFor(newaa, 1);
assertNotNull(alcl);
mappedCl = alcl.getMappedPositionsFor(0, 4);
assertNotNull(mappedCl);
assertFalse(m.contains(null, 3, 3));
}
+ @Test(groups = { "Functional" })
+ public void testMatchAdjacent()
+ {
+ SequenceI seq1 = new Sequence("", "abcdefghijklm");
+ SequenceI seq2 = new Sequence("", "abcdefghijklm");
+ SearchResultMatchI m = new SearchResults().new Match(seq1, 2, 5);
+
+ assertTrue(m.adjacent(seq1, 2, 5));
+ assertTrue(m.adjacent(seq1, 3, 5));
+ assertTrue(m.adjacent(seq1, 2, 4));
+ assertTrue(m.adjacent(seq1, 3, 3));
+
+ assertTrue(m.adjacent(seq1, 2, 6));
+ assertTrue(m.adjacent(seq1, 1, 5));
+ assertTrue(m.adjacent(seq1, 1, 8));
+ assertFalse(m.adjacent(seq1, 0, 0));
+ assertFalse(m.adjacent(seq1, 7, 8));
+ assertTrue(m.adjacent(seq1, 6, 8));
+ assertTrue(m.adjacent(seq1, 5, 8));
+ assertTrue(m.adjacent(seq1, 0, 1));
+
+
+ assertFalse(m.adjacent(seq2, 3, 3));
+ assertFalse(m.adjacent(null, 3, 3));
+ }
+
/**
* test markColumns for creating column selections
*/
}
/**
+ * Test to verify appending creates a minimal set of results
+ */
+ @Test(groups = { "Functional" })
+ public void testAppendResult()
+ {
+ SequenceI seq1 = new Sequence("", "abcdefghijklm"),seq2=new Sequence("","defdefdefdef");
+ SearchResultsI sr = new SearchResults();
+ sr.appendResult(seq1, 3, 5);
+ assertEquals(1, sr.getCount());
+ sr.appendResult(seq1, 3, 6);
+ assertEquals(1, sr.getCount());
+ sr.appendResult(seq1, 8, 8);
+ assertEquals(2, sr.getCount());
+ sr.appendResult(seq1, 7, 7);
+ assertEquals(1, sr.getCount());
+ sr.appendResult(seq2, 7, 7);
+ assertEquals(2, sr.getCount());
+ sr.appendResult(seq2, 2, 7);
+ assertTrue(sr.appendResult(seq2, 7, 49));
+ assertTrue(sr.appendResult(seq2, 0, 30));
+ assertEquals(2, sr.getCount());
+ int c=0;
+ for (SearchResultMatchI sre: sr.getResults())
+ {
+ c++;
+ }
+ assertEquals(c,2);
+
+ }
+ /**
* Test for method that checks if search results matches a sequence region
*/
@Test(groups = { "Functional" })
{
Jalview.main(
new String[]
- { "-noquestionnaire", "-nonews", "-props",
+ { "--noquestionnaire", "--nonews", "--props",
"test/jalview/ext/rbvi/chimera/testProps.jvprops" });
}
{
Jalview.main(
new String[]
- { "-noquestionnaire", "-nonews", "-props",
+ { "--noquestionnaire", "--nonews", "--props",
"test/jalview/ext/rbvi/chimera/testProps.jvprops" });
Cache.setProperty(Preferences.STRUCTURE_DISPLAY,
ViewerType.CHIMERA.name());
+ " \"resolution\":2.2,\n"
+ " \"title\":\"Crystal structure of the complex between maize sulfite reductase and ferredoxin in the form-2 crystal\"}]\n"
+ " }}" });
+ mocks.add(new String[] {
+ "https://www.ebi.ac.uk/pdbe/search/pdb/select?wt=json&fl=pdb_id,title,experimental_method,resolution&rows=500&start=0&q=(4gs9+OR+6bvb+OR+8ck8+OR+8ck3+OR+6x3d+OR+8ck4+OR+6x28+OR+6i7r+OR+3h82+OR+6i7q+OR+6x21+OR+4xt2+OR+5kiz+OR+7q5v+OR+6x2h+OR+7q5x+OR+3f1n+OR+3f1o+OR+2a24+OR+3f1p+OR+1p97+OR+4ghi+OR+3h7w+OR+6d09+OR+6czw+OR+7ujv+OR+5tbm+OR+5ufp+OR+4pky+OR+6d0b+OR+6d0c+OR+6x37)+AND+molecule_sequence:%5B''+TO+*%5D+AND+status:REL&sort="
+ ,
+ readJsonStringFromFile(
+ "test/jalview/fts/threedbeacons/q99814_tdb_pdbfts_query_resp.txt")});
} catch (Throwable e)
{
Assert.fail("Couldn't read mock data.", e);
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jalview.datamodel.Sequence;
+import jalview.fts.api.FTSData;
import jalview.fts.api.FTSDataColumnI;
import jalview.fts.api.FTSDataColumnI.FTSDataColumnGroupI;
import jalview.fts.core.FTSRestClient;
import jalview.fts.core.FTSRestRequest;
import jalview.fts.core.FTSRestResponse;
import jalview.fts.service.pdb.PDBFTSRestClientTest;
+import jalview.fts.service.threedbeacons.TDB_FTSData;
import jalview.fts.service.threedbeacons.TDBeaconsFTSRestClient;
import jalview.gui.JvOptionPane;
+import jalview.gui.structurechooser.PDBStructureChooserQuerySource;
+import jalview.gui.structurechooser.TDBResultAnalyser;
+import jalview.gui.structurechooser.ThreeDBStructureChooserQuerySource;
public class TDBeaconsFTSRestClientTest
{
private static String[][] mocks = { { "P38398.json", null },
{ "P01308.json", null },
{ "P0DTD1.json", null },
- { "P27787.json", null }
+ { "P27787.json", null },
+ { "Q99814.json", null }
// , { "P0DTD3.json", "{}" } actually results in 404, but {} is in body
};
mocks[3][1] = PDBFTSRestClientTest.readJsonStringFromFile(
"test/jalview/fts/threedbeacons/p27787_tdb_fts_query_resp.txt");
+ mocks[4][1] = PDBFTSRestClientTest.readJsonStringFromFile(
+ "test/jalview/fts/threedbeacons/q99814_tdb_fts_query_resp.txt");
} catch (IOException e)
{
System.out.println("Search summary : \n" + response.getSearchSummary());
// System.out.println(response.getSearchSummary().size());
}
+
}
--- /dev/null
+https://www.ebi.ac.uk/pdbe/pdbe-kb/3dbeacons/api/uniprot/summary/Q99814.json
--- /dev/null
+{"uniprot_entry":{"ac":"Q99814","id":"EPAS1_HUMAN","uniprot_checksum":"4838989598234FC1","sequence_length":870,"segment_start":8,"segment_end":359},"structures":[{"summary":{"model_identifier":"3f1p","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/3f1p_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/3f1p","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2008-10-28","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.17,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]}]}},{"summary":{"model_identifier":"7q5v","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/7q5v_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/7q5v","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2021-11-04","sequence_identity":100.0,"uniprot_start":523,"uniprot_end":542,"coverage":0.023,"experimental_method":"X-RAY DIFFRACTION","resolution":1.17,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q9GZT9","identifier_category":"UNIPROT","description":"Egl nine homolog 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"GOL","identifier_category":"CCD","description":"GLYCEROL","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"FMT","identifier_category":"CCD","description":"FORMIC ACID","chain_ids":["A","B"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"CL","identifier_category":"CCD","description":"CHLORIDE ION","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"MG","identifier_category":"CCD","description":"MAGNESIUM ION","chain_ids":["A","B"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"OGA","identifier_category":"CCD","description":"N-OXALYLGLYCINE","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"MN","identifier_category":"CCD","description":"MANGANESE (II) ION","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"PEG","identifier_category":"CCD","description":"DI(HYDROXYETHYL)ETHER","chain_ids":["A"]}]}},{"summary":{"model_identifier":"7q5x","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/7q5x_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/7q5x","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2021-11-04","sequence_identity":100.0,"uniprot_start":523,"uniprot_end":542,"coverage":0.023,"experimental_method":"X-RAY DIFFRACTION","resolution":1.21,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q9GZT9","identifier_category":"UNIPROT","description":"Egl nine homolog 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"GOL","identifier_category":"CCD","description":"GLYCEROL","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"FMT","identifier_category":"CCD","description":"FORMIC ACID","chain_ids":["A","B"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"CL","identifier_category":"CCD","description":"CHLORIDE ION","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"MG","identifier_category":"CCD","description":"MAGNESIUM ION","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"AKG","identifier_category":"CCD","description":"2-OXOGLUTARIC ACID","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"MN","identifier_category":"CCD","description":"MANGANESE (II) ION","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"PEG","identifier_category":"CCD","description":"DI(HYDROXYETHYL)ETHER","chain_ids":["A"]}]}},{"summary":{"model_identifier":"3f1n","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/3f1n_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/3f1n","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2008-10-28","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.479,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"EDO","identifier_category":"CCD","description":"1,2-ETHANEDIOL","chain_ids":["A"]}]}},{"summary":{"model_identifier":"4ghi","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/4ghi_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/4ghi","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2012-08-07","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.5,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"0X3","identifier_category":"CCD","description":"N-(3-chloro-5-fluorophenyl)-4-nitro-2,1,3-benzoxadiazol-5-amine","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6d0c","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6d0c_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6d0c","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2018-04-10","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.5,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]}]}},{"summary":{"model_identifier":"3h82","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/3h82_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/3h82","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2009-04-28","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.5,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"020","identifier_category":"CCD","description":"N-(furan-2-ylmethyl)-2-nitro-4-(trifluoromethyl)aniline","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6x21","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6x21_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6x21","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2020-05-19","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":348,"coverage":0.126,"experimental_method":"X-RAY DIFFRACTION","resolution":1.54,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"UKJ","identifier_category":"CCD","description":"1-(3-bromo-5-fluorophenoxy)-4-[(difluoromethyl)sulfonyl]-2-nitrobenzene","chain_ids":["A"]}]}},{"summary":{"model_identifier":"3f1o","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/3f1o_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/3f1o","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2008-10-28","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.598,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"EDO","identifier_category":"CCD","description":"1,2-ETHANEDIOL","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"2XY","identifier_category":"CCD","description":"N-[2-nitro-4-(trifluoromethyl)phenyl]morpholin-4-amine","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6czw","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6czw_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6czw","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2018-04-09","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.6,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"FO7","identifier_category":"CCD","description":"{2-bromo-3-(3-chloro-5-fluorophenoxy)-6-[(difluoromethyl)sulfonyl]phenyl}methanol","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6d0b","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6d0b_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6d0b","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2018-04-10","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.6,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"FOV","identifier_category":"CCD","description":"N-(3-chloro-5-fluorophenyl)-2-nitro-4-[(trifluoromethyl)sulfonyl]aniline","chain_ids":["A"]}]}},{"summary":{"model_identifier":"3h7w","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/3h7w_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/3h7w","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2009-04-28","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.65,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"018","identifier_category":"CCD","description":"2-nitro-N-(thiophen-3-ylmethyl)-4-(trifluoromethyl)aniline","chain_ids":["A"]}]}},{"summary":{"model_identifier":"4xt2","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/4xt2_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/4xt2","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2015-01-22","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.698,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["D","B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A","C"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"43L","identifier_category":"CCD","description":"(5S,7R)-5,7-bis(3-bromophenyl)-4,5,6,7-tetrahydrotetrazolo[1,5-a]pyrimidine","chain_ids":["A","C"]}]}},{"summary":{"model_identifier":"8ck3","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/8ck3_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/8ck3","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2023-02-14","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.707,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"DMS","identifier_category":"CCD","description":"DIMETHYL SULFOXIDE","chain_ids":["B"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"UXU","identifier_category":"CCD","description":"(4~{S})-1-[3,5-bis(fluoranyl)phenyl]-5,5-bis(fluoranyl)-3-methylsulfonyl-4,6-dihydrocyclopenta[c]thiophen-4-ol","chain_ids":["A"]}]}},{"summary":{"model_identifier":"4gs9","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/4gs9_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/4gs9","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2012-08-27","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.72,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"PE8","identifier_category":"CCD","description":"3,6,9,12,15,18,21-HEPTAOXATRICOSANE-1,23-DIOL","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"0XB","identifier_category":"CCD","description":"N-(3-fluorophenyl)-4-nitro-2,1,3-benzoxadiazol-5-amine","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6i7q","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6i7q_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6i7q","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2018-11-17","sequence_identity":95.0,"uniprot_start":523,"uniprot_end":542,"coverage":0.023,"experimental_method":"X-RAY DIFFRACTION","resolution":1.798,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P40337","identifier_category":"UNIPROT","description":"von Hippel-Lindau disease tumor suppressor","chain_ids":["V"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q15370","identifier_category":"UNIPROT","description":"Elongin-B","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q2KII4","identifier_category":"UNIPROT","description":"Elongin-C","chain_ids":["C"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["H"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"GOL","identifier_category":"CCD","description":"GLYCEROL","chain_ids":["V"]}]}},{"summary":{"model_identifier":"7ujv","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/7ujv_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/7ujv","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2022-03-31","sequence_identity":100.0,"uniprot_start":523,"uniprot_end":542,"coverage":0.023,"experimental_method":"X-RAY DIFFRACTION","resolution":1.8,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q9GZT9","identifier_category":"UNIPROT","description":"Egl nine homolog 1","chain_ids":["B"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"GOL","identifier_category":"CCD","description":"GLYCEROL","chain_ids":["B"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"FE","identifier_category":"CCD","description":"FE (III) ION","chain_ids":["B"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"OGA","identifier_category":"CCD","description":"N-OXALYLGLYCINE","chain_ids":["B"]}]}},{"summary":{"model_identifier":"6d09","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6d09_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6d09","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2018-04-10","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.85,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"FOJ","identifier_category":"CCD","description":"3-{[(3R)-4-(difluoromethyl)-2,2-difluoro-3-hydroxy-1,1-dioxo-2,3-dihydro-1H-1-benzothiophen-5-yl]oxy}-5-fluorobenzonitrile","chain_ids":["A"]}]}},{"summary":{"model_identifier":"5tbm","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/5tbm_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/5tbm","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2016-09-12","sequence_identity":97.0,"uniprot_start":237,"uniprot_end":348,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":1.85,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"79A","identifier_category":"CCD","description":"3-{[(1S)-2,2-difluoro-1-hydroxy-7-(methylsulfonyl)-2,3-dihydro-1H-inden-4-yl]oxy}-5-fluorobenzonitrile","chain_ids":["A"]}]}},{"summary":{"model_identifier":"5ufp","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/5ufp_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/5ufp","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2017-01-05","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":348,"coverage":0.126,"experimental_method":"X-RAY DIFFRACTION","resolution":1.9,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"86D","identifier_category":"CCD","description":"3-({(1S)-7-[(difluoromethyl)sulfonyl]-2,2-difluoro-1-hydroxy-2,3-dihydro-1H-inden-4-yl}oxy)-5-fluorobenzonitrile","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6x28","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6x28_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6x28","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2020-05-20","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":348,"coverage":0.126,"experimental_method":"X-RAY DIFFRACTION","resolution":1.92,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"ULG","identifier_category":"CCD","description":"(1R)-4-(3,5-difluorophenoxy)-7-(trifluoromethyl)-2,3-dihydro-1H-inden-1-ol","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6x37","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6x37_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6x37","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2020-05-21","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":348,"coverage":0.126,"experimental_method":"X-RAY DIFFRACTION","resolution":1.94,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"ULS","identifier_category":"CCD","description":"3-fluoro-5-{[(7R)-7-hydroxy-1-(trifluoromethyl)-6,7-dihydro-5H-cyclopenta[c]pyridin-4-yl]oxy}benzonitrile","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6i7r","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6i7r_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6i7r","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2018-11-17","sequence_identity":95.0,"uniprot_start":523,"uniprot_end":542,"coverage":0.023,"experimental_method":"X-RAY DIFFRACTION","resolution":1.949,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P40337","identifier_category":"UNIPROT","description":"von Hippel-Lindau disease tumor suppressor","chain_ids":["V"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q15369","identifier_category":"UNIPROT","description":"Elongin-C","chain_ids":["C"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q15370","identifier_category":"UNIPROT","description":"Elongin-B","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["H"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"FMT","identifier_category":"CCD","description":"FORMIC ACID","chain_ids":["V"]}]}},{"summary":{"model_identifier":"6x2h","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6x2h_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6x2h","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2020-05-20","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":348,"coverage":0.126,"experimental_method":"X-RAY DIFFRACTION","resolution":2.0,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"ULD","identifier_category":"CCD","description":"cis-3-({(1S)-7-[dihydroxy(trifluoromethyl)-lambda~4~-sulfanyl]-2,2-difluoro-1-hydroxy-2,3-dihydro-1H-inden-4-yl}oxy)cyclobutane-1-carbonitrile","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6x3d","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6x3d_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6x3d","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2020-05-21","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":348,"coverage":0.126,"experimental_method":"X-RAY DIFFRACTION","resolution":2.0,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"ULM","identifier_category":"CCD","description":"(6R,7S)-4-[(3,3-difluorocyclobutyl)oxy]-6-fluoro-1-(trifluoromethyl)-6,7-dihydro-5H-cyclopenta[c]pyridin-7-ol","chain_ids":["A"]}]}},{"summary":{"model_identifier":"6bvb","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/6bvb_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/6bvb","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2017-12-12","sequence_identity":100.0,"uniprot_start":523,"uniprot_end":540,"coverage":0.021,"experimental_method":"X-RAY DIFFRACTION","resolution":2.002,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P40337","identifier_category":"UNIPROT","description":"von Hippel-Lindau disease tumor suppressor","chain_ids":["V"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q15369","identifier_category":"UNIPROT","description":"Elongin-C","chain_ids":["C"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q15370","identifier_category":"UNIPROT","description":"Elongin-B","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Hypoxia-Inducible Factor 2 alpha","chain_ids":["H"]}]}},{"summary":{"model_identifier":"8ck4","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/8ck4_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/8ck4","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2023-02-14","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":2.29,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"UY3","identifier_category":"CCD","description":"(4~{S})-1-[3,5-bis(fluoranyl)phenyl]-5,5-bis(fluoranyl)-3-methylsulfonyl-6,7-dihydro-4~{H}-2-benzothiophen-4-ol","chain_ids":["A"]}]}},{"summary":{"model_identifier":"8ck8","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/8ck8_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/8ck8","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2023-02-14","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":2.302,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"UYF","identifier_category":"CCD","description":"(4~{S})-1-cyclohexyloxy-5,5-bis(fluoranyl)-3-methylsulfonyl-4,6-dihydrocyclopenta[c]thiophen-4-ol","chain_ids":["A"]}]}},{"summary":{"model_identifier":"4pky","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/4pky_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/4pky","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2014-05-15","sequence_identity":97.0,"uniprot_start":239,"uniprot_end":350,"coverage":0.129,"experimental_method":"X-RAY DIFFRACTION","resolution":3.2,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["A","D"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["G"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q9JJ11","identifier_category":"UNIPROT","description":"Transforming acidic coiled-coil-containing protein 3","chain_ids":["E","F","C","B"]},{"entity_type":"NON-POLYMER","entity_poly_type":null,"identifier":"SO4","identifier_category":"CCD","description":"SULFATE ION","chain_ids":["B"]}]}},{"summary":{"model_identifier":"1p97","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/1p97_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/1p97","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2003-05-09","sequence_identity":100.0,"uniprot_start":240,"uniprot_end":350,"coverage":0.128,"experimental_method":"SOLUTION NMR","resolution":null,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain protein 1","chain_ids":["A"]}]}},{"summary":{"model_identifier":"5kiz","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/5kiz_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/5kiz","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2016-06-17","sequence_identity":94.0,"uniprot_start":239,"uniprot_end":349,"coverage":0.128,"experimental_method":"SOLUTION NMR","resolution":null,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]}]}},{"summary":{"model_identifier":"2a24","model_category":"EXPERIMENTALLY DETERMINED","model_url":"https://www.ebi.ac.uk/pdbe/static/entry/2a24_updated.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://www.ebi.ac.uk/pdbe/entry/pdb/2a24","provider":"PDBe","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2005-06-21","sequence_identity":100.0,"uniprot_start":242,"uniprot_end":348,"coverage":0.123,"experimental_method":"SOLUTION NMR","resolution":null,"confidence_type":null,"confidence_version":null,"confidence_avg_local_score":null,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"P27540","identifier_category":"UNIPROT","description":"Aryl hydrocarbon receptor nuclear translocator","chain_ids":["B"]},{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain protein 1","chain_ids":["A"]}]}},{"summary":{"model_identifier":"Q99814_8-359:4zpk.1.B","model_category":"TEMPLATE-BASED","model_url":"https://swissmodel.expasy.org/3d-beacons/uniprot/Q99814.pdb?range=8-359&template=4zpk.1.B&provider=swissmodel","model_format":"PDB","model_type":"ATOMIC","model_page_url":"https://swissmodel.expasy.org/repository/uniprot/Q99814?range=8-359&template=4zpk.1.B","provider":"SWISS-MODEL","created":"2023-10-21","sequence_identity":1.0,"uniprot_start":8,"uniprot_end":359,"coverage":0.405,"confidence_type":"QMEANDisCo","confidence_version":"4.3.1","confidence_avg_local_score":0.676,"oligomeric_state":"MONOMER","entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"model based on template 4zpk.1.B: Endothelial PAS domain-containing protein 1","chain_ids":["B"]}]}},{"summary":{"model_identifier":"Q99814_26-342:7w80.1.A","model_category":"TEMPLATE-BASED","model_url":"https://swissmodel.expasy.org/3d-beacons/uniprot/Q99814.pdb?range=26-342&template=7w80.1.A&provider=swissmodel","model_format":"PDB","model_type":"ATOMIC","model_page_url":"https://swissmodel.expasy.org/repository/uniprot/Q99814?range=26-342&template=7w80.1.A","provider":"SWISS-MODEL","created":"2023-10-21","sequence_identity":1.0,"uniprot_start":26,"uniprot_end":342,"coverage":0.364,"confidence_type":"QMEANDisCo","confidence_version":"4.3.1","confidence_avg_local_score":0.586,"oligomeric_state":"MONOMER","entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"model based on template 7w80.1.A: Aryl hydrocarbon receptor nuclear translocator","chain_ids":["A"]}]}},{"summary":{"model_identifier":"AF-Q99814-F1","model_category":"AB-INITIO","model_url":"https://alphafold.ebi.ac.uk/files/AF-Q99814-F1-model_v4.cif","model_format":"MMCIF","model_type":null,"model_page_url":"https://alphafold.ebi.ac.uk/entry/Q99814","provider":"AlphaFold DB","number_of_conformers":null,"ensemble_sample_url":null,"ensemble_sample_format":null,"created":"2022-06-01","sequence_identity":1.0,"uniprot_start":1,"uniprot_end":870,"coverage":1.0,"experimental_method":null,"resolution":null,"confidence_type":"pLDDT","confidence_version":null,"confidence_avg_local_score":58.6,"oligomeric_state":null,"preferred_assembly_id":null,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]}]}},{"summary":{"model_identifier":"Q99814","model_category":"TEMPLATE-BASED","model_url":"https://alphafill.eu/v1/aff/Q99814","model_format":"MMCIF","model_page_url":"https://alphafill.eu/model?id=Q99814","provider":"AlphaFill","created":"2022-05-07","sequence_identity":1.0,"uniprot_start":1,"uniprot_end":870,"coverage":1.0,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]},{"entity_type":"NON-POLYMER","description":"PROFLAVIN","chain_ids":["B","C"]},{"entity_type":"NON-POLYMER","description":"ERBIUM (III) ION","chain_ids":["D","E","F","G","H","I","J","K"]}]}},{"summary":{"model_identifier":"CHS.29392.1","model_category":"AB-INITIO","model_url":"https://storage.googleapis.com/isoform.io/pdb/CHS.29392.1.pdb","model_format":"PDB","provider":"isoform.io","created":"2022-06-05","sequence_identity":1.0,"uniprot_start":1,"uniprot_end":870,"coverage":1.0,"entities":[{"entity_type":"POLYMER","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A"]}]}},{"summary":{"model_identifier":"Q99814_V1_5","model_category":"AB-INITIO","model_url":"https://shmoo.weizmann.ac.il/elevy/HomAtlas/Q99814_V1_5.pdb","model_format":"PDB","model_type":"ATOMIC","provider":"levylab","created":"2023-09-14","sequence_identity":1.0,"uniprot_start":1,"uniprot_end":870,"coverage":1.0,"confidence_type":"pLDDT","confidence_version":"AlphaFold2","confidence_avg_local_score":50.9166,"oligomeric_state":"HOMODIMER","oligomeric_state_confidence":0.6276,"entities":[{"entity_type":"POLYMER","entity_poly_type":"POLYPEPTIDE(L)","identifier":"Q99814","identifier_category":"UNIPROT","description":"Endothelial PAS domain-containing protein 1","chain_ids":["A","B"]}]}}]}
\ No newline at end of file
--- /dev/null
+{
+ "responseHeader":{
+ "status":0,
+ "QTime":0,
+ "params":{
+ "q":"(4gs9 OR 6bvb OR 8ck8 OR 8ck3 OR 6x3d OR 8ck4 OR 6x28 OR 6i7r OR 3h82 OR 6i7q OR 6x21 OR 4xt2 OR 5kiz OR 7q5v OR 6x2h OR 7q5x OR 3f1n OR 3f1o OR 2a24 OR 3f1p OR 1p97 OR 4ghi OR 3h7w OR 6d09 OR 6czw OR 7ujv OR 5tbm OR 5ufp OR 4pky OR 6d0b OR 6d0c OR 6x37) AND molecule_sequence:['' TO *] AND status:REL",
+ "fl":"pdb_id,title,experimental_method,resolution",
+ "start":"0",
+ "sort":"",
+ "rows":"500",
+ "wt":"json"}},
+ "response":{"numFound":69,"start":0,"docs":[
+ {
+ "experimental_method":["Solution NMR"],
+ "pdb_id":"1p97",
+ "title":"NMR structure of the C-terminal PAS domain of HIF2a"},
+ {
+ "experimental_method":["Solution NMR"],
+ "pdb_id":"5kiz",
+ "title":"Solution Structure of a repacked version of HIF-2 alpha PAS-B"},
+ {
+ "experimental_method":["Solution NMR"],
+ "pdb_id":"2a24",
+ "title":"HADDOCK Structure of HIF-2a/ARNT PAS-B Heterodimer"},
+ {
+ "experimental_method":["Solution NMR"],
+ "pdb_id":"2a24",
+ "title":"HADDOCK Structure of HIF-2a/ARNT PAS-B Heterodimer"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6x28",
+ "resolution":1.92,
+ "title":"Crystal structure of PT2243 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6x2h",
+ "resolution":2.0,
+ "title":"Crystal structure of PT2863 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6d0c",
+ "resolution":1.5,
+ "title":"Crystal structure of HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6d0c",
+ "resolution":1.5,
+ "title":"Crystal structure of HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6x28",
+ "resolution":1.92,
+ "title":"Crystal structure of PT2243 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6x3d",
+ "resolution":2.0,
+ "title":"Crystal structure of PT3388 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6x3d",
+ "resolution":2.0,
+ "title":"Crystal structure of PT3388 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6x37",
+ "resolution":1.94,
+ "title":"Crystal structure of PT3245 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6x37",
+ "resolution":1.94,
+ "title":"Crystal structure of PT3245 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6x21",
+ "resolution":1.54,
+ "title":"Crystal structure of PT1673 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6x21",
+ "resolution":1.54,
+ "title":"Crystal structure of PT1673 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6x2h",
+ "resolution":2.0,
+ "title":"Crystal structure of PT2863 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6d0b",
+ "resolution":1.6,
+ "title":"Crystal structure of PT1614 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6d09",
+ "resolution":1.85,
+ "title":"Crystal structure of PT2440 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6czw",
+ "resolution":1.6,
+ "title":"Crystal structure of PT1940 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"8ck8",
+ "resolution":2.302,
+ "title":"STRUCTURE OF HIF2A-ARNT HETERODIMER IN COMPLEX WITH (S)-1-Cyclohexyloxy-5,5-difluoro-3-methanesulfonyl-5,6-dihydro-4H-cyclopenta[c]thiophen-4-ol"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"8ck4",
+ "resolution":2.29,
+ "title":"STRUCTURE OF HIF2A-ARNT HETERODIMER IN COMPLEX WITH (4S)-1-(3,5-difluorophenyl)-5,5-difluoro-3-methanesulfonyl-4,5,6,7-tetrahydro-2-benzothiophen-4-ol"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"8ck4",
+ "resolution":2.29,
+ "title":"STRUCTURE OF HIF2A-ARNT HETERODIMER IN COMPLEX WITH (4S)-1-(3,5-difluorophenyl)-5,5-difluoro-3-methanesulfonyl-4,5,6,7-tetrahydro-2-benzothiophen-4-ol"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"8ck8",
+ "resolution":2.302,
+ "title":"STRUCTURE OF HIF2A-ARNT HETERODIMER IN COMPLEX WITH (S)-1-Cyclohexyloxy-5,5-difluoro-3-methanesulfonyl-5,6-dihydro-4H-cyclopenta[c]thiophen-4-ol"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"4xt2",
+ "resolution":1.698,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains in complex with a tetrazole-containing antagonist"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"3h82",
+ "resolution":1.5,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains with the artificial ligand THS020"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"3h7w",
+ "resolution":1.65,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains with the artificial ligand THS017"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"3f1p",
+ "resolution":1.17,
+ "title":"Crystal structure of a high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"3f1p",
+ "resolution":1.17,
+ "title":"Crystal structure of a high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6d0b",
+ "resolution":1.6,
+ "title":"Crystal structure of PT1614 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6d09",
+ "resolution":1.85,
+ "title":"Crystal structure of PT2440 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6czw",
+ "resolution":1.6,
+ "title":"Crystal structure of PT1940 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"4xt2",
+ "resolution":1.698,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains in complex with a tetrazole-containing antagonist"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"5tbm",
+ "resolution":1.85,
+ "title":"Crystal structure of PT2385 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"3h82",
+ "resolution":1.5,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains with the artificial ligand THS020"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"4gs9",
+ "resolution":1.72,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains in complex with an inactive benzoxadiazole antagonist"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"4ghi",
+ "resolution":1.5,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains in complex with a benzoxadiazole antagonist"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"4ghi",
+ "resolution":1.5,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains in complex with a benzoxadiazole antagonist"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"3h7w",
+ "resolution":1.65,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains with the artificial ligand THS017"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"3f1n",
+ "resolution":1.479,
+ "title":"Crystal structure of a high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains, with internally bound ethylene glycol."},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"3f1n",
+ "resolution":1.479,
+ "title":"Crystal structure of a high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains, with internally bound ethylene glycol."},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"3f1o",
+ "resolution":1.598,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains, with an internally-bound artificial ligand"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"3f1o",
+ "resolution":1.598,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains, with an internally-bound artificial ligand"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"7ujv",
+ "resolution":1.8,
+ "title":"Structure of PHD2 in complex with HIF2a-CODD"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"8ck3",
+ "resolution":1.707,
+ "title":"STRUCTURE OF HIF2A-ARNT HETERODIMER IN COMPLEX WITH (S)-1-(3,5-Difluoro-phenyl)-5,5-difluoro-3-methanesulfonyl-5,6-dihydro-4H-cyclopenta[c]thiophen-4-ol"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"8ck3",
+ "resolution":1.707,
+ "title":"STRUCTURE OF HIF2A-ARNT HETERODIMER IN COMPLEX WITH (S)-1-(3,5-Difluoro-phenyl)-5,5-difluoro-3-methanesulfonyl-5,6-dihydro-4H-cyclopenta[c]thiophen-4-ol"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"4gs9",
+ "resolution":1.72,
+ "title":"Crystal structure of the high affinity heterodimer of HIF2 alpha and ARNT C-terminal PAS domains in complex with an inactive benzoxadiazole antagonist"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"5tbm",
+ "resolution":1.85,
+ "title":"Crystal structure of PT2385 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"5ufp",
+ "resolution":1.9,
+ "title":"Crystal structure of PT2399 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"5ufp",
+ "resolution":1.9,
+ "title":"Crystal structure of PT2399 bound to HIF2a-B*:ARNT-B* complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"4pky",
+ "resolution":3.2,
+ "title":"ARNT/HIF transcription factor/coactivator complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6bvb",
+ "resolution":2.002,
+ "title":"Crystal structure of HIF-2alpha-pVHL-elongin B-elongin C"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"4pky",
+ "resolution":3.2,
+ "title":"ARNT/HIF transcription factor/coactivator complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"4pky",
+ "resolution":3.2,
+ "title":"ARNT/HIF transcription factor/coactivator complex"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6i7q",
+ "resolution":1.798,
+ "title":"Structure of pVHL-elongin B-elongin C (VCB) in complex with hydroxylated-HIF-2alpha (523-542) in the C2221 form"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6i7r",
+ "resolution":1.949,
+ "title":"Structure of pVHL-elongin B-elongin C (VCB) in complex with hydroxylated-HIF-2alpha (523-542) in the P43212 form"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"7ujv",
+ "resolution":1.8,
+ "title":"Structure of PHD2 in complex with HIF2a-CODD"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"7q5v",
+ "resolution":1.17,
+ "title":"HIF PROLYL HYDROXYLASE 2 (PHD2/EGLN1) IN COMPLEX WITH N-OXALYLGLYCINE (NOG) AND HIF-2 ALPHA CODD (523-542)"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"7q5x",
+ "resolution":1.21,
+ "title":"HIF PROLYL HYDROXYLASE 2 (PHD2/EGLN1) IN COMPLEX WITH 2-OXOGLUTARATE (2OG) AND HIF-2 ALPHA CODD (523-542)"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"7q5v",
+ "resolution":1.17,
+ "title":"HIF PROLYL HYDROXYLASE 2 (PHD2/EGLN1) IN COMPLEX WITH N-OXALYLGLYCINE (NOG) AND HIF-2 ALPHA CODD (523-542)"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6bvb",
+ "resolution":2.002,
+ "title":"Crystal structure of HIF-2alpha-pVHL-elongin B-elongin C"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"7q5x",
+ "resolution":1.21,
+ "title":"HIF PROLYL HYDROXYLASE 2 (PHD2/EGLN1) IN COMPLEX WITH 2-OXOGLUTARATE (2OG) AND HIF-2 ALPHA CODD (523-542)"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6i7r",
+ "resolution":1.949,
+ "title":"Structure of pVHL-elongin B-elongin C (VCB) in complex with hydroxylated-HIF-2alpha (523-542) in the P43212 form"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6i7q",
+ "resolution":1.798,
+ "title":"Structure of pVHL-elongin B-elongin C (VCB) in complex with hydroxylated-HIF-2alpha (523-542) in the C2221 form"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6bvb",
+ "resolution":2.002,
+ "title":"Crystal structure of HIF-2alpha-pVHL-elongin B-elongin C"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6i7r",
+ "resolution":1.949,
+ "title":"Structure of pVHL-elongin B-elongin C (VCB) in complex with hydroxylated-HIF-2alpha (523-542) in the P43212 form"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6i7q",
+ "resolution":1.798,
+ "title":"Structure of pVHL-elongin B-elongin C (VCB) in complex with hydroxylated-HIF-2alpha (523-542) in the C2221 form"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6bvb",
+ "resolution":2.002,
+ "title":"Crystal structure of HIF-2alpha-pVHL-elongin B-elongin C"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6i7q",
+ "resolution":1.798,
+ "title":"Structure of pVHL-elongin B-elongin C (VCB) in complex with hydroxylated-HIF-2alpha (523-542) in the C2221 form"},
+ {
+ "experimental_method":["X-ray diffraction"],
+ "pdb_id":"6i7r",
+ "resolution":1.949,
+ "title":"Structure of pVHL-elongin B-elongin C (VCB) in complex with hydroxylated-HIF-2alpha (523-542) in the P43212 form"}]
+ }}
* use read-only test properties file
*/
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Jalview.main(new String[] { "-nonews" });
+ Jalview.main(new String[] { "--nonews" });
}
@AfterMethod(alwaysRun = true)
{
Jalview.main(
new String[]
- { "-nonews", "-props", "test/jalview/testProps.jvprops" });
+ { "--nonews", "--props", "test/jalview/testProps.jvprops" });
/*
* remove any sequence mappings left lying around by other tests
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
+import java.awt.Container;
import java.awt.Dimension;
import java.awt.Font;
import java.awt.FontMetrics;
{
Jalview.main(
new String[]
- { "-nonews", "-props", "test/jalview/testProps.jvprops" });
+ { "--nonews", "--props", "test/jalview/testProps.jvprops" });
Cache.applicationProperties.setProperty("SHOW_IDENTITY",
Boolean.TRUE.toString());
/**
* Test the variant of calculateIdWidth that computes the longest of any
* sequence name or annotation label width
+ * FIXME: JAL-4291: test needs updating for JAL-244 and JAL-4091
*/
- @Test(groups = "Functional")
+ @Test(groups = "Functional",enabled=false)
public void testCalculateIdWidth_withMaxWidth()
{
AlignViewportI av = af.alignPanel.getAlignViewport();
av.setShowAnnotation(false);
av.setIdWidth(18);
+ FontMetrics fmfor = new Container()
+ .getFontMetrics(new Font(af.viewport.font.getName(),
+ Font.ITALIC, af.viewport.font.getSize()));
+
/*
* note 4 pixels 'padding' are added to the longest seq name/annotation label
*/
Dimension d = af.alignPanel.calculateIdWidth(2000);
+ // Assumption ID_WIDTH_PADDING == 4
+ int expwidth = 3 + fmfor.stringWidth("Conservation");
+
assertEquals(d.width, 166); // 4 + pixel width of "Q93Z60_ARATH/1-118"
assertEquals(d.height, 12); // fixed value (not used?)
- assertEquals(av.getIdWidth(), 18); // not changed by this method
+ assertEquals(av.getIdWidth(), expwidth); // not changed by this method
/*
* make the longest sequence name longer
*/
AlignmentAnnotation aa = av.getAlignment().getAlignmentAnnotation()[0];
aa.label = "THIS IS A VERY LONG LABEL INDEED";
- FontMetrics fmfor = af.alignPanel
- .getFontMetrics(af.alignPanel.getAlabels().getFont());
- // Assumption ID_WIDTH_PADDING == 4
- int expwidth = 4 + fmfor.stringWidth(aa.label);
d = af.alignPanel.calculateIdWidth(2000);
+ // Assumption ID_WIDTH_PADDING == 3
+ expwidth = 3 + fmfor.stringWidth(aa.label);
+
assertEquals(d.width, expwidth); // 228 == ID_WIDTH_PADDING + pixel width of
// "THIS IS A VERY LONG LABEL INDEED"
assertEquals(d.height, 12);
* use read-only test properties file
*/
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Jalview.main(new String[] { "-nonews" });
+ Jalview.main(new String[] { "--nonews" });
}
@AfterMethod(alwaysRun = true)
{
Assert.fail("Unexpected exception " + x);
}
- AlignFrame[] alfs = Desktop.getAlignFrames();
+ AlignFrame[] alfs = Desktop.getDesktopAlignFrames();
Assert.assertEquals("Expect just 2 alignment frames", 2, alfs.length);
// internal paste should yield a new alignment window with shared dataset
AlignmentI dataset = internalSource.getViewport().getAlignment()
* use read-only test properties file
*/
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Jalview.main(new String[] { "-nonews" });
+ Jalview.main(new String[] { "--nonews" });
}
@AfterMethod(alwaysRun = true)
{
Jalview.main(
new String[]
- { "-nonews", "-props", "test/jalview/testProps.jvprops" });
+ { "--nonews", "--props", "test/jalview/testProps.jvprops" });
String True = Boolean.TRUE.toString();
Cache.applicationProperties.setProperty("SHOW_ANNOTATIONS", True);
Cache.applicationProperties.setProperty("SHOW_QUALITY", True);
Jalview.main(
new String[]
- { "-nowebservicediscovery", "-nosplash", "-nonews" });
+ { "--nowebservicediscovery", "--nosplash", "--nonews" });
}
@AfterClass(alwaysRun = true)
ScalePanel scalePanel = alignFrame.alignPanel.getScalePanel();
MouseEvent mouse = new MouseEvent(scalePanel, 0, 1, 0, 4, 0, 1, false);
+
+ // check the bounded lookup is not returning negatives
+ assertEquals(alignFrame.alignPanel.getSeqPanel().findAlignmentColumn(mouse),0);
+
scalePanel.mousePressed(mouse);
scalePanel.mouseDragged(mouse);
* use read-only test properties file
*/
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Jalview.main(new String[] { "-nonews" });
+ Jalview.main(new String[] { "--nonews" });
}
}
}
@Test(groups = "Functional")
- public void testFindColumn_wrapped()
+ public void testFindColumn_and_FindAlignmentColumn_wrapped()
{
Cache.applicationProperties.setProperty("WRAP_ALIGNMENT", "true");
AlignFrame alignFrame = new FileLoader().LoadFileWaitTillLoaded(
MouseEvent evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0,
x, 0, 0, 0, 0, false, 0);
assertEquals(testee.findColumn(evt), 0);
+ assertEquals(testee.findAlignmentColumn(evt), 0);
/*
* not quite one charWidth across
evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
0, false, 0);
assertEquals(testee.findColumn(evt), 0);
+ assertEquals(testee.findAlignmentColumn(evt), 0);
/*
* one charWidth across
evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
0, false, 0);
assertEquals(testee.findColumn(evt), 1);
+ assertEquals(testee.findAlignmentColumn(evt), 1);
/*
* x over scale left (before drawn columns) results in -1
evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
0, false, 0);
assertEquals(testee.findColumn(evt), -1);
+ assertEquals(testee.findAlignmentColumn(evt), 0);
+
x = labelWidth;
evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
0, false, 0);
assertEquals(testee.findColumn(evt), 0);
+ assertEquals(testee.findAlignmentColumn(evt), 0);
+
/*
* x over right edge of last residue (including scale left)
evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
0, false, 0);
assertEquals(testee.findColumn(evt), residuesWide - 1);
+ assertEquals(testee.findAlignmentColumn(evt), residuesWide-1);
+
/*
* x over scale right (beyond drawn columns) results in -1
x += 1; // just over left edge of scale right
evt = new MouseEvent(testee, MouseEvent.MOUSE_MOVED, 0L, 0, x, 0, 0, 0,
0, false, 0);
+ // on scale
assertEquals(testee.findColumn(evt), -1);
+ // return right-most column visible
+ assertEquals(testee.findAlignmentColumn(evt), residuesWide2-1);
+
// todo add startRes offset, hidden columns
* use read-only test properties file
*/
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Jalview.main(new String[] { "-nonews" });
+ Jalview.main(new String[] { "--nonews" });
}
/**
{
Jalview.main(
new String[]
- { "-nonews", "-props", "test/jalview/testProps.jvprops" });
+ { "--nonews", "--props", "test/jalview/testProps.jvprops" });
}
@BeforeMethod(alwaysRun = true)
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+import java.util.ArrayList;
import java.util.List;
import java.util.Vector;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceI;
+import jalview.fts.api.FTSData;
+import jalview.fts.api.FTSDataColumnI;
+import jalview.fts.core.FTSRestRequest;
import jalview.fts.core.FTSRestResponse;
import jalview.fts.service.pdb.PDBFTSRestClientTest;
+import jalview.fts.service.threedbeacons.TDB_FTSData;
+import jalview.fts.service.threedbeacons.TDBeaconsFTSRestClient;
import jalview.fts.threedbeacons.TDBeaconsFTSRestClientTest;
import jalview.gui.JvOptionPane;
import jalview.gui.StructureChooser;
private Sequence upSeq_fer1_maize;
+ private Sequence upSeq_epas1_human;
+
// same set up as for structurechooser test
@BeforeMethod(alwaysRun = true)
upSeq_fer1_maize
.addDBRef(new DBRefEntry("UNIPROT", "0", "P27787", null, true));
upSeq_fer1_maize.createDatasetSequence();
-
+
+ upSeq_epas1_human = new Sequence("EPAS1_HUMAN","MTADKEKKRSSSERRKEKSRDAARCRRSKETEVFYELAHELPLPHSVSSHLDKASIMRLAISFLRTHKLLSS\n"
+ + "VCSENESEAEADQQMDNLYLKALEGFIAVVTQDGDMIFLSENISKFMGLTQVELTGHSIFDFTHPCDHEEIR\n"
+ + "ENLSLKNGSGFGKKSKDMSTERDFFMRMKCTVTNRGRTVNLKSATWKVLHCTGQVKVYNNCPPHNSLCGYKE\n"
+ + "PLLSCLIIMCEPIQHPSHMDIPLDSKTFLSRHSMDMKFTYCDDRITELIGYHPEELLGRSAYEFYHALDSEN\n"
+ + "MTKSHQNLCTKGQVVSGQYRMLAKHGGYVWLETQGTVIYNPRNLQPQCIMCVNYVLSEIEKNDVVFSMDQTE\n"
+ + "SLFKPHLMAMNSIFDSSGKGAVSEKSNFLFTKLKEEPEELAQLAPTPGDAIISLDFGNQNFEESSAYGKAIL\n"
+ + "PPSQPWATELRSHSTQSEAGSLPAFTVPQAAAPGSTTPSATSSSSSCSTPNSPEDYYTSLDNDLKIEVIEKL\n"
+ + "FAMDTEAKDQCSTQTDFNELDLETLAPYIPMDGEDFQLSPICPEERLLAENPQSTPQHCFSAMTNIFQPLAP\n"
+ + "VAPHSPFLLDKFQQQLESKKTEPEHRPMSSIFFDAGSKASLPPCCGQASTPLSSMGGRSNTQWPPDPPLHFG\n"
+ + "PTKWAVGDQRTEFLGAAPLGPPVSPPHVSTFKTRSAKGFGARGPDVLSPAMVALSNKLKLKRQLEYEEQAFQ\n"
+ + "DLSGGDPPGGSTSHLMWKRMKNLRGGSCPLMPDKPLSANVPNDKFTQNPMRGLGHPLRHLPLPQPPSAISPG\n"
+ + "ENSKSRFPPQCYATQYQDYSLSSAHKVSGMASRLLGPSFESYLLPELTRYDCEVNVPVLGSSTLLQGGDLLR\n"
+ + "ALDQAT");
+ upSeq_epas1_human.setDescription("Endothelial PAS domain-containing protein 1");
+ upSeq_epas1_human
+ .addDBRef(new DBRefEntry("UNIPROT", "0", "Q99814", null, true));
+ upSeq_epas1_human.createDatasetSequence();
}
@AfterMethod(alwaysRun = true)
upSeq = null;
upSeq_r1ab = null;
upSeq_fer1_maize = null;
+ upSeq_epas1_human=null;
}
@SuppressWarnings("deprecation")
pdbResponse);
assertEquals(upResponse.getNumberOfItemsFound(),
joinedResp.getNumberOfItemsFound());
+
+ // Special data test case
+ if (testUpSeq.getDisplayId(true)
+ .equals(upSeq_epas1_human.getDisplayId(true)))
+ {
+
+ TDBResultAnalyser tDBResultAnalyz = new TDBResultAnalyser(testUpSeq,
+ joinedResp.getSearchSummary(), tdbquery.lastTdbRequest,
+ ThreeDBStructureChooserQuerySource.FILTER_FIRST_BEST_COVERAGE,
+ tdbquery.remove_prefix(
+ ThreeDBStructureChooserQuerySource.FILTER_FIRST_BEST_COVERAGE));
+ List<FTSData> ordered = tDBResultAnalyz.getFilteredResponse();
+ List<FTSData> selected = tDBResultAnalyz.selectStructures(ordered);
+ assertEquals(((TDB_FTSData) selected.get(0)).getProvider(),
+ "AlphaFold DB");
+ // to be sufficient, should also
+ // test that adjacent ordered structure in ordered is levyLab
+ // TDB_FTSData first = (TDB_FTSData) ordered.get(0),
+ // second = (TDB_FTSData) ordered.get(1),
+ // third = (TDB_FTSData) ordered.get(2);
+ // Assert.assertEquals("pLDDT", first.getConfidenceScoreType());
+ // Assert.assertTrue(first.getConfidenceScoreType()
+ // .equals(second.getConfidenceScoreType())); // pLDDT first and
+ // // second
+ }
} catch (
{
setUp();
return new Object[][] { { upSeq }, { upSeq_insulin }, { upSeq_r1ab },
- { upSeq_fer1_maize } };
+ { upSeq_fer1_maize },{upSeq_epas1_human} };
}
@Test(groups = { "Functional" })
name = "abcde12[345a]fg";
AssertJUnit.assertEquals("abcde12345afg",
PDBStructureChooserQuerySource.sanitizeSeqName(name));
- }
+ }
}
{
jalview.bin.Jalview
.main(new String[]
- { "-props", "test/jalview/io/testProps.jvprops" });
+ { "--props", "test/jalview/io/testProps.jvprops" });
}
/**
SequenceFetcher sf = new SequenceFetcher(Desktop.instance,
forSource, forAccession);
sf.run();
- AlignFrame[] afs = Desktop.getAlignFrames();
+ AlignFrame[] afs = Desktop.getDesktopAlignFrames();
if (afs.length == 0)
{
failedDBRetr.add("Didn't retrieve " + first);
{
jalview.bin.Jalview
.main(new String[]
- { "-props", "test/jalview/io/testProps.jvprops" });
+ { "--props", "test/jalview/io/testProps.jvprops" });
}
/**
assertTrue(report.startsWith("<i>\n" + "<br/>\n" + "UNIPROT P30410,\n"
+ " P30411,\n" + " P30412,\n" + " P30413,...<br/>\n"
+ "PDB0 3iu1<br/>\n" + "PDB1 3iu1<br/>"));
- assertTrue(report.endsWith("PDB5 3iu1<br/>\n" + "PDB6 3iu1<br/>\n"
- + "PDB7 3iu1<br/>\n" + "PDB8,...<br/>\n"
+ assertTrue(report.endsWith("PDB3 3iu1<br/>\n"+"PDB4,...<br/>\n"
+ "(Output Sequence Details to list all database references)\n"
+ "</i>"));
}
appCache = AppCache.getInstance();
}
- @Test(groups = { "Functional" })
+ @Test(groups = { "Functional", "testTask2" })
public void getUserInputTest()
{
String userInput = cacheBox.getUserInput();
cacheBox.addItem(testInput);
cacheBox.setSelectedItem(testInput);
cacheBox.updateCache();
-
- try
+ boolean done[]=new boolean[] { false };
+ // this event gets processed after updateCache's update event on the swing
+ // thread
+ SwingUtilities.invokeLater(() -> {
+ done[0]=true;
+ });
+ long t=0;
+ while (!done[0] && t<200)
{
- // fix for JAL-4153
- // This delay is to let cacheBox.updateCache() finish updating the cache
- SwingUtilities.invokeAndWait(() -> {
- try
- {
- Thread.sleep(1);
+ try {
+ Thread.sleep(7);
+ t++;
} catch (InterruptedException e)
{
e.printStackTrace();
}
- });
- } catch (InvocationTargetException | InterruptedException e)
+ }
+ if (!done[0])
{
- e.printStackTrace();
+ Assert.fail("Giving up after 1.4s waiting for cache to be updated.");
}
+
LinkedHashSet<String> foundCache = appCache
.getAllCachedItemsFor(TEST_CACHE_KEY);
Assert.assertTrue(foundCache.contains(testInput));
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
+import jalview.analysis.AlignmentUtils;
import jalview.analysis.scoremodels.SimilarityParams;
import jalview.api.AlignViewportI;
import jalview.api.AlignmentViewPanel;
import jalview.datamodel.Mapping;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.PDBEntry.Type;
+import jalview.datamodel.Sequence;
import jalview.datamodel.Sequence.DBModList;
import jalview.datamodel.SequenceCollectionI;
import jalview.datamodel.SequenceFeature;
@Test(groups = { "Functional" })
public void gatherViewsHere() throws Exception
{
- int origCount = Desktop.getAlignFrames() == null ? 0
- : Desktop.getAlignFrames().length;
+ int origCount = Desktop.getDesktopAlignFrames() == null ? 0
+ : Desktop.getDesktopAlignFrames().length;
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/exampleFile_2_7.jar", DataSourceType.FILE);
assertNotNull(af, "Didn't read in the example file correctly.");
- assertTrue(Desktop.getAlignFrames().length == 1 + origCount,
+ assertTrue(Desktop.getDesktopAlignFrames().length == 1 + origCount,
"Didn't gather the views in the example file.");
}
AlignFrame af = new FileLoader().LoadFileWaitTillLoaded(
"examples/exampleFile_2_7.jar", DataSourceType.FILE);
- Assert.assertEquals(Desktop.getAlignFrames().length, 1);
+ Assert.assertEquals(Desktop.getDesktopAlignFrames().length, 1);
String afid = af.getViewport().getSequenceSetId();
// check FileLoader returned a reference to the one alignFrame that is
Desktop.explodeViews(af);
- int oldviews = Desktop.getAlignFrames().length;
- Assert.assertEquals(Desktop.getAlignFrames().length,
+ int oldviews = Desktop.getDesktopAlignFrames().length;
+ Assert.assertEquals(Desktop.getDesktopAlignFrames().length,
Desktop.getAlignmentPanels(afid).length);
File tfile = File.createTempFile("testStoreAndRecoverExpanded", ".jvp");
try
Assert.fail("Didn't save the expanded view state", e);
}
Desktop.instance.closeAll_actionPerformed(null);
- if (Desktop.getAlignFrames() != null)
+ if (Desktop.getDesktopAlignFrames() != null)
{
- Assert.assertEquals(Desktop.getAlignFrames().length, 0);
+ Assert.assertEquals(Desktop.getDesktopAlignFrames().length, 0);
}
af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
DataSourceType.FILE);
Assert.assertNotNull(af);
- Assert.assertEquals(Desktop.getAlignFrames().length,
+ Assert.assertEquals(Desktop.getDesktopAlignFrames().length,
Desktop.getAlignmentPanels(
af.getViewport().getSequenceSetId()).length);
Assert.assertEquals(Desktop
Assert.fail("Didn't save the expanded view state", e);
}
Desktop.instance.closeAll_actionPerformed(null);
- if (Desktop.getAlignFrames() != null)
+ if (Desktop.getDesktopAlignFrames() != null)
{
- Assert.assertEquals(Desktop.getAlignFrames().length, 0);
+ Assert.assertEquals(Desktop.getDesktopAlignFrames().length, 0);
}
af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
Assert.fail("Didn't save the expanded view state", e);
}
Desktop.instance.closeAll_actionPerformed(null);
- if (Desktop.getAlignFrames() != null)
+ if (Desktop.getDesktopAlignFrames() != null)
{
- Assert.assertEquals(Desktop.getAlignFrames().length, 0);
+ Assert.assertEquals(Desktop.getDesktopAlignFrames().length, 0);
}
af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
Assert.fail("Didn't save the state", e);
}
Desktop.instance.closeAll_actionPerformed(null);
- if (Desktop.getAlignFrames() != null)
+ if (Desktop.getDesktopAlignFrames() != null)
{
- Assert.assertEquals(Desktop.getAlignFrames().length, 0);
+ Assert.assertEquals(Desktop.getDesktopAlignFrames().length, 0);
}
AlignFrame restoredFrame = new FileLoader().LoadFileWaitTillLoaded(
assertNotNull(af);
AlignmentI ds = null;
- for (AlignFrame alignFrame : Desktop.getAlignFrames())
+ for (AlignFrame alignFrame : Desktop.getDesktopAlignFrames())
{
if (ds == null)
{
}
@Test(groups = { "Functional" })
+ public void testMatrixToFloatsAndBack()
+ {
+ int imax=2000;
+ int i=imax;
+ SequenceI sq = new Sequence("dummy","SEQ");
+ while (sq.getLength()<i)
+ {
+ sq.setSequence(sq.getSequenceAsString()+'Q');
+ }
+ float[][] paevals = new float[i][i];
+ for (i = imax - 1; i >= 0; i--)
+ {
+ for (int j = 0; j <= i; j++)
+ {
+ paevals[i][j] = ((i - j < 2)
+ || ((i > 1 && i < 5) && (j > 1 && i < 5))) ? 1 : 0f;
+ paevals[j][i] = -paevals[i][j];
+ }
+ }
+ PAEContactMatrix dummyMat = new PAEContactMatrix(sq, paevals);
+ String content = ContactMatrix.contactToFloatString(dummyMat);
+ Assert.assertTrue(content.contains("\t1.")); // at least one element must be
+ // 1
+ float[][] vals = ContactMatrix.fromFloatStringToContacts(content,
+ sq.getLength(), sq.getLength());
+ assertEquals(vals[3][4], paevals[3][4]);
+ assertEquals(vals[4][3], paevals[4][3]);
+
+ // test recovery
+ for (i=0;i<imax;i++)
+ {
+ for (int j=0;j<imax;j++)
+ {
+ assertEquals(vals[i][j],paevals[i][j]);
+ }
+ }
+ }
+ @Test(groups = { "Functional" })
public void testPAEsaveRestore() throws Exception
{
Desktop.instance.closeAll_actionPerformed(null);
Assert.assertEquals(restoredMat.getGroups(), dummyMat.getGroups());
Assert.assertEquals(restoredMat.hasTree(), dummyMat.hasTree());
Assert.assertEquals(restoredMat.getNewick(), dummyMat.getNewick());
+
+ // verify no duplicate PAE matrix data when new view created and saved
+
+ // add reference annotations to view first, then copy
+ AlignmentUtils.addReferenceAnnotationTo(newAl, newAl.getSequenceAt(0), newSeq.getAnnotation()[0],null);
+
+ AlignmentViewPanel newview = af.newView("copy of PAE", true);
+
+ // redundant asserts here check all is good with the new view firest...
+ AlignmentI newviewAl = newview.getAlignment();
+ SequenceI newviewSeq = newviewAl.getSequenceAt(0);
+ // check annotation of the expected type exists
+ Assert.assertEquals(newviewSeq.getAnnotation().length, 1);
+ Assert.assertEquals(newviewSeq.getAnnotation()[0].graph, paeCm.graph);
+ // check we have just one contact matrix mapping
+ Assert.assertEquals(newviewSeq.getContactMaps().size(), 1);
+
+ // and can be found for the annotation on the sequence
+ ContactMatrixI newviewMat = newviewSeq
+ .getContactMatrixFor(newviewSeq.getAnnotation()[0]);
+ Assert.assertNotNull(newviewMat);
+
+ Assert.assertTrue(newviewMat == restoredMat);
+
+ // save the two views and restore. Now look at visible annotation to check all views have shared refs.
+
+ tfile = File.createTempFile("testStoreAndRecoverPAEmatrixTwoViews",
+ ".jvp");
+ new Jalview2XML(false).saveState(tfile);
+ Desktop.instance.closeAll_actionPerformed(null);
+
+ af = new FileLoader().LoadFileWaitTillLoaded(tfile.getAbsolutePath(),
+ DataSourceType.FILE);
+ newAl = af.getAlignPanels().get(0).getAlignment();
+ AlignmentAnnotation view1aa = newAl.getSequenceAt(0).getAnnotation()[0];
+
+ newviewAl = af.getAlignPanels().get(1).getAlignment();
+ AlignmentAnnotation view2aa = newviewAl.getSequenceAt(0).getAnnotation()[0];
+
+ // annotations are shared across alignment views - so should still have an identical pair of annotations.
+ Assert.assertTrue(view1aa==view2aa);
+ // identical annotations means identical contact matrix mappings
+ Assert.assertEquals(newAl.getDataset().getSequenceAt(0).getContactMaps().size(), 1);
+
+ // TODO Verify when distinct mappable PAEs are created, only one PAE dataset is actually held.
+ // Assert.assertTrue(view1aa!=view2aa);
+ // restoredMat = newAl.getContactMatrixFor(view1aa);
+ // newviewMat = newviewAl.getContactMatrixFor(view2aa);
+ // Assert.assertTrue(restoredMat!=newviewMat);
+
}
@Test(groups = "Functional")
--- /dev/null
+/*
+ * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$)
+ * Copyright (C) $$Year-Rel$$ The Jalview Authors
+ *
+ * This file is part of Jalview.
+ *
+ * Jalview is free software: you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation, either version 3
+ * of the License, or (at your option) any later version.
+ *
+ * Jalview is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty
+ * of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ * PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with Jalview. If not, see <http://www.gnu.org/licenses/>.
+ * The Jalview Authors are detailed in the 'AUTHORS' file.
+ */
+package jalview.renderer;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import org.testng.annotations.Test;
+
+import jalview.datamodel.AlignmentAnnotation;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.ContactListI;
+import jalview.datamodel.ContactRange;
+import jalview.datamodel.Mapping;
+import jalview.datamodel.SeqDistanceContactMatrix;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
+import jalview.util.MapList;
+import jalview.util.StringUtils;
+import jalview.ws.datamodel.MappableContactMatrixI;
+
+public class ContactGeometryTest
+{
+ @Test(groups="Functional")
+ public void testCoverageofRange()
+ {
+ // a really dumb test to make sure we really cover the requested pixel and
+ // contactList range for any dimension of each
+ for (int range = 12; range < 2000; range += 35)
+ {
+ StringBuilder sb = new StringBuilder();
+ while (sb.length() < range)
+ {
+ sb.append("c");
+ }
+ SequenceI sq = new Sequence("a", sb.toString());
+ MappableContactMatrixI cm = new SeqDistanceContactMatrix(range);
+ AlignmentAnnotation cm_aan = sq.addContactList(cm);
+ ContactListI cl = sq.getContactListFor(cm_aan, 10);
+ assertNotNull(cl);
+ for (int ht = range / 2; ht < range * 3; ht++)
+ {
+ ContactGeometry clgeom = new ContactGeometry(cl, ht);
+ assertNotNull(clgeom.allSteps());
+ }
+ }
+ }
+ @Test(groups = "Functional")
+ public void testContactGeometry()
+ {
+ SequenceI sq = new Sequence("a", "SSSQ");
+ MappableContactMatrixI cm = new SeqDistanceContactMatrix(4);
+ AlignmentAnnotation cm_aan = sq.addContactList(cm);
+ checkConsistencyFor(sq,cm_aan);
+ // Also check all is good when there's a sequence mapping involved
+ MappableContactMatrixI newcm=cm.liftOver(sq,
+ new Mapping(sq, new MapList(new int[]
+ { 1, 4 }, new int[] { 1, 4 }, 1, 1)));
+ AlignmentAnnotation mapped_cm = sq.addContactList(newcm);
+ checkConsistencyFor(sq,mapped_cm);
+ }
+ // Do some asserts for a sequence and a contact matrix
+ private void checkConsistencyFor(SequenceI sq, AlignmentAnnotation cm_aan)
+ {
+ int col=1;
+ ContactListI cl = sq.getContactListFor(cm_aan, col);
+ assertNotNull(cl);
+ assertEquals(cl.getContactHeight(),4);
+
+ // Map contacts 0 to 3 to a tiny range and check
+ ContactGeometry testee = new ContactGeometry(cl,2);
+ assertEquals(testee.contacts_per_pixel,2d);
+ ContactGeometry.contactInterval lastInterval = testee.mapFor(1);
+ assertEquals(lastInterval.cStart,2);
+ assertEquals(lastInterval.cEnd,3);
+ assertEquals(lastInterval.pStart,1);
+ assertEquals(lastInterval.pEnd,1);
+ ContactGeometry.contactInterval another = testee.mapFor(1,2);
+ assertEquals(lastInterval,another);
+ // Also check for a big pixel range
+ testee = new ContactGeometry(cl, 395);
+ lastInterval = testee.mapFor(390, 395); // 395 is one over limit.
+ assertNotNull(lastInterval);
+ assertEquals(lastInterval.cEnd,3);
+ assertEquals(lastInterval.pEnd,394);
+ // Map contacts 0 to 3 to Pixels 0-9, 10-19, 20-29, 30-39
+ testee = new ContactGeometry(cl, 40);
+
+ // verify mapping from pixel to contacts
+
+ // renderer thinks base 0 for pixel coordinates
+ // contact coordinates are base 1
+ for (int p = 0; p < 40; p++)
+ {
+ int expectC=(p / 10);
+ int expectP=(expectC)*10;
+ ContactGeometry.contactInterval ci_at = testee.mapFor(p),
+ ci_from = testee.mapFor(p, p);
+ assertNotNull(ci_at);
+ // mapFor and map should locate the same pixel window
+ assertEquals(ci_at.cStart, expectC,"Different cStart at position "+p);
+ assertEquals(ci_at.cEnd, expectC,"Different cEnd at position "+p);
+ assertEquals(ci_at.pStart,expectP, "Different pStart at position "+p);
+ assertEquals(ci_at.pEnd,expectP+9, "Different pEnd at position "+p);
+
+ assertEquals(ci_from,ci_at, "Different contactIntervals at position "+p);
+ // also test getRangeFor
+ ContactRange cr = cl.getRangeFor(ci_at.cStart, ci_at.cEnd);
+ assertEquals(cr.getFrom_column(),cr.getTo_column());
+ assertEquals((double) cr.getMean(),(double)Math.abs(col-cr.getFrom_column()), "Didn't resolve expected value at position "+p);
+ }
+
+ ContactGeometry.contactInterval ci_at0 = testee.mapFor(0);
+ ContactGeometry.contactInterval ci_at9 = testee.mapFor(9);
+ assertNotNull(ci_at9);
+
+ assertEquals(ci_at0,ci_at9);
+
+ // Adjacent cell
+ ContactGeometry.contactInterval ci_at10 = testee.mapFor(10);
+ assertNotNull(ci_at10);
+ ContactGeometry.contactInterval ci_at11 = testee.mapFor(11);
+ assertNotNull(ci_at11);
+
+ assertEquals(ci_at11,ci_at10,"Off-by-one in ContactGeometry mapping.");
+
+ assertNotEquals(ci_at0,ci_at10,"Expected adjacent cells to be not equal.");
+
+ // verify adjacent window is mapped
+ assertEquals(ci_at11.cStart,ci_at9.cStart+1);
+
+ assertEquals(ci_at9.cEnd+1,ci_at11.cStart);
+ assertEquals(ci_at9.cEnd+1,ci_at11.cEnd);
+
+ // verify interval/intersection
+ // column selection is base 0
+ ColumnSelection cs = new ColumnSelection();
+ cs.addElement(2);
+
+ boolean mask = false;
+ do
+ {
+ assertFalse(testee.intersects(ci_at0, cs, null, mask));
+ assertFalse(testee.intersects(ci_at11, cs, null, mask));
+ assertTrue(testee.intersects(testee.mapFor(21), cs, null, mask));
+ assertFalse(testee.intersects(testee.mapFor(31), cs, null, mask));
+ cs.addElement(3);
+ assertTrue(testee.intersects(testee.mapFor(31), cs, null, mask));
+ cs.removeElement(2);
+ assertFalse(testee.intersects(testee.mapFor(21), cs, null, mask));
+ mask = !mask;
+ } while (!mask);
+
+ }
+}
{
Jalview.main(
new String[]
- { "-nonews", "-props", "test/jalview/testProps.jvprops" });
+ { "--nonews", "--props", "test/jalview/testProps.jvprops" });
// codons for MCWHSE
String cdsSeq = ">cds\nATGtgtTGGcacTCAgaa";
/*
* find the complement frames (ugly)
*/
- AlignFrame[] frames = Desktop.getAlignFrames();
+ AlignFrame[] frames = Desktop.getDesktopAlignFrames();
assertEquals(frames.length, 2);
AlignViewport av1 = frames[0].getViewport();
AlignViewport av2 = frames[1].getViewport();
* use read-only test properties file
*/
Cache.loadProperties("test/jalview/io/testProps.jvprops");
- Jalview.main(new String[] { "-nonews" });
+ Jalview.main(new String[] { "--nonews" });
}
@AfterClass(alwaysRun = true)
package jalview.util;
import java.io.File;
-import java.io.IOException;
import java.util.List;
import org.testng.Assert;
}
@Test(groups = "Functional", dataProvider = "dirnamesAndBasenames")
- public void testDirnamesAndBasenames(String filename, int where,
- String dirname, String basename, String notInDirname)
+ public void testDirnamesAndBasenames(String filename, String dirname,
+ String endsWith, String basename, String notInDirname)
{
File file = new File(filename);
String d = FileUtils.getDirname(file);
String b = FileUtils.getBasename(file);
Assert.assertEquals(b, basename);
- if (where == 0)
- Assert.assertEquals(d, dirname);
- else if (where < 0)
- Assert.assertTrue(d.startsWith(dirname),
- "getDirname(" + file.getPath() + ")=" + d
- + " didn't start with '" + dirname + "'");
- else if (where > 0)
- Assert.assertTrue(d.endsWith(dirname), "getDirname(" + file.getPath()
- + ")=" + d + " didn't end with '" + d + "'");
+ Assert.assertTrue(d.startsWith(dirname), "getDirname(" + file.getPath()
+ + ")=" + d + " didn't start with '" + dirname + "'");
+ Assert.assertTrue(d.endsWith(endsWith), "getDirname(" + file.getPath()
+ + ")=" + d + " didn't end with '" + endsWith + "'");
// ensure dirname doesn't end with basename (which means you can't use same
// filename as dir in tests!)
- Assert.assertFalse(d.endsWith(b));
+ Assert.assertFalse(d.endsWith(b), "Processed dirname '" + d
+ + "' ends with '" + b + "' when it shouldn't");
if (notInDirname != null)
- Assert.assertFalse(d.contains(notInDirname));
+ Assert.assertFalse(d.contains(notInDirname), "Processed directory '"
+ + d + "' contains '" + notInDirname + "' when it shouldn't");
}
@DataProvider(name = "patternsAndMinNumFiles")
@DataProvider(name = "dirnamesAndBasenames")
public Object[][] dirnamesAndBasenames()
{
- String homeDir = null;
- try
- {
- homeDir = new File(System.getProperty("user.home"))
- .getCanonicalPath();
- } catch (IOException e)
- {
- System.err.println("Problem getting canonical home dir");
- e.printStackTrace();
- }
+ String homeDir = new File(System.getProperty("user.home")).getPath();
return new Object[][] { // -1=startsWith, 0=equals, 1=endsWith
- { "~/hello/sailor", -1, homeDir, "sailor", "~" }, //
- { "~/hello/sailor", 1, "/hello", "sailor", "~" }, //
- { "./examples/uniref50.fa", -1, "/", "uniref50", "." }, //
- { "./examples/uniref50.fa", 1, "/examples", "uniref50", "." }, //
- { "examples/uniref50.fa", 1, "/examples", "uniref50", ".fa" }, //
+ { "~/hello/sailor", homeDir, "/hello", "sailor", "~" }, //
+ { "./examples/uniref50.fa", "./", "examples", "uniref50", "Users" }, //
+ { "./examples/uniref50.1.fa", "./", "examples", "uniref50.1",
+ "Users" }, //
+ { "examples/uniref50.fa", "examples", "examples", "uniref50",
+ ".fa" }, //
};
}
+
+ @Test(groups = "Functional", dataProvider = "convertWildcardsToPathData")
+ public void convertWildcardsToPathTest(String value, String wildcard,
+ String dirname, String basename, String path)
+ {
+
+ Assert.assertEquals(
+ FileUtils.convertWildcardsToPath(value, wildcard, dirname,
+ basename),
+ path, "Conversion of wildcard output path is not right.");
+
+ }
+
+ @DataProvider(name = "convertWildcardsToPathData")
+ public Object[][] convertWildcardsToPathData()
+ {
+ return new Object[][] {
+ /*
+ * cmdline args
+ * Arg (null if only testing headless)
+ * String value if there is one (null otherwise)
+ * boolean value if String value is null
+ * expected value of isHeadless()
+ */
+ /*
+ */
+ { "*/*", "*", "{dirname}", "{basename}", "{dirname}/{basename}" },
+ { "*/", "*", "{dirname}", "{basename}", "{dirname}/" },
+ { "/*", "*", "{dirname}", "{basename}", "/{basename}" },
+ { "*", "*", "{dirname}", "{basename}", "{basename}" },
+ { "tmp/output/*/file-*.stk", "*", "{dirname}", "{basename}",
+ "tmp/output/{dirname}/file-{basename}.stk" },
+ { "/*.file", "*", "{dirname}", "{basename}", "/{basename}.file" },
+ { "*/file.stk", "*", "{dirname}", "{basename}",
+ "{dirname}/file.stk" },
+ { "tmp/abc*def/file.stk", "*", "{dirname}", "{basename}",
+ "tmp/abc{dirname}def/file.stk" },
+ { "a*b/c*d", "*", "{dirname}", "{basename}",
+ "a{dirname}b/c{basename}d" },
+ { "a*b/c", "*", "{dirname}", "{basename}", "a{dirname}b/c" },
+ { "a/b*c", "*", "{dirname}", "{basename}", "a/b{basename}c" },
+ { "a*b", "*", "{dirname}", "{basename}", "a{basename}b" },
+ { "aSTARb/cSTARd", "STAR", "BEFORE", "AFTER", "aBEFOREb/cAFTERd" },
+ { "aSTARb/c", "STAR", "BEFORE", "AFTER", "aBEFOREb/c" },
+ { "a/bSTARc", "STAR", "BEFORE", "AFTER", "a/bAFTERc" },
+ { "aSTARb", "STAR", "BEFORE", "AFTER", "aAFTERb" },
+ //
+ };
+ }
+
}
--- /dev/null
+package jalview.util;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import jalview.bin.Cache;
+import jalview.util.imagemaker.BitmapImageSizing;
+
+public class ImageMakerTest
+{
+ @Test(groups = { "Functional" })
+ public void testParseScaleWidthHeightStrings()
+ {
+ Cache.setPropsAreReadOnly(true);
+ Cache.loadProperties("test/jalview/bin/testProps.jvprops");
+
+ Cache.removeProperty(BitmapImageSizing.BITMAP_SCALE);
+ Cache.removeProperty(BitmapImageSizing.BITMAP_HEIGHT);
+ Cache.removeProperty(BitmapImageSizing.BITMAP_WIDTH);
+
+ BitmapImageSizing bis = null;
+
+ // No defaults set, 3 values given. Should be the 3 values.
+ bis = ImageMaker.parseScaleWidthHeightStrings("1.2", "3", "4");
+ Assert.assertEquals(bis.scale(), 1.2f,
+ "scale not parsed and set to value given");
+ Assert.assertEquals(bis.width(), 3,
+ "width not parsed and set to value given");
+ Assert.assertEquals(bis.height(), 4,
+ "height not parsed and set to value given");
+
+ // No defaults set, 1 value given. Should be the 1 value and 2 0s.
+ bis = ImageMaker.parseScaleWidthHeightStrings("1.2", null, null);
+ Assert.assertEquals(bis.scale(), 1.2f,
+ "scale not parsed and set to value given");
+ Assert.assertEquals(bis.width(), 0, "width not parsed and set to 0");
+ Assert.assertEquals(bis.height(), 0, "height not parsed and set to 0");
+
+ // No defaults set, 1 value given. Should be the 1 value and 2 0s. (checking
+ // the other value)
+ bis = ImageMaker.parseScaleWidthHeightStrings(null, "1", null);
+ Assert.assertEquals(bis.scale(), 0f, "scale not parsed and set to 0f");
+ Assert.assertEquals(bis.width(), 1,
+ "width not parsed and set to value given");
+ Assert.assertEquals(bis.height(), 0, "height not parsed and set to 0");
+
+ // No defaults set, no values given, these should first look at defaults and
+ // then set all to 0
+ bis = ImageMaker.parseScaleWidthHeightStrings(null, null, null);
+ Assert.assertEquals(bis.scale(), 0f,
+ "scale not parsed and set to undefined default 0f");
+ Assert.assertEquals(bis.width(), 0,
+ "width not parsed and set to undefined default 0");
+ Assert.assertEquals(bis.height(), 0,
+ "height not parsed and set to undefined default 0");
+
+ Cache.setProperty(BitmapImageSizing.BITMAP_HEIGHT, "1");
+ // 1 default set, bis should detect this
+ Assert.assertEquals(bis.scale(), 0f,
+ "scale not parsed and set to undefined default 0f");
+ Assert.assertEquals(bis.width(), 0,
+ "width not parsed and set to undefined default 0");
+ Assert.assertEquals(bis.height(), 1,
+ "height not parsed and set to default 1");
+
+ Cache.setProperty(BitmapImageSizing.BITMAP_SCALE, "3.4");
+ Cache.setProperty(BitmapImageSizing.BITMAP_WIDTH, "2");
+ // Now all 3 defaults set, bis should detect this
+ Assert.assertEquals(bis.scale(), 3.4f,
+ "scale not parsed and set to undefined default 3.2f");
+ Assert.assertEquals(bis.width(), 2,
+ "width not parsed and set to undefined default 2");
+ Assert.assertEquals(bis.height(), 1,
+ "height not parsed and set to default 1");
+
+ // 3 defaults set, and 3 values given, should use the 3 values
+ bis = ImageMaker.parseScaleWidthHeightStrings("1.2", "3", "4");
+ Assert.assertEquals(bis.scale(), 1.2f,
+ "scale not parsed and set to value given");
+ Assert.assertEquals(bis.width(), 3,
+ "width not parsed and set to value given");
+ Assert.assertEquals(bis.height(), 4,
+ "height not parsed and set to value given");
+
+ // 3 defaults set, and 1 value given, should use the 1 value and 2 0s
+ bis = ImageMaker.parseScaleWidthHeightStrings("1.2", null, null);
+ Assert.assertEquals(bis.scale(), 1.2f,
+ "scale not parsed and set to value given");
+ Assert.assertEquals(bis.width(), 0,
+ "width not parsed and set to undefined 0");
+ Assert.assertEquals(bis.height(), 0,
+ "height not parsed and set to undefined 0");
+
+ // 3 defaults set, and 1 value given, should use the 1 value and 2 0s
+ bis = ImageMaker.parseScaleWidthHeightStrings(null, null, "5");
+ Assert.assertEquals(bis.scale(), 0f,
+ "scale not parsed and set to undefined 0f");
+ Assert.assertEquals(bis.width(), 0,
+ "width not parsed and set to undefined 0");
+ Assert.assertEquals(bis.height(), 5,
+ "height not parsed and set to value given");
+
+ // 3 defaults set, and no values given, should use the 3 default values
+ bis = ImageMaker.parseScaleWidthHeightStrings(null, null, null);
+ Assert.assertEquals(bis.scale(), 3.4f,
+ "scale not parsed and set to undefined default 3.4f");
+ Assert.assertEquals(bis.width(), 2,
+ "width not parsed and set to undefined default 2");
+ Assert.assertEquals(bis.height(), 1,
+ "height not parsed and set to default 1");
+ }
+}
import jalview.bin.Cache;
-public class BitmapImageSizeTest {
- @Test(groups = {"Functional"})
- public void testCacheSettingsRecovery() {
+public class BitmapImageSizeTest
+{
+ @Test(groups = { "Functional" })
+ public void testCacheSettingsRecovery()
+ {
Cache.setPropsAreReadOnly(true);
Cache.loadProperties("test/jalview/bin/testProps.jvprops");
-
+
Cache.removeProperty(BitmapImageSizing.BITMAP_HEIGHT);
Cache.removeProperty(BitmapImageSizing.BITMAP_SCALE);
Cache.removeProperty(BitmapImageSizing.BITMAP_WIDTH);
-
+
BitmapImageSizing def = BitmapImageSizing.defaultBitmapImageSizing();
BitmapImageSizing zero = BitmapImageSizing.nullBitmapImageSizing();
- assertEquals(def.height, zero.height);
- assertEquals(def.width, zero.width);
- assertEquals(def.scale, zero.scale);
-
- Cache.setProperty(BitmapImageSizing.BITMAP_HEIGHT,"120");
- Cache.setProperty(BitmapImageSizing.BITMAP_SCALE,"240");
- Cache.setProperty(BitmapImageSizing.BITMAP_WIDTH,"360");
-
- def = BitmapImageSizing.defaultBitmapImageSizing();
-
- assertEquals(def.height, 120);
- assertEquals(def.width, 360);
- assertEquals(def.scale, 24f);
-
+ assertEquals(def.height(), zero.height());
+ assertEquals(def.width(), zero.width());
+ assertEquals(def.scale(), zero.scale());
+
+ Cache.setProperty(BitmapImageSizing.BITMAP_HEIGHT, "120");
+ Cache.setProperty(BitmapImageSizing.BITMAP_SCALE, "24");
+ Cache.setProperty(BitmapImageSizing.BITMAP_WIDTH, "360");
+
+ // default now updates dynamically
+ // def = BitmapImageSizing.defaultBitmapImageSizing();
+
+ assertEquals(def.height(), 120);
+ assertEquals(def.width(), 360);
+ assertEquals(def.scale(), 24f);
+
Cache.removeProperty(BitmapImageSizing.BITMAP_WIDTH);
-
- def = BitmapImageSizing.defaultBitmapImageSizing();
- assertEquals(def.height, 120);
- assertEquals(def.width, zero.width);
- assertEquals(def.scale, 24f);
+
+ // def = BitmapImageSizing.defaultBitmapImageSizing();
+ assertEquals(def.height(), 120);
+ assertEquals(def.width(), zero.width());
+ assertEquals(def.scale(), 24f);
}
}