2 * Jalview - A Sequence Alignment Editor and Viewer
3 * Copyright (C) 2006 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 import jalview.datamodel.*;
30 public class FormatAdapter extends AppletFormatAdapter
33 public String formatSequences(String format,
35 String [] omitHiddenColumns)
37 if(omitHiddenColumns!=null)
39 SequenceI [] tmp = new SequenceI[seqs.length];
40 for(int i=0; i<seqs.length; i++)
41 tmp [i] = new Sequence(
42 seqs[i].getName(), omitHiddenColumns[i],
43 seqs[i].getStart(), seqs[i].getEnd());
48 return formatSequences(format, seqs);
55 * @param format DOCUMENT ME!
56 * @param seqs DOCUMENT ME!
58 * @return DOCUMENT ME!
60 public String formatSequences(String format,
66 AlignFile afile = null;
68 if (format.equalsIgnoreCase("FASTA"))
70 afile = new FastaFile();
72 jalview.bin.Cache.getDefault("FASTA_JVSUFFIX", true));
74 else if (format.equalsIgnoreCase("MSF"))
76 afile = new MSFfile();
78 jalview.bin.Cache.getDefault("MSF_JVSUFFIX", true));
80 else if (format.equalsIgnoreCase("PileUp"))
82 afile = new PileUpfile();
84 jalview.bin.Cache.getDefault("PILEUP_JVSUFFIX", true));
86 else if (format.equalsIgnoreCase("CLUSTAL"))
88 afile = new ClustalFile();
90 jalview.bin.Cache.getDefault("CLUSTAL_JVSUFFIX", true));
92 else if (format.equalsIgnoreCase("BLC"))
94 afile = new BLCFile();
96 jalview.bin.Cache.getDefault("BLC_JVSUFFIX", true));
98 else if (format.equalsIgnoreCase("PIR"))
100 afile = new PIRFile();
102 jalview.bin.Cache.getDefault("PIR_JVSUFFIX", true));
104 else if (format.equalsIgnoreCase("PFAM"))
106 afile = new PfamFile();
108 jalview.bin.Cache.getDefault("PFAM_JVSUFFIX", true));
113 return afile.print();
117 System.err.println("Failed to write alignment as a '" + format +