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