X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFormatAdapter.java;h=eac1041b9d8625cc4fc3f6e3b3263961396637ca;hb=ee198b3ca3687f18a2ee186f4e7c7330f4ea30f0;hp=ebca31bb8c025ca36ce16e320b5bf212395c6bb2;hpb=4d7f98a6dd54d9863ba449ec79dcd95d25ed863d;p=jalview.git diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index ebca31b..eac1041 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -22,6 +22,7 @@ package jalview.io; import jalview.api.AlignExportSettingI; import jalview.api.AlignmentViewPanel; +import jalview.bin.Cache; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; @@ -30,6 +31,8 @@ import jalview.datamodel.Sequence; import jalview.datamodel.SequenceGroup; import jalview.datamodel.SequenceI; +import java.io.IOException; + /** * Additional formatting methods used by the application in a number of places. * @@ -107,7 +110,6 @@ public class FormatAdapter extends AppletFormatAdapter { startRes = seqs[i].getStart(); endRes = seqs[i].getEnd(); - if (startEnd != null) { startIndex = startEnd[0]; @@ -127,9 +129,7 @@ public class FormatAdapter extends AppletFormatAdapter } startRes = seqs[i].findPosition(startIndex); - startRes = seqs[i].getStart() > 1 ? startRes - seqs[i].getStart() - : startRes; - endRes = seqs[i].findPosition(endIndex) - seqs[i].getStart(); + endRes = seqs[i].findPosition(endIndex); } tmp[i] = new Sequence(seqs[i].getName(), omitHiddenColumns[i], @@ -228,24 +228,24 @@ public class FormatAdapter extends AppletFormatAdapter return null; } - public boolean getCacheSuffixDefault(String format) + public boolean getCacheSuffixDefault(FileFormatI format) { if (isValidFormat(format)) { - return jalview.bin.Cache.getDefault(format.toUpperCase() + return Cache.getDefault(format.toUpperCase() + "_JVSUFFIX", true); } return false; } - public String formatSequences(String format, AlignmentI alignment, + public String formatSequences(FileFormatI format, AlignmentI alignment, String[] omitHidden, int[] exportRange, ColumnSelection colSel) { return formatSequences(format, alignment, omitHidden, exportRange, getCacheSuffixDefault(format), colSel, null); } - public String formatSequences(String format, AlignmentI alignment, + public String formatSequences(FileFormatI format, AlignmentI alignment, String[] omitHidden, int[] exportRange, ColumnSelection colSel, SequenceGroup sgp) { @@ -265,7 +265,7 @@ public class FormatAdapter extends AppletFormatAdapter * defines hidden columns that are edited out of annotation * @return string representation of the alignment formatted as format */ - public String formatSequences(String format, AlignmentI alignment, + public String formatSequences(FileFormatI format, AlignmentI alignment, String[] omitHidden, int[] exportRange, boolean suffix, ColumnSelection colSel) { @@ -273,9 +273,9 @@ public class FormatAdapter extends AppletFormatAdapter suffix, colSel, null); } - public String formatSequences(String format, AlignmentI alignment, + public String formatSequences(FileFormatI format, AlignmentI alignment, String[] omitHidden, int[] exportRange, boolean suffix, - ColumnSelection colSel, jalview.datamodel.SequenceGroup selgp) + ColumnSelection colSel, SequenceGroup selgp) { if (omitHidden != null) { @@ -308,15 +308,17 @@ public class FormatAdapter extends AppletFormatAdapter return this.formatSequences(format, alignment, suffix); } - public AlignmentI readFile(String inFile, String type, String format) - throws java.io.IOException + @Override + public AlignmentI readFile(String file, DataSourceType sourceType, + FileFormatI fileFormat) throws IOException { - AlignmentI al = super.readFile(inFile, type, format); + AlignmentI al = super.readFile(file, sourceType, fileFormat); return al; } - public AlignmentI readFromFile(FileParse source, String format) - throws java.io.IOException + @Override + public AlignmentI readFromFile(FileParse source, FileFormatI format) + throws IOException { AlignmentI al = super.readFromFile(source, format); return al; @@ -353,7 +355,7 @@ public class FormatAdapter extends AppletFormatAdapter * alignment panel originating the view * @return String containing flat file */ - public String formatSequences(String format, AlignmentViewPanel ap, + public String formatSequences(FileFormatI format, AlignmentViewPanel ap, boolean selectedOnly) { return formatSequences(format, getCacheSuffixDefault(format), ap,