X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fdatamodel%2FCigarArray.java;h=aeaa37400554bc3f667b3eb69d675eb9b86bab63;hb=b7a8120335d2b6be10ce363b3d9353ddca751a77;hp=c17e01eecbbb9b336a63369fb0c306d6c9e2535d;hpb=7bc226b58110fa26d9dbd3f0c78095d06909ffc3;p=jalview.git diff --git a/src/jalview/datamodel/CigarArray.java b/src/jalview/datamodel/CigarArray.java index c17e01e..aeaa374 100644 --- a/src/jalview/datamodel/CigarArray.java +++ b/src/jalview/datamodel/CigarArray.java @@ -1,36 +1,37 @@ /* - * Jalview - A Sequence Alignment Editor and Viewer - * Copyright (C) 2007 AM Waterhouse, J Procter, G Barton, M Clamp, S Searle - * + * Jalview - A Sequence Alignment Editor and Viewer (Development Version 2.4.1) + * Copyright (C) 2009 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; -public class CigarArray - extends CigarBase +public class CigarArray extends CigarBase { /** - * Do CIGAR operations on a set of sequences from many other cigars - * BAD THINGS WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY - * or a CIGARCIGAR is given a CIGARARRAY to insert gaps into. + * Do CIGAR operations on a set of sequences from many other cigars BAD THINGS + * WILL HAPPEN IF A CIGARARRAY IS PASSED TO A CIGARARRAY or a CIGARCIGAR is + * given a CIGARARRAY to insert gaps into. */ /** * array of subject cigars */ public CigarSimple refCigars[] = null; + private boolean seqcigararray = false; + private CigarArray() { super(); @@ -38,6 +39,7 @@ public class CigarArray /** * isSeqCigarArray() + * * @return boolean true if all refCigars resolve to a SeqCigar or a CigarCigar */ public boolean isSeqCigarArray() @@ -46,9 +48,11 @@ public class CigarArray } /** - * Apply CIGAR operations to several cigars in parallel - * will throw an error if any of cigar are actually CigarArrays. - * @param cigar Cigar[] + * Apply CIGAR operations to several cigars in parallel will throw an error if + * any of cigar are actually CigarArrays. + * + * @param cigar + * Cigar[] */ public CigarArray(CigarSimple[] cigars) { @@ -60,8 +64,7 @@ public class CigarArray for (int c = 0; c < cigars.length; c++) { refCigars[c] = cigars[c]; - if (! ( (cigars[c] instanceof SeqCigar) - || cigars[c] instanceof CigarCigar)) + if (!((cigars[c] instanceof SeqCigar) || cigars[c] instanceof CigarCigar)) { seqcigararray = false; } @@ -71,7 +74,8 @@ public class CigarArray /** * @see Cigar.getSequenceAndDeletions - * @param GapChar char + * @param GapChar + * char * @return Object[][] */ protected Object[][] getArrayofSequenceAndDeletions(char GapChar) @@ -98,8 +102,11 @@ public class CigarArray /** * NOTE: this is an improper sequence string function - * @return String formed by newline concatenated results of applying CIGAR operations to each reference object in turn. - * @param GapChar char + * + * @return String formed by newline concatenated results of applying CIGAR + * operations to each reference object in turn. + * @param GapChar + * char * @return '\n' separated strings (empty results included as \n\n) */ public String getSequenceString(char GapChar) @@ -114,7 +121,7 @@ public class CigarArray { if (sqanddels[c] != null) { - seqStrings.append( (String) sqanddels[c][0]); + seqStrings.append((String) sqanddels[c][0]); sqanddels[c][0] = null; } seqStrings.append('\n'); @@ -124,7 +131,9 @@ public class CigarArray /** * return string results of applying cigar string to all reference cigars - * @param GapChar char + * + * @param GapChar + * char * @return String[] */ public String[] getSequenceStrings(char GapChar) @@ -146,18 +155,19 @@ public class CigarArray /** * Combines the CigarArray cigar operations with the operations in each * reference cigar - creating a new reference cigar + * * @return Cigar[] - - public CigarBase[] getEditedCigars() { - - return new CigarBase[] {}; - } + * + * public CigarBase[] getEditedCigars() { + * + * return new CigarBase[] {}; } */ /** - * applyDeletions - * edits underlying refCigars to propagate deleted regions, and removes deletion - * operations from CigarArray operation list. - * @return int[] position after deletion occured and range of deletion in cigarArray or null if none occured + * applyDeletions edits underlying refCigars to propagate deleted regions, and + * removes deletion operations from CigarArray operation list. + * + * @return int[] position after deletion occured and range of deletion in + * cigarArray or null if none occured */ public int[] applyDeletions() { @@ -188,18 +198,16 @@ public class CigarArray } int delstart = cursor, delend = cursor + range[i] - 1; // inclusive delpos.addElement(new int[] - {vcursor + offset, range[i]}); // index of right hand column after hidden region boundary + { vcursor + offset, range[i] }); // index of right hand column after + // hidden region boundary offset += range[i] - 1; // shift in visible column coordinates System.arraycopy(operation, i + 1, operation, i, length - i); System.arraycopy(range, i + 1, range, i, length - i); length--; - /* int dmax=0; - for (int s=0; sdmax) - dmax=d; - } - offset+=dmax; // shift in visible column coordinates + /* + * int dmax=0; for (int s=0; sdmax) dmax=d; } + * offset+=dmax; // shift in visible column coordinates */ for (int s = 0; s < refCigars.length; s++) { @@ -213,7 +221,7 @@ public class CigarArray int[] pos = new int[delpos.size() * 2]; for (int k = 0, l = delpos.size(); k < l; k++) { - int[] dr = ( (int[]) delpos.elementAt(k)); + int[] dr = ((int[]) delpos.elementAt(k)); pos[k * 2] = dr[0]; pos[k * 2 + 1] = dr[1]; delpos.setElementAt(null, k); @@ -225,8 +233,9 @@ public class CigarArray } /** - * - * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does not resolve to set of seqCigars) + * + * @return SeqCigar[] or null if CigarArray is not a SeqCigarArray (ie it does + * not resolve to set of seqCigars) */ public SeqCigar[] getSeqCigarArray() {