From 12b928f827972f429471a5bf7a832fa634259a16 Mon Sep 17 00:00:00 2001
From: jprocter
Any or all value fields may be left empty, as well as the BAR_GRAPH's
@@ -55,11 +55,17 @@ associated with that sequence, and the first field in the Value field
list will (optionally) be placed at the startIndex'th column.
Plots a histogram with labels below each bar.
- number,text character
Draws a line between values on the annotation row.
number
For a row consisting of text labels and/or secondary structure symbols.
- {Secondary Structure Symbol},text label
+ {Secondary Structure Symbol},text label,Tooltip text
Currently supported secondary structure structure symbols are H (for helix) and E (for strand)
Sequence associations are turned off for subsequent annotation definitions by:
SEQUENCE_REF ALIGNMENT+
Since version 2.5, Jalview allows annotation rows to be associated with a group defined on the alignment, by preceding the annotation row with the line: +
GROUP_REF group_name+Group association is turned off for subsequent annotation rows by +
GROUP_REF ALIGNMENT+Annotations may be associated with both a sequence and a group, however - group annotations are still experimental and unexpected behaviour may be observed when editing alignments containing both group and sequence associated annotation rows.
LINE_GRAPH type annotations can be given a colour (specified as 24 bit RGB triplet in hexadecimal or comma separated values), combined onto the same vertical axis, and have ordinate lines @@ -69,13 +75,13 @@ following commands (respectively): COMBINE graph_1_name graph_2_name GRAPHLINE graph_name value label colour -
The visual display properties for a set of annotation rows can be modified using the following tab-delimited line:
ROWPROPERTIES Row label centrelabs=true( or false) showalllabs=true(default is false) scaletofit=true (default is false)
This sets the visual display properties according to the given values for all the annotation rows with labels matching Row label. The properties mostly affect the display of multi-character column labels, and are as follows:
Groups of sequences can be defined using the tab delimited line
@@ -108,8 +114,9 @@ GRAPHLINE graph_name value label colo textCol2=black
An example Annotation file is given below:
diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java
index aac48eb..01daf39 100755
--- a/src/jalview/io/AnnotationFile.java
+++ b/src/jalview/io/AnnotationFile.java
@@ -72,8 +72,11 @@ public class AnnotationFile
this.hiddenRepSeqs = hiddenRepSeqs;
}
}
+
/**
- * Prepare an annotation file given a set of annotations, groups, alignment properties and views.
+ * Prepare an annotation file given a set of annotations, groups, alignment
+ * properties and views.
+ *
* @param annotations
* @param groups
* @param properties
@@ -83,13 +86,15 @@ public class AnnotationFile
public String printAnnotations(AlignmentAnnotation[] annotations,
Vector groups, Hashtable properties, ViewDef[] views)
{
- // TODO: resolve views issue : annotationFile could contain visible region, or full data + hidden region specifications for a view.
+ // TODO: resolve views issue : annotationFile could contain visible region,
+ // or full data + hidden region specifications for a view.
if (annotations != null)
{
boolean oneColour = true;
AlignmentAnnotation row;
String comma;
SequenceI refSeq = null;
+ SequenceGroup refGroup = null;
StringBuffer colours = new StringBuffer();
StringBuffer graphLine = new StringBuffer();
@@ -120,11 +125,34 @@ public class AnnotationFile
refSeq = null;
}
- else if (refSeq == null || refSeq != row.sequenceRef)
+ else
+ {
+ if (refSeq == null || refSeq != row.sequenceRef)
+ {
+ refSeq = row.sequenceRef;
+ text.append("\nSEQUENCE_REF\t" + refSeq.getName() + "\n");
+ }
+ }
+ // mark any group references for the row
+ if (row.groupRef == null)
+ {
+
+ if (refGroup != null)
+ {
+ text.append("\nGROUP_REF\tALIGNMENT\n");
+ }
+
+ refGroup = null;
+ }
+ else
{
- refSeq = row.sequenceRef;
- text.append("\nSEQUENCE_REF\t" + refSeq.getName() + "\n");
+ if (refGroup == null || refGroup != row.groupRef)
+ {
+ refGroup = row.groupRef;
+ text.append("\nGROUP_REF\t" + refGroup.getName() + "\n");
+ }
}
+
boolean hasGlyphs = row.hasIcons, hasLabels = row.hasText, hasValues = row.hasScore, hasText = false;
// lookahead to check what the annotation row object actually contains.
for (int j = 0; row.annotations != null
@@ -138,8 +166,8 @@ public class AnnotationFile
.equals(" "));
hasGlyphs |= (row.annotations[j].secondaryStructure != 0 && row.annotations[j].secondaryStructure != ' ');
hasValues |= (row.annotations[j].value != Float.NaN); // NaNs can't
- // be
- // rendered..
+ // be
+ // rendered..
hasText |= (row.annotations[j].description != null && row.annotations[j].description
.length() > 0);
}
@@ -210,7 +238,7 @@ public class AnnotationFile
if (row.annotations[j] != null)
{
comma = "";
- if (hasGlyphs) // could be also hasGlyphs || ...
+ if (hasGlyphs) // could be also hasGlyphs || ...
{
text.append(comma);
@@ -288,12 +316,13 @@ public class AnnotationFile
colours.append("COLOUR\t" + row.label + "\t"
+ jalview.util.Format.getHexString(color) + "\n");
}
- if (row.scaleColLabel || row.showAllColLabels || row.centreColLabels)
+ if (row.scaleColLabel || row.showAllColLabels
+ || row.centreColLabels)
{
- rowprops.append("ROWPROPERTIES\t"+row.label);
- rowprops.append("\tscaletofit="+row.scaleColLabel);
- rowprops.append("\tshowalllabs="+row.showAllColLabels);
- rowprops.append("\tcentrelabs="+row.centreColLabels);
+ rowprops.append("ROWPROPERTIES\t" + row.label);
+ rowprops.append("\tscaletofit=" + row.scaleColLabel);
+ rowprops.append("\tshowalllabs=" + row.showAllColLabels);
+ rowprops.append("\tcentrelabs=" + row.centreColLabels);
rowprops.append("\n");
}
}
@@ -433,7 +462,10 @@ public class AnnotationFile
public boolean readAnnotationFile(AlignmentI al, String file,
String protocol)
{
- Hashtable autoAnnots=new Hashtable();
+ String groupRef = null;
+ Hashtable groupRefRows = new Hashtable();
+
+ Hashtable autoAnnots = new Hashtable();
try
{
BufferedReader in = null;
@@ -463,21 +495,28 @@ public class AnnotationFile
int graphStyle, index;
int refSeqIndex = 1;
int existingAnnotations = 0;
- // when true - will add new rows regardless of whether they are duplicate auto-annotation like consensus or conservation graphs
- boolean overrideAutoAnnot=false;
+ // when true - will add new rows regardless of whether they are duplicate
+ // auto-annotation like consensus or conservation graphs
+ boolean overrideAutoAnnot = false;
if (al.getAlignmentAnnotation() != null)
{
existingAnnotations = al.getAlignmentAnnotation().length;
- if (existingAnnotations>0)
+ if (existingAnnotations > 0)
{
AlignmentAnnotation[] aa = al.getAlignmentAnnotation();
- for (int aai=0;aai