From 1772466d28ffeef4aa4e1a4d5a640fd6a987df8c Mon Sep 17 00:00:00 2001 From: amwaterhouse Date: Tue, 24 Oct 2006 11:20:33 +0000 Subject: [PATCH] maxIdLength redundant, deleteCols, trimLeft, removeGaps moved to Commands --- src/jalview/datamodel/Alignment.java | 159 +-------------------------------- src/jalview/datamodel/AlignmentI.java | 40 +-------- 2 files changed, 4 insertions(+), 195 deletions(-) diff --git a/src/jalview/datamodel/Alignment.java b/src/jalview/datamodel/Alignment.java index 5f60530..4485c46 100755 --- a/src/jalview/datamodel/Alignment.java +++ b/src/jalview/datamodel/Alignment.java @@ -173,136 +173,6 @@ public class Alignment implements AlignmentI { return groups; } - /** Takes out columns consisting entirely of gaps (-,.," ") - */ - public void removeGaps() { - removeGaps((ShiftList)null); - } - /** - * remove gaps in alignment - recording any frame shifts in shiftrecord - * intended to be passed to ColumnSelection.compensateForEdits(shiftrecord) - * @param shiftrecord - */ - public void removeGaps(ShiftList shiftrecord) { - SequenceI[] seqs = getVisibleAndRepresentedSeqs(); - int j, jSize = seqs.length; - - int width = 0; - for (int i = 0; i < jSize; i++) - { - if (seqs[i].getLength() > 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); - if (shiftrecord!=null) { - shiftrecord.addShift(startCol, 1+endCol-startCol); - } - width -= (endCol - startCol); - i -= (endCol - startCol); - startCol = -1; - endCol = -1; - } - } - - if (delete && startCol > -1) - { - deleteColumns(seqs, startCol, endCol); - if (shiftrecord!=null) { - shiftrecord.addShift(startCol, 1+endCol-startCol); - } - } - } - - /** 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! @@ -321,8 +191,11 @@ public class Alignment implements AlignmentI */ public void deleteSequence(int i) { + if(i>0 && i max) - { - max = tmp.length(); - } - - i++; - } - - return max; - } /** * DOCUMENT ME! diff --git a/src/jalview/datamodel/AlignmentI.java b/src/jalview/datamodel/AlignmentI.java index 71ba3e0..94dbf1b 100755 --- a/src/jalview/datamodel/AlignmentI.java +++ b/src/jalview/datamodel/AlignmentI.java @@ -41,12 +41,6 @@ public interface AlignmentI */ public int getWidth(); - /** - * Calculates the longest sequence Id of the alignment - * - * @return Number of characters in longest sequence Id. - */ - public int getMaxIdLength(); /** * Calculates if this set of sequences is all the same length @@ -94,7 +88,7 @@ public interface AlignmentI public void setSequenceAt(int i, SequenceI seq); /** - * Deletes a sequence from the alignment. + * Deletes a sequence from the alignment * * @param s Sequence to be deleted. */ @@ -109,15 +103,6 @@ public interface AlignmentI /** - * Deletes all residues in every sequence of alignment within given columns. - * - * @param start Start index of columns to delete. - * @param end End index to columns to delete. - */ - public void deleteColumns(SequenceI seqs [], int start, int end); - - - /** * Finds sequence in alignment using sequence name as query. * * @param name Id of sequence to search for. @@ -137,29 +122,6 @@ public interface AlignmentI */ public int findIndex(SequenceI s); - /** - * All sequences will be cut from beginning to given index. - * - * @param i Remove all residues in sequences up to this column. - */ - public void trimLeft(int i); - - /** - * All sequences will be cut from given index. - * - * @param i Remove all residues in sequences beyond this column. - */ - public void trimRight(int i); - - /** - * Removes all columns containing entirely gap characters. - */ - public void removeGaps(); - /** - * remove gaps in alignment - recording any frame shifts in shiftrecord - * @param shiftrecord - */ - public void removeGaps(ShiftList shiftrecord); /** * Finds group that given sequence is part of. -- 1.7.10.2