+
+
+
+
+
+
+
+
diff --git a/help/html/features/chimera.html b/help/html/features/chimera.html
index e866597..236701a 100644
--- a/help/html/features/chimera.html
+++ b/help/html/features/chimera.html
@@ -133,6 +133,8 @@ atoms in the displayed structures. For comprehensive details of Chimera's comman
they are insertions (relative to the associated sequence in the
alignment) and grey if they are N or C terminal flanks outside the
region mapped to the alignment window's sequence.
+
By Chain
+ Uses the Chimera 'rainbow chain' command to apply a different colour to each chain.
Charge & Cysteine Highlights cysteines in yellow, anionic (Aspartic Acid or
Glutamic Acid) residues in red, and cationic (Lysine or Arginine)
diff --git a/lib/jsoup-1.8.1.jar b/lib/jsoup-1.8.1.jar
new file mode 100644
index 0000000..ae717d4
Binary files /dev/null and b/lib/jsoup-1.8.1.jar differ
diff --git a/resources/lang/Messages.properties b/resources/lang/Messages.properties
index 5d3667b..cabee76 100644
--- a/resources/lang/Messages.properties
+++ b/resources/lang/Messages.properties
@@ -107,7 +107,7 @@ action.change_params = Change Parameters
action.apply = Apply
action.apply_threshold_all_groups = Apply threshold to all groups
action.apply_all_groups = Apply to all Groups
-action.by_chain = By chain
+action.by_chain = By Chain
action.by_sequence = By Sequence
action.paste_annotations = Paste Annotations
action.format = Format
diff --git a/resources/templates/BioJSTemplate.txt b/resources/templates/BioJSTemplate.txt
new file mode 100644
index 0000000..bf780bb
--- /dev/null
+++ b/resources/templates/BioJSTemplate.txt
@@ -0,0 +1,9032 @@
+
+BioJS viewer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
press "Run with JS"
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/MCview/PDBChain.java b/src/MCview/PDBChain.java
index e8f1bc9..408108b 100755
--- a/src/MCview/PDBChain.java
+++ b/src/MCview/PDBChain.java
@@ -392,8 +392,8 @@ public class PDBChain
}
AlignmentAnnotation tfactorann = new AlignmentAnnotation(
- "PDB.TempFactor", "Temperature Factor for "
- + sequence.getName(), annots, 0, max,
+ "Temperature Factor", "Temperature Factor for " + pdbid + id,
+ annots, 0, max,
AlignmentAnnotation.LINE_GRAPH);
tfactorann.setSequenceRef(sequence);
sequence.addAlignmentAnnotation(tfactorann);
@@ -552,34 +552,37 @@ public class PDBChain
}
}
}
- float min = -1, max = 0;
- Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1];
- for (int i = sq.getStart(), j = sq.getEnd(), k = 0; i <= j; i++, k++)
+ if (false)
{
- int prn = mapping.getPDBResNum(k + 1);
-
- an[k] = new Annotation(prn);
- if (min == -1)
+ // Useful for debugging mappings - adds annotation for mapped position
+ float min = -1, max = 0;
+ Annotation[] an = new Annotation[sq.getEnd() - sq.getStart() + 1];
+ for (int i = sq.getStart(), j = sq.getEnd(), k = 0; i <= j; i++, k++)
{
- min = k;
- max = k;
- }
- else
- {
- if (min > k)
+ int prn = mapping.getPDBResNum(k + 1);
+
+ an[k] = new Annotation(prn);
+ if (min == -1)
{
min = k;
+ max = k;
}
- else if (max < k)
+ else
{
- max = k;
+ if (min > k)
+ {
+ min = k;
+ }
+ else if (max < k)
+ {
+ max = k;
+ }
}
}
+ sq.addAlignmentAnnotation(new AlignmentAnnotation("PDB.RESNUM",
+ "PDB Residue Numbering for " + this.pdbid + ":" + this.id,
+ an, min, max, AlignmentAnnotation.LINE_GRAPH));
}
- sq.addAlignmentAnnotation(new AlignmentAnnotation("PDB.RESNUM",
- "PDB Residue Numbering for " + this.pdbid + ":" + this.id,
- an, min, max, AlignmentAnnotation.LINE_GRAPH));
-
}
}
}
diff --git a/src/MCview/PDBfile.java b/src/MCview/PDBfile.java
index e1c4dc5..691fdcd 100755
--- a/src/MCview/PDBfile.java
+++ b/src/MCview/PDBfile.java
@@ -361,8 +361,8 @@ public class PDBfile extends jalview.io.AlignFile
AlignmentI al, String pep, boolean b)
{
List> replaced = AlignSeq
- .replaceMatchingSeqsWith(seqs, annotations, prot, al,
- AlignSeq.PEP, false);
+ .replaceMatchingSeqsWith(seqs, annotations, prot, al, pep,
+ false);
for (PDBChain ch : chains)
{
int p = 0;
diff --git a/src/jalview/analysis/AnnotationSorter.java b/src/jalview/analysis/AnnotationSorter.java
index a5d2164..81398eb 100644
--- a/src/jalview/analysis/AnnotationSorter.java
+++ b/src/jalview/analysis/AnnotationSorter.java
@@ -209,6 +209,10 @@ public class AnnotationSorter
public void sort(AlignmentAnnotation[] alignmentAnnotations,
SequenceAnnotationOrder order)
{
+ if (alignmentAnnotations == null)
+ {
+ return;
+ }
// cache 'alignment sequence position' for the annotations
saveSequenceIndices(alignmentAnnotations);
diff --git a/src/jalview/analysis/Rna.java b/src/jalview/analysis/Rna.java
index e4a0d76..227bf09 100644
--- a/src/jalview/analysis/Rna.java
+++ b/src/jalview/analysis/Rna.java
@@ -26,6 +26,10 @@
package jalview.analysis;
+import jalview.analysis.SecStrConsensus.SimpleBP;
+import jalview.datamodel.SequenceFeature;
+import jalview.util.MessageManager;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
@@ -33,10 +37,6 @@ import java.util.Hashtable;
import java.util.Stack;
import java.util.Vector;
-import jalview.analysis.SecStrConsensus.SimpleBP;
-import jalview.datamodel.SequenceFeature;
-import jalview.util.MessageManager;
-
public class Rna
{
@@ -65,7 +65,7 @@ public class Rna
{
for (int i = 0; i < openingPars.length; i++)
{
- System.out.println(closingPars[i] + "->" + openingPars[i]);
+ // System.out.println(closingPars[i] + "->" + openingPars[i]);
put(closingPars[i], openingPars[i]);
}
}
@@ -107,7 +107,6 @@ public class Rna
public static Vector GetSimpleBPs(CharSequence line)
throws WUSSParseException
{
- System.out.println(line);
Hashtable> stacks = new Hashtable>();
Vector pairs = new Vector();
int i = 0;
diff --git a/src/jalview/appletgui/APopupMenu.java b/src/jalview/appletgui/APopupMenu.java
index eba1200..98a4a1c 100644
--- a/src/jalview/appletgui/APopupMenu.java
+++ b/src/jalview/appletgui/APopupMenu.java
@@ -20,19 +20,43 @@
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.analysis.*;
-import jalview.commands.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
-import jalview.util.MessageManager;
-import jalview.util.UrlLink;
+import jalview.analysis.AAFrequency;
+import jalview.analysis.Conservation;
+import jalview.commands.ChangeCaseCommand;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.datamodel.DBRefEntry;
+import jalview.datamodel.PDBEntry;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
import jalview.io.AppletFormatAdapter;
import jalview.io.SequenceAnnotationReport;
+import jalview.schemes.Blosum62ColourScheme;
+import jalview.schemes.BuriedColourScheme;
+import jalview.schemes.ClustalxColourScheme;
+import jalview.schemes.HelixColourScheme;
+import jalview.schemes.HydrophobicColourScheme;
+import jalview.schemes.NucleotideColourScheme;
+import jalview.schemes.PIDColourScheme;
+import jalview.schemes.ResidueProperties;
+import jalview.schemes.StrandColourScheme;
+import jalview.schemes.TaylorColourScheme;
+import jalview.schemes.TurnColourScheme;
+import jalview.schemes.ZappoColourScheme;
+import jalview.util.MessageManager;
+import jalview.util.UrlLink;
+
+import java.awt.CheckboxMenuItem;
+import java.awt.Frame;
+import java.awt.Menu;
+import java.awt.MenuItem;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.util.Vector;
public class APopupMenu extends java.awt.PopupMenu implements
ActionListener, ItemListener
@@ -549,7 +573,9 @@ public class APopupMenu extends java.awt.PopupMenu implements
if (sg != null)
{
if (seq == null)
+ {
seq = (Sequence) sg.getSequenceAt(0);
+ }
EditNameDialog dialog = new EditNameDialog(seq.getSequenceAsString(
sg.getStartRes(), sg.getEndRes() + 1), null,
@@ -560,7 +586,7 @@ public class APopupMenu extends java.awt.PopupMenu implements
if (dialog.accept)
{
EditCommand editCommand = new EditCommand(MessageManager.getString("label.edit_sequences"),
- EditCommand.REPLACE, dialog.getName().replace(' ',
+ Action.REPLACE, dialog.getName().replace(' ',
ap.av.getGapCharacter()),
sg.getSequencesAsArray(ap.av.getHiddenRepSequences()),
sg.getStartRes(), sg.getEndRes() + 1,
@@ -742,11 +768,15 @@ public class APopupMenu extends java.awt.PopupMenu implements
PDBEntry entry = (PDBEntry) seq.getPDBId().firstElement();
if (ap.av.applet.jmolAvailable)
+ {
new jalview.appletgui.AppletJmol(entry, new Sequence[]
{ seq }, null, ap, AppletFormatAdapter.URL);
+ }
else
+ {
new MCview.AppletPDBViewer(entry, new Sequence[]
{ seq }, null, ap, AppletFormatAdapter.URL);
+ }
}
else
diff --git a/src/jalview/appletgui/AlignFrame.java b/src/jalview/appletgui/AlignFrame.java
index 34ec2cf..ed64215 100644
--- a/src/jalview/appletgui/AlignFrame.java
+++ b/src/jalview/appletgui/AlignFrame.java
@@ -27,6 +27,7 @@ import jalview.api.SequenceStructureBinding;
import jalview.bin.JalviewLite;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
import jalview.commands.OrderCommand;
import jalview.commands.RemoveGapColCommand;
import jalview.commands.RemoveGapsCommand;
@@ -1833,7 +1834,8 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
}
// !newAlignment
- addHistoryItem(new EditCommand(MessageManager.getString("label.add_sequences"), EditCommand.PASTE,
+ addHistoryItem(new EditCommand(
+ MessageManager.getString("label.add_sequences"), Action.PASTE,
seqs, 0, viewport.getAlignment().getWidth(),
viewport.getAlignment()));
@@ -1883,8 +1885,9 @@ public class AlignFrame extends EmbmenuFrame implements ActionListener,
/*
* //ADD HISTORY ITEM
*/
- addHistoryItem(new EditCommand(MessageManager.getString("label.cut_sequences"), EditCommand.CUT, cut,
- sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
+ addHistoryItem(new EditCommand(
+ MessageManager.getString("label.cut_sequences"), Action.CUT,
+ cut, sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
viewport.getAlignment()));
viewport.setSelectionGroup(null);
diff --git a/src/jalview/appletgui/AnnotationPanel.java b/src/jalview/appletgui/AnnotationPanel.java
index 4b9fa67..22996f7 100755
--- a/src/jalview/appletgui/AnnotationPanel.java
+++ b/src/jalview/appletgui/AnnotationPanel.java
@@ -256,7 +256,9 @@ public class AnnotationPanel extends Panel implements AwtRenderPanelI,
anot[index] = new Annotation(label, "", type, 0);
}
- anot[index].secondaryStructure = type;
+
+ anot[index].secondaryStructure = type != 'S' ? type : label
+ .length() == 0 ? ' ' : label.charAt(0);
anot[index].displayCharacter = label;
}
}
diff --git a/src/jalview/appletgui/PairwiseAlignPanel.java b/src/jalview/appletgui/PairwiseAlignPanel.java
index 9afc70b..5a3b56c 100644
--- a/src/jalview/appletgui/PairwiseAlignPanel.java
+++ b/src/jalview/appletgui/PairwiseAlignPanel.java
@@ -20,15 +20,21 @@
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.analysis.*;
-import jalview.datamodel.*;
+import jalview.analysis.AlignSeq;
+import jalview.datamodel.Alignment;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceI;
import jalview.util.MessageManager;
+import java.awt.BorderLayout;
+import java.awt.Button;
+import java.awt.Panel;
+import java.awt.ScrollPane;
+import java.awt.TextArea;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Vector;
+
public class PairwiseAlignPanel extends Panel implements ActionListener
{
Vector sequences = new Vector();
@@ -89,13 +95,8 @@ public class PairwiseAlignPanel extends Panel implements ActionListener
totscore = totscore + scores[i][j];
textarea.append(as.getOutput());
- seq = new Sequence(as.getS1().getName(), as.getAStr1(), as.getS1()
- .getStart(), as.getS1().getEnd());
- sequences.addElement(seq);
-
- seq = new Sequence(as.getS2().getName(), as.getAStr2(), as.getS2()
- .getStart(), as.getS2().getEnd());
- sequences.addElement(seq);
+ sequences.add(as.getAlignedSeq1());
+ sequences.add(as.getAlignedSeq1());
}
}
diff --git a/src/jalview/appletgui/RedundancyPanel.java b/src/jalview/appletgui/RedundancyPanel.java
index 1547862..8e364f0 100644
--- a/src/jalview/appletgui/RedundancyPanel.java
+++ b/src/jalview/appletgui/RedundancyPanel.java
@@ -20,16 +20,26 @@
*/
package jalview.appletgui;
-import java.util.*;
-import java.util.List;
-import java.awt.*;
-import java.awt.event.*;
-
import jalview.analysis.AlignSeq;
-import jalview.commands.*;
-import jalview.datamodel.*;
+import jalview.commands.CommandI;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
import jalview.util.MessageManager;
+import java.awt.Frame;
+import java.awt.event.ActionEvent;
+import java.awt.event.AdjustmentEvent;
+import java.awt.event.AdjustmentListener;
+import java.awt.event.WindowEvent;
+import java.awt.event.WindowListener;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Stack;
+import java.util.Vector;
+
public class RedundancyPanel extends SliderPanel implements Runnable,
WindowListener
{
@@ -197,7 +207,7 @@ public class RedundancyPanel extends SliderPanel implements Runnable,
}
EditCommand cut = new EditCommand(MessageManager.getString("action.remove_redundancy"),
- EditCommand.CUT, deleted, 0, width, ap.av.getAlignment());
+ Action.CUT, deleted, 0, width, ap.av.getAlignment());
AlignmentI alignment = ap.av.getAlignment();
for (int i = 0; i < del.size(); i++)
{
diff --git a/src/jalview/appletgui/SeqPanel.java b/src/jalview/appletgui/SeqPanel.java
index de4d979..592fd4f 100644
--- a/src/jalview/appletgui/SeqPanel.java
+++ b/src/jalview/appletgui/SeqPanel.java
@@ -20,19 +20,31 @@
*/
package jalview.appletgui;
-import java.util.*;
-
-import java.awt.*;
-import java.awt.event.*;
-
-import jalview.commands.*;
-import jalview.datamodel.*;
-import jalview.schemes.*;
+import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SearchResults;
+import jalview.datamodel.Sequence;
+import jalview.datamodel.SequenceFeature;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.schemes.ResidueProperties;
import jalview.structure.SelectionSource;
import jalview.structure.SequenceListener;
import jalview.structure.StructureSelectionManager;
import jalview.util.MessageManager;
+import java.awt.BorderLayout;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Panel;
+import java.awt.Point;
+import java.awt.event.InputEvent;
+import java.awt.event.MouseEvent;
+import java.awt.event.MouseListener;
+import java.awt.event.MouseMotionListener;
+import java.util.Vector;
+
public class SeqPanel extends Panel implements MouseMotionListener,
MouseListener, SequenceListener
{
@@ -147,7 +159,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
void setCursorPosition()
{
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(
+ SequenceI sequence = av.getAlignment().getSequenceAt(
seqCanvas.cursorY);
seqCanvas.cursorX = sequence.findIndex(getKeyboardNo1()) - 1;
@@ -240,7 +252,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
void setSelectionAreaAtCursor(boolean topLeft)
{
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(
+ SequenceI sequence = av.getAlignment().getSequenceAt(
seqCanvas.cursorY);
if (av.getSelectionGroup() != null)
@@ -648,7 +660,9 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
String tmp = sequence.hashCode() + index + "";
if (lastMessage == null || !lastMessage.equals(tmp))
+ {
ssm.mouseOverSequence(sequence, index, pos, av);
+ }
lastMessage = tmp;
}
@@ -698,7 +712,9 @@ public class SeqPanel extends Panel implements MouseMotionListener,
int respos = sequence.findPosition(res);
if (ssm != null)
+ {
mouseOverSequence(sequence, res, respos);
+ }
StringBuffer text = new StringBuffer("Sequence " + (seq + 1) + " ID: "
+ sequence.getName());
@@ -813,7 +829,9 @@ public class SeqPanel extends Panel implements MouseMotionListener,
.containsKey(features[i].featureGroup)
&& !((Boolean) seqCanvas.fr.featureGroups
.get(features[i].featureGroup)).booleanValue())
+ {
continue;
+ }
if ((features[i].getBegin() <= res)
&& (features[i].getEnd() >= res))
@@ -938,7 +956,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
{
if (av.isHiddenRepSequence(seq))
{
- sg = (SequenceGroup) av.getRepresentedSequences(seq);
+ sg = av.getRepresentedSequences(seq);
groupEditing = true;
}
}
@@ -1164,7 +1182,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
else
{
- editCommand.appendEdit(EditCommand.INSERT_GAP, groupSeqs,
+ editCommand.appendEdit(Action.INSERT_GAP, groupSeqs,
startres, startres - lastres, av.getAlignment(), true);
}
}
@@ -1180,7 +1198,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
else
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, groupSeqs,
+ editCommand.appendEdit(Action.DELETE_GAP, groupSeqs,
startres, lastres - startres, av.getAlignment(), true);
}
@@ -1202,7 +1220,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
else
{
- editCommand.appendEdit(EditCommand.INSERT_GAP, new SequenceI[]
+ editCommand.appendEdit(Action.INSERT_GAP, new SequenceI[]
{ seq }, lastres, startres - lastres, av.getAlignment(), true);
}
}
@@ -1237,7 +1255,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
if (max > 0)
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, new SequenceI[]
+ editCommand.appendEdit(Action.DELETE_GAP, new SequenceI[]
{ seq }, startres, max, av.getAlignment(), true);
}
}
@@ -1273,10 +1291,10 @@ public class SeqPanel extends Panel implements MouseMotionListener,
}
}
- editCommand.appendEdit(EditCommand.DELETE_GAP, seq, blankColumn, 1,
+ editCommand.appendEdit(Action.DELETE_GAP, seq, blankColumn, 1,
av.getAlignment(), true);
- editCommand.appendEdit(EditCommand.INSERT_GAP, seq, j, 1,
+ editCommand.appendEdit(Action.INSERT_GAP, seq, j, 1,
av.getAlignment(), true);
}
@@ -1284,10 +1302,10 @@ public class SeqPanel extends Panel implements MouseMotionListener,
void deleteChar(int j, SequenceI[] seq, int fixedColumn)
{
- editCommand.appendEdit(EditCommand.DELETE_GAP, seq, j, 1,
+ editCommand.appendEdit(Action.DELETE_GAP, seq, j, 1,
av.getAlignment(), true);
- editCommand.appendEdit(EditCommand.INSERT_GAP, seq, fixedColumn, 1,
+ editCommand.appendEdit(Action.INSERT_GAP, seq, fixedColumn, 1,
av.getAlignment(), true);
}
@@ -1312,7 +1330,7 @@ public class SeqPanel extends Panel implements MouseMotionListener,
return;
}
- SequenceI sequence = (Sequence) av.getAlignment().getSequenceAt(seq);
+ SequenceI sequence = av.getAlignment().getSequenceAt(seq);
if (sequence == null || res > sequence.getLength())
{
diff --git a/src/jalview/bin/Cache.java b/src/jalview/bin/Cache.java
index 24ed1b4..3b0a23e 100755
--- a/src/jalview/bin/Cache.java
+++ b/src/jalview/bin/Cache.java
@@ -150,6 +150,7 @@ import org.apache.log4j.SimpleLayout;
*
FOLLOW_SELECTIONS (true) Controls whether a new alignment view should
* respond to selections made in other alignments containing the same sequences.
*
+ *
JWS2HOSTURLS comma-separated list of URLs to try for JABAWS services
*
SHOW_WSDISCOVERY_ERRORS (true) Controls if the web service URL discovery
* warning dialog box is displayed.
*
ANNOTATIONCOLOUR_MIN (orange) Shade used for minimum value of annotation
diff --git a/src/jalview/bin/Jalview.java b/src/jalview/bin/Jalview.java
index 184c267..f80f341 100755
--- a/src/jalview/bin/Jalview.java
+++ b/src/jalview/bin/Jalview.java
@@ -24,6 +24,7 @@ import jalview.gui.AlignFrame;
import jalview.gui.Desktop;
import jalview.util.MessageManager;
import jalview.util.Platform;
+import jalview.ws.jws2.Jws2Discoverer;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -34,6 +35,7 @@ import java.io.IOException;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.lang.reflect.Constructor;
+import java.net.MalformedURLException;
import java.net.URI;
import java.net.URL;
import java.net.URLDecoder;
@@ -106,40 +108,7 @@ public class Jalview
if (aparser.contains("help") || aparser.contains("h"))
{
- System.out
- .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
- + "-nodisplay\tRun Jalview without User Interface.\n"
- + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
- + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
- + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
- + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
- + "-features FILE\tUse the given file to mark features on the alignment.\n"
- + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
- + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
- + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
- + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
- + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
- + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
- + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
- + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
- + "-png FILE\tCreate PNG image FILE from alignment.\n"
- + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
- + "-eps FILE\tCreate EPS file FILE from alignment.\n"
- + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
- + "-noquestionnaire\tTurn off questionnaire check.\n"
- + "-nousagestats\tTurn off google analytics tracking for this session.\n"
- + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
- // +
- // "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)"
- + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n"
- + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
- + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
- + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
- // +
- // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
- // + "-vses vamsas-session\tJoin session with given URN\n"
- + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n"
- + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
+ showUsage();
System.exit(0);
}
if (aparser.contains("nodisplay") || aparser.contains("nogui")
@@ -150,6 +119,20 @@ public class Jalview
}
Cache.loadProperties(aparser.getValue("props")); // must do this before
// anything else!
+
+ final String jabawsUrl = aparser.getValue("jabaws");
+ if (jabawsUrl != null)
+ {
+ try
+ {
+ Jws2Discoverer.getDiscoverer().setPreferredUrl(jabawsUrl);
+ } catch (MalformedURLException e)
+ {
+ System.err.println("Invalid jabaws parameter: " + jabawsUrl
+ + " ignored");
+ }
+ }
+
String defs = aparser.getValue("setprop");
while (defs != null)
{
@@ -619,6 +602,45 @@ public class Jalview
}
}
+ private static void showUsage()
+ {
+ System.out
+ .println("Usage: jalview -open [FILE] [OUTPUT_FORMAT] [OUTPUT_FILE]\n\n"
+ + "-nodisplay\tRun Jalview without User Interface.\n"
+ + "-props FILE\tUse the given Jalview properties file instead of users default.\n"
+ + "-colour COLOURSCHEME\tThe colourscheme to be applied to the alignment\n"
+ + "-annotations FILE\tAdd precalculated annotations to the alignment.\n"
+ + "-tree FILE\tLoad the given newick format tree file onto the alignment\n"
+ + "-features FILE\tUse the given file to mark features on the alignment.\n"
+ + "-fasta FILE\tCreate alignment file FILE in Fasta format.\n"
+ + "-clustal FILE\tCreate alignment file FILE in Clustal format.\n"
+ + "-pfam FILE\tCreate alignment file FILE in PFAM format.\n"
+ + "-msf FILE\tCreate alignment file FILE in MSF format.\n"
+ + "-pileup FILE\tCreate alignment file FILE in Pileup format\n"
+ + "-pir FILE\tCreate alignment file FILE in PIR format.\n"
+ + "-blc FILE\tCreate alignment file FILE in BLC format.\n"
+ + "-jalview FILE\tCreate alignment file FILE in Jalview format.\n"
+ + "-png FILE\tCreate PNG image FILE from alignment.\n"
+ + "-imgMap FILE\tCreate HTML file FILE with image map of PNG image.\n"
+ + "-eps FILE\tCreate EPS file FILE from alignment.\n"
+ + "-questionnaire URL\tQueries the given URL for information about any Jalview user questionnaires.\n"
+ + "-noquestionnaire\tTurn off questionnaire check.\n"
+ + "-nousagestats\tTurn off google analytics tracking for this session.\n"
+ + "-sortbytree OR -nosortbytree\tEnable or disable sorting of the given alignment by the given tree\n"
+ // +
+ // "-setprop PROPERTY=VALUE\tSet the given Jalview property, after all other properties files have been read\n\t (quote the 'PROPERTY=VALUE' pair to ensure spaces are passed in correctly)"
+ + "-jabaws URL\tSpecify URL for Jabaws services (e.g. for a local installation).\n"
+ + "-dasserver nickname=URL\tAdd and enable a das server with given nickname\n\t\t\t(alphanumeric or underscores only) for retrieval of features for all alignments.\n"
+ + "\t\t\tSources that also support the sequence command may be specified by prepending the URL with sequence:\n"
+ + "\t\t\t e.g. sequence:http://localdas.somewhere.org/das/source)\n"
+ + "-fetchfrom nickname\tQuery nickname for features for the alignments and display them.\n"
+ // +
+ // "-vdoc vamsas-document\tImport vamsas document into new session or join existing session with same URN\n"
+ // + "-vses vamsas-session\tJoin session with given URN\n"
+ + "-groovy FILE\tExecute groovy script in FILE, after all other arguments have been processed (if FILE is the text 'STDIN' then the file will be read from STDIN)\n"
+ + "\n~Read documentation in Application or visit http://www.jalview.org for description of Features and Annotations file~\n\n");
+ }
+
private static void startUsageStats(final Desktop desktop)
{
/**
diff --git a/src/jalview/commands/EditCommand.java b/src/jalview/commands/EditCommand.java
index 5c698a8..82de3b2 100644
--- a/src/jalview/commands/EditCommand.java
+++ b/src/jalview/commands/EditCommand.java
@@ -27,8 +27,10 @@ import jalview.datamodel.Sequence;
import jalview.datamodel.SequenceFeature;
import jalview.datamodel.SequenceI;
+import java.util.ArrayList;
import java.util.Hashtable;
import java.util.List;
+import java.util.ListIterator;
/**
*
@@ -54,19 +56,12 @@ import java.util.List;
*/
public class EditCommand implements CommandI
{
- public static final int INSERT_GAP = 0;
-
- public static final int DELETE_GAP = 1;
-
- public static final int CUT = 2;
-
- public static final int PASTE = 3;
-
- public static final int REPLACE = 4;
-
- public static final int INSERT_NUC = 5;
+ public enum Action
+ {
+ INSERT_GAP, DELETE_GAP, CUT, PASTE, REPLACE, INSERT_NUC
+ };
- Edit[] edits;
+ private List edits = new ArrayList();
String description;
@@ -79,32 +74,75 @@ public class EditCommand implements CommandI
this.description = description;
}
- public EditCommand(String description, int command, SequenceI[] seqs,
+ public EditCommand(String description, Action command, SequenceI[] seqs,
int position, int number, AlignmentI al)
{
this.description = description;
- if (command == CUT || command == PASTE)
+ if (command == Action.CUT || command == Action.PASTE)
{
- edits = new Edit[]
- { new Edit(command, seqs, position, number, al) };
+ setEdit(new Edit(command, seqs, position, number, al));
}
performEdit(0, null);
}
- public EditCommand(String description, int command, String replace,
+ public EditCommand(String description, Action command, String replace,
SequenceI[] seqs, int position, int number, AlignmentI al)
{
this.description = description;
- if (command == REPLACE)
+ if (command == Action.REPLACE)
{
- edits = new Edit[]
- { new Edit(command, seqs, position, number, al, replace) };
+ setEdit(new Edit(command, seqs, position, number, al, replace));
}
performEdit(0, null);
}
+ /**
+ * Set the list of edits to the specified item (only).
+ *
+ * @param e
+ */
+ protected void setEdit(Edit e)
+ {
+ edits.clear();
+ edits.add(e);
+ }
+
+ /**
+ * Add the given edit command to the stored list of commands.
+ *
+ * @param e
+ */
+ protected void addEdit(Edit e)
+ {
+ edits.add(e);
+ }
+
+ /**
+ * Clear the list of stored edit commands.
+ *
+ */
+ protected void clearEdits()
+ {
+ edits.clear();
+ }
+
+ /**
+ * Returns the i'th stored Edit command.
+ *
+ * @param i
+ * @return
+ */
+ protected Edit getEdit(int i)
+ {
+ if (i >= 0 && i < edits.size())
+ {
+ return edits.get(i);
+ }
+ return null;
+ }
+
@Override
final public String getDescription()
{
@@ -114,12 +152,17 @@ public class EditCommand implements CommandI
@Override
public int getSize()
{
- return edits == null ? 0 : edits.length;
+ return edits.size();
}
+ /**
+ * Return the alignment for the first edit (or null if no edit).
+ *
+ * @return
+ */
final public AlignmentI getAlignment()
{
- return edits[0].al;
+ return (edits.isEmpty() ? null : edits.get(0).al);
}
/**
@@ -135,7 +178,8 @@ public class EditCommand implements CommandI
* @param al
* @param performEdit
*/
- final public void appendEdit(int command, SequenceI[] seqs, int position,
+ final public void appendEdit(Action command, SequenceI[] seqs,
+ int position,
int number, AlignmentI al, boolean performEdit)
{
appendEdit(command, seqs, position, number, al, performEdit, null);
@@ -153,7 +197,8 @@ public class EditCommand implements CommandI
* @param performEdit
* @param views
*/
- final public void appendEdit(int command, SequenceI[] seqs, int position,
+ final public void appendEdit(Action command, SequenceI[] seqs,
+ int position,
int number, AlignmentI al, boolean performEdit, AlignmentI[] views)
{
Edit edit = new Edit(command, seqs, position, number,
@@ -164,52 +209,62 @@ public class EditCommand implements CommandI
edit.fullAlignmentHeight = true;
}
- if (edits != null)
- {
- Edit[] temp = new Edit[edits.length + 1];
- System.arraycopy(edits, 0, temp, 0, edits.length);
- edits = temp;
- edits[edits.length - 1] = edit;
- }
- else
- {
- edits = new Edit[]
- { edit };
- }
+ edits.add(edit);
if (performEdit)
{
- performEdit(edits.length - 1, views);
+ performEdit(edit, views);
}
}
+ /**
+ * Execute all the edit commands, starting at the given commandIndex
+ *
+ * @param commandIndex
+ * @param views
+ */
final void performEdit(int commandIndex, AlignmentI[] views)
{
- int eSize = edits.length;
- for (int e = commandIndex; e < eSize; e++)
+ ListIterator iterator = edits.listIterator(commandIndex);
+ while (iterator.hasNext())
{
- switch (edits[e].command)
- {
- case INSERT_GAP:
- insertGap(edits[e]);
- break;
- case DELETE_GAP:
- deleteGap(edits[e]);
- break;
- case CUT:
- cut(edits[e], views);
- break;
- case PASTE:
- paste(edits[e], views);
- break;
- case REPLACE:
- replace(edits[e]);
- break;
+ Edit edit = iterator.next();
+ performEdit(edit, views);
+ }
+ }
+
+ /**
+ * Execute one edit command in all the specified alignment views
+ *
+ * @param edit
+ * @param views
+ */
+ protected void performEdit(Edit edit, AlignmentI[] views)
+ {
+ switch (edit.command)
+ {
+ case INSERT_GAP:
+ insertGap(edit);
+ break;
+ case DELETE_GAP:
+ deleteGap(edit);
+ break;
+ case CUT:
+ cut(edit, views);
+ break;
+ case PASTE:
+ paste(edit, views);
+ break;
+ case REPLACE:
+ replace(edit);
+ break;
+ case INSERT_NUC:
// TODO:add deleteNuc for UNDO
// case INSERT_NUC:
// insertNuc(edits[e]);
- // break;
- }
+ break;
+ default:
+ break;
}
}
@@ -219,32 +274,49 @@ public class EditCommand implements CommandI
performEdit(0, views);
}
+ /**
+ * Undo the stored list of commands, in reverse order.
+ */
@Override
final public void undoCommand(AlignmentI[] views)
{
- for(Edit e : edits){
- switch (e.command)
- {
- case INSERT_GAP:
- deleteGap(e);
- break;
- case DELETE_GAP:
- insertGap(e);
- break;
- case CUT:
- paste(e, views);
- break;
- case PASTE:
- cut(e, views);
- break;
- case REPLACE:
- replace(e);
- break;
- }
+ ListIterator iterator = edits.listIterator(edits.size());
+ while (iterator.hasPrevious())
+ {
+ Edit e = iterator.previous();
+ switch (e.command)
+ {
+ case INSERT_GAP:
+ deleteGap(e);
+ break;
+ case DELETE_GAP:
+ insertGap(e);
+ break;
+ case CUT:
+ paste(e, views);
+ break;
+ case PASTE:
+ cut(e, views);
+ break;
+ case REPLACE:
+ replace(e);
+ break;
+ case INSERT_NUC:
+ // not implemented
+ break;
+ default:
+ break;
+ }
}
}
- final void insertGap(Edit command)
+ /**
+ * Insert gap(s) in sequences as specified by the command, and adjust
+ * annotations.
+ *
+ * @param command
+ */
+ final private void insertGap(Edit command)
{
for (int s = 0; s < command.seqs.length; s++)
@@ -270,7 +342,13 @@ public class EditCommand implements CommandI
// adjustAnnotations(command, true, false, null);
// }
- final void deleteGap(Edit command)
+ /**
+ * Delete gap(s) in sequences as specified by the command, and adjust
+ * annotations.
+ *
+ * @param command
+ */
+ final private void deleteGap(Edit command)
{
for (int s = 0; s < command.seqs.length; s++)
{
@@ -281,6 +359,13 @@ public class EditCommand implements CommandI
adjustAnnotations(command, false, false, null);
}
+ /**
+ * Carry out a Cut action. The cut characters are saved in case Undo is
+ * requested.
+ *
+ * @param command
+ * @param views
+ */
void cut(Edit command, AlignmentI[] views)
{
boolean seqDeleted = false;
@@ -288,29 +373,30 @@ public class EditCommand implements CommandI
for (int i = 0; i < command.seqs.length; i++)
{
- if (command.seqs[i].getLength() > command.position)
+ final SequenceI sequence = command.seqs[i];
+ if (sequence.getLength() > command.position)
{
- command.string[i] = command.seqs[i].getSequence(command.position,
+ command.string[i] = sequence.getSequence(command.position,
command.position + command.number);
- SequenceI oldds = command.seqs[i].getDatasetSequence();
+ SequenceI oldds = sequence.getDatasetSequence();
if (command.oldds != null && command.oldds[i] != null)
{
// we are redoing an undone cut.
- command.seqs[i].setDatasetSequence(null);
+ sequence.setDatasetSequence(null);
}
- command.seqs[i].deleteChars(command.position, command.position
+ sequence.deleteChars(command.position, command.position
+ command.number);
if (command.oldds != null && command.oldds[i] != null)
{
// oldds entry contains the cut dataset sequence.
- command.seqs[i].setDatasetSequence(command.oldds[i]);
+ sequence.setDatasetSequence(command.oldds[i]);
command.oldds[i] = oldds;
}
else
{
// modify the oldds if necessary
- if (oldds != command.seqs[i].getDatasetSequence()
- || command.seqs[i].getSequenceFeatures() != null)
+ if (oldds != sequence.getDatasetSequence()
+ || sequence.getSequenceFeatures() != null)
{
if (command.oldds == null)
{
@@ -320,16 +406,16 @@ public class EditCommand implements CommandI
adjustFeatures(
command,
i,
- command.seqs[i].findPosition(command.position),
- command.seqs[i].findPosition(command.position
+ sequence.findPosition(command.position),
+ sequence.findPosition(command.position
+ command.number), false);
}
}
}
- if (command.seqs[i].getLength() < 1)
+ if (sequence.getLength() < 1)
{
- command.al.deleteSequence(command.seqs[i]);
+ command.al.deleteSequence(sequence);
seqDeleted = true;
}
}
@@ -337,6 +423,13 @@ public class EditCommand implements CommandI
adjustAnnotations(command, false, seqDeleted, views);
}
+ /**
+ * Perform the given Paste command. This may be to add cut or copied sequences
+ * to an alignment, or to undo a 'Cut' action on a region of the alignment.
+ *
+ * @param command
+ * @param views
+ */
void paste(Edit command, AlignmentI[] views)
{
StringBuffer tmp;
@@ -540,7 +633,7 @@ public class EditCommand implements CommandI
if (modifyVisibility && !insert)
{
// only occurs if a sequence was added or deleted.
- command.deletedAnnotationRows = new Hashtable();
+ command.deletedAnnotationRows = new Hashtable();
}
if (command.fullAlignmentHeight)
{
@@ -624,7 +717,7 @@ public class EditCommand implements CommandI
&& command.deletedAnnotationRows
.containsKey(command.seqs[s]))
{
- AlignmentAnnotation[] revealed = (AlignmentAnnotation[]) command.deletedAnnotationRows
+ AlignmentAnnotation[] revealed = command.deletedAnnotationRows
.get(command.seqs[s]);
command.seqs[s].setAlignmentAnnotation(revealed);
if (revealed != null)
@@ -695,7 +788,7 @@ public class EditCommand implements CommandI
if (!insert)
{
- command.deletedAnnotations = new Hashtable();
+ command.deletedAnnotations = new Hashtable();
}
int aSize;
@@ -758,7 +851,7 @@ public class EditCommand implements CommandI
&& command.deletedAnnotations
.containsKey(annotations[a].annotationId))
{
- Annotation[] restore = (Annotation[]) command.deletedAnnotations
+ Annotation[] restore = command.deletedAnnotations
.get(annotations[a].annotationId);
System.arraycopy(restore, 0, temp, command.position,
@@ -776,7 +869,7 @@ public class EditCommand implements CommandI
&& command.deletedAnnotations
.containsKey(annotations[a].annotationId))
{
- Annotation[] restore = (Annotation[]) command.deletedAnnotations
+ Annotation[] restore = command.deletedAnnotations
.get(annotations[a].annotationId);
temp = new Annotation[annotations[a].annotations.length
@@ -871,7 +964,7 @@ public class EditCommand implements CommandI
if (command.editedFeatures != null
&& command.editedFeatures.containsKey(seq))
{
- sequence.setSequenceFeatures((SequenceFeature[]) command.editedFeatures
+ sequence.setSequenceFeatures(command.editedFeatures
.get(seq));
}
@@ -927,7 +1020,7 @@ public class EditCommand implements CommandI
if (command.editedFeatures == null)
{
- command.editedFeatures = new Hashtable();
+ command.editedFeatures = new Hashtable();
}
command.editedFeatures.put(seq, oldsf);
@@ -940,15 +1033,15 @@ public class EditCommand implements CommandI
boolean fullAlignmentHeight = false;
- Hashtable deletedAnnotationRows;
+ Hashtable deletedAnnotationRows;
- Hashtable deletedAnnotations;
+ Hashtable deletedAnnotations;
- Hashtable editedFeatures;
+ Hashtable editedFeatures;
AlignmentI al;
- int command;
+ Action command;
char[][] string;
@@ -960,7 +1053,7 @@ public class EditCommand implements CommandI
char gapChar;
- Edit(int command, SequenceI[] seqs, int position, int number,
+ Edit(Action command, SequenceI[] seqs, int position, int number,
char gapChar)
{
this.command = command;
@@ -970,7 +1063,7 @@ public class EditCommand implements CommandI
this.gapChar = gapChar;
}
- Edit(int command, SequenceI[] seqs, int position, int number,
+ Edit(Action command, SequenceI[] seqs, int position, int number,
AlignmentI al)
{
this.gapChar = al.getGapCharacter();
@@ -989,7 +1082,7 @@ public class EditCommand implements CommandI
fullAlignmentHeight = (al.getHeight() == seqs.length);
}
- Edit(int command, SequenceI[] seqs, int position, int number,
+ Edit(Action command, SequenceI[] seqs, int position, int number,
AlignmentI al, String replace)
{
this.command = command;
diff --git a/src/jalview/commands/RemoveGapColCommand.java b/src/jalview/commands/RemoveGapColCommand.java
index 6172ce8..ac93d4e 100644
--- a/src/jalview/commands/RemoveGapColCommand.java
+++ b/src/jalview/commands/RemoveGapColCommand.java
@@ -39,7 +39,8 @@ package jalview.commands;
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
public class RemoveGapColCommand extends EditCommand
{
@@ -55,7 +56,7 @@ public class RemoveGapColCommand extends EditCommand
int startCol = -1, endCol = -1;
columnsDeleted = 0;
- edits = new Edit[0];
+ clearEdits();
boolean delete = true;
for (int i = start; i <= end; i++)
@@ -86,7 +87,8 @@ public class RemoveGapColCommand extends EditCommand
if (!delete && startCol > -1)
{
- this.appendEdit(DELETE_GAP, seqs, startCol - columnsDeleted, endCol
+ this.appendEdit(Action.DELETE_GAP, seqs, startCol - columnsDeleted,
+ endCol
- startCol, al, false, null);
columnsDeleted += (endCol - startCol);
@@ -100,7 +102,8 @@ public class RemoveGapColCommand extends EditCommand
// This is for empty columns at the
// end of the alignment
- this.appendEdit(DELETE_GAP, seqs, startCol - columnsDeleted, end
+ this.appendEdit(Action.DELETE_GAP, seqs, startCol - columnsDeleted,
+ end
- startCol + 1, al, false, null);
columnsDeleted += (end - startCol + 1);
diff --git a/src/jalview/commands/RemoveGapsCommand.java b/src/jalview/commands/RemoveGapsCommand.java
index 2e8d744..60d09f7 100644
--- a/src/jalview/commands/RemoveGapsCommand.java
+++ b/src/jalview/commands/RemoveGapsCommand.java
@@ -39,7 +39,8 @@ package jalview.commands;
* Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
-import jalview.datamodel.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.SequenceI;
public class RemoveGapsCommand extends EditCommand
{
@@ -74,7 +75,7 @@ public class RemoveGapsCommand extends EditCommand
int j, jSize;
- edits = new Edit[0];
+ clearEdits();
boolean delete = true;
char[] sequence;
@@ -108,7 +109,7 @@ public class RemoveGapsCommand extends EditCommand
if (!delete && startCol > -1)
{
- this.appendEdit(DELETE_GAP, new SequenceI[]
+ this.appendEdit(Action.DELETE_GAP, new SequenceI[]
{ seqs[s] }, start + startCol - deletedCols, endCol - startCol,
al, false, null);
@@ -119,7 +120,7 @@ public class RemoveGapsCommand extends EditCommand
}
if (delete && startCol > -1)
{
- this.appendEdit(DELETE_GAP, new SequenceI[]
+ this.appendEdit(Action.DELETE_GAP, new SequenceI[]
{ seqs[s] }, start + startCol - deletedCols, jSize - startCol, al,
false, null);
}
diff --git a/src/jalview/commands/SlideSequencesCommand.java b/src/jalview/commands/SlideSequencesCommand.java
index 1ad3d9e..382085c 100644
--- a/src/jalview/commands/SlideSequencesCommand.java
+++ b/src/jalview/commands/SlideSequencesCommand.java
@@ -20,7 +20,7 @@
*/
package jalview.commands;
-import jalview.datamodel.*;
+import jalview.datamodel.SequenceI;
public class SlideSequencesCommand extends EditCommand
{
@@ -37,21 +37,29 @@ public class SlideSequencesCommand extends EditCommand
for (i = 0; i < lSize; i++)
{
for (j = 0; j < slideSize; j++)
+ {
if (!jalview.util.Comparison.isGap(seqsLeft[i].getCharAt(j)))
{
gapsInsertedBegin = true;
break;
}
+ }
}
+ Edit e = null;
+
if (!gapsInsertedBegin)
- edits = new Edit[]
- { new Edit(DELETE_GAP, seqsLeft, 0, slideSize, gapChar) };
+ {
+ e = new Edit(Action.DELETE_GAP, seqsLeft, 0, slideSize, gapChar);
+ setEdit(e);
+ }
else
- edits = new Edit[]
- { new Edit(INSERT_GAP, seqsRight, 0, slideSize, gapChar) };
+ {
+ e = new Edit(Action.INSERT_GAP, seqsRight, 0, slideSize, gapChar);
+ setEdit(e);
+ }
- performEdit(0, null);
+ performEdit(e, null);
}
public boolean getGapsInsertedBegin()
@@ -63,12 +71,12 @@ public class SlideSequencesCommand extends EditCommand
{
boolean same = false;
- if (command.edits[0].seqs.length == edits[0].seqs.length)
+ if (command.getEdit(0).seqs.length == getEdit(0).seqs.length)
{
same = true;
- for (int i = 0; i < command.edits[0].seqs.length; i++)
+ for (int i = 0; i < command.getEdit(0).seqs.length; i++)
{
- if (edits[0].seqs[i] != command.edits[0].seqs[i])
+ if (getEdit(0).seqs[i] != command.getEdit(0).seqs[i])
{
same = false;
}
@@ -77,10 +85,7 @@ public class SlideSequencesCommand extends EditCommand
if (same)
{
- Edit[] temp = new Edit[command.edits.length + 1];
- System.arraycopy(command.edits, 0, temp, 0, command.edits.length);
- command.edits = temp;
- command.edits[command.edits.length - 1] = edits[0];
+ command.addEdit(getEdit(0));
}
return same;
diff --git a/src/jalview/commands/TrimRegionCommand.java b/src/jalview/commands/TrimRegionCommand.java
index a757d1a..ebbe827 100644
--- a/src/jalview/commands/TrimRegionCommand.java
+++ b/src/jalview/commands/TrimRegionCommand.java
@@ -20,10 +20,13 @@
*/
package jalview.commands;
-import java.util.*;
+import jalview.datamodel.AlignmentI;
+import jalview.datamodel.ColumnSelection;
+import jalview.datamodel.SequenceGroup;
+import jalview.datamodel.SequenceI;
+import jalview.util.ShiftList;
-import jalview.datamodel.*;
-import jalview.util.*;
+import java.util.List;
public class TrimRegionCommand extends EditCommand
{
@@ -39,7 +42,7 @@ public class TrimRegionCommand extends EditCommand
SequenceGroup selectionGroup;
- Vector deletedHiddenColumns;
+ List deletedHiddenColumns;
int columnsDeleted;
@@ -59,8 +62,7 @@ public class TrimRegionCommand extends EditCommand
columnsDeleted = column;
- edits = new Edit[]
- { new Edit(CUT, seqs, 0, column, al) };
+ setEdit(new Edit(Action.CUT, seqs, 0, column, al));
}
else if (command.equalsIgnoreCase(TRIM_RIGHT))
{
@@ -72,17 +74,16 @@ public class TrimRegionCommand extends EditCommand
columnsDeleted = width - 1;
- edits = new Edit[]
- { new Edit(CUT, seqs, column + 1, width, al) };
+ setEdit(new Edit(Action.CUT, seqs, column + 1, width, al));
}
// We need to keep a record of the sequence start
// in order to restore the state after a redo
- int i, isize = edits[0].seqs.length;
+ int i, isize = getEdit(0).seqs.length;
start = new int[isize];
for (i = 0; i < isize; i++)
{
- start[i] = edits[0].seqs[i].getStart();
+ start[i] = getEdit(0).seqs[i].getStart();
}
performEdit(0, null);
@@ -160,7 +161,7 @@ public class TrimRegionCommand extends EditCommand
int[] region;
for (int i = 0; i < deletedHiddenColumns.size(); i++)
{
- region = (int[]) deletedHiddenColumns.elementAt(i);
+ region = deletedHiddenColumns.get(i);
colSel.hideColumns(region[0], region[1]);
}
}
diff --git a/src/jalview/datamodel/AlignmentAnnotation.java b/src/jalview/datamodel/AlignmentAnnotation.java
index 0731991..e137225 100755
--- a/src/jalview/datamodel/AlignmentAnnotation.java
+++ b/src/jalview/datamodel/AlignmentAnnotation.java
@@ -75,9 +75,10 @@ public class AlignmentAnnotation
public SequenceFeature[] _rnasecstr = null;
/**
- * position of annotation resulting in invalid WUSS parsing or -1
+ * position of annotation resulting in invalid WUSS parsing or -1. -2 means
+ * there was no RNA structure in this annotation
*/
- private long invalidrnastruc = -1;
+ private long invalidrnastruc = -2;
/**
* Updates the _rnasecstr field Determines the positions that base pair and
@@ -110,10 +111,47 @@ public class AlignmentAnnotation
isrna = true;
showAllColLabels = true;
scaleColLabel = true;
+ _markRnaHelices();
}
// System.out.println("featuregroup " + _rnasecstr[0].getFeatureGroup());
+
}
+ private void _markRnaHelices()
+ {
+ int mxval = 0;
+ // Figure out number of helices
+ // Length of rnasecstr is the number of pairs of positions that base pair
+ // with each other in the secondary structure
+ for (int x = 0; x < _rnasecstr.length; x++)
+ {
+
+ /*
+ * System.out.println(this.annotation._rnasecstr[x] + " Begin" +
+ * this.annotation._rnasecstr[x].getBegin());
+ */
+ // System.out.println(this.annotation._rnasecstr[x].getFeatureGroup());
+ int val = 0;
+ try
+ {
+ val = Integer.valueOf(_rnasecstr[x].getFeatureGroup());
+ if (mxval < val)
+ {
+ mxval = val;
+ }
+ } catch (NumberFormatException q)
+ {
+ }
+ ;
+
+ annotations[_rnasecstr[x].getBegin()].value = val;
+ annotations[_rnasecstr[x].getEnd()].value = val;
+
+ // annotations[_rnasecstr[x].getBegin()].displayCharacter = "" + val;
+ // annotations[_rnasecstr[x].getEnd()].displayCharacter = "" + val;
+ }
+ setScore(mxval);
+ }
/**
* map of positions in the associated annotation
*/
@@ -455,11 +493,10 @@ public class AlignmentAnnotation
@Override
public char charAt(int index)
{
- String dc;
return ((index + offset < 0) || (index + offset) >= max
- || annotations[index + offset] == null || (dc = annotations[index
- + offset].displayCharacter.trim()).length() < 1) ? '.' : dc
- .charAt(0);
+ || annotations[index + offset] == null || (annotations[index
+ + offset].secondaryStructure < ' ') ? ' '
+ : annotations[index + offset].secondaryStructure);
}
public String toString()
@@ -469,9 +506,8 @@ public class AlignmentAnnotation
for (int i = offset; i < mx; i++)
{
- String dc;
- string[i] = (annotations[i] == null || (dc = annotations[i].displayCharacter
- .trim()).length() < 1) ? '.' : dc.charAt(0);
+ string[i] = (annotations[i] == null || (annotations[i].secondaryStructure < 32)) ? ' '
+ : annotations[i].secondaryStructure;
}
return new String(string);
}
diff --git a/src/jalview/datamodel/ColumnSelection.java b/src/jalview/datamodel/ColumnSelection.java
index 35d467a..f414d13 100644
--- a/src/jalview/datamodel/ColumnSelection.java
+++ b/src/jalview/datamodel/ColumnSelection.java
@@ -20,9 +20,12 @@
*/
package jalview.datamodel;
-import java.util.*;
+import jalview.util.ShiftList;
-import jalview.util.*;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Vector;
/**
* NOTE: Columns are zero based.
@@ -186,9 +189,9 @@ public class ColumnSelection
* @param left
* shift in edit (+ve for removal, or -ve for inserts)
*/
- public Vector compensateForEdit(int start, int change)
+ public List compensateForEdit(int start, int change)
{
- Vector deletedHiddenColumns = null;
+ List deletedHiddenColumns = null;
for (int i = 0; i < size(); i++)
{
int temp = columnAt(i);
@@ -201,14 +204,14 @@ public class ColumnSelection
if (hiddenColumns != null)
{
- deletedHiddenColumns = new Vector();
+ deletedHiddenColumns = new ArrayList();
int hSize = hiddenColumns.size();
for (int i = 0; i < hSize; i++)
{
int[] region = (int[]) hiddenColumns.elementAt(i);
if (region[0] > start && start + change > region[1])
{
- deletedHiddenColumns.addElement(hiddenColumns.elementAt(i));
+ deletedHiddenColumns.add(region);
hiddenColumns.removeElementAt(i);
i--;
@@ -752,6 +755,7 @@ public class ColumnSelection
public boolean isVisible(int column)
{
if (hiddenColumns != null)
+ {
for (int i = 0; i < hiddenColumns.size(); i++)
{
int[] region = (int[]) hiddenColumns.elementAt(i);
@@ -760,6 +764,7 @@ public class ColumnSelection
return false;
}
}
+ }
return true;
}
@@ -1018,7 +1023,9 @@ public class ColumnSelection
w += els.length;
}
if (w == 0)
+ {
return;
+ }
Enumeration e = annels.elements();
alignmentAnnotation.annotations = new Annotation[w];
w = 0;
diff --git a/src/jalview/exceptions/JalviewException.java b/src/jalview/exceptions/JalviewException.java
new file mode 100644
index 0000000..80e0b08
--- /dev/null
+++ b/src/jalview/exceptions/JalviewException.java
@@ -0,0 +1,25 @@
+package jalview.exceptions;
+
+@SuppressWarnings("serial")
+public class JalviewException extends Exception
+{
+ public JalviewException(String exceptionMessage)
+ {
+ super(exceptionMessage);
+ }
+
+ public JalviewException()
+ {
+ super();
+ }
+
+ public JalviewException(String exceptionMessage, Throwable cause)
+ {
+ super(exceptionMessage, cause);
+ }
+
+ public JalviewException(Throwable cause)
+ {
+ super(cause);
+ }
+}
diff --git a/src/jalview/exceptions/NoFileSelectedException.java b/src/jalview/exceptions/NoFileSelectedException.java
new file mode 100644
index 0000000..5c56f47
--- /dev/null
+++ b/src/jalview/exceptions/NoFileSelectedException.java
@@ -0,0 +1,10 @@
+package jalview.exceptions;
+
+@SuppressWarnings("serial")
+public class NoFileSelectedException extends JalviewException
+{
+ public NoFileSelectedException(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/src/jalview/ext/jmol/PDBFileWithJmol.java b/src/jalview/ext/jmol/PDBFileWithJmol.java
index 9fa6bf4..f5710d3 100644
--- a/src/jalview/ext/jmol/PDBFileWithJmol.java
+++ b/src/jalview/ext/jmol/PDBFileWithJmol.java
@@ -186,9 +186,12 @@ public class PDBFileWithJmol extends AlignFile implements
seqs.add(sq);
if (!isNa)
{
+ String mt = model.getModelTitle() == null ? getDataName()
+ : model.getModelTitle();
+ mt += _lastChainId;
AlignmentAnnotation ann = new AlignmentAnnotation(
"Secondary Structure",
- "Secondary Structure from PDB File", asecstr);
+ "Secondary Structure for " + mt, asecstr);
ann.belowAlignment=true;
ann.visible=true;
ann.autoCalculated=false;
diff --git a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
index 090b61d..fb03f04 100644
--- a/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
+++ b/src/jalview/ext/rbvi/chimera/JalviewChimeraBinding.java
@@ -343,8 +343,7 @@ public abstract class JalviewChimeraBinding extends
public void colourByChain()
{
colourBySequence = false;
- // this is not a valid Chimera command; is there one? Menu option hidden
- evalStateCommand("select *;color chain",false);
+ evalStateCommand("rainbow chain", false);
}
public void colourByCharge()
diff --git a/src/jalview/gui/AlignFrame.java b/src/jalview/gui/AlignFrame.java
index 684e7ac..04df3d6 100644
--- a/src/jalview/gui/AlignFrame.java
+++ b/src/jalview/gui/AlignFrame.java
@@ -34,6 +34,7 @@ import jalview.api.analysis.ScoreModelI;
import jalview.bin.Cache;
import jalview.commands.CommandI;
import jalview.commands.EditCommand;
+import jalview.commands.EditCommand.Action;
import jalview.commands.OrderCommand;
import jalview.commands.RemoveGapColCommand;
import jalview.commands.RemoveGapsCommand;
@@ -53,6 +54,7 @@ import jalview.datamodel.SequenceGroup;
import jalview.datamodel.SequenceI;
import jalview.io.AlignmentProperties;
import jalview.io.AnnotationFile;
+import jalview.io.BioJsHTMLOutput;
import jalview.io.FeaturesFile;
import jalview.io.FileLoader;
import jalview.io.FormatAdapter;
@@ -1231,6 +1233,12 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
}
+ @Override
+ public void bioJSMenuItem_actionPerformed(ActionEvent e)
+ {
+ new BioJsHTMLOutput(alignPanel,
+ alignPanel.seqPanel.seqCanvas.getFeatureRenderer());
+ }
public void createImageMap(File file, String image)
{
alignPanel.makePNGImageMap(file, image);
@@ -1410,7 +1418,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
if (viewport.historyList.size() > 0)
{
undoMenuItem.setEnabled(true);
- CommandI command = (CommandI) viewport.historyList.peek();
+ CommandI command = viewport.historyList.peek();
undoMenuItem.setText(MessageManager.formatMessage(
"label.undo_command", new String[]
{ command.getDescription() }));
@@ -1425,7 +1433,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
redoMenuItem.setEnabled(true);
- CommandI command = (CommandI) viewport.redoList.peek();
+ CommandI command = viewport.redoList.peek();
redoMenuItem.setText(MessageManager.formatMessage(
"label.redo_command", new String[]
{ command.getDescription() }));
@@ -1489,7 +1497,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
{
return;
}
- CommandI command = (CommandI) viewport.historyList.pop();
+ CommandI command = viewport.historyList.pop();
viewport.redoList.push(command);
command.undoCommand(getViewAlignments());
@@ -1528,7 +1536,7 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
return;
}
- CommandI command = (CommandI) viewport.redoList.pop();
+ CommandI command = viewport.redoList.pop();
viewport.historyList.push(command);
command.doCommand(getViewAlignments());
@@ -1990,7 +1998,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
// /////
// ADD HISTORY ITEM
//
- addHistoryItem(new EditCommand(MessageManager.getString("label.add_sequences"), EditCommand.PASTE,
+ addHistoryItem(new EditCommand(
+ MessageManager.getString("label.add_sequences"),
+ Action.PASTE,
sequences, 0, alignment.getWidth(), alignment));
}
// Add any annotations attached to sequences
@@ -2261,8 +2271,9 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
/*
* //ADD HISTORY ITEM
*/
- addHistoryItem(new EditCommand(MessageManager.getString("label.cut_sequences"), EditCommand.CUT, cut,
- sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
+ addHistoryItem(new EditCommand(
+ MessageManager.getString("label.cut_sequences"), Action.CUT,
+ cut, sg.getStartRes(), sg.getEndRes() - sg.getStartRes() + 1,
viewport.getAlignment()));
viewport.setSelectionGroup(null);
@@ -5797,7 +5808,8 @@ public class AlignFrame extends GAlignFrame implements DropTargetListener,
aa.visible = visible;
}
}
- this.alignPanel.paintAlignment(true);
+ alignPanel.validateAnnotationDimensions(false);
+ alignPanel.alignmentChanged();
}
/**
diff --git a/src/jalview/gui/AlignViewport.java b/src/jalview/gui/AlignViewport.java
index 5c383d8..632d2b2 100644
--- a/src/jalview/gui/AlignViewport.java
+++ b/src/jalview/gui/AlignViewport.java
@@ -42,9 +42,8 @@ import jalview.analysis.AnnotationSorter.SequenceAnnotationOrder;
import jalview.analysis.NJTree;
import jalview.api.AlignViewportI;
import jalview.bin.Cache;
-import jalview.datamodel.AlignmentAnnotation;
+import jalview.commands.CommandI;
import jalview.datamodel.AlignmentI;
-import jalview.datamodel.Annotation;
import jalview.datamodel.ColumnSelection;
import jalview.datamodel.PDBEntry;
import jalview.datamodel.Sequence;
@@ -130,7 +129,7 @@ public class AlignViewport extends AlignmentViewport implements
* Keys are the feature types which are currently visible. Note: Values are
* not used!
*/
- Hashtable featuresDisplayed = null;
+ private Hashtable featuresDisplayed = null;
boolean antiAlias = false;
@@ -140,9 +139,9 @@ public class AlignViewport extends AlignmentViewport implements
boolean gatherViewsHere = false;
- Stack historyList = new Stack();
+ Stack historyList = new Stack();
- Stack redoList = new Stack();
+ Stack redoList = new Stack();
int thresholdTextColour = 0;
@@ -337,10 +336,6 @@ public class AlignViewport extends AlignmentViewport implements
false);
showGroupConsensus = Cache.getDefault("SHOW_GROUP_CONSENSUS", false);
showConsensus = Cache.getDefault("SHOW_IDENTITY", true);
- consensus = new AlignmentAnnotation("Consensus", "PID",
- new Annotation[1], 0f, 100f, AlignmentAnnotation.BAR_GRAPH);
- consensus.hasText = true;
- consensus.autoCalculated = true;
}
initAutoAnnotation();
if (jalview.bin.Cache.getProperty("DEFAULT_COLOUR") != null)
@@ -1279,6 +1274,16 @@ public class AlignViewport extends AlignmentViewport implements
}
}
+
+ public Hashtable getFeaturesDisplayed()
+ {
+ return featuresDisplayed;
+ }
+
+ public void setFeaturesDisplayed(Hashtable featuresDisplayed)
+ {
+ this.featuresDisplayed = featuresDisplayed;
+ }
protected SequenceAnnotationOrder getSortAnnotationsBy()
{
return sortAnnotationsBy;
diff --git a/src/jalview/gui/AnnotationExporter.java b/src/jalview/gui/AnnotationExporter.java
index 315c3e2..ecf4b8e 100644
--- a/src/jalview/gui/AnnotationExporter.java
+++ b/src/jalview/gui/AnnotationExporter.java
@@ -210,11 +210,11 @@ public class AnnotationExporter extends JPanel
private Hashtable getDisplayedFeatureCols()
{
Hashtable fcols = new Hashtable();
- if (ap.av.featuresDisplayed == null)
+ if (ap.av.getFeaturesDisplayed() == null)
{
return fcols;
}
- Enumeration en = ap.av.featuresDisplayed.keys();
+ Enumeration en = ap.av.getFeaturesDisplayed().keys();
FeatureRenderer fr = ap.seqPanel.seqCanvas.getFeatureRenderer(); // consider
// higher
// level
diff --git a/src/jalview/gui/AnnotationLabels.java b/src/jalview/gui/AnnotationLabels.java
index ad6f9e5..6e8417f 100755
--- a/src/jalview/gui/AnnotationLabels.java
+++ b/src/jalview/gui/AnnotationLabels.java
@@ -478,20 +478,29 @@ public class AnnotationLabels extends JPanel implements MouseListener,
{
desc.append(" ");
}
-
+ // if (aa.hasProperties())
+ // {
+ // desc.append("