X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=site%2Fj2s%2Fjalview%2Fio%2FAlignFile.js;h=142c507b74827be531cb6e04f2c18e7d0ba8526a;hp=f3247de1799dc989de099564fc21b3b21d39ced6;hb=b9b7a352eee79b7764c3b09c9d19663075061d8c;hpb=7301a2415adab88038b291fc54caeeb3a5a47a44 diff --git a/site/j2s/jalview/io/AlignFile.js b/site/j2s/jalview/io/AlignFile.js index f3247de..142c507 100644 --- a/site/j2s/jalview/io/AlignFile.js +++ b/site/j2s/jalview/io/AlignFile.js @@ -1,158 +1,158 @@ -Clazz.declarePackage ("jalview.io"); -Clazz.load (["jalview.io.FileParse"], "jalview.io.AlignFile", ["jalview.datamodel.Sequence", "jalview.util.MessageManager", "java.io.IOException", "java.lang.Error", "java.util.ArrayList", "$.Hashtable", "$.Vector"], function () { -c$ = Clazz.decorateAsClass (function () { -this.noSeqs = 0; -this.maxLength = 0; -this.seqs = null; -this.annotations = null; -this.seqGroups = null; -this.properties = null; -this.start = 0; -this.end = 0; -this.jvSuffix = true; -this.parseCalled = false; -this.newickStrings = null; -Clazz.instantialize (this, arguments); -}, jalview.io, "AlignFile", jalview.io.FileParse); -Clazz.makeConstructor (c$, -function () { -Clazz.superConstructor (this, jalview.io.AlignFile, []); -this.initData (); -}); -Clazz.makeConstructor (c$, -function (inFile, type) { -this.construct (true, inFile, type); -}, "~S,~S"); -Clazz.makeConstructor (c$, -function (parseImmediately, inFile, type) { -Clazz.superConstructor (this, jalview.io.AlignFile, [inFile, type]); -this.initData (); -if (parseImmediately) { -this.doParse (); -}}, "~B,~S,~S"); -Clazz.makeConstructor (c$, -function (source) { -this.construct (true, source); -}, "jalview.io.FileParse"); -Clazz.makeConstructor (c$, -function (parseImmediately, source) { -Clazz.superConstructor (this, jalview.io.AlignFile, [source]); -this.initData (); -if (parseImmediately) { -this.doParse (); -}}, "~B,jalview.io.FileParse"); -Clazz.defineMethod (c$, "doParse", -function () { -if (this.parseCalled) { -throw new java.io.IOException ("Implementation error: Parser called twice for same data.\nNeed to call initData() again before parsing can be reattempted."); -}this.parseCalled = true; -this.parse (); -for (var i = 0, c = this.seqs.size (); i < c; i++) { -this.seqs.get (i).setIndex (i); -} -}); -Clazz.defineMethod (c$, "getSeqs", -function () { -return this.seqs; -}); -Clazz.defineMethod (c$, "getSeqGroups", -function () { -return this.seqGroups; -}); -Clazz.defineMethod (c$, "getSeqsAsArray", -function () { -var s = new Array (this.seqs.size ()); -for (var i = 0; i < this.seqs.size (); i++) { -s[i] = this.seqs.elementAt (i); -} -return s; -}); -Clazz.defineMethod (c$, "addAnnotations", -function (al) { -this.addProperties (al); -for (var i = 0; i < this.annotations.size (); i++) { -var an = this.annotations.elementAt (i); -an.validateRangeAndDisplay (); -al.addAnnotation (an); -} -}, "jalview.datamodel.AlignmentI"); -Clazz.defineMethod (c$, "addSeqGroups", -function (al) { -this.seqGroups = al.getGroups (); -}, "jalview.datamodel.AlignmentI"); -Clazz.defineMethod (c$, "addProperties", -function (al) { -if (this.properties != null && this.properties.size () > 0) { -var keys = this.properties.keys (); -var vals = this.properties.elements (); -while (keys.hasMoreElements ()) { -al.setProperty (keys.nextElement (), vals.nextElement ()); -} -}}, "jalview.datamodel.AlignmentI"); -Clazz.defineMethod (c$, "setAlignmentProperty", -function (key, value) { -if (key == null) { -throw new Error (jalview.util.MessageManager.getString ("error.implementation_error_cannot_have_null_alignment")); -}if (value == null) { -return; -}if (this.properties == null) { -this.properties = new java.util.Hashtable (); -}this.properties.put (key, value); -}, "~O,~O"); -Clazz.defineMethod (c$, "getAlignmentProperty", -function (key) { -if (this.properties != null && key != null) { -return this.properties.get (key); -}return null; -}, "~O"); -Clazz.defineMethod (c$, "initData", -function () { -this.seqs = new java.util.Vector (); -this.annotations = new java.util.Vector (); -this.seqGroups = new java.util.ArrayList (); -this.parseCalled = false; -}); -Clazz.defineMethod (c$, "setSeqs", -function (s) { -this.seqs = new java.util.Vector (); -for (var i = 0; i < s.length; i++) { -this.seqs.addElement (s[i]); -} -}, "~A"); -Clazz.defineMethod (c$, "addJVSuffix", -function (b) { -this.jvSuffix = b; -}, "~B"); -Clazz.defineMethod (c$, "parseId", -function (id) { -var seq = null; -id = id.trim (); -var space = id.indexOf (" "); -if (space > -1) { -seq = new jalview.datamodel.Sequence (id.substring (0, space), ""); -seq.setDescription (id.substring (space + 1)); -} else { -seq = new jalview.datamodel.Sequence (id, ""); -}return seq; -}, "~S"); -Clazz.defineMethod (c$, "printId", -function (seq) { -return seq.getDisplayId (this.jvSuffix); -}, "jalview.datamodel.SequenceI"); -Clazz.defineMethod (c$, "addNewickTree", -function (treeName, newickString) { -if (this.newickStrings == null) { -this.newickStrings = new java.util.Vector (); -}this.newickStrings.addElement ( Clazz.newArray (-1, [treeName, newickString])); -}, "~S,~S"); -Clazz.defineMethod (c$, "getTreeCount", -function () { -return this.newickStrings == null ? 0 : this.newickStrings.size (); -}); -Clazz.defineMethod (c$, "addGroups", -function (al) { -for (var sg, $sg = this.getSeqGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) { -al.addGroup (sg); -} -}, "jalview.datamodel.AlignmentI"); -}); +Clazz.declarePackage ("jalview.io"); +Clazz.load (["jalview.io.FileParse"], "jalview.io.AlignFile", ["jalview.datamodel.Sequence", "jalview.util.MessageManager", "java.io.IOException", "java.lang.Error", "java.util.ArrayList", "$.Hashtable", "$.Vector"], function () { +c$ = Clazz.decorateAsClass (function () { +this.noSeqs = 0; +this.maxLength = 0; +this.seqs = null; +this.annotations = null; +this.seqGroups = null; +this.properties = null; +this.start = 0; +this.end = 0; +this.jvSuffix = true; +this.parseCalled = false; +this.newickStrings = null; +Clazz.instantialize (this, arguments); +}, jalview.io, "AlignFile", jalview.io.FileParse); +Clazz.makeConstructor (c$, +function () { +Clazz.superConstructor (this, jalview.io.AlignFile, []); +this.initData (); +}); +Clazz.makeConstructor (c$, +function (inFile, type) { +this.construct (true, inFile, type); +}, "~S,~S"); +Clazz.makeConstructor (c$, +function (parseImmediately, inFile, type) { +Clazz.superConstructor (this, jalview.io.AlignFile, [inFile, type]); +this.initData (); +if (parseImmediately) { +this.doParse (); +}}, "~B,~S,~S"); +Clazz.makeConstructor (c$, +function (source) { +this.construct (true, source); +}, "jalview.io.FileParse"); +Clazz.makeConstructor (c$, +function (parseImmediately, source) { +Clazz.superConstructor (this, jalview.io.AlignFile, [source]); +this.initData (); +if (parseImmediately) { +this.doParse (); +}}, "~B,jalview.io.FileParse"); +Clazz.defineMethod (c$, "doParse", +function () { +if (this.parseCalled) { +throw new java.io.IOException ("Implementation error: Parser called twice for same data.\nNeed to call initData() again before parsing can be reattempted."); +}this.parseCalled = true; +this.parse (); +for (var i = 0, c = this.seqs.size (); i < c; i++) { +this.seqs.get (i).setIndex (i); +} +}); +Clazz.defineMethod (c$, "getSeqs", +function () { +return this.seqs; +}); +Clazz.defineMethod (c$, "getSeqGroups", +function () { +return this.seqGroups; +}); +Clazz.defineMethod (c$, "getSeqsAsArray", +function () { +var s = new Array (this.seqs.size ()); +for (var i = 0; i < this.seqs.size (); i++) { +s[i] = this.seqs.elementAt (i); +} +return s; +}); +Clazz.defineMethod (c$, "addAnnotations", +function (al) { +this.addProperties (al); +for (var i = 0; i < this.annotations.size (); i++) { +var an = this.annotations.elementAt (i); +an.validateRangeAndDisplay (); +al.addAnnotation (an); +} +}, "jalview.datamodel.AlignmentI"); +Clazz.defineMethod (c$, "addSeqGroups", +function (al) { +this.seqGroups = al.getGroups (); +}, "jalview.datamodel.AlignmentI"); +Clazz.defineMethod (c$, "addProperties", +function (al) { +if (this.properties != null && this.properties.size () > 0) { +var keys = this.properties.keys (); +var vals = this.properties.elements (); +while (keys.hasMoreElements ()) { +al.setProperty (keys.nextElement (), vals.nextElement ()); +} +}}, "jalview.datamodel.AlignmentI"); +Clazz.defineMethod (c$, "setAlignmentProperty", +function (key, value) { +if (key == null) { +throw new Error (jalview.util.MessageManager.getString ("error.implementation_error_cannot_have_null_alignment")); +}if (value == null) { +return; +}if (this.properties == null) { +this.properties = new java.util.Hashtable (); +}this.properties.put (key, value); +}, "~O,~O"); +Clazz.defineMethod (c$, "getAlignmentProperty", +function (key) { +if (this.properties != null && key != null) { +return this.properties.get (key); +}return null; +}, "~O"); +Clazz.defineMethod (c$, "initData", +function () { +this.seqs = new java.util.Vector (); +this.annotations = new java.util.Vector (); +this.seqGroups = new java.util.ArrayList (); +this.parseCalled = false; +}); +Clazz.defineMethod (c$, "setSeqs", +function (s) { +this.seqs = new java.util.Vector (); +for (var i = 0; i < s.length; i++) { +this.seqs.addElement (s[i]); +} +}, "~A"); +Clazz.defineMethod (c$, "addJVSuffix", +function (b) { +this.jvSuffix = b; +}, "~B"); +Clazz.defineMethod (c$, "parseId", +function (id) { +var seq = null; +id = id.trim (); +var space = id.indexOf (" "); +if (space > -1) { +seq = new jalview.datamodel.Sequence (id.substring (0, space), ""); +seq.setDescription (id.substring (space + 1)); +} else { +seq = new jalview.datamodel.Sequence (id, ""); +}return seq; +}, "~S"); +Clazz.defineMethod (c$, "printId", +function (seq) { +return seq.getDisplayId (this.jvSuffix); +}, "jalview.datamodel.SequenceI"); +Clazz.defineMethod (c$, "addNewickTree", +function (treeName, newickString) { +if (this.newickStrings == null) { +this.newickStrings = new java.util.Vector (); +}this.newickStrings.addElement ( Clazz.newArray (-1, [treeName, newickString])); +}, "~S,~S"); +Clazz.defineMethod (c$, "getTreeCount", +function () { +return this.newickStrings == null ? 0 : this.newickStrings.size (); +}); +Clazz.defineMethod (c$, "addGroups", +function (al) { +for (var sg, $sg = this.getSeqGroups ().iterator (); $sg.hasNext () && ((sg = $sg.next ()) || true);) { +al.addGroup (sg); +} +}, "jalview.datamodel.AlignmentI"); +});