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
22 import jalview.datamodel.*;
\r
27 public abstract class AlignFile extends FileParse {
\r
40 public AlignFile(String inStr) {
\r
42 System.out.println("is this ever called??");
\r
45 }catch(Exception ex){}
\r
49 * Constructor which parses the data from a file of some specified type.
\r
50 * @param inFile Filename to read from.
\r
51 * @param type What type of file to read from (File, URL)
\r
53 public AlignFile(String inFile, String type) throws IOException {
\r
63 * Return the seqs Vector
\r
65 public Vector getSeqs() {
\r
70 * Return the Sequences in the seqs Vector as an array of Sequences
\r
72 public SequenceI [] getSeqsAsArray() {
\r
73 SequenceI [] s = new SequenceI[seqs.size()];
\r
74 for (int i=0;i < seqs.size();i++) {
\r
75 s[i] = (SequenceI)seqs.elementAt(i);
\r
82 * Initialise objects to store sequence data in.
\r
84 protected void initData() {
\r
85 seqs = new Vector();
\r
86 headers = new Vector();
\r
89 protected void setSeqs(SequenceI [] s) {
\r
90 seqs = new Vector();
\r
91 for (int i=0; i<s.length; i++) {
\r
92 seqs.addElement(s[i]);
\r
96 // Checks whether sequence is valid aa characters
\r
97 protected boolean isValidProteinSequence(String sequence)
\r
99 for (int i = 0; i < sequence.length(); i++)
\r
100 if (!jalview.schemes.ResidueProperties.aaHash.containsKey(String.valueOf(sequence.charAt(i))))
\r
108 * This method must be implemented to parse the contents of the file.
\r
110 public abstract void parse() throws IOException;
\r
114 * Print out in alignment file format the Sequences in the seqs Vector.
\r
116 public abstract String print();
\r