X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FMSFfile.java;h=0a0520ab3d9bff4d7180b71b4dac2901591c1197;hb=c932f0e85a8852824cdd8ce790af68682732c85c;hp=9036eb4844aa13c46db3daca972d404ae81bd5ca;hpb=db93a1adcbe0a4eaaf06e0a70ade0d6c5c1961c3;p=jalview.git diff --git a/src/jalview/io/MSFfile.java b/src/jalview/io/MSFfile.java index 9036eb4..0a0520a 100755 --- a/src/jalview/io/MSFfile.java +++ b/src/jalview/io/MSFfile.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2) - * Copyright (C) 2015 The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) + * Copyright (C) $$Year-Rel$$ The Jalview Authors * * This file is part of Jalview. * @@ -20,6 +20,8 @@ */ package jalview.io; +import java.util.Locale; + import jalview.datamodel.Sequence; import jalview.datamodel.SequenceI; import jalview.util.Comparison; @@ -58,7 +60,7 @@ public class MSFfile extends AlignFile * @throws IOException * DOCUMENT ME! */ - public MSFfile(String inFile, String type) throws IOException + public MSFfile(String inFile, DataSourceType type) throws IOException { super(inFile, type); } @@ -134,7 +136,7 @@ public class MSFfile extends AlignFile } } catch (IOException e) { - System.err.println("Exception parsing MSFFile " + e); + jalview.bin.Console.errPrintln("Exception parsing MSFFile " + e); e.printStackTrace(); } @@ -167,7 +169,7 @@ public class MSFfile extends AlignFile } else { - System.err.println("MSFFile Parser: Can't find sequence for " + jalview.bin.Console.errPrintln("MSFFile Parser: Can't find sequence for " + headers.get(i)); } } @@ -184,7 +186,7 @@ public class MSFfile extends AlignFile public int checkSum(String seq) { int check = 0; - String sequence = seq.toUpperCase(); + String sequence = seq.toUpperCase(Locale.ROOT); for (int i = 0; i < sequence.length(); i++) { @@ -198,7 +200,7 @@ public class MSFfile extends AlignFile } } catch (Exception e) { - System.err.println("Exception during MSF Checksum calculation"); + jalview.bin.Console.errPrintln("Exception during MSF Checksum calculation"); e.printStackTrace(); } } @@ -216,7 +218,8 @@ public class MSFfile extends AlignFile * * @return DOCUMENT ME! */ - public String print(SequenceI[] sqs) + @Override + public String print(SequenceI[] sqs, boolean jvSuffix) { boolean is_NA = Comparison.isNucleotide(sqs); @@ -277,10 +280,10 @@ public class MSFfile extends AlignFile i++; } - Format maxLenpad = new Format("%" + (new String("" + max)).length() - + "d"); - Format maxChkpad = new Format("%" + (new String("1" + max)).length() - + "d"); + Format maxLenpad = new Format( + "%" + (new String("" + max)).length() + "d"); + Format maxChkpad = new Format( + "%" + (new String("1" + max)).length() + "d"); i = 0; int bigChecksum = 0; @@ -293,7 +296,7 @@ public class MSFfile extends AlignFile } long maxNB = 0; - out.append(" MSF: " + s[0].getSequence().length + " Type: " + out.append(" MSF: " + s[0].getLength() + " Type: " + (is_NA ? "N" : "P") + " Check: " + (bigChecksum % 10000) + " .."); out.append(newline); @@ -307,11 +310,11 @@ public class MSFfile extends AlignFile while ((i < s.length) && (s[i] != null)) { - nameBlock[i] = new String(" Name: " + printId(s[i]) + " "); + nameBlock[i] = new String(" Name: " + printId(s[i], jvSuffix) + " "); - idBlock[i] = new String("Len: " - + maxLenpad.form(s[i].getSequence().length) + " Check: " - + maxChkpad.form(checksums[i]) + " Weight: 1.00" + newline); + idBlock[i] = new String("Len: " + maxLenpad.form(s[i].getLength()) + + " Check: " + maxChkpad.form(checksums[i]) + + " Weight: 1.00" + newline); if (s[i].getName().length() > maxid) { @@ -359,7 +362,7 @@ public class MSFfile extends AlignFile while ((j < s.length) && (s[j] != null)) { - String name = printId(s[j]); + String name = printId(s[j], jvSuffix); out.append(new Format("%-" + maxid + "s").form(name + " ")); @@ -368,8 +371,8 @@ public class MSFfile extends AlignFile int start = (i * 50) + (k * 10); int end = start + 10; - if ((end < s[j].getSequence().length) - && (start < s[j].getSequence().length)) + int length = s[j].getLength(); + if ((end < length) && (start < length)) { out.append(s[j].getSequence(start, end)); @@ -384,7 +387,7 @@ public class MSFfile extends AlignFile } else { - if (start < s[j].getSequence().length) + if (start < length) { out.append(s[j].getSequenceAsString().substring(start)); out.append(newline); @@ -407,15 +410,4 @@ public class MSFfile extends AlignFile return out.toString(); } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - @Override - public String print() - { - return print(getSeqsAsArray()); - } }