1 Clazz.declarePackage ("jalview.io");
2 Clazz.load (["java.util.Hashtable"], "jalview.io.ModellerDescription", ["jalview.datamodel.DBRefSource", "jalview.jsdev.RegExp", "java.util.StringTokenizer"], function () {
3 c$ = Clazz.decorateAsClass (function () {
12 this.DESCRIPTION1 = 6;
13 this.DESCRIPTION2 = 7;
19 if (!Clazz.isClassDefined ("jalview.io.ModellerDescription.resCode")) {
20 jalview.io.ModellerDescription.$ModellerDescription$resCode$ ();
22 Clazz.instantialize (this, arguments);
23 }, jalview.io, "ModellerDescription");
24 Clazz.prepareFields (c$, function () {
25 this.seqTypes = Clazz.newArray (-1, ["sequence", "structure", "structureX", "structureN"]);
26 this.Fields = Clazz.newArray (-1, ["objectType", "objectId", "startField", "startCode", "endField", "endCode", "description1", "description2", "resolutionField", "tailField"]);
27 this.Types = Clazz.newIntArray (-1, [0, 0, 1, 0, 1, 0, 0, 0, 0, 0]);
28 this.Padding = Clazz.newCharArray (-1, [' ', ' ', ' ', '.', ' ', '.', '.', '.', '.', '.']);
29 this.fields = new java.util.Hashtable ();
31 Clazz.makeConstructor (c$,
33 this.fields.put (this.Fields[9], "");
35 Clazz.defineMethod (c$, "validResidueCode",
36 ($fz = function (field) {
38 var r = jalview.jsdev.RegExp.newRegex (["\\s*((([-0-9]+).?)|FIRST|LAST|@)"]);
39 if (!r.search (field)) {
41 }var value = r.stringMatchedI (3);
43 value = r.stringMatchedI (1);
45 val = Integer.$valueOf (value);
46 return Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, field, val);
48 if (Clazz.exceptionOf (e, Exception)) {
53 return Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, field, null);
54 }, $fz.isPrivate = true, $fz), "~S");
55 Clazz.defineMethod (c$, "parseDescription",
56 ($fz = function (desc) {
57 var fields = new java.util.Hashtable ();
58 var st = new java.util.StringTokenizer (desc, ":", true);
61 if (st.countTokens () > 0) {
63 field = st.nextToken (":");
65 if (this.seqTypes[i].equalsIgnoreCase (field)) {
67 }} while (++i < this.seqTypes.length);
68 if (i < this.seqTypes.length) {
72 while (i < 9 && st.hasMoreTokens ()) {
73 if ((field = st.nextToken (":")) != null) {
74 if (!field.equals (":")) {
75 if (this.Types[i] == 1) {
76 var val = this.validResidueCode (field);
78 fields.put ( String.instantialize (this.Fields[i] + "num"), val);
81 };}fields.put (this.Fields[i++], field);
82 if (st.hasMoreTokens ()) {
88 while (st.hasMoreTokens ()) {
89 var tl = st.nextToken (":");
90 field += tl.equals (":") ? tl : (":" + tl);
92 fields.put (this.Fields[9], field);
94 fields = new java.util.Hashtable ();
95 fields.put (this.Fields[9], String.instantialize (desc));
97 fields.put (this.Fields[0], this.seqTypes[type]);
99 }, $fz.isPrivate = true, $fz), "~S");
100 Clazz.makeConstructor (c$,
104 }this.fields = this.parseDescription (desc);
106 Clazz.defineMethod (c$, "setStartCode",
109 this.fields.put (this.Fields[2] + "num", r = Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, v));
110 this.fields.put (this.Fields[2], r.field);
112 Clazz.defineMethod (c$, "setEndCode",
115 this.fields.put (this.Fields[4] + "num", r = Clazz.innerTypeInstance (jalview.io.ModellerDescription.resCode, this, null, v));
116 this.fields.put (this.Fields[4], r.field);
118 Clazz.makeConstructor (c$,
120 if (seq.getDescription () != null) {
121 this.fields = this.parseDescription (seq.getDescription ());
122 }if (this.isModellerFieldset ()) {
123 if (this.getStartCode () == null || (this.getStartNum () != seq.getStart () && this.getStartCode ().val != null)) {
124 this.setStartCode (seq.getStart ());
125 }if (this.getEndCode () == null || (this.getEndNum () != seq.getEnd () && this.getStartCode () != null && this.getStartCode ().val != null)) {
126 this.setEndCode (seq.getEnd ());
128 this.setStartCode (seq.getStart ());
129 this.setEndCode (seq.getEnd ());
130 this.fields.put (this.Fields[1], seq.getName ());
132 if (seq.getDatasetSequence () != null && seq.getDatasetSequence ().getDBRef () != null) {
133 var dbr = seq.getDatasetSequence ().getDBRef ();
136 for (i = 0, j = dbr.length; i < j; i++) {
137 if (dbr[i] != null) {
138 if (dbr[i].getSource ().equals (jalview.datamodel.DBRefSource.PDB)) {
139 this.fields.put (this.Fields[1], dbr[i].getAccessionId ());
143 }this.fields.put (this.Fields[0], this.seqTypes[t]);
144 }}, "jalview.datamodel.SequenceI");
145 Clazz.defineMethod (c$, "isModellerFieldset",
147 return (this.fields.containsKey (this.Fields[0]));
149 Clazz.defineMethod (c$, "getDescriptionLine",
152 var lastfield = this.Fields.length - 1;
153 if (this.isModellerFieldset ()) {
155 for (; lastfield > 6; lastfield--) {
156 if (this.fields.containsKey (this.Fields[lastfield])) {
159 for (var i = 0; i < lastfield; i++) {
160 value = this.fields.get (this.Fields[i]);
161 if (value != null && value.length > 0) {
162 desc += (this.fields.get (this.Fields[i])) + ":";
164 desc += this.Padding[i] + ":";
166 }if (this.fields.containsKey (this.Fields[lastfield])) {
167 desc += this.fields.get (this.Fields[lastfield]);
172 Clazz.defineMethod (c$, "getStartNum",
175 var val = this.getStartCode ();
176 if (val != null && val.val != null) {
177 return val.val.intValue ();
180 Clazz.defineMethod (c$, "getStartCode",
182 if (this.isModellerFieldset () && this.fields.containsKey (this.Fields[2] + "num")) {
183 return this.fields.get (this.Fields[2] + "num");
186 Clazz.defineMethod (c$, "getEndCode",
188 if (this.isModellerFieldset () && this.fields.containsKey (this.Fields[4] + "num")) {
189 return this.fields.get (this.Fields[4] + "num");
192 Clazz.defineMethod (c$, "getEndNum",
195 var val = this.getEndCode ();
196 if (val != null && val.val != null) {
197 return val.val.intValue ();
200 Clazz.defineMethod (c$, "updateSequenceI",
202 if (this.isModellerFieldset ()) {
203 var rc = this.getStartCode ();
204 if (rc != null && rc.val != null) {
205 newSeq.setStart (this.getStartNum ());
208 }rc = this.getEndCode ();
209 if (rc != null && rc.val != null) {
210 newSeq.setEnd (this.getEndNum ());
212 newSeq.setEnd (newSeq.getStart () + newSeq.getLength ());
215 }, "jalview.datamodel.SequenceI");
216 c$.$ModellerDescription$resCode$ = function () {
218 c$ = Clazz.decorateAsClass (function () {
219 Clazz.prepareCallback (this, arguments);
222 Clazz.instantialize (this, arguments);
223 }, jalview.io.ModellerDescription, "resCode");
224 Clazz.makeConstructor (c$,
229 Clazz.makeConstructor (c$,
231 this.val = new Integer (a);
232 this.field = this.val.toString ();