X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFormatAdapter.java;h=92e5810c71f123183a0f68534f739cdced07ded6;hb=db93a1adcbe0a4eaaf06e0a70ade0d6c5c1961c3;hp=d241308b7142ec69fa7bf8d3c5ba12a10c66a305;hpb=d7989f319488cc56440f822261bc5014c27e03c6;p=jalview.git diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index d241308..92e5810 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -1,6 +1,6 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer ($$Version-Rel$$) - * Copyright (C) $$Year-Rel$$ The Jalview Authors + * Jalview - A Sequence Alignment Editor and Viewer (Version 2.9.0b2) + * Copyright (C) 2015 The Jalview Authors * * This file is part of Jalview. * @@ -20,7 +20,8 @@ */ package jalview.io; -import jalview.api.AlignViewportI; +import jalview.api.AlignExportSettingI; +import jalview.api.AlignmentViewPanel; import jalview.datamodel.Alignment; import jalview.datamodel.AlignmentAnnotation; import jalview.datamodel.AlignmentI; @@ -37,9 +38,9 @@ import jalview.datamodel.SequenceI; */ public class FormatAdapter extends AppletFormatAdapter { - public FormatAdapter(AlignViewportI viewport) + public FormatAdapter(AlignmentViewPanel viewpanel) { - super(viewport); + super(viewpanel); init(); } @@ -49,6 +50,12 @@ public class FormatAdapter extends AppletFormatAdapter init(); } + public FormatAdapter(AlignmentViewPanel alignPanel, + AlignExportSettingI settings) + { + super(alignPanel, settings); + } + private void init() { if (jalview.bin.Cache.getDefault("STRUCT_FROM_PDB", true)) @@ -56,9 +63,9 @@ public class FormatAdapter extends AppletFormatAdapter annotFromStructure = jalview.bin.Cache.getDefault("ADD_TEMPFACT_ANN", true); localSecondaryStruct = jalview.bin.Cache.getDefault("ADD_SS_ANN", - true); - serviceSecondaryStruct = jalview.bin.Cache.getDefault("USE_RNAVIEW", - true); + true); + serviceSecondaryStruct = jalview.bin.Cache.getDefault("USE_RNAVIEW", + true); } else { @@ -100,12 +107,10 @@ public class FormatAdapter extends AppletFormatAdapter { startRes = seqs[i].getStart(); endRes = seqs[i].getEnd(); - - startIndex = startEnd[0]; - endIndex = startEnd[1]; - if (startEnd != null) { + startIndex = startEnd[0]; + endIndex = startEnd[1]; // get first non-gaped residue start position while (jalview.util.Comparison.isGap(seqs[i] .getCharAt(startIndex)) && startIndex < endIndex) @@ -121,9 +126,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], @@ -264,14 +267,12 @@ public class FormatAdapter extends AppletFormatAdapter ColumnSelection colSel) { return formatSequences(format, alignment, omitHidden, exportRange, - suffix, colSel, - null); + suffix, colSel, null); } public String formatSequences(String format, AlignmentI alignment, String[] omitHidden, int[] exportRange, boolean suffix, - ColumnSelection colSel, - jalview.datamodel.SequenceGroup selgp) + ColumnSelection colSel, jalview.datamodel.SequenceGroup selgp) { if (omitHidden != null) { @@ -304,20 +305,6 @@ public class FormatAdapter extends AppletFormatAdapter return this.formatSequences(format, alignment, suffix); } - public Alignment readFile(String inFile, String type, String format) - throws java.io.IOException - { - Alignment al = super.readFile(inFile, type, format); - return al; - } - - public AlignmentI readFromFile(FileParse source, String format) - throws java.io.IOException - { - Alignment al = (Alignment) super.readFromFile(source, format); - return al; - } - /** * validate format is valid for IO in Application. This is basically the * AppletFormatAdapter.isValidFormat call with additional checks for @@ -341,15 +328,19 @@ public class FormatAdapter extends AppletFormatAdapter } /** - * Create a flat file representation of a given view or selected region of a view + * Create a flat file representation of a given view or selected region of a + * view + * * @param format - * @param av + * @param ap + * alignment panel originating the view * @return String containing flat file */ - public String formatSequences(String format, AlignViewportI av, boolean selectedOnly) + public String formatSequences(String format, AlignmentViewPanel ap, + boolean selectedOnly) { - return formatSequences(format, getCacheSuffixDefault(format), av, selectedOnly); + return formatSequences(format, getCacheSuffixDefault(format), ap, + selectedOnly); } - }