X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFeaturesFile.java;h=64bb539bfafe961aefe5c50deaf77e78ef58a8fe;hb=caf13e6a9dc82023cd8648420201e5ad60ce0393;hp=cfc08fbdcaebb2e8917e9fe0e0c8d0c27e342806;hpb=153dd62dc91da13ae732600e6ea55ddbe15eab39;p=jalview.git diff --git a/src/jalview/io/FeaturesFile.java b/src/jalview/io/FeaturesFile.java index cfc08fb..64bb539 100755 --- a/src/jalview/io/FeaturesFile.java +++ b/src/jalview/io/FeaturesFile.java @@ -165,24 +165,27 @@ public class FeaturesFile extends AlignFile // fifth is either 'above','below', or 'none'. // sixth is a float value and only required when fifth is either // 'above' or 'below'. - StringTokenizer gcol = new StringTokenizer(colscheme, "|", true); + StringTokenizer gcol = new StringTokenizer(colscheme, "|", + true); // set defaults int threshtype = AnnotationColourGradient.NO_THRESHOLD; float min = Float.MIN_VALUE, max = Float.MAX_VALUE, threshval = Float.NaN; boolean labelCol = false; // Parse spec line String mincol = gcol.nextToken(); - if (mincol=="|") + if (mincol == "|") { System.err - .println("Expected either 'label' or a colour specification in the line: "+line ); + .println("Expected either 'label' or a colour specification in the line: " + + line); continue; } String maxcol = null; if (mincol.toLowerCase().indexOf("label") == 0) { labelCol = true; - mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); // skip '|' + mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); // skip + // '|' mincol = (gcol.hasMoreTokens() ? gcol.nextToken() : null); } String abso = null, minval, maxval; @@ -191,16 +194,20 @@ public class FeaturesFile extends AlignFile // at least four more tokens if (mincol.equals("|")) { - mincol=""; - } else { + mincol = ""; + } + else + { gcol.nextToken(); // skip next '|' } // continue parsing rest of line maxcol = gcol.nextToken(); if (maxcol.equals("|")) { - maxcol=""; - } else { + maxcol = ""; + } + else + { gcol.nextToken(); // skip next '|' } abso = gcol.nextToken(); @@ -216,7 +223,8 @@ public class FeaturesFile extends AlignFile gcol.nextToken(); // skip next '|' } maxval = gcol.nextToken(); - if (gcol.hasMoreTokens()) { + if (gcol.hasMoreTokens()) + { gcol.nextToken(); // skip next '|' } try @@ -599,7 +607,7 @@ public class FeaturesFile extends AlignFile } else if (tag != null && tag.equalsIgnoreCase("br")) { - sb.append("\n"); + sb.append(newline); } else if (token.startsWith("lt;")) { @@ -718,7 +726,10 @@ public class FeaturesFile extends AlignFile color = Format.getHexString(new java.awt.Color(Integer .parseInt(visible.get(type).toString()))); } - out.append(type + "\t" + color + "\n"); + out.append(type); + out.append("\t"); + out.append(color); + out.append(newline); } } // Work out which groups are both present and visible @@ -757,7 +768,10 @@ public class FeaturesFile extends AlignFile if (groups.size() > 0 && groupIndex < groups.size()) { group = groups.elementAt(groupIndex).toString(); - out.append("\nSTARTGROUP\t" + group + "\n"); + out.append(newline); + out.append("STARTGROUP\t"); + out.append(group); + out.append(newline); } else { @@ -830,22 +844,28 @@ public class FeaturesFile extends AlignFile out.append("\t"); } - out.append(seqs[i].getName() - + "\t-1\t" - + next[j].begin - + "\t" - + next[j].end - + "\t" - + next[j].type - + ((next[j].score != Float.NaN) ? "\t" + next[j].score - + "\n" : "\n")); + out.append(seqs[i].getName()); + out.append("\t-1\t"); + out.append(next[j].begin); + out.append("\t"); + out.append(next[j].end); + out.append("\t"); + out.append(next[j].type); + if (next[j].score != Float.NaN) + { + out.append("\t"); + out.append(next[j].score); + } + out.append(newline); } } } if (group != null) { - out.append("ENDGROUP\t" + group + "\n"); + out.append("ENDGROUP\t"); + out.append(group); + out.append(newline); groupIndex++; } else @@ -904,13 +924,24 @@ public class FeaturesFile extends AlignFile source = next[j].getDescription(); } - out.append(seqs[i].getName() + "\t" + source + "\t" - + next[j].type + "\t" + next[j].begin + "\t" - + next[j].end + "\t" + next[j].score + "\t"); + out.append(seqs[i].getName()); + out.append("\t"); + out.append(source); + out.append("\t"); + out.append(next[j].type); + out.append( "\t"); + out.append( next[j].begin ); + out.append("\t"); + out.append( + next[j].end); + out.append( "\t"); + out.append( next[j].score); + out.append( "\t"); if (next[j].getValue("STRAND") != null) { - out.append(next[j].getValue("STRAND") + "\t"); + out.append(next[j].getValue("STRAND")); + out.append( "\t"); } else { @@ -925,13 +956,14 @@ public class FeaturesFile extends AlignFile { out.append("."); } + // TODO: verify/check GFF - should there be a /t here before attribute output ? if (next[j].getValue("ATTRIBUTES") != null) { out.append(next[j].getValue("ATTRIBUTES")); } - out.append("\n"); + out.append(newline); } }