2 * Jalview - A Sequence Alignment Editor and Viewer
\r
3 * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle
\r
5 * This program is free software; you can redistribute it and/or
\r
6 * modify it under the terms of the GNU General Public License
\r
7 * as published by the Free Software Foundation; either version 2
\r
8 * of the License, or (at your option) any later version.
\r
10 * This program is distributed in the hope that it will be useful,
\r
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
\r
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
\r
13 * GNU General Public License for more details.
\r
15 * You should have received a copy of the GNU General Public License
\r
16 * along with this program; if not, write to the Free Software
\r
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
\r
21 import jalview.datamodel.*;
\r
28 * @version $Revision$
\r
30 public class FormatAdapter extends AppletFormatAdapter
\r
33 public String formatSequences(String format,
\r
35 String [] omitHiddenColumns)
\r
37 if(omitHiddenColumns!=null)
\r
39 for(int i=0; i<seqs.length; i++)
\r
40 seqs [i] = new Sequence(
\r
41 seqs[i].getName(), omitHiddenColumns[i],
\r
42 seqs[i].getStart(), seqs[i].getEnd());
\r
45 return formatSequences(format, seqs);
\r
52 * @param format DOCUMENT ME!
\r
53 * @param seqs DOCUMENT ME!
\r
55 * @return DOCUMENT ME!
\r
57 public String formatSequences(String format,
\r
63 AlignFile afile = null;
\r
65 if (format.equalsIgnoreCase("FASTA"))
\r
67 afile = new FastaFile();
\r
69 jalview.bin.Cache.getDefault("FASTA_JVSUFFIX", true));
\r
71 else if (format.equalsIgnoreCase("MSF"))
\r
73 afile = new MSFfile();
\r
75 jalview.bin.Cache.getDefault("MSF_JVSUFFIX", true));
\r
77 else if (format.equalsIgnoreCase("PileUp"))
\r
79 afile = new PileUpfile();
\r
81 jalview.bin.Cache.getDefault("PILEUP_JVSUFFIX", true));
\r
83 else if (format.equalsIgnoreCase("CLUSTAL"))
\r
85 afile = new ClustalFile();
\r
87 jalview.bin.Cache.getDefault("CLUSTAL_JVSUFFIX", true));
\r
89 else if (format.equalsIgnoreCase("BLC"))
\r
91 afile = new BLCFile();
\r
93 jalview.bin.Cache.getDefault("BLC_JVSUFFIX", true));
\r
95 else if (format.equalsIgnoreCase("PIR"))
\r
97 afile = new PIRFile();
\r
99 jalview.bin.Cache.getDefault("PIR_JVSUFFIX", true));
\r
101 else if (format.equalsIgnoreCase("PFAM"))
\r
103 afile = new PfamFile();
\r
105 jalview.bin.Cache.getDefault("PFAM_JVSUFFIX", true));
\r
108 afile.setSeqs(seqs);
\r
110 return afile.print();
\r
112 catch (Exception e)
\r
114 System.err.println("Failed to write alignment as a '" + format +
\r
116 e.printStackTrace();
\r