X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FClustalFile.java;h=d6188091491f83d54bfe6e4f4460883c91b44d40;hb=c55e1fa5d2782cc46e515c11a91cf502f37386ab;hp=049606d87b3683dbb53e5fb30a043274af65e3fc;hpb=db93a1adcbe0a4eaaf06e0a70ade0d6c5c1961c3;p=jalview.git diff --git a/src/jalview/io/ClustalFile.java b/src/jalview/io/ClustalFile.java index 049606d..d618809 100755 --- a/src/jalview/io/ClustalFile.java +++ b/src/jalview/io/ClustalFile.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. * @@ -37,9 +37,10 @@ public class ClustalFile extends AlignFile { } - public ClustalFile(String inFile, String type) throws IOException + public ClustalFile(String inFile, DataSourceType sourceType) + throws IOException { - super(inFile, type); + super(inFile, sourceType); } public ClustalFile(FileParse source) throws IOException @@ -196,13 +197,7 @@ public class ClustalFile extends AlignFile } @Override - public String print() - { - return print(getSeqsAsArray()); - // TODO: locaRNA style aln output - } - - public String print(SequenceI[] s) + public String print(SequenceI[] s, boolean jvsuffix) { StringBuffer out = new StringBuffer("CLUSTAL" + newline + newline); @@ -213,12 +208,9 @@ public class ClustalFile extends AlignFile while ((i < s.length) && (s[i] != null)) { - String tmp = printId(s[i]); + String tmp = printId(s[i], jvsuffix); - if (s[i].getSequence().length > max) - { - max = s[i].getSequence().length; - } + max = Math.max(max, s[i].getLength()); if (tmp.length() > maxid) { @@ -244,19 +236,20 @@ public class ClustalFile extends AlignFile while ((j < s.length) && (s[j] != null)) { - out.append(new Format("%-" + maxid + "s").form(printId(s[j]) + " ")); + out.append(new Format("%-" + maxid + "s").form(printId(s[j], + jvsuffix) + " ")); int start = i * len; int end = start + len; - 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].getSequenceAsString(start, end)); } else { - if (start < s[j].getSequence().length) + if (start < length) { out.append(s[j].getSequenceAsString().substring(start)); }