textCol1=black<br>
textCol2=black<br>
textColThreshold=0<br>
- idColour=ff3322</p>
-<em>New Features in 2.4:</em><ul><li>if the <strong>idColour</strong> property
+ idColour=ff3322<br>
+ hide=false
+ hidecols=false</p>
+<ul><li>if the <strong>idColour</strong> property
is given without specifying a colour scheme with the <strong>colour</strong>
property, then the idColour will also be used to colour the sequence.</li>
<li>the <strong>colour</strong> property can take either a colour scheme name,
or a single colour specification (either a colour name like 'red' or an RGB
triplet like 'ff0066'). If a single colour is specified, then the group
will be coloured with that colour.</li>
+ <li><em>New Features in 2.4.1</em></li>
+ <li>hide and hidecols instruct jalview to hide the sequences or columns covered by the group.</li>
+ <li>Sequence associated Groups<br>If a group is defined after a valid
+ <em>SEQUENCE_REF</em> sequence reference statement, the sequence representative
+ for the group will be set to the referenced sequence.<br><strong>Note:</strong> if the <em>hide</em>
+ property is set then only the representative sequence for the group will be shown in the alignment.</li>
</ul>
<p> </p>
<p>An example Annotation file is given below:
boolean displayText = true;
boolean colourText = false;
-
+ /**
+ * group members
+ */
private Vector sequences = new Vector();
-
+ /**
+ * representative sequence for this group (if any)
+ */
+ private SequenceI seqrep = null;
int width = -1;
- /** DOCUMENT ME!! */
+ /**
+ * Colourscheme applied to group if any */
public ColourSchemeI cs;
int startRes = 0;
{
this.idColour = idColour;
}
+
+ /**
+ * @return the representative sequence for this group
+ */
+ public SequenceI getSeqrep()
+ {
+ return seqrep;
+ }
+
+ /**
+ * set the representative sequence for this group.
+ * Note - this affects the interpretation of the Hidereps attribute.
+ * @param seqrep the seqrep to set (null means no sequence representative)
+ */
+ public void setSeqrep(SequenceI seqrep)
+ {
+ this.seqrep = seqrep;
+ }
+ /**
+ *
+ * @return true if group has a sequence representative
+ */
+ public boolean hasSeqrep()
+ {
+ return seqrep != null;
+ }
+ /**
+ * visibility of rows or represented rows covered by group
+ */
+ private boolean hidereps=false;
+ /**
+ * set visibility of sequences covered by (if no sequence representative is defined)
+ * or represented by this group.
+ * @param visibility
+ */
+ public void setHidereps(boolean visibility)
+ {
+ hidereps = visibility;
+ }
+ /**
+ *
+ * @return true if sequences represented (or covered) by this group should be hidden
+ */
+ public boolean isHidereps()
+ {
+ return hidereps;
+ }
+ /**
+ * visibility of columns intersecting this group
+ */
+ private boolean hidecols=false;
+ /**
+ * set intended visibility of columns covered by this group
+ * @param visibility
+ */
+ public void setHideCols(boolean visibility)
+ {
+ hidecols = visibility;
+ }
+ /**
+ *
+ * @return true if columns covered by group should be hidden
+ */
+ public boolean isHideCols()
+ {
+ return hidecols;
+ }
}
public ColumnSelection hiddencols;\r
\r
public Vector visibleGroups;\r
-\r
+ public Hashtable hiddenRepSeqs;\r
+ \r
public ViewDef(String viewname, HiddenSequences hidseqs,\r
- ColumnSelection hiddencols)\r
+ ColumnSelection hiddencols, Hashtable hiddenRepSeqs)\r
{\r
this.viewname = viewname;\r
this.hidseqs = hidseqs;\r
this.hiddencols = hiddencols;\r
+ this.hiddenRepSeqs = hiddenRepSeqs;\r
}\r
}\r
\r
public void printGroups(Vector sequenceGroups)\r
{\r
SequenceGroup sg;\r
+ SequenceI seqrep=null;\r
for (int i = 0; i < sequenceGroups.size(); i++)\r
{\r
sg = (SequenceGroup) sequenceGroups.elementAt(i);\r
- text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"\r
- + (sg.getStartRes() + 1) + "\t" + (sg.getEndRes() + 1) + "\t"\r
- + "-1\t");\r
+ if (!sg.hasSeqrep())\r
+ {\r
+ text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"\r
+ + (sg.getStartRes() + 1) + "\t" + (sg.getEndRes() + 1) + "\t"\r
+ + "-1\t");\r
+ seqrep = null;\r
+ } else {\r
+ seqrep = sg.getSeqrep();\r
+ text.append("SEQUENCE_REF\t"+seqrep.getName()+"\n");\r
+ text.append("SEQUENCE_GROUP\t" + sg.getName() + "\t"\r
+ + (seqrep.findPosition(sg.getStartRes())) + "\t" + (seqrep.findPosition(sg.getEndRes())) + "\t"\r
+ + "-1\t");\r
+ }\r
for (int s = 0; s < sg.getSize(); s++)\r
{\r
text.append(sg.getSequenceAt(s).getName() + "\t");\r
}\r
if (sg.thresholdTextColour != 0)\r
{\r
- text.append("textColThreshold=" + sg.thresholdTextColour);\r
+ text.append("textColThreshold=" + sg.thresholdTextColour+"\t");\r
}\r
if (sg.idColour != null)\r
{\r
text.append("idColour="\r
+ jalview.util.Format.getHexString(sg.idColour) + "\t");\r
}\r
-\r
+ if (sg.isHidereps())\r
+ {\r
+ text.append("hide=true\t");\r
+ }\r
+ if (sg.isHideCols())\r
+ {\r
+ text.append("hidecols=true\t");\r
+ }\r
+ if (seqrep!=null)\r
+ {\r
+ // terminate the last line and clear the sequence ref for the group\r
+ text.append("\nSEQUENCE_REF");\r
+ }\r
text.append("\n\n");\r
\r
}\r
\r
annotation.setThreshold(new GraphLine(value, label, colour));\r
}\r
-\r
void addGroup(AlignmentI al, StringTokenizer st)\r
{\r
SequenceGroup sg = new SequenceGroup();\r
sg.setName(st.nextToken());\r
- sg.setStartRes(Integer.parseInt(st.nextToken()) - 1);\r
- sg.setEndRes(Integer.parseInt(st.nextToken()) - 1);\r
+ String rng ="";\r
+ try {\r
+ rng = st.nextToken();\r
+ if (rng.length()>0 && !rng.startsWith("*"))\r
+ {\r
+ sg.setStartRes(Integer.parseInt(rng) - 1);\r
+ } else {\r
+ sg.setStartRes(0);\r
+ }\r
+ rng = st.nextToken();\r
+ if (rng.length()>0 && !rng.startsWith("*"))\r
+ {\r
+ sg.setEndRes(Integer.parseInt(rng) - 1);\r
+ } else {\r
+ sg.setEndRes(al.getWidth()-1);\r
+ }\r
+ } catch (Exception e)\r
+ {\r
+ System.err.println("Couldn't parse Group Start or End Field as '*' or a valid column or sequence index: '"+rng+"' - assuming alignment width for group.");\r
+ // assume group is full width\r
+ sg.setStartRes(0);\r
+ sg.setEndRes(al.getWidth()-1);\r
+ }\r
\r
String index = st.nextToken();\r
if (index.equals("-1"))\r
{\r
sg.setStartRes(refSeq.findIndex(sg.getStartRes() + 1) - 1);\r
sg.setEndRes(refSeq.findIndex(sg.getEndRes() + 1) - 1);\r
+ sg.setSeqrep(refSeq);\r
}\r
\r
if (sg.getSize() > 0)\r
sg.setIdColour((def = new UserColourScheme(value))\r
.findColour('A'));\r
}\r
+ else if (key.equalsIgnoreCase("hide"))\r
+ {\r
+ // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847\r
+ sg.setHidereps(true);\r
+ }\r
+ else if (key.equalsIgnoreCase("hidecols"))\r
+ {\r
+ // see bug https://mantis.lifesci.dundee.ac.uk/view.php?id=25847\r
+ sg.setHideCols(true);\r
+ }\r
sg.recalcConservation();\r
}\r
if (sg.cs == null)\r