git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Watch out for - symbol lin jnet files
[jalview.git]
/
src
/
jalview
/
io
/
AnnotationFile.java
diff --git
a/src/jalview/io/AnnotationFile.java
b/src/jalview/io/AnnotationFile.java
index
d004c1a
..
a211d1a
100755
(executable)
--- a/
src/jalview/io/AnnotationFile.java
+++ b/
src/jalview/io/AnnotationFile.java
@@
-38,7
+38,7
@@
public class AnnotationFile
\r
AlignmentAnnotation row;
\r
String comma;
\r
\r
AlignmentAnnotation row;
\r
String comma;
\r
- String seqref = null;
\r
+ SequenceI seqref = null;
\r
\r
StringBuffer colours = new StringBuffer();
\r
StringBuffer graphLine = new StringBuffer();
\r
\r
StringBuffer colours = new StringBuffer();
\r
StringBuffer graphLine = new StringBuffer();
\r
@@
-55,11
+55,10
@@
public class AnnotationFile
if( row.sequenceRef == null)
\r
seqref = null;
\r
\r
if( row.sequenceRef == null)
\r
seqref = null;
\r
\r
- else if (seqref == null
\r
- || !seqref.equals(row.sequenceRef.getName()))
\r
+ else if (seqref == null || seqref != row.sequenceRef)
\r
{
\r
{
\r
- seqref = row.sequenceRef.getName();
\r
- text.append("\nSEQUENCE_REF\t" + seqref + "\n");
\r
+ seqref = row.sequenceRef;
\r
+ text.append("\nSEQUENCE_REF\t" + seqref.getName() + "\n");
\r
}
\r
\r
\r
}
\r
\r
\r
@@
-98,24
+97,29
@@
public class AnnotationFile
\r
for(int j=0; j<row.annotations.length; j++)
\r
{
\r
\r
for(int j=0; j<row.annotations.length; j++)
\r
{
\r
+ if (seqref != null && jalview.util.Comparison.isGap(seqref.getCharAt(j)))
\r
+ continue;
\r
+
\r
if(row.annotations[j]!=null)
\r
{
\r
comma = "";
\r
if(row.annotations[j]!=null)
\r
{
\r
comma = "";
\r
- if (row.annotations[j].displayCharacter.length() > 0
\r
- && !row.annotations[j].displayCharacter.equals(" "))
\r
- {
\r
- text.append(row.annotations[j].displayCharacter);
\r
- comma = ",";
\r
- }
\r
if (row.annotations[j].secondaryStructure!=' ')
\r
{
\r
text.append(comma + row.annotations[j].secondaryStructure);
\r
comma = ",";
\r
}
\r
if (row.annotations[j].secondaryStructure!=' ')
\r
{
\r
text.append(comma + row.annotations[j].secondaryStructure);
\r
comma = ",";
\r
}
\r
- if (row.annotations[j].value!=0f)
\r
+ if (row.annotations[j].displayCharacter.length() > 0
\r
+ && !row.annotations[j].displayCharacter.equals(" "))
\r
+ {
\r
+ text.append(comma + row.annotations[j].displayCharacter);
\r
+ comma = ",";
\r
+ }
\r
+
\r
+ if (row.annotations[j]!=null)
\r
{
\r
color = row.annotations[j].colour;
\r
{
\r
color = row.annotations[j].colour;
\r
- text.append(comma + row.annotations[j].value);
\r
+ if (row.annotations[j].value!=0f)
\r
+ text.append(comma + row.annotations[j].value);
\r
}
\r
}
\r
text.append("|");
\r
}
\r
}
\r
text.append("|");
\r
@@
-239,6
+243,11
@@
public class AnnotationFile
refSeq = al.findName(st.nextToken());
\r
try{
\r
refSeqIndex = Integer.parseInt(st.nextToken());
\r
refSeq = al.findName(st.nextToken());
\r
try{
\r
refSeqIndex = Integer.parseInt(st.nextToken());
\r
+ if(refSeqIndex<1)
\r
+ {
\r
+ refSeqIndex = 1;
\r
+ System.out.println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile");
\r
+ }
\r
}
\r
catch(Exception ex)
\r
{
\r
}
\r
catch(Exception ex)
\r
{
\r
@@
-287,7
+296,7
@@
public class AnnotationFile
\r
if(refSeq!=null)
\r
{
\r
\r
if(refSeq!=null)
\r
{
\r
- annotation.createSequenceMapping(refSeq, refSeqIndex);
\r
+ annotation.createSequenceMapping(refSeq, refSeqIndex, false);
\r
refSeq.addAlignmentAnnotation(annotation);
\r
}
\r
\r
refSeq.addAlignmentAnnotation(annotation);
\r
}
\r
\r
@@
-307,7
+316,7
@@
public class AnnotationFile
\r
Annotation parseAnnotation(String string)
\r
{
\r
\r
Annotation parseAnnotation(String string)
\r
{
\r
- String desc = "", displayChar="";
\r
+ String desc = null, displayChar="";
\r
char ss = ' '; // secondaryStructure
\r
float value = 0;
\r
boolean parsedValue = false;
\r
char ss = ' '; // secondaryStructure
\r
float value = 0;
\r
boolean parsedValue = false;
\r
@@
-325,6
+334,7
@@
public class AnnotationFile
displayChar = token;
\r
value = new Float(token).floatValue();
\r
parsedValue = true;
\r
displayChar = token;
\r
value = new Float(token).floatValue();
\r
parsedValue = true;
\r
+ continue;
\r
}catch(NumberFormatException ex){}
\r
}
\r
\r
}catch(NumberFormatException ex){}
\r
}
\r
\r
@@
-336,11
+346,21
@@
public class AnnotationFile
if(displayChar.equals(token.substring(0,1)))
\r
displayChar = "";
\r
}
\r
if(displayChar.equals(token.substring(0,1)))
\r
displayChar = "";
\r
}
\r
- else if(desc.length()<1)
\r
+ else if(desc==null)
\r
desc = token;
\r
\r
}
\r
\r
desc = token;
\r
\r
}
\r
\r
+ if(desc == null)
\r
+ desc = value+"";
\r
+
\r
+ if(displayChar.length()>1 && desc.length()==1)
\r
+ {
\r
+ String tmp = displayChar;
\r
+ displayChar = desc;
\r
+ desc = tmp;
\r
+ }
\r
+
\r
return new Annotation(displayChar, desc, ss, value);
\r
}
\r
\r
return new Annotation(displayChar, desc, ss, value);
\r
}
\r
\r
@@
-356,7
+376,7
@@
public class AnnotationFile
for(int j=0; j<annotations.length; j++)
\r
{
\r
if(annotations[j]!=null)
\r
for(int j=0; j<annotations.length; j++)
\r
{
\r
if(annotations[j]!=null)
\r
- annotations[j].colour = ucs.findColour("A");
\r
+ annotations[j].colour = ucs.findColour('A');
\r
}
\r
}
\r
}
\r
}
\r
}
\r
}
\r
@@
-414,7
+434,7
@@
public class AnnotationFile
if(st.hasMoreTokens())
\r
{
\r
UserColourScheme ucs = new UserColourScheme(st.nextToken());
\r
if(st.hasMoreTokens())
\r
{
\r
UserColourScheme ucs = new UserColourScheme(st.nextToken());
\r
- colour = ucs.findColour("A");
\r
+ colour = ucs.findColour('A');
\r
}
\r
\r
annotation.setThreshold(new GraphLine(value, label, colour));
\r
}
\r
\r
annotation.setThreshold(new GraphLine(value, label, colour));
\r