git://source.jalview.org
/
jalview.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
a982a77
)
patch for secondary issue in JAL-664 re parsing empty fields in description line
author
jprocter
<Jim Procter>
Tue, 12 Oct 2010 12:59:58 +0000
(12:59 +0000)
committer
jprocter
<Jim Procter>
Tue, 12 Oct 2010 12:59:58 +0000
(12:59 +0000)
src/jalview/io/ModellerDescription.java
patch
|
blob
|
history
diff --git
a/src/jalview/io/ModellerDescription.java
b/src/jalview/io/ModellerDescription.java
index
b590a6d
..
3af2f93
100755
(executable)
--- a/
src/jalview/io/ModellerDescription.java
+++ b/
src/jalview/io/ModellerDescription.java
@@
-119,7
+119,8
@@
public class ModellerDescription
private java.util.Hashtable parseDescription(String desc)
{
java.util.Hashtable fields = new java.util.Hashtable();
private java.util.Hashtable parseDescription(String desc)
{
java.util.Hashtable fields = new java.util.Hashtable();
- java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":");
+ java.util.StringTokenizer st = new java.util.StringTokenizer(desc, ":",true);
+
String field;
int type = -1;
if (st.countTokens() > 0)
String field;
int type = -1;
if (st.countTokens() > 0)
@@
-137,6
+138,7
@@
public class ModellerDescription
if (i < seqTypes.length)
{
if (i < seqTypes.length)
{
+ st.nextToken(); // skip ':'
// valid seqType for modeller
type = i;
i = 1; // continue parsing fields
// valid seqType for modeller
type = i;
i = 1; // continue parsing fields
@@
-144,6
+146,8
@@
public class ModellerDescription
{
if ((field = st.nextToken(":")) != null)
{
{
if ((field = st.nextToken(":")) != null)
{
+ if (!field.equals(":"))
+ {
// validate residue field value
if (Types[i] == 1)
{
// validate residue field value
if (Types[i] == 1)
{
@@
-162,6
+166,12
@@
public class ModellerDescription
;
}
fields.put(Fields[i++], field);
;
}
fields.put(Fields[i++], field);
+ if (st.hasMoreTokens()) {
+ st.nextToken(); // skip token sep.
+ }
+ } else {
+ i++;
+ }
}
}
if (i == TAIL)
}
}
if (i == TAIL)
@@
-169,7
+179,8
@@
public class ModellerDescription
// slurp remaining fields
while (st.hasMoreTokens())
{
// slurp remaining fields
while (st.hasMoreTokens())
{
- field += ":" + st.nextToken(":");
+ String tl = st.nextToken(":");
+ field += tl.equals(":") ? tl : (":" + tl);
}
fields.put(Fields[TAIL], field);
}
}
fields.put(Fields[TAIL], field);
}
@@
-229,12
+240,13
@@
public class ModellerDescription
{
// Set start and end before we update the type (in the case of a
// synthesized field set)
{
// Set start and end before we update the type (in the case of a
// synthesized field set)
- if (getStartNum() != seq.getStart() && getStartCode().val != null)
+ if (getStartCode()==null || (getStartNum() != seq.getStart() && getStartCode().val != null))
{
{
+ // unset or user updated sequence start position
setStartCode(seq.getStart());
}
setStartCode(seq.getStart());
}
- if (getEndNum() != seq.getEnd() && getStartCode().val != null)
+ if (getEndCode()==null || (getEndNum() != seq.getEnd() && getStartCode()!=null && getStartCode().val != null))
{
setEndCode(seq.getEnd());
}
{
setEndCode(seq.getEnd());
}
@@
-337,7
+349,7
@@
public class ModellerDescription
{
int start = 0;
resCode val = getStartCode();
{
int start = 0;
resCode val = getStartCode();
- if (val.val != null)
+ if (val!=null && val.val != null)
{
return val.val.intValue();
}
{
return val.val.intValue();
}
@@
-366,7
+378,7
@@
public class ModellerDescription
{
int end = 0;
resCode val = getEndCode();
{
int end = 0;
resCode val = getEndCode();
- if (val.val != null)
+ if (val!=null && val.val != null)
{
return val.val.intValue();
}
{
return val.val.intValue();
}
@@
-384,7
+396,8
@@
public class ModellerDescription
{
if (isModellerFieldset())
{
{
if (isModellerFieldset())
{
- if (getStartCode().val != null)
+ resCode rc=getStartCode();
+ if (rc!=null && rc.val != null)
{
newSeq.setStart(getStartNum());
}
{
newSeq.setStart(getStartNum());
}
@@
-392,7
+405,8
@@
public class ModellerDescription
{
newSeq.setStart(1);
}
{
newSeq.setStart(1);
}
- if (getEndCode().val != null)
+ rc=getEndCode();
+ if (rc!=null && rc.val != null)
{
newSeq.setEnd(getEndNum());
}
{
newSeq.setEnd(getEndNum());
}