X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2FFormatAdapter.java;h=64f33cda30665e59e4cff014c49b619a6c2f5e53;hb=f1671000d7556b46d63e676b83b3f7b6e9179849;hp=61c2331465e952492f73174cc456fff1376a5ac3;hpb=008ad05ffd2964c864cdab0f18dff2fb36c82242;p=jalview.git diff --git a/src/jalview/io/FormatAdapter.java b/src/jalview/io/FormatAdapter.java index 61c2331..64f33cd 100755 --- a/src/jalview/io/FormatAdapter.java +++ b/src/jalview/io/FormatAdapter.java @@ -29,79 +29,8 @@ import java.util.Vector; * @author $author$ * @version $Revision$ */ -public class FormatAdapter +public class FormatAdapter extends AppletFormatAdapter { - /** DOCUMENT ME!! */ - public static final Vector formats = new Vector(); - - static - { - formats.addElement("FASTA"); - formats.addElement("MSF"); - formats.addElement("PileUp"); - formats.addElement("CLUSTAL"); - formats.addElement("BLC"); - formats.addElement("PIR"); - formats.addElement("PFAM"); - } - - AlignFile afile = null; - - /** - * DOCUMENT ME! - * - * @param inFile DOCUMENT ME! - * @param type DOCUMENT ME! - * @param format DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public SequenceI[] readFile(String inFile, String type, String format) - { - try - { - if (format.equals("FASTA")) - { - afile = new FastaFile(inFile, type); - } - else if (format.equals("MSF")) - { - afile = new MSFfile(inFile, type); - } - else if (format.equals("PileUp")) - { - afile = new PileUpfile(inFile, type); - } - else if (format.equals("CLUSTAL")) - { - afile = new ClustalFile(inFile, type); - } - else if (format.equals("BLC")) - { - afile = new BLCFile(inFile, type); - } - else if (format.equals("PIR")) - { - afile = new PIRFile(inFile, type); - } - else if (format.equals("PFAM")) - { - afile = new PfamFile(inFile, type); - } - - return afile.getSeqsAsArray(); - } - catch (Exception e) - { - System.err.println("Failed to read alignment using the '" + format + - "' reader."); - e.printStackTrace(); - } - - return null; - } - - /** * DOCUMENT ME! * @@ -124,30 +53,58 @@ public class FormatAdapter if (format.equalsIgnoreCase("FASTA")) { afile = new FastaFile(); + afile.addDBPrefix( + jalview.bin.Cache.getDefault("FASTA_DBPREFIX", false)); + afile.addJVSuffix( + jalview.bin.Cache.getDefault("FASTA_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("MSF")) { - afile = new MSFfile(); + afile = new MSFfile(); + afile.addDBPrefix( + jalview.bin.Cache.getDefault("MSF_DBPREFIX", false)); + afile.addJVSuffix( + jalview.bin.Cache.getDefault("MSF_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("PileUp")) { afile = new PileUpfile(); + afile.addDBPrefix( + jalview.bin.Cache.getDefault("PILEUP_DBPREFIX", false)); + afile.addJVSuffix( + jalview.bin.Cache.getDefault("PILEUP_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("CLUSTAL")) { afile = new ClustalFile(); + afile.addDBPrefix( + jalview.bin.Cache.getDefault("CLUSTAL_DBPREFIX", false)); + afile.addJVSuffix( + jalview.bin.Cache.getDefault("CLUSTAL_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("BLC")) { afile = new BLCFile(); + afile.addDBPrefix( + jalview.bin.Cache.getDefault("BLC_DBPREFIX", false)); + afile.addJVSuffix( + jalview.bin.Cache.getDefault("BLC_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("PIR")) { afile = new PIRFile(); + afile.addDBPrefix( + jalview.bin.Cache.getDefault("PIR_DBPREFIX", false)); + afile.addJVSuffix( + jalview.bin.Cache.getDefault("PIR_JVSUFFIX", true)); } else if (format.equalsIgnoreCase("PFAM")) { afile = new PfamFile(); + afile.addDBPrefix( + jalview.bin.Cache.getDefault("PFAM_DBPREFIX", false)); + afile.addJVSuffix( + jalview.bin.Cache.getDefault("PFAM_JVSUFFIX", true)); } afile.setSeqs(s);