From: jprocter Date: Wed, 26 Jul 2006 13:43:24 +0000 (+0000) Subject: CigarBase class and derivatives. X-Git-Tag: Release_2_1~196 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=95789943eb181b1768a081e779a044bf595b6bf6;p=jalview.git CigarBase class and derivatives. --- diff --git a/src/jalview/datamodel/CigarArray.java b/src/jalview/datamodel/CigarArray.java new file mode 100644 index 0000000..447b4d0 --- /dev/null +++ b/src/jalview/datamodel/CigarArray.java @@ -0,0 +1,117 @@ +package jalview.datamodel; + +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. + */ + /** + * array of subject cigars + */ + public CigarSimple refCigars[]=null; + private boolean seqcigararray=false; + private CigarArray() { + super(); + } + + /** + * isSeqCigarArray() + * @return boolean true if all refCigars resolve to a SeqCigar or a CigarCigar + */ + public boolean isSeqCigarArray() + { + return seqcigararray; + } + + /** + * 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) { + super(); + seqcigararray = true; + if (cigars != null && cigars.length > 0) + { + refCigars = new CigarSimple[cigars.length]; + for (int c = 0; c < cigars.length; c++) + { + refCigars[c] = cigars[c]; + if (! ( (cigars[c] instanceof SeqCigar) + || cigars[c] instanceof CigarCigar)) + { + seqcigararray = false; + } + } + } + } + /** + * @see Cigar.getSequenceAndDeletions + * @param GapChar char + * @return Object[][] + */ + protected Object[][] getArrayofSequenceAndDeletions(char GapChar) { + if (refCigars == null || refCigars.length == 0 || length == 0) { + return null; + } + Object[][] sqanddels = new Object[refCigars.length][]; + for (int c=0; c