X-Git-Url: http://source.jalview.org/gitweb/?p=jalviewjs.git;a=blobdiff_plain;f=bin%2Fjalview%2Fio%2FModellerDescription.js;h=c08736d44036c99deffc21a678d43c4337f4ad71;hp=1232c0523e5d39a28fe345e76ea3bcb62c8e7655;hb=7301a2415adab88038b291fc54caeeb3a5a47a44;hpb=6154cb57a6eac3bb1344b8342495f5bb701ee921 diff --git a/bin/jalview/io/ModellerDescription.js b/bin/jalview/io/ModellerDescription.js index 1232c05..c08736d 100644 --- a/bin/jalview/io/ModellerDescription.js +++ b/bin/jalview/io/ModellerDescription.js @@ -1,236 +1,236 @@ -Clazz.declarePackage ("jalview.io"); -Clazz.load (["java.util.Hashtable"], "jalview.io.ModellerDescription", ["jalview.datamodel.DBRefSource", "jalview.jsdev.RegExp", "java.util.StringTokenizer"], function () { -c$ = Clazz.decorateAsClass (function () { -this.seqTypes = null; -this.Fields = null; -this.TYPE = 0; -this.LOCALID = 1; -this.START = 2; -this.START_CHAIN = 3; -this.END = 4; -this.END_CHAIN = 5; -this.DESCRIPTION1 = 6; -this.DESCRIPTION2 = 7; -this.RESOLUTION = 8; -this.TAIL = 9; -this.Types = null; -this.Padding = null; -this.fields = null; -if (!Clazz.isClassDefined ("jalview.io.ModellerDescription.resCode")) { -jalview.io.ModellerDescription.$ModellerDescription$resCode$ (); -} -Clazz.instantialize (this, arguments); -}, jalview.io, "ModellerDescription"); -Clazz.prepareFields (c$, function () { -this.seqTypes = Clazz.newArray (-1, ["sequence", "structure", "structureX", "structureN"]); -this.Fields = Clazz.newArray (-1, ["objectType", "objectId", "startField", "startCode", "endField", "endCode", "description1", "description2", "resolutionField", "tailField"]); -this.Types = Clazz.newIntArray (-1, [0, 0, 1, 0, 1, 0, 0, 0, 0, 0]); -this.Padding = Clazz.newCharArray (-1, [' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.']); -this.fields = new java.util.Hashtable (); -}); -Clazz.makeConstructor (c$, -function () { -this.fields.put (this.Fields[9], ""); -}); -Clazz.defineMethod (c$, "validResidueCode", -($fz = function (field) { -var val = null; -var r = jalview.jsdev.RegExp.newRegex (["\\s*((([-0-9]+).?)|FIRST|LAST|@)"]); -if (!r.search (field)) { -return null; -}var value = r.stringMatchedI (3); -if (value == null) { -value = r.stringMatchedI (1); -}try { -val = Integer.$valueOf (value); -return Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, field, val); -} catch (e) { -if (Clazz.exceptionOf (e, Exception)) { -} else { -throw e; -} -} -return Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, field, null); -}, $fz.isPrivate = true, $fz), "~S"); -Clazz.defineMethod (c$, "parseDescription", -($fz = function (desc) { -var fields = new java.util.Hashtable (); -var st = new java.util.StringTokenizer (desc, ":", true); -var field; -var type = -1; -if (st.countTokens () > 0) { -var i = 0; -field = st.nextToken (":"); -do { -if (this.seqTypes[i].equalsIgnoreCase (field)) { -break; -}} while (++i < this.seqTypes.length); -if (i < this.seqTypes.length) { -st.nextToken (); -type = i; -i = 1; -while (i < 9 && st.hasMoreTokens ()) { -if ((field = st.nextToken (":")) != null) { -if (!field.equals (":")) { -if (this.Types[i] == 1) { -var val = this.validResidueCode (field); -if (val != null) { -fields.put ( String.instantialize (this.Fields[i] + "num"), val); -} else { -type = -1; -};}fields.put (this.Fields[i++], field); -if (st.hasMoreTokens ()) { -st.nextToken (); -}} else { -i++; -}}} -if (i == 9) { -while (st.hasMoreTokens ()) { -var tl = st.nextToken (":"); -field += tl.equals (":") ? tl : (":" + tl); -} -fields.put (this.Fields[9], field); -}}}if (type == -1) { -fields = new java.util.Hashtable (); -fields.put (this.Fields[9], String.instantialize (desc)); -} else { -fields.put (this.Fields[0], this.seqTypes[type]); -}return fields; -}, $fz.isPrivate = true, $fz), "~S"); -Clazz.makeConstructor (c$, -function (desc) { -if (desc == null) { -desc = ""; -}this.fields = this.parseDescription (desc); -}, "~S"); -Clazz.defineMethod (c$, "setStartCode", -function (v) { -var r; -this.fields.put (this.Fields[2] + "num", r = Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, v)); -this.fields.put (this.Fields[2], r.field); -}, "~N"); -Clazz.defineMethod (c$, "setEndCode", -function (v) { -var r; -this.fields.put (this.Fields[4] + "num", r = Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, v)); -this.fields.put (this.Fields[4], r.field); -}, "~N"); -Clazz.makeConstructor (c$, -function (seq) { -if (seq.getDescription () != null) { -this.fields = this.parseDescription (seq.getDescription ()); -}if (this.isModellerFieldset ()) { -if (this.getStartCode () == null || (this.getStartNum () != seq.getStart () && this.getStartCode ().val != null)) { -this.setStartCode (seq.getStart ()); -}if (this.getEndCode () == null || (this.getEndNum () != seq.getEnd () && this.getStartCode () != null && this.getStartCode ().val != null)) { -this.setEndCode (seq.getEnd ()); -}} else { -this.setStartCode (seq.getStart ()); -this.setEndCode (seq.getEnd ()); -this.fields.put (this.Fields[1], seq.getName ()); -var t = 0; -if (seq.getDatasetSequence () != null && seq.getDatasetSequence ().getDBRef () != null) { -var dbr = seq.getDatasetSequence ().getDBRef (); -var i; -var j; -for (i = 0, j = dbr.length; i < j; i++) { -if (dbr[i] != null) { -if (dbr[i].getSource ().equals (jalview.datamodel.DBRefSource.PDB)) { -this.fields.put (this.Fields[1], dbr[i].getAccessionId ()); -t = 2; -break; -}}} -}this.fields.put (this.Fields[0], this.seqTypes[t]); -}}, "jalview.datamodel.SequenceI"); -Clazz.defineMethod (c$, "isModellerFieldset", -function () { -return (this.fields.containsKey (this.Fields[0])); -}); -Clazz.defineMethod (c$, "getDescriptionLine", -function () { -var desc = ""; -var lastfield = this.Fields.length - 1; -if (this.isModellerFieldset ()) { -var value; -for (; lastfield > 6; lastfield--) { -if (this.fields.containsKey (this.Fields[lastfield])) { -break; -}} -for (var i = 0; i < lastfield; i++) { -value = this.fields.get (this.Fields[i]); -if (value != null && value.length > 0) { -desc += (this.fields.get (this.Fields[i])) + ":"; -} else { -desc += this.Padding[i] + ":"; -}} -}if (this.fields.containsKey (this.Fields[lastfield])) { -desc += this.fields.get (this.Fields[lastfield]); -} else { -desc += "."; -}return desc; -}); -Clazz.defineMethod (c$, "getStartNum", -function () { -var start = 0; -var val = this.getStartCode (); -if (val != null && val.val != null) { -return val.val.intValue (); -}return start; -}); -Clazz.defineMethod (c$, "getStartCode", -function () { -if (this.isModellerFieldset () && this.fields.containsKey (this.Fields[2] + "num")) { -return this.fields.get (this.Fields[2] + "num"); -}return null; -}); -Clazz.defineMethod (c$, "getEndCode", -function () { -if (this.isModellerFieldset () && this.fields.containsKey (this.Fields[4] + "num")) { -return this.fields.get (this.Fields[4] + "num"); -}return null; -}); -Clazz.defineMethod (c$, "getEndNum", -function () { -var end = 0; -var val = this.getEndCode (); -if (val != null && val.val != null) { -return val.val.intValue (); -}return end; -}); -Clazz.defineMethod (c$, "updateSequenceI", -function (newSeq) { -if (this.isModellerFieldset ()) { -var rc = this.getStartCode (); -if (rc != null && rc.val != null) { -newSeq.setStart (this.getStartNum ()); -} else { -newSeq.setStart (1); -}rc = this.getEndCode (); -if (rc != null && rc.val != null) { -newSeq.setEnd (this.getEndNum ()); -} else { -newSeq.setEnd (newSeq.getStart () + newSeq.getLength ()); -}return true; -}return false; -}, "jalview.datamodel.SequenceI"); -c$.$ModellerDescription$resCode$ = function () { -Clazz.pu$h (); -c$ = Clazz.decorateAsClass (function () { -Clazz.prepareCallback (this, arguments); -this.val = null; -this.field = null; -Clazz.instantialize (this, arguments); -}, jalview.io.ModellerDescription, "resCode"); -Clazz.makeConstructor (c$, -function (a, b) { -this.val = b; -this.field = a; -}, "~S,Integer"); -Clazz.makeConstructor (c$, -function (a) { -this.val = new Integer (a); -this.field = this.val.toString (); -}, "~N"); -c$ = Clazz.p0p (); -}; -}); +Clazz.declarePackage ("jalview.io"); +Clazz.load (["java.util.Hashtable"], "jalview.io.ModellerDescription", ["jalview.datamodel.DBRefSource", "jalview.jsdev.RegExp", "java.util.StringTokenizer"], function () { +c$ = Clazz.decorateAsClass (function () { +this.seqTypes = null; +this.Fields = null; +this.TYPE = 0; +this.LOCALID = 1; +this.START = 2; +this.START_CHAIN = 3; +this.END = 4; +this.END_CHAIN = 5; +this.DESCRIPTION1 = 6; +this.DESCRIPTION2 = 7; +this.RESOLUTION = 8; +this.TAIL = 9; +this.Types = null; +this.Padding = null; +this.fields = null; +if (!Clazz.isClassDefined ("jalview.io.ModellerDescription.resCode")) { +jalview.io.ModellerDescription.$ModellerDescription$resCode$ (); +} +Clazz.instantialize (this, arguments); +}, jalview.io, "ModellerDescription"); +Clazz.prepareFields (c$, function () { +this.seqTypes = Clazz.newArray (-1, ["sequence", "structure", "structureX", "structureN"]); +this.Fields = Clazz.newArray (-1, ["objectType", "objectId", "startField", "startCode", "endField", "endCode", "description1", "description2", "resolutionField", "tailField"]); +this.Types = Clazz.newIntArray (-1, [0, 0, 1, 0, 1, 0, 0, 0, 0, 0]); +this.Padding = Clazz.newCharArray (-1, [' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.']); +this.fields = new java.util.Hashtable (); +}); +Clazz.makeConstructor (c$, +function () { +this.fields.put (this.Fields[9], ""); +}); +Clazz.defineMethod (c$, "validResidueCode", +($fz = function (field) { +var val = null; +var r = jalview.jsdev.RegExp.newRegex (["\\s*((([-0-9]+).?)|FIRST|LAST|@)"]); +if (!r.search (field)) { +return null; +}var value = r.stringMatchedI (3); +if (value == null) { +value = r.stringMatchedI (1); +}try { +val = Integer.$valueOf (value); +return Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, field, val); +} catch (e) { +if (Clazz.exceptionOf (e, Exception)) { +} else { +throw e; +} +} +return Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, field, null); +}, $fz.isPrivate = true, $fz), "~S"); +Clazz.defineMethod (c$, "parseDescription", +($fz = function (desc) { +var fields = new java.util.Hashtable (); +var st = new java.util.StringTokenizer (desc, ":", true); +var field; +var type = -1; +if (st.countTokens () > 0) { +var i = 0; +field = st.nextToken (":"); +do { +if (this.seqTypes[i].equalsIgnoreCase (field)) { +break; +}} while (++i < this.seqTypes.length); +if (i < this.seqTypes.length) { +st.nextToken (); +type = i; +i = 1; +while (i < 9 && st.hasMoreTokens ()) { +if ((field = st.nextToken (":")) != null) { +if (!field.equals (":")) { +if (this.Types[i] == 1) { +var val = this.validResidueCode (field); +if (val != null) { +fields.put ( String.instantialize (this.Fields[i] + "num"), val); +} else { +type = -1; +};}fields.put (this.Fields[i++], field); +if (st.hasMoreTokens ()) { +st.nextToken (); +}} else { +i++; +}}} +if (i == 9) { +while (st.hasMoreTokens ()) { +var tl = st.nextToken (":"); +field += tl.equals (":") ? tl : (":" + tl); +} +fields.put (this.Fields[9], field); +}}}if (type == -1) { +fields = new java.util.Hashtable (); +fields.put (this.Fields[9], String.instantialize (desc)); +} else { +fields.put (this.Fields[0], this.seqTypes[type]); +}return fields; +}, $fz.isPrivate = true, $fz), "~S"); +Clazz.makeConstructor (c$, +function (desc) { +if (desc == null) { +desc = ""; +}this.fields = this.parseDescription (desc); +}, "~S"); +Clazz.defineMethod (c$, "setStartCode", +function (v) { +var r; +this.fields.put (this.Fields[2] + "num", r = Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, v)); +this.fields.put (this.Fields[2], r.field); +}, "~N"); +Clazz.defineMethod (c$, "setEndCode", +function (v) { +var r; +this.fields.put (this.Fields[4] + "num", r = Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, v)); +this.fields.put (this.Fields[4], r.field); +}, "~N"); +Clazz.makeConstructor (c$, +function (seq) { +if (seq.getDescription () != null) { +this.fields = this.parseDescription (seq.getDescription ()); +}if (this.isModellerFieldset ()) { +if (this.getStartCode () == null || (this.getStartNum () != seq.getStart () && this.getStartCode ().val != null)) { +this.setStartCode (seq.getStart ()); +}if (this.getEndCode () == null || (this.getEndNum () != seq.getEnd () && this.getStartCode () != null && this.getStartCode ().val != null)) { +this.setEndCode (seq.getEnd ()); +}} else { +this.setStartCode (seq.getStart ()); +this.setEndCode (seq.getEnd ()); +this.fields.put (this.Fields[1], seq.getName ()); +var t = 0; +if (seq.getDatasetSequence () != null && seq.getDatasetSequence ().getDBRef () != null) { +var dbr = seq.getDatasetSequence ().getDBRef (); +var i; +var j; +for (i = 0, j = dbr.length; i < j; i++) { +if (dbr[i] != null) { +if (dbr[i].getSource ().equals (jalview.datamodel.DBRefSource.PDB)) { +this.fields.put (this.Fields[1], dbr[i].getAccessionId ()); +t = 2; +break; +}}} +}this.fields.put (this.Fields[0], this.seqTypes[t]); +}}, "jalview.datamodel.SequenceI"); +Clazz.defineMethod (c$, "isModellerFieldset", +function () { +return (this.fields.containsKey (this.Fields[0])); +}); +Clazz.defineMethod (c$, "getDescriptionLine", +function () { +var desc = ""; +var lastfield = this.Fields.length - 1; +if (this.isModellerFieldset ()) { +var value; +for (; lastfield > 6; lastfield--) { +if (this.fields.containsKey (this.Fields[lastfield])) { +break; +}} +for (var i = 0; i < lastfield; i++) { +value = this.fields.get (this.Fields[i]); +if (value != null && value.length > 0) { +desc += (this.fields.get (this.Fields[i])) + ":"; +} else { +desc += this.Padding[i] + ":"; +}} +}if (this.fields.containsKey (this.Fields[lastfield])) { +desc += this.fields.get (this.Fields[lastfield]); +} else { +desc += "."; +}return desc; +}); +Clazz.defineMethod (c$, "getStartNum", +function () { +var start = 0; +var val = this.getStartCode (); +if (val != null && val.val != null) { +return val.val.intValue (); +}return start; +}); +Clazz.defineMethod (c$, "getStartCode", +function () { +if (this.isModellerFieldset () && this.fields.containsKey (this.Fields[2] + "num")) { +return this.fields.get (this.Fields[2] + "num"); +}return null; +}); +Clazz.defineMethod (c$, "getEndCode", +function () { +if (this.isModellerFieldset () && this.fields.containsKey (this.Fields[4] + "num")) { +return this.fields.get (this.Fields[4] + "num"); +}return null; +}); +Clazz.defineMethod (c$, "getEndNum", +function () { +var end = 0; +var val = this.getEndCode (); +if (val != null && val.val != null) { +return val.val.intValue (); +}return end; +}); +Clazz.defineMethod (c$, "updateSequenceI", +function (newSeq) { +if (this.isModellerFieldset ()) { +var rc = this.getStartCode (); +if (rc != null && rc.val != null) { +newSeq.setStart (this.getStartNum ()); +} else { +newSeq.setStart (1); +}rc = this.getEndCode (); +if (rc != null && rc.val != null) { +newSeq.setEnd (this.getEndNum ()); +} else { +newSeq.setEnd (newSeq.getStart () + newSeq.getLength ()); +}return true; +}return false; +}, "jalview.datamodel.SequenceI"); +c$.$ModellerDescription$resCode$ = function () { +Clazz.pu$h (); +c$ = Clazz.decorateAsClass (function () { +Clazz.prepareCallback (this, arguments); +this.val = null; +this.field = null; +Clazz.instantialize (this, arguments); +}, jalview.io.ModellerDescription, "resCode"); +Clazz.makeConstructor (c$, +function (a, b) { +this.val = b; +this.field = a; +}, "~S,Integer"); +Clazz.makeConstructor (c$, +function (a) { +this.val = new Integer (a); +this.field = this.val.toString (); +}, "~N"); +c$ = Clazz.p0p (); +}; +});