X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;ds=sidebyside;f=src%2Fjalview%2Fdatamodel%2FAlignment.java;h=cb73d0c578895dbce018f6146dfc4c33dc8a547b;hb=5cf622544aaa7453e5e1710186b53734334783d6;hp=8c320f75ca02c8f27a3791b5efa816952dea49c4;hpb=e33cdacd2ac2836504375c538574a0f1cafec7e3;p=jalview.git diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 8c320f7..cb73d0c 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) 2006 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 @@ -70,11 +70,7 @@ public class Alignment implements AlignmentI * @param seqs SeqCigar[] */ public Alignment(SeqCigar[] alseqs) { - - SequenceI[] seqs = new SequenceI[alseqs.length]; - for (int i=0; i width) - { - width = seqs[i].getLength(); - } - } - - int startCol = -1, endCol = -1; - boolean delete = true; - for (int i = 0; i < width; i++) - { - delete = true; - - for (j = 0; j < jSize; j++) - { - if (seqs[j].getLength() > i) - { - if (!jalview.util.Comparison.isGap(seqs[j].getCharAt(i))) - { - if(delete) - endCol = i; - - delete = false; - break; - } - } - } - - if(delete && startCol==-1) - { - startCol = i; - } - - - if (!delete && startCol > -1) - { - deleteColumns(seqs, startCol, endCol); - width -= (endCol - startCol); - i -= (endCol - startCol); - startCol = -1; - endCol = -1; - } - } - - if (delete && startCol > -1) - { - deleteColumns(seqs, startCol, endCol); - } - } - - /** Removes a range of columns (start to end inclusive). - * - * @param seqs Sequences to remove columns from - * @param start Start column in the alignment - * @param end End column in the alignment - */ - public void deleteColumns(SequenceI [] seqs, int start, int end) - { - for(int i=0; iseqs[j].getLength()) - { - sequences.removeElement(seqs[j]); - j--; - jSize--; - } - else - { - seqs[j].setStart(newstart); - seqs[j].setSequence(seqs[j].getSequence().substring(i)); - } - } - } - - /** - * DOCUMENT ME! - * - * @param i DOCUMENT ME! - */ - public void trimRight(int i) - { - SequenceI[] seqs = getVisibleAndRepresentedSeqs(); - int j, jSize = seqs.length; - for (j = 0; j < jSize; j++) - { - int newend = seqs[j].findPosition(i); - - seqs[j].setEnd(newend); - if(seqs[j].getLength()>i) - seqs[j].setSequence(seqs[j].getSequence().substring(0, i + 1)); - } - } - /** * DOCUMENT ME! * @@ -302,13 +180,7 @@ public class Alignment implements AlignmentI */ public void deleteSequence(SequenceI s) { - for (int i = 0; i < getHeight(); i++) - { - if (getSequenceAt(i) == s) - { - deleteSequence(i); - } - } + deleteSequence(findIndex(s)); } /** @@ -318,7 +190,11 @@ public class Alignment implements AlignmentI */ public void deleteSequence(int i) { + if(i>-1 && i max) - { - max = tmp.length(); - } - - i++; - } - - return max; - } /** * DOCUMENT ME! @@ -535,15 +407,6 @@ public class Alignment implements AlignmentI return gapCharacter; } - /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - */ - public Vector getAAFrequency() - { - return AAFrequency.calculate(sequences, 0, getWidth()); - } /** * DOCUMENT ME! @@ -715,7 +578,8 @@ public class Alignment implements AlignmentI ), getSequenceAt(i).getStart(), getSequenceAt(i).getEnd()); - + seqs[i].sequenceFeatures = getSequenceAt(i).getSequenceFeatures(); + getSequenceAt(i).setSequenceFeatures(null); getSequenceAt(i).setDatasetSequence(seqs[i]); } } @@ -811,9 +675,11 @@ public class Alignment implements AlignmentI { SeqCigar alseqs[] = new SeqCigar[sequences.size()]; for (int i=0; i