X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=83d2499e238b2124d0ab043a81f0381e962a5d62;hb=f980095ff022f62822f1522c221957e49a7bbfc7;hp=62852a21985e55c36e6ce60a2c97b552a4ec3969;hpb=608832fec5a504b4c56e5837b2b3dfc1993fe734;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 62852a2..83d2499 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -1,6 +1,6 @@ /* * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2005 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle + * Copyright (C) 2007 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 @@ -18,833 +18,688 @@ */ package jalview.datamodel; -import jalview.analysis.*; - -import jalview.util.*; - import java.util.*; +import jalview.analysis.*; + /** Data structure to hold and manipulate a multiple sequence alignment */ -public class Alignment implements AlignmentI +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; + 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; + /** DOCUMENT ME!! */ + public AlignmentAnnotation[] annotations; - sequences = new Vector(); + HiddenSequences hiddenSequences = new HiddenSequences(this); - for (i = 0; i < seqs.length; i++) - { - sequences.addElement(seqs[i]); - } + private void initAlignment(SequenceI[] seqs) + { + int i = 0; - } - /** Make an alignment from an array of Sequences. - * - * @param sequences - */ - public Alignment(SequenceI[] seqs) + if (jalview.util.Comparison.isNucleotide(seqs)) { - initAlignment(seqs); - } - /** - * Make a new alignment from an array of SeqCigars - * @param seqs SeqCigar[] - */ - public Alignment(SeqCigar[] alseqs) { - SequenceI[] seqs = SeqCigar.createAlignmentSequences(alseqs, gapCharacter, new ColumnSelection(), null); - initAlignment(seqs); + type = NUCLEOTIDE; } - /** - * Make a new alignment from an CigarArray - * JBPNote - can only do this when compactAlignment does not contain hidden regions. - * JBPNote - must also check that compactAlignment resolves to a set of SeqCigars - or construct them appropriately. - * @param compactAlignment CigarArray - */ - public static AlignmentI createAlignment(CigarArray compactAlignment) { - throw new Error("Alignment(CigarArray) not yet implemented"); - // this(compactAlignment.refCigars); - } - - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Vector getSequences() + else { - return sequences; + type = PROTEIN; } - public SequenceI [] getSequencesArray() + sequences = new Vector(); + + for (i = 0; i < seqs.length; i++) { - SequenceI [] reply = new SequenceI[sequences.size()]; - for(int i=0; i