<li><a href="#groupdefs">SEQUENCE_GROUP</a> to define groups of sequences for further annotation</li>
<li><a href="#groupprops">PROPERTIES</a> to set visualisation properties for sequence groups</li>
<li><a href="#seqgrprefs">SEQUENCE_REF and GROUP_REF</a> for attaching annotation to sequences and groups</li>
- <li><a href="#refsandviews">VIEW_SETREF and HIDE_INSERTIONS</a>
+ <li><a href="#refsandviews">VIEW_SETREF, VIEW_HIDECOLS and HIDE_INSERTIONS</a>
for defining a reference sequence on the alignment and hiding regions
based on gaps in a reference sequence</li>
</ul>
<tr><td width="50%">idColour</td><td>Colour for highlighting the Sequence ID labels for this group<br/>If <em>idColour</em> is given but <em>colour</em> is not, then idColor will also be used for the group background colour.</td></tr>
<tr><td width="50%">showunconserved</td><td>Boolean (default false) indicating whether residues should only be shown that are different from current reference or consensus sequence</td></tr>
<tr><td width="50%">hide</td><td>Boolean (default false) indicating whether the rows in this group should be marked as hidden.<br/><em>Note:</em> if the group is sequence associated (specified by SEQUENCE_REF), then all members will be hidden and marked as represented by the reference sequence.</td></tr>
-<tr><td width="50%">hidecols</td><td>Boolean (default false) indicating whether columns in this groushould be marked as hidden</td></tr></tbody>
+<!-- <tr><td width="50%">hidecols</td><td>Boolean (default false) indicating whether columns in this groushould be marked as hidden</td></tr> --></tbody>
</table>
<p><strong>Specifying colours in PROPERTIES key-value pairs</strong><br/>
<pre>GROUP_REF	<em>ALIGNMENT</em></pre>
</p>
<hr/>
-<p><strong><a name="refsandviews">VIEW_SETREF, and HIDE_INSERTIONS</a></strong><br/>
+<p><strong><a name="refsandviews">VIEW_SETREF, VIEW_HIDECOL and HIDE_INSERTIONS</a></strong><br/>
Since Jalview 2.9, the Annotations file has also supported the definition of views on the alignment, and definition of hidden regions.</p>
<!-- <p>
<em>VIEW_DEF</em> allows the current view to be named according to the
corresponding sequence as the <a href="../features/refsequence.html">reference
sequence</a> for the alignment.
</p>
+ <em>VIEW_HIDECOLS</em> takes either a single argument consisting of a
+ comma separated series of integer pairs like
+ <em>3-4</em>. These integer pairs define columns (starting from the
+ left-hand column 0) that should be marked as hidden in the alignment
+ view.
+ </p>
<p>
<em>HIDE_INSERTIONS</em> takes a either a single sequence ID or a
numeric index, or no arguments. This command marks all gapped
public String printAnnotations(AlignmentAnnotation[] annotations,
List<SequenceGroup> list, Hashtable properties)
{
- return printAnnotations(annotations, list, properties, null);
+ return printAnnotations(annotations, list, properties, null, null, null);
}
* @return annotation file
*/
public String printAnnotations(AlignmentAnnotation[] annotations,
- List<SequenceGroup> list, Hashtable properties, ViewDef[] views)
+ List<SequenceGroup> list, Hashtable properties,
+ ColumnSelection cs, AlignmentI al, ViewDef view)
{
- // TODO: resolve views issue : annotationFile could contain visible region,
- // or full data + hidden region specifications for a view.
- if (views != null)
+ if (view != null)
{
- // are views defined and then annotation added to alignment or the other
- // way around ?
-
+ if (view.viewname != null)
+ {
+ text.append("VIEW_DEF\t" + view.viewname + "\n");
+ }
+ if (list == null)
+ {
+ list = view.visibleGroups;
+ }
+ if (cs == null)
+ {
+ cs = view.hiddencols;
+ }
+ if (al == null)
+ {
+ // add hidden rep sequences.
+ }
+ }
+ // first target - store and restore all settings for a view.
+ if (al != null && al.hasSeqrep())
+ {
+ text.append("VIEW_SETREF\t" + al.getSeqrep().getName() + "\n");
}
+ if (cs != null && cs.hasHiddenColumns())
+ {
+ text.append("VIEW_HIDECOLS\t");
+ List<int[]> hc = cs.getHiddenColumns();
+ boolean comma = false;
+ for (int[] r : hc)
+ {
+ if (!comma)
+ {
+ comma = true;
+ }
+ else
+ {
+ text.append(",");
+ }
+ text.append(r[0]);
+ text.append("-");
+ text.append(r[1]);
+ }
+ text.append("\n");
+ }
+ // TODO: allow efficient recovery of annotation data shown in several
+ // different views
if (annotations != null)
{
boolean oneColour = true;
text.append(properties.get(key));
}
// TODO: output alignment visualization settings here if required
-
+ // iterate through one or more views, defining, marking columns and rows as visible/hidden, and emmitting view properties.
+ // View specific annotation is
}
return text.toString();
modified = true;
continue;
}
+ // else if (token.equalsIgnoreCase("VIEW_DEF"))
+ // {
+ // addOrSetView(al,st);
+ // modified = true;
+ // continue;
+ // }
else if (token.equalsIgnoreCase("VIEW_SETREF"))
{
if (refSeq != null)
modified = true;
continue;
}
+ else if (token.equalsIgnoreCase("VIEW_HIDECOLS"))
+ {
+ if (st.hasMoreTokens())
+ {
+ if (colSel == null)
+ {
+ colSel = new ColumnSelection();
+ }
+ parseHideCols(colSel, st.nextToken());
+ }
+ modified = true;
+ continue;
+ }
else if (token.equalsIgnoreCase("HIDE_INSERTIONS"))
{
SequenceI sr = refSeq == null ? al.getSeqrep() : refSeq;
return modified;
}
+ private void parseHideCols(ColumnSelection colSel, String nextToken)
+ {
+ StringTokenizer inval = new StringTokenizer(nextToken,",");
+ while (inval.hasMoreTokens())
+ {
+ String range = inval.nextToken().trim();
+ int from, to = range.indexOf("-");
+ if (to == -1)
+ {
+ from = to = Integer.parseInt(range);
+ if (from >= 0)
+ {
+ colSel.hideColumns(from, to);
+ }
+ }
+ else
+ {
+ from = Integer.parseInt(range.substring(0, to));
+ if (to < range.length() - 1)
+ {
+ to = Integer.parseInt(range.substring(to + 1));
+ }
+ else
+ {
+ to = from;
+ }
+ if (from > 0 && to >= from)
+ {
+ colSel.hideColumns(from, to);
+ }
+ }
+ }
+ }
+
private Object autoAnnotsKey(AlignmentAnnotation annotation,
SequenceI refSeq, String groupRef)
{
return printAnnotations(viewport.isShowAnnotation() ? viewport
.getAlignment().getAlignmentAnnotation() : null, viewport
.getAlignment().getGroups(), viewport.getAlignment()
- .getProperties());
+ .getProperties(), viewport.getColumnSelection(),
+ viewport.getAlignment(), null);
}
public String printAnnotationsForAlignment(AlignmentI al)
{
return printAnnotations(al.getAlignmentAnnotation(), al.getGroups(),
- al.getProperties());
+ al.getProperties(), null, al, null);
}
}