/* * Jalview - A Sequence Alignment Editor and Viewer * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ package jalview.datamodel; import jalview.analysis.*; import jalview.util.*; import java.util.*; /** Data structure to hold and manipulate a multiple sequence alignment */ public class Alignment implements AlignmentI { protected Alignment dataset; protected Vector sequences; protected Vector groups = new Vector(); protected char gapCharacter = '-'; protected int type = NUCLEOTIDE; public static final int PROTEIN = 0; public static final int NUCLEOTIDE = 1; /** DOCUMENT ME!! */ public AlignmentAnnotation[] annotations; HiddenSequences hiddenSequences = new HiddenSequences(this); private void initAlignment(SequenceI[] seqs) { int i=0; if( jalview.util.Comparison.isNucleotide(seqs)) type = NUCLEOTIDE; else type = PROTEIN; sequences = new Vector(); for (i = 0; i < seqs.length; i++) { sequences.addElement(seqs[i]); } } /** Make an alignment from an array of Sequences. * * @param sequences */ public Alignment(SequenceI[] seqs) { initAlignment(seqs); } /** * Make a new alignment from an array of SeqCigars * @param seqs SeqCigar[] */ public Alignment(SeqCigar[] alseqs) { SequenceI[] seqs = new SequenceI[alseqs.length]; for (int i=0; i