X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FAnnotationFile.java;h=a211d1aa415ab7ac9761286137a3a35a77ed6d88;hb=a7bec763a3e4f17a549115f8f9f19ee4c742c26b;hp=08b58629552d758e35baf0e0989213c65870c765;hpb=51eebe77f74dda2f4ff336dfe0fea0ed68b86e5b;p=jalview.git diff --git a/src/jalview/io/AnnotationFile.java b/src/jalview/io/AnnotationFile.java index 08b5862..a211d1a 100755 --- a/src/jalview/io/AnnotationFile.java +++ b/src/jalview/io/AnnotationFile.java @@ -38,7 +38,7 @@ public class AnnotationFile AlignmentAnnotation row; String comma; - String seqref = null; + SequenceI seqref = null; StringBuffer colours = new StringBuffer(); StringBuffer graphLine = new StringBuffer(); @@ -55,11 +55,10 @@ public class AnnotationFile if( row.sequenceRef == null) seqref = null; - else if (seqref == null - || !seqref.equals(row.sequenceRef.getName())) + else if (seqref == null || seqref != row.sequenceRef) { - seqref = row.sequenceRef.getName(); - text.append("\nSEQUENCE_REF\t" + seqref + "\n"); + seqref = row.sequenceRef; + text.append("\nSEQUENCE_REF\t" + seqref.getName() + "\n"); } @@ -98,24 +97,29 @@ public class AnnotationFile for(int j=0; j 0 - && !row.annotations[j].displayCharacter.equals(" ")) - { - text.append(row.annotations[j].displayCharacter); - comma = ","; - } if (row.annotations[j].secondaryStructure!=' ') { text.append(comma + row.annotations[j].secondaryStructure); comma = ","; } - if (row.annotations[j].value!=0f) + if (row.annotations[j].displayCharacter.length() > 0 + && !row.annotations[j].displayCharacter.equals(" ")) + { + text.append(comma + row.annotations[j].displayCharacter); + comma = ","; + } + + if (row.annotations[j]!=null) { color = row.annotations[j].colour; - text.append(comma + row.annotations[j].value); + if (row.annotations[j].value!=0f) + text.append(comma + row.annotations[j].value); } } text.append("|"); @@ -239,6 +243,11 @@ public class AnnotationFile refSeq = al.findName(st.nextToken()); try{ refSeqIndex = Integer.parseInt(st.nextToken()); + if(refSeqIndex<1) + { + refSeqIndex = 1; + System.out.println("WARNING: SEQUENCE_REF index must be > 0 in AnnotationFile"); + } } catch(Exception ex) { @@ -307,7 +316,7 @@ public class AnnotationFile Annotation parseAnnotation(String string) { - String desc = "", displayChar=""; + String desc = null, displayChar=""; char ss = ' '; // secondaryStructure float value = 0; boolean parsedValue = false; @@ -325,6 +334,7 @@ public class AnnotationFile displayChar = token; value = new Float(token).floatValue(); parsedValue = true; + continue; }catch(NumberFormatException ex){} } @@ -336,11 +346,21 @@ public class AnnotationFile if(displayChar.equals(token.substring(0,1))) displayChar = ""; } - else if(desc.length()<1) + else if(desc==null) desc = token; } + if(desc == null) + desc = value+""; + + if(displayChar.length()>1 && desc.length()==1) + { + String tmp = displayChar; + displayChar = desc; + desc = tmp; + } + return new Annotation(displayChar, desc, ss, value); } @@ -356,7 +376,7 @@ public class AnnotationFile for(int j=0; j