X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjalview%2Fdatamodel%2FSequenceGroup.js;fp=site%2Fj2s%2Fjalview%2Fdatamodel%2FSequenceGroup.js;h=852a6ff9dc0a03f01f13323f76a50b01071fb3d9;hp=368e8900f11b0d52c1d74029b96dbafbe0fc1581;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/j2s/jalview/datamodel/SequenceGroup.js b/site/j2s/jalview/datamodel/SequenceGroup.js index 368e890..852a6ff 100644 --- a/site/j2s/jalview/datamodel/SequenceGroup.js +++ b/site/j2s/jalview/datamodel/SequenceGroup.js @@ -1,601 +1,601 @@ -Clazz.declarePackage ("jalview.datamodel"); -Clazz.load (["jalview.datamodel.AnnotatedCollectionI", "java.awt.Color", "java.util.ArrayList"], "jalview.datamodel.SequenceGroup", ["jalview.analysis.AAFrequency", "$.Conservation", "jalview.datamodel.AlignmentAnnotation", "$.Sequence", "jalview.schemes.ResidueProperties", "jalview.util.Comparison", "java.lang.StringBuffer"], function () { -c$ = Clazz.decorateAsClass (function () { -this.groupName = null; -this.description = null; -this.conserve = null; -this.aaFrequency = null; -this.displayBoxes = true; -this.displayText = true; -this.colourText = false; -this.showNonconserved = false; -this.sequences = null; -this.seqrep = null; -this.width = -1; -this.cs = null; -this.startRes = 0; -this.endRes = 0; -this.outlineColour = null; -this.idColour = null; -this.thresholdTextColour = 0; -this.textColour = null; -this.textColour2 = null; -this.ignoreGapsInConsensus = true; -this.showSequenceLogo = false; -this.normaliseSequenceLogo = false; -this.consPercGaps = 25; -this.consensusData = null; -this.hidereps = false; -this.hidecols = false; -this.consensus = null; -this.conservation = null; -this.showConsensusHistogram = false; -this.context = null; -Clazz.instantialize (this, arguments); -}, jalview.datamodel, "SequenceGroup", null, jalview.datamodel.AnnotatedCollectionI); -Clazz.prepareFields (c$, function () { -this.sequences = new java.util.ArrayList (); -this.outlineColour = java.awt.Color.black; -this.textColour = java.awt.Color.black; -this.textColour2 = java.awt.Color.white; -}); -Clazz.defineMethod (c$, "isShowSequenceLogo", -function () { -return this.showSequenceLogo; -}); -Clazz.makeConstructor (c$, -function () { -this.groupName = "JGroup:" + this.hashCode (); -}); -Clazz.makeConstructor (c$, -function (sequences, groupName, scheme, displayBoxes, displayText, colourText, start, end) { -this.sequences = sequences; -this.groupName = groupName; -this.displayBoxes = displayBoxes; -this.displayText = displayText; -this.colourText = colourText; -this.cs = scheme; -this.startRes = start; -this.endRes = end; -this.recalcConservation (); -}, "java.util.List,~S,jalview.schemes.ColourSchemeI,~B,~B,~B,~N,~N"); -Clazz.makeConstructor (c$, -function (seqsel) { -if (seqsel != null) { -this.sequences = new java.util.ArrayList (); -this.sequences.addAll (seqsel.sequences); -if (seqsel.groupName != null) { -this.groupName = String.instantialize (seqsel.groupName); -}this.displayBoxes = seqsel.displayBoxes; -this.displayText = seqsel.displayText; -this.colourText = seqsel.colourText; -this.startRes = seqsel.startRes; -this.endRes = seqsel.endRes; -this.cs = seqsel.cs; -if (seqsel.description != null) { -this.description = String.instantialize (seqsel.description); -}this.hidecols = seqsel.hidecols; -this.hidereps = seqsel.hidereps; -this.idColour = seqsel.idColour; -this.outlineColour = seqsel.outlineColour; -this.seqrep = seqsel.seqrep; -this.textColour = seqsel.textColour; -this.textColour2 = seqsel.textColour2; -this.thresholdTextColour = seqsel.thresholdTextColour; -this.width = seqsel.width; -this.ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus; -if (seqsel.conserve != null) { -this.recalcConservation (); -}}}, "jalview.datamodel.SequenceGroup"); -Clazz.defineMethod (c$, "getSelectionAsNewSequences", -function (align) { -var iSize = this.sequences.size (); -var seqs = new Array (iSize); -var inorder = this.getSequencesInOrder (align); -for (var i = 0, ipos = 0; i < inorder.length; i++) { -var seq = inorder[i]; -seqs[ipos] = seq.getSubSequence (this.startRes, this.endRes + 1); -if (seqs[ipos] != null) { -seqs[ipos].setDescription (seq.getDescription ()); -seqs[ipos].setDBRef (seq.getDBRef ()); -seqs[ipos].setSequenceFeatures (seq.getSequenceFeatures ()); -if (seq.getDatasetSequence () != null) { -seqs[ipos].setDatasetSequence (seq.getDatasetSequence ()); -}if (seq.getAnnotation () != null) { -var alann = align.getAlignmentAnnotation (); -for (var a = 0; a < seq.getAnnotation ().length; a++) { -var tocopy = seq.getAnnotation ()[a]; -if (alann != null) { -var found = false; -for (var pos = 0; pos < alann.length; pos++) { -if (alann[pos] === tocopy) { -found = true; -break; -}} -if (!found) { -continue; -}}var newannot = new jalview.datamodel.AlignmentAnnotation (seq.getAnnotation ()[a]); -newannot.restrict (this.startRes, this.endRes); -newannot.setSequenceRef (seqs[ipos]); -newannot.adjustForAlignment (); -seqs[ipos].addAlignmentAnnotation (newannot); -} -}ipos++; -} else { -iSize--; -}} -if (iSize != inorder.length) { -var nseqs = new Array (iSize); -System.arraycopy (seqs, 0, nseqs, 0, iSize); -seqs = nseqs; -}return seqs; -}, "jalview.datamodel.AlignmentI"); -Clazz.defineMethod (c$, "findEndRes", -function (seq) { -var eres = 0; -var ch; -for (var j = 0; j < this.endRes + 1 && j < seq.getLength (); j++) { -ch = seq.getCharAt (j); -if (!jalview.util.Comparison.isGap ((ch))) { -eres++; -}} -if (eres > 0) { -eres += seq.getStart () - 1; -}return eres; -}, "jalview.datamodel.SequenceI"); -Clazz.defineMethod (c$, "getSequences", -function () { -return this.sequences; -}); -Clazz.defineMethod (c$, "getSequences", -function (hiddenReps) { -if (hiddenReps == null) { -return this.sequences; -} else { -var allSequences = new java.util.ArrayList (); -for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) { -allSequences.add (seq); -if (hiddenReps.containsKey (seq)) { -var hsg = hiddenReps.get (seq); -for (var seq2, $seq2 = hsg.getSequences ().iterator (); $seq2.hasNext () && ((seq2 = $seq2.next ()) || true);) { -if (seq2 !== seq && !allSequences.contains (seq2)) { -allSequences.add (seq2); -}} -}} -return allSequences; -}}, "java.util.Map"); -Clazz.defineMethod (c$, "getSequencesAsArray", -function (map) { -var tmp = this.getSequences (map); -if (tmp == null) { -return null; -}return tmp.toArray ( new Array (tmp.size ())); -}, "java.util.Map"); -Clazz.defineMethod (c$, "adjustForRemoveLeft", -function (col) { -if (this.startRes >= col) { -this.startRes = this.startRes - col; -}if (this.endRes >= col) { -this.endRes = this.endRes - col; -if (this.startRes > this.endRes) { -this.startRes = 0; -}} else { -return false; -}return true; -}, "~N"); -Clazz.defineMethod (c$, "adjustForRemoveRight", -function (col) { -if (this.startRes > col) { -return false; -}if (this.endRes >= col) { -this.endRes = col; -}return true; -}, "~N"); -Clazz.defineMethod (c$, "getName", -function () { -return this.groupName; -}); -Clazz.defineMethod (c$, "getDescription", -function () { -return this.description; -}); -Clazz.defineMethod (c$, "setName", -function (name) { -this.groupName = name; -}, "~S"); -Clazz.defineMethod (c$, "setDescription", -function (desc) { -this.description = desc; -}, "~S"); -Clazz.defineMethod (c$, "getConservation", -function () { -return this.conserve; -}); -Clazz.defineMethod (c$, "setConservation", -function (c) { -this.conserve = c; -}, "jalview.analysis.Conservation"); -Clazz.defineMethod (c$, "addSequence", -function (s, recalc) { -{ -if (s != null && !this.sequences.contains (s)) { -this.sequences.add (s); -}if (recalc) { -this.recalcConservation (); -}}}, "jalview.datamodel.SequenceI,~B"); -Clazz.defineMethod (c$, "getConsPercGaps", -function () { -return this.consPercGaps; -}); -Clazz.defineMethod (c$, "setConsPercGaps", -function (consPercGaps) { -this.consPercGaps = consPercGaps; -}, "~N"); -Clazz.defineMethod (c$, "recalcConservation", -function () { -if (this.cs == null && this.consensus == null && this.conservation == null) { -return; -}try { -var cnsns = jalview.analysis.AAFrequency.calculate (this.sequences, this.startRes, this.endRes + 1, this.showSequenceLogo); -if (this.consensus != null) { -this._updateConsensusRow (cnsns, this.sequences.size ()); -}if (this.cs != null) { -this.cs.setConsensus (cnsns); -}if ((this.conservation != null) || (this.cs != null && this.cs.conservationApplied ())) { -var c = new jalview.analysis.Conservation (this.groupName, jalview.schemes.ResidueProperties.propHash, 3, this.sequences, this.startRes, this.endRes + 1); -c.calculate (); -c.verdict (false, this.consPercGaps); -if (this.conservation != null) { -this._updateConservationRow (c); -}if (this.cs != null) { -if (this.cs.conservationApplied ()) { -this.cs.setConservation (c); -}}}if (this.cs != null) { -this.cs.alignmentChanged (this.context != null ? this.context : this, null); -}} catch (err) { -if (Clazz.exceptionOf (err, OutOfMemoryError)) { -System.out.println ("Out of memory loading groups: " + err); -} else { -throw err; -} -} -}); -Clazz.defineMethod (c$, "_updateConservationRow", - function (c) { -if (this.conservation == null) { -this.getConservation (); -}this.conservation.label = "Conservation for " + this.getName (); -this.conservation.description = "Conservation for group " + this.getName () + " less than " + this.consPercGaps + "% gaps"; -var aWidth = (this.conservation.annotations != null) ? (this.endRes < this.conservation.annotations.length ? this.conservation.annotations.length : this.endRes + 1) : this.endRes + 1; -this.conservation.annotations = null; -this.conservation.annotations = new Array (aWidth); -c.completeAnnotations (this.conservation, null, this.startRes, this.endRes + 1); -}, "jalview.analysis.Conservation"); -Clazz.defineMethod (c$, "_updateConsensusRow", - function (cnsns, nseq) { -if (this.consensus == null) { -this.getConsensus (); -}this.consensus.label = "Consensus for " + this.getName (); -this.consensus.description = "Percent Identity"; -this.consensusData = cnsns; -var aWidth = (this.consensus.annotations != null) ? (this.endRes < this.consensus.annotations.length ? this.consensus.annotations.length : this.endRes + 1) : this.endRes + 1; -this.consensus.annotations = null; -this.consensus.annotations = new Array (aWidth); -jalview.analysis.AAFrequency.completeConsensus (this.consensus, cnsns, this.startRes, this.endRes + 1, this.ignoreGapsInConsensus, this.showSequenceLogo, nseq); -}, "~A,~N"); -Clazz.defineMethod (c$, "addOrRemove", -function (s, recalc) { -{ -if (this.sequences.contains (s)) { -this.deleteSequence (s, recalc); -} else { -this.addSequence (s, recalc); -}}}, "jalview.datamodel.SequenceI,~B"); -Clazz.defineMethod (c$, "deleteSequence", -function (s, recalc) { -{ -this.sequences.remove (s); -if (recalc) { -this.recalcConservation (); -}}}, "jalview.datamodel.SequenceI,~B"); -Clazz.overrideMethod (c$, "getStartRes", -function () { -return this.startRes; -}); -Clazz.overrideMethod (c$, "getEndRes", -function () { -return this.endRes; -}); -Clazz.defineMethod (c$, "setStartRes", -function (i) { -this.startRes = i; -}, "~N"); -Clazz.defineMethod (c$, "setEndRes", -function (i) { -this.endRes = i; -}, "~N"); -Clazz.defineMethod (c$, "getSize", -function () { -return this.sequences.size (); -}); -Clazz.defineMethod (c$, "getSequenceAt", -function (i) { -return this.sequences.get (i); -}, "~N"); -Clazz.defineMethod (c$, "setColourText", -function (state) { -this.colourText = state; -}, "~B"); -Clazz.defineMethod (c$, "getColourText", -function () { -return this.colourText; -}); -Clazz.defineMethod (c$, "setDisplayText", -function (state) { -this.displayText = state; -}, "~B"); -Clazz.defineMethod (c$, "getDisplayText", -function () { -return this.displayText; -}); -Clazz.defineMethod (c$, "setDisplayBoxes", -function (state) { -this.displayBoxes = state; -}, "~B"); -Clazz.defineMethod (c$, "getDisplayBoxes", -function () { -return this.displayBoxes; -}); -Clazz.overrideMethod (c$, "getWidth", -function () { -{ -var first = true; -for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) { -if (first || seq.getLength () > this.width) { -this.width = seq.getLength (); -first = false; -}} -return this.width; -}}); -Clazz.defineMethod (c$, "setOutlineColour", -function (c) { -this.outlineColour = c; -}, "java.awt.Color"); -Clazz.defineMethod (c$, "getOutlineColour", -function () { -return this.outlineColour; -}); -Clazz.defineMethod (c$, "getSequencesInOrder", -function (al) { -return this.getSequencesInOrder (al, true); -}, "jalview.datamodel.AlignmentI"); -Clazz.defineMethod (c$, "getSequencesInOrder", -function (al, trim) { -{ -var sSize = this.sequences.size (); -var alHeight = al.getHeight (); -var seqs = new Array ((trim) ? sSize : alHeight); -var index = 0; -for (var i = 0; i < alHeight && index < sSize; i++) { -if (this.sequences.contains (al.getSequenceAt (i))) { -seqs[(trim) ? index : i] = al.getSequenceAt (i); -index++; -}} -if (index == 0) { -return null; -}if (!trim) { -return seqs; -}if (index < seqs.length) { -var dummy = seqs; -seqs = new Array (index); -while (--index >= 0) { -seqs[index] = dummy[index]; -dummy[index] = null; -} -}return seqs; -}}, "jalview.datamodel.AlignmentI,~B"); -Clazz.defineMethod (c$, "getIdColour", -function () { -return this.idColour; -}); -Clazz.defineMethod (c$, "setIdColour", -function (idColour) { -this.idColour = idColour; -}, "java.awt.Color"); -Clazz.overrideMethod (c$, "getSeqrep", -function () { -return this.seqrep; -}); -Clazz.overrideMethod (c$, "setSeqrep", -function (seqrep) { -this.seqrep = seqrep; -}, "jalview.datamodel.SequenceI"); -Clazz.overrideMethod (c$, "hasSeqrep", -function () { -return this.seqrep != null; -}); -Clazz.defineMethod (c$, "setHidereps", -function (visibility) { -this.hidereps = visibility; -}, "~B"); -Clazz.defineMethod (c$, "isHidereps", -function () { -return this.hidereps; -}); -Clazz.defineMethod (c$, "setHideCols", -function (visibility) { -this.hidecols = visibility; -}, "~B"); -Clazz.defineMethod (c$, "isHideCols", -function () { -return this.hidecols; -}); -Clazz.defineMethod (c$, "intersect", -function (alignment, map) { -var sgroup = new jalview.datamodel.SequenceGroup (this); -var insect = this.getSequencesInOrder (alignment); -sgroup.sequences = new java.util.ArrayList (); -for (var s = 0; insect != null && s < insect.length; s++) { -if (map == null || map.containsKey (insect[s])) { -sgroup.sequences.add (insect[s]); -}} -return sgroup; -}, "jalview.datamodel.AlignmentI,java.util.Map"); -Clazz.defineMethod (c$, "getShowNonconserved", -function () { -return this.showNonconserved; -}); -Clazz.defineMethod (c$, "setShowNonconserved", -function (displayNonconserved) { -this.showNonconserved = displayNonconserved; -}, "~B"); -Clazz.defineMethod (c$, "setConsensus", -function (aan) { -if (this.consensus == null) { -this.consensus = aan; -}}, "jalview.datamodel.AlignmentAnnotation"); -Clazz.defineMethod (c$, "getConsensus", -function () { -var aWidth = this.getWidth (); -if (aWidth < 0) { -return null; -}if (this.consensus == null) { -this.consensus = new jalview.datamodel.AlignmentAnnotation ("", "", new Array (1), 0, 100, 1); -this.consensus.hasText = true; -this.consensus.autoCalculated = true; -this.consensus.groupRef = this; -this.consensus.label = "Consensus for " + this.getName (); -this.consensus.description = "Percent Identity"; -}return this.consensus; -}); -Clazz.defineMethod (c$, "setConservationRow", -function (aan) { -if (this.conservation == null) { -this.conservation = aan; -}}, "jalview.datamodel.AlignmentAnnotation"); -Clazz.defineMethod (c$, "getConservationRow", -function () { -if (this.conservation == null) { -this.conservation = new jalview.datamodel.AlignmentAnnotation ("", "", new Array (1), 0, 11, 1); -}this.conservation.hasText = true; -this.conservation.autoCalculated = true; -this.conservation.groupRef = this; -this.conservation.label = "Conservation for " + this.getName (); -this.conservation.description = "Conservation for group " + this.getName () + " less than " + this.consPercGaps + "% gaps"; -return this.conservation; -}); -Clazz.defineMethod (c$, "hasAnnotationRows", -function () { -return this.consensus != null || this.conservation != null; -}); -Clazz.defineMethod (c$, "getConsensusSeq", -function () { -this.getConsensus (); -var seqs = new StringBuffer (); -for (var i = 0; i < this.consensus.annotations.length; i++) { -if (this.consensus.annotations[i] != null) { -if (this.consensus.annotations[i].description.charAt (0) == '[') { -seqs.append (this.consensus.annotations[i].description.charAt (1)); -} else { -seqs.append (this.consensus.annotations[i].displayCharacter); -}}} -var sq = new jalview.datamodel.Sequence ("Group" + this.getName () + " Consensus", seqs.toString ()); -sq.setDescription ("Percentage Identity Consensus " + ((this.ignoreGapsInConsensus) ? " without gaps" : "")); -return sq; -}); -Clazz.defineMethod (c$, "setIgnoreGapsConsensus", -function (state) { -if (this.ignoreGapsInConsensus != state && this.consensus != null) { -this.ignoreGapsInConsensus = state; -this.recalcConservation (); -}this.ignoreGapsInConsensus = state; -}, "~B"); -Clazz.defineMethod (c$, "getIgnoreGapsConsensus", -function () { -return this.ignoreGapsInConsensus; -}); -Clazz.defineMethod (c$, "setshowSequenceLogo", -function (showSequenceLogo) { -if (this.showSequenceLogo != showSequenceLogo && this.consensus != null) { -this.showSequenceLogo = showSequenceLogo; -this.recalcConservation (); -}this.showSequenceLogo = showSequenceLogo; -}, "~B"); -Clazz.defineMethod (c$, "setShowConsensusHistogram", -function (showConsHist) { -if (this.showConsensusHistogram != showConsHist && this.consensus != null) { -this.showConsensusHistogram = showConsHist; -this.recalcConservation (); -}this.showConsensusHistogram = showConsHist; -}, "~B"); -Clazz.defineMethod (c$, "isShowConsensusHistogram", -function () { -return this.showConsensusHistogram; -}); -Clazz.defineMethod (c$, "setNormaliseSequenceLogo", -function (norm) { -this.normaliseSequenceLogo = norm; -}, "~B"); -Clazz.defineMethod (c$, "isNormaliseSequenceLogo", -function () { -return this.normaliseSequenceLogo; -}); -Clazz.overrideMethod (c$, "getAlignmentAnnotation", -function () { -var annot = new java.util.ArrayList (); -{ -for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) { -var aa = seq.getAnnotation (); -if (aa != null) { -for (var al, $al = 0, $$al = aa; $al < $$al.length && ((al = $$al[$al]) || true); $al++) { -if (al.groupRef === this) { -annot.add (al); -}} -}} -if (this.consensus != null) { -annot.add (this.consensus); -}if (this.conservation != null) { -annot.add (this.conservation); -}}return annot.toArray ( new Array (0)); -}); -Clazz.overrideMethod (c$, "findAnnotation", -function (calcId) { -var aa = new java.util.ArrayList (); -for (var a, $a = 0, $$a = this.getAlignmentAnnotation (); $a < $$a.length && ((a = $$a[$a]) || true); $a++) { -if (a.getCalcId () === calcId) { -aa.add (a); -}} -return aa; -}, "~S"); -Clazz.overrideMethod (c$, "findAnnotations", -function (seq, calcId, label) { -var aa = new java.util.ArrayList (); -for (var ann, $ann = 0, $$ann = this.getAlignmentAnnotation (); $ann < $$ann.length && ((ann = $$ann[$ann]) || true); $ann++) { -if (ann.getCalcId () != null && ann.getCalcId ().equals (calcId) && ann.sequenceRef != null && ann.sequenceRef === seq && ann.label != null && ann.label.equals (label)) { -aa.add (ann); -}} -return aa; -}, "jalview.datamodel.SequenceI,~S,~S"); -Clazz.defineMethod (c$, "hasAnnotation", -function (calcId) { -if (calcId != null && !"".equals (calcId)) { -for (var a, $a = 0, $$a = this.getAlignmentAnnotation (); $a < $$a.length && ((a = $$a[$a]) || true); $a++) { -if (a.getCalcId () === calcId) { -return true; -}} -}return false; -}, "~S"); -Clazz.defineMethod (c$, "clear", -function () { -{ -this.sequences.clear (); -}}); -Clazz.defineMethod (c$, "setContext", -function (context) { -this.context = context; -}, "jalview.datamodel.AnnotatedCollectionI"); -Clazz.overrideMethod (c$, "getContext", -function () { -return this.context; -}); -}); +Clazz.declarePackage ("jalview.datamodel"); +Clazz.load (["jalview.datamodel.AnnotatedCollectionI", "java.awt.Color", "java.util.ArrayList"], "jalview.datamodel.SequenceGroup", ["jalview.analysis.AAFrequency", "$.Conservation", "jalview.datamodel.AlignmentAnnotation", "$.Sequence", "jalview.schemes.ResidueProperties", "jalview.util.Comparison", "java.lang.StringBuffer"], function () { +c$ = Clazz.decorateAsClass (function () { +this.groupName = null; +this.description = null; +this.conserve = null; +this.aaFrequency = null; +this.displayBoxes = true; +this.displayText = true; +this.colourText = false; +this.showNonconserved = false; +this.sequences = null; +this.seqrep = null; +this.width = -1; +this.cs = null; +this.startRes = 0; +this.endRes = 0; +this.outlineColour = null; +this.idColour = null; +this.thresholdTextColour = 0; +this.textColour = null; +this.textColour2 = null; +this.ignoreGapsInConsensus = true; +this.showSequenceLogo = false; +this.normaliseSequenceLogo = false; +this.consPercGaps = 25; +this.consensusData = null; +this.hidereps = false; +this.hidecols = false; +this.consensus = null; +this.conservation = null; +this.showConsensusHistogram = false; +this.context = null; +Clazz.instantialize (this, arguments); +}, jalview.datamodel, "SequenceGroup", null, jalview.datamodel.AnnotatedCollectionI); +Clazz.prepareFields (c$, function () { +this.sequences = new java.util.ArrayList (); +this.outlineColour = java.awt.Color.black; +this.textColour = java.awt.Color.black; +this.textColour2 = java.awt.Color.white; +}); +Clazz.defineMethod (c$, "isShowSequenceLogo", +function () { +return this.showSequenceLogo; +}); +Clazz.makeConstructor (c$, +function () { +this.groupName = "JGroup:" + this.hashCode (); +}); +Clazz.makeConstructor (c$, +function (sequences, groupName, scheme, displayBoxes, displayText, colourText, start, end) { +this.sequences = sequences; +this.groupName = groupName; +this.displayBoxes = displayBoxes; +this.displayText = displayText; +this.colourText = colourText; +this.cs = scheme; +this.startRes = start; +this.endRes = end; +this.recalcConservation (); +}, "java.util.List,~S,jalview.schemes.ColourSchemeI,~B,~B,~B,~N,~N"); +Clazz.makeConstructor (c$, +function (seqsel) { +if (seqsel != null) { +this.sequences = new java.util.ArrayList (); +this.sequences.addAll (seqsel.sequences); +if (seqsel.groupName != null) { +this.groupName = String.instantialize (seqsel.groupName); +}this.displayBoxes = seqsel.displayBoxes; +this.displayText = seqsel.displayText; +this.colourText = seqsel.colourText; +this.startRes = seqsel.startRes; +this.endRes = seqsel.endRes; +this.cs = seqsel.cs; +if (seqsel.description != null) { +this.description = String.instantialize (seqsel.description); +}this.hidecols = seqsel.hidecols; +this.hidereps = seqsel.hidereps; +this.idColour = seqsel.idColour; +this.outlineColour = seqsel.outlineColour; +this.seqrep = seqsel.seqrep; +this.textColour = seqsel.textColour; +this.textColour2 = seqsel.textColour2; +this.thresholdTextColour = seqsel.thresholdTextColour; +this.width = seqsel.width; +this.ignoreGapsInConsensus = seqsel.ignoreGapsInConsensus; +if (seqsel.conserve != null) { +this.recalcConservation (); +}}}, "jalview.datamodel.SequenceGroup"); +Clazz.defineMethod (c$, "getSelectionAsNewSequences", +function (align) { +var iSize = this.sequences.size (); +var seqs = new Array (iSize); +var inorder = this.getSequencesInOrder (align); +for (var i = 0, ipos = 0; i < inorder.length; i++) { +var seq = inorder[i]; +seqs[ipos] = seq.getSubSequence (this.startRes, this.endRes + 1); +if (seqs[ipos] != null) { +seqs[ipos].setDescription (seq.getDescription ()); +seqs[ipos].setDBRef (seq.getDBRef ()); +seqs[ipos].setSequenceFeatures (seq.getSequenceFeatures ()); +if (seq.getDatasetSequence () != null) { +seqs[ipos].setDatasetSequence (seq.getDatasetSequence ()); +}if (seq.getAnnotation () != null) { +var alann = align.getAlignmentAnnotation (); +for (var a = 0; a < seq.getAnnotation ().length; a++) { +var tocopy = seq.getAnnotation ()[a]; +if (alann != null) { +var found = false; +for (var pos = 0; pos < alann.length; pos++) { +if (alann[pos] === tocopy) { +found = true; +break; +}} +if (!found) { +continue; +}}var newannot = new jalview.datamodel.AlignmentAnnotation (seq.getAnnotation ()[a]); +newannot.restrict (this.startRes, this.endRes); +newannot.setSequenceRef (seqs[ipos]); +newannot.adjustForAlignment (); +seqs[ipos].addAlignmentAnnotation (newannot); +} +}ipos++; +} else { +iSize--; +}} +if (iSize != inorder.length) { +var nseqs = new Array (iSize); +System.arraycopy (seqs, 0, nseqs, 0, iSize); +seqs = nseqs; +}return seqs; +}, "jalview.datamodel.AlignmentI"); +Clazz.defineMethod (c$, "findEndRes", +function (seq) { +var eres = 0; +var ch; +for (var j = 0; j < this.endRes + 1 && j < seq.getLength (); j++) { +ch = seq.getCharAt (j); +if (!jalview.util.Comparison.isGap ((ch))) { +eres++; +}} +if (eres > 0) { +eres += seq.getStart () - 1; +}return eres; +}, "jalview.datamodel.SequenceI"); +Clazz.defineMethod (c$, "getSequences", +function () { +return this.sequences; +}); +Clazz.defineMethod (c$, "getSequences", +function (hiddenReps) { +if (hiddenReps == null) { +return this.sequences; +} else { +var allSequences = new java.util.ArrayList (); +for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) { +allSequences.add (seq); +if (hiddenReps.containsKey (seq)) { +var hsg = hiddenReps.get (seq); +for (var seq2, $seq2 = hsg.getSequences ().iterator (); $seq2.hasNext () && ((seq2 = $seq2.next ()) || true);) { +if (seq2 !== seq && !allSequences.contains (seq2)) { +allSequences.add (seq2); +}} +}} +return allSequences; +}}, "java.util.Map"); +Clazz.defineMethod (c$, "getSequencesAsArray", +function (map) { +var tmp = this.getSequences (map); +if (tmp == null) { +return null; +}return tmp.toArray ( new Array (tmp.size ())); +}, "java.util.Map"); +Clazz.defineMethod (c$, "adjustForRemoveLeft", +function (col) { +if (this.startRes >= col) { +this.startRes = this.startRes - col; +}if (this.endRes >= col) { +this.endRes = this.endRes - col; +if (this.startRes > this.endRes) { +this.startRes = 0; +}} else { +return false; +}return true; +}, "~N"); +Clazz.defineMethod (c$, "adjustForRemoveRight", +function (col) { +if (this.startRes > col) { +return false; +}if (this.endRes >= col) { +this.endRes = col; +}return true; +}, "~N"); +Clazz.defineMethod (c$, "getName", +function () { +return this.groupName; +}); +Clazz.defineMethod (c$, "getDescription", +function () { +return this.description; +}); +Clazz.defineMethod (c$, "setName", +function (name) { +this.groupName = name; +}, "~S"); +Clazz.defineMethod (c$, "setDescription", +function (desc) { +this.description = desc; +}, "~S"); +Clazz.defineMethod (c$, "getConservation", +function () { +return this.conserve; +}); +Clazz.defineMethod (c$, "setConservation", +function (c) { +this.conserve = c; +}, "jalview.analysis.Conservation"); +Clazz.defineMethod (c$, "addSequence", +function (s, recalc) { +{ +if (s != null && !this.sequences.contains (s)) { +this.sequences.add (s); +}if (recalc) { +this.recalcConservation (); +}}}, "jalview.datamodel.SequenceI,~B"); +Clazz.defineMethod (c$, "getConsPercGaps", +function () { +return this.consPercGaps; +}); +Clazz.defineMethod (c$, "setConsPercGaps", +function (consPercGaps) { +this.consPercGaps = consPercGaps; +}, "~N"); +Clazz.defineMethod (c$, "recalcConservation", +function () { +if (this.cs == null && this.consensus == null && this.conservation == null) { +return; +}try { +var cnsns = jalview.analysis.AAFrequency.calculate (this.sequences, this.startRes, this.endRes + 1, this.showSequenceLogo); +if (this.consensus != null) { +this._updateConsensusRow (cnsns, this.sequences.size ()); +}if (this.cs != null) { +this.cs.setConsensus (cnsns); +}if ((this.conservation != null) || (this.cs != null && this.cs.conservationApplied ())) { +var c = new jalview.analysis.Conservation (this.groupName, jalview.schemes.ResidueProperties.propHash, 3, this.sequences, this.startRes, this.endRes + 1); +c.calculate (); +c.verdict (false, this.consPercGaps); +if (this.conservation != null) { +this._updateConservationRow (c); +}if (this.cs != null) { +if (this.cs.conservationApplied ()) { +this.cs.setConservation (c); +}}}if (this.cs != null) { +this.cs.alignmentChanged (this.context != null ? this.context : this, null); +}} catch (err) { +if (Clazz.exceptionOf (err, OutOfMemoryError)) { +System.out.println ("Out of memory loading groups: " + err); +} else { +throw err; +} +} +}); +Clazz.defineMethod (c$, "_updateConservationRow", + function (c) { +if (this.conservation == null) { +this.getConservation (); +}this.conservation.label = "Conservation for " + this.getName (); +this.conservation.description = "Conservation for group " + this.getName () + " less than " + this.consPercGaps + "% gaps"; +var aWidth = (this.conservation.annotations != null) ? (this.endRes < this.conservation.annotations.length ? this.conservation.annotations.length : this.endRes + 1) : this.endRes + 1; +this.conservation.annotations = null; +this.conservation.annotations = new Array (aWidth); +c.completeAnnotations (this.conservation, null, this.startRes, this.endRes + 1); +}, "jalview.analysis.Conservation"); +Clazz.defineMethod (c$, "_updateConsensusRow", + function (cnsns, nseq) { +if (this.consensus == null) { +this.getConsensus (); +}this.consensus.label = "Consensus for " + this.getName (); +this.consensus.description = "Percent Identity"; +this.consensusData = cnsns; +var aWidth = (this.consensus.annotations != null) ? (this.endRes < this.consensus.annotations.length ? this.consensus.annotations.length : this.endRes + 1) : this.endRes + 1; +this.consensus.annotations = null; +this.consensus.annotations = new Array (aWidth); +jalview.analysis.AAFrequency.completeConsensus (this.consensus, cnsns, this.startRes, this.endRes + 1, this.ignoreGapsInConsensus, this.showSequenceLogo, nseq); +}, "~A,~N"); +Clazz.defineMethod (c$, "addOrRemove", +function (s, recalc) { +{ +if (this.sequences.contains (s)) { +this.deleteSequence (s, recalc); +} else { +this.addSequence (s, recalc); +}}}, "jalview.datamodel.SequenceI,~B"); +Clazz.defineMethod (c$, "deleteSequence", +function (s, recalc) { +{ +this.sequences.remove (s); +if (recalc) { +this.recalcConservation (); +}}}, "jalview.datamodel.SequenceI,~B"); +Clazz.overrideMethod (c$, "getStartRes", +function () { +return this.startRes; +}); +Clazz.overrideMethod (c$, "getEndRes", +function () { +return this.endRes; +}); +Clazz.defineMethod (c$, "setStartRes", +function (i) { +this.startRes = i; +}, "~N"); +Clazz.defineMethod (c$, "setEndRes", +function (i) { +this.endRes = i; +}, "~N"); +Clazz.defineMethod (c$, "getSize", +function () { +return this.sequences.size (); +}); +Clazz.defineMethod (c$, "getSequenceAt", +function (i) { +return this.sequences.get (i); +}, "~N"); +Clazz.defineMethod (c$, "setColourText", +function (state) { +this.colourText = state; +}, "~B"); +Clazz.defineMethod (c$, "getColourText", +function () { +return this.colourText; +}); +Clazz.defineMethod (c$, "setDisplayText", +function (state) { +this.displayText = state; +}, "~B"); +Clazz.defineMethod (c$, "getDisplayText", +function () { +return this.displayText; +}); +Clazz.defineMethod (c$, "setDisplayBoxes", +function (state) { +this.displayBoxes = state; +}, "~B"); +Clazz.defineMethod (c$, "getDisplayBoxes", +function () { +return this.displayBoxes; +}); +Clazz.overrideMethod (c$, "getWidth", +function () { +{ +var first = true; +for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) { +if (first || seq.getLength () > this.width) { +this.width = seq.getLength (); +first = false; +}} +return this.width; +}}); +Clazz.defineMethod (c$, "setOutlineColour", +function (c) { +this.outlineColour = c; +}, "java.awt.Color"); +Clazz.defineMethod (c$, "getOutlineColour", +function () { +return this.outlineColour; +}); +Clazz.defineMethod (c$, "getSequencesInOrder", +function (al) { +return this.getSequencesInOrder (al, true); +}, "jalview.datamodel.AlignmentI"); +Clazz.defineMethod (c$, "getSequencesInOrder", +function (al, trim) { +{ +var sSize = this.sequences.size (); +var alHeight = al.getHeight (); +var seqs = new Array ((trim) ? sSize : alHeight); +var index = 0; +for (var i = 0; i < alHeight && index < sSize; i++) { +if (this.sequences.contains (al.getSequenceAt (i))) { +seqs[(trim) ? index : i] = al.getSequenceAt (i); +index++; +}} +if (index == 0) { +return null; +}if (!trim) { +return seqs; +}if (index < seqs.length) { +var dummy = seqs; +seqs = new Array (index); +while (--index >= 0) { +seqs[index] = dummy[index]; +dummy[index] = null; +} +}return seqs; +}}, "jalview.datamodel.AlignmentI,~B"); +Clazz.defineMethod (c$, "getIdColour", +function () { +return this.idColour; +}); +Clazz.defineMethod (c$, "setIdColour", +function (idColour) { +this.idColour = idColour; +}, "java.awt.Color"); +Clazz.overrideMethod (c$, "getSeqrep", +function () { +return this.seqrep; +}); +Clazz.overrideMethod (c$, "setSeqrep", +function (seqrep) { +this.seqrep = seqrep; +}, "jalview.datamodel.SequenceI"); +Clazz.overrideMethod (c$, "hasSeqrep", +function () { +return this.seqrep != null; +}); +Clazz.defineMethod (c$, "setHidereps", +function (visibility) { +this.hidereps = visibility; +}, "~B"); +Clazz.defineMethod (c$, "isHidereps", +function () { +return this.hidereps; +}); +Clazz.defineMethod (c$, "setHideCols", +function (visibility) { +this.hidecols = visibility; +}, "~B"); +Clazz.defineMethod (c$, "isHideCols", +function () { +return this.hidecols; +}); +Clazz.defineMethod (c$, "intersect", +function (alignment, map) { +var sgroup = new jalview.datamodel.SequenceGroup (this); +var insect = this.getSequencesInOrder (alignment); +sgroup.sequences = new java.util.ArrayList (); +for (var s = 0; insect != null && s < insect.length; s++) { +if (map == null || map.containsKey (insect[s])) { +sgroup.sequences.add (insect[s]); +}} +return sgroup; +}, "jalview.datamodel.AlignmentI,java.util.Map"); +Clazz.defineMethod (c$, "getShowNonconserved", +function () { +return this.showNonconserved; +}); +Clazz.defineMethod (c$, "setShowNonconserved", +function (displayNonconserved) { +this.showNonconserved = displayNonconserved; +}, "~B"); +Clazz.defineMethod (c$, "setConsensus", +function (aan) { +if (this.consensus == null) { +this.consensus = aan; +}}, "jalview.datamodel.AlignmentAnnotation"); +Clazz.defineMethod (c$, "getConsensus", +function () { +var aWidth = this.getWidth (); +if (aWidth < 0) { +return null; +}if (this.consensus == null) { +this.consensus = new jalview.datamodel.AlignmentAnnotation ("", "", new Array (1), 0, 100, 1); +this.consensus.hasText = true; +this.consensus.autoCalculated = true; +this.consensus.groupRef = this; +this.consensus.label = "Consensus for " + this.getName (); +this.consensus.description = "Percent Identity"; +}return this.consensus; +}); +Clazz.defineMethod (c$, "setConservationRow", +function (aan) { +if (this.conservation == null) { +this.conservation = aan; +}}, "jalview.datamodel.AlignmentAnnotation"); +Clazz.defineMethod (c$, "getConservationRow", +function () { +if (this.conservation == null) { +this.conservation = new jalview.datamodel.AlignmentAnnotation ("", "", new Array (1), 0, 11, 1); +}this.conservation.hasText = true; +this.conservation.autoCalculated = true; +this.conservation.groupRef = this; +this.conservation.label = "Conservation for " + this.getName (); +this.conservation.description = "Conservation for group " + this.getName () + " less than " + this.consPercGaps + "% gaps"; +return this.conservation; +}); +Clazz.defineMethod (c$, "hasAnnotationRows", +function () { +return this.consensus != null || this.conservation != null; +}); +Clazz.defineMethod (c$, "getConsensusSeq", +function () { +this.getConsensus (); +var seqs = new StringBuffer (); +for (var i = 0; i < this.consensus.annotations.length; i++) { +if (this.consensus.annotations[i] != null) { +if (this.consensus.annotations[i].description.charAt (0) == '[') { +seqs.append (this.consensus.annotations[i].description.charAt (1)); +} else { +seqs.append (this.consensus.annotations[i].displayCharacter); +}}} +var sq = new jalview.datamodel.Sequence ("Group" + this.getName () + " Consensus", seqs.toString ()); +sq.setDescription ("Percentage Identity Consensus " + ((this.ignoreGapsInConsensus) ? " without gaps" : "")); +return sq; +}); +Clazz.defineMethod (c$, "setIgnoreGapsConsensus", +function (state) { +if (this.ignoreGapsInConsensus != state && this.consensus != null) { +this.ignoreGapsInConsensus = state; +this.recalcConservation (); +}this.ignoreGapsInConsensus = state; +}, "~B"); +Clazz.defineMethod (c$, "getIgnoreGapsConsensus", +function () { +return this.ignoreGapsInConsensus; +}); +Clazz.defineMethod (c$, "setshowSequenceLogo", +function (showSequenceLogo) { +if (this.showSequenceLogo != showSequenceLogo && this.consensus != null) { +this.showSequenceLogo = showSequenceLogo; +this.recalcConservation (); +}this.showSequenceLogo = showSequenceLogo; +}, "~B"); +Clazz.defineMethod (c$, "setShowConsensusHistogram", +function (showConsHist) { +if (this.showConsensusHistogram != showConsHist && this.consensus != null) { +this.showConsensusHistogram = showConsHist; +this.recalcConservation (); +}this.showConsensusHistogram = showConsHist; +}, "~B"); +Clazz.defineMethod (c$, "isShowConsensusHistogram", +function () { +return this.showConsensusHistogram; +}); +Clazz.defineMethod (c$, "setNormaliseSequenceLogo", +function (norm) { +this.normaliseSequenceLogo = norm; +}, "~B"); +Clazz.defineMethod (c$, "isNormaliseSequenceLogo", +function () { +return this.normaliseSequenceLogo; +}); +Clazz.overrideMethod (c$, "getAlignmentAnnotation", +function () { +var annot = new java.util.ArrayList (); +{ +for (var seq, $seq = this.sequences.iterator (); $seq.hasNext () && ((seq = $seq.next ()) || true);) { +var aa = seq.getAnnotation (); +if (aa != null) { +for (var al, $al = 0, $$al = aa; $al < $$al.length && ((al = $$al[$al]) || true); $al++) { +if (al.groupRef === this) { +annot.add (al); +}} +}} +if (this.consensus != null) { +annot.add (this.consensus); +}if (this.conservation != null) { +annot.add (this.conservation); +}}return annot.toArray ( new Array (0)); +}); +Clazz.overrideMethod (c$, "findAnnotation", +function (calcId) { +var aa = new java.util.ArrayList (); +for (var a, $a = 0, $$a = this.getAlignmentAnnotation (); $a < $$a.length && ((a = $$a[$a]) || true); $a++) { +if (a.getCalcId () === calcId) { +aa.add (a); +}} +return aa; +}, "~S"); +Clazz.overrideMethod (c$, "findAnnotations", +function (seq, calcId, label) { +var aa = new java.util.ArrayList (); +for (var ann, $ann = 0, $$ann = this.getAlignmentAnnotation (); $ann < $$ann.length && ((ann = $$ann[$ann]) || true); $ann++) { +if (ann.getCalcId () != null && ann.getCalcId ().equals (calcId) && ann.sequenceRef != null && ann.sequenceRef === seq && ann.label != null && ann.label.equals (label)) { +aa.add (ann); +}} +return aa; +}, "jalview.datamodel.SequenceI,~S,~S"); +Clazz.defineMethod (c$, "hasAnnotation", +function (calcId) { +if (calcId != null && !"".equals (calcId)) { +for (var a, $a = 0, $$a = this.getAlignmentAnnotation (); $a < $$a.length && ((a = $$a[$a]) || true); $a++) { +if (a.getCalcId () === calcId) { +return true; +}} +}return false; +}, "~S"); +Clazz.defineMethod (c$, "clear", +function () { +{ +this.sequences.clear (); +}}); +Clazz.defineMethod (c$, "setContext", +function (context) { +this.context = context; +}, "jalview.datamodel.AnnotatedCollectionI"); +Clazz.overrideMethod (c$, "getContext", +function () { +return this.context; +}); +});