From 824361e7dc543c96a526b488919b2e27dc01e92f Mon Sep 17 00:00:00 2001 From: jprocter Date: Thu, 14 Sep 2006 11:09:22 +0000 Subject: [PATCH] hunting for id bug and fixed emptyAnnotationRow problems. --- src/jalview/io/VamsasDatastore.java | 45 ++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/src/jalview/io/VamsasDatastore.java b/src/jalview/io/VamsasDatastore.java index 279a4c4..a7982cc 100755 --- a/src/jalview/io/VamsasDatastore.java +++ b/src/jalview/io/VamsasDatastore.java @@ -126,16 +126,20 @@ public class VamsasDatastore { if (id==null || vobj.getVorbaId()==null) Cache.log.error("Failed to get id for "+(vobj.isRegisterable() ? "registerable" : "unregisterable") +" object "+vobj); } - if (vobj2jv.containsKey(vobj.getVorbaId()) || jv2vobj.containsKey(jvobj)) - { - Cache.log.error("Duplicate object binding! "+vobj+" id " +vobj.getVorbaId().getId()+" to "+jvobj); + + if (vobj2jv.containsKey(vobj.getVorbaId()) && !((VorbaId)vobj2jv.get(vobj.getVorbaId())).equals(jvobj)) { + Cache.log.debug("Warning? Overwriting existing vamsas id binding for "+vobj.getVorbaId(), new Exception("Overwriting vamsas id binding.")); } - else + else if (jv2vobj.containsKey(jvobj) && !((VorbaId)jv2vobj.get(jvobj)).equals(vobj.getVorbaId())) { - vobj2jv.put(vobj.getVorbaId(), jvobj);// JBPNote - better implementing a - // hybrid invertible hash. - jv2vobj.put(jvobj, vobj.getVorbaId()); + Cache.log.debug("Warning? Overwriting existing jalview object binding for "+jvobj, new Exception("Overwriting jalview object binding.")); } + /* Cache.log.error("Attempt to make conflicting object binding! "+vobj+" id " +vobj.getVorbaId()+" already bound to "+getvObj2jv(vobj)+" and "+jvobj+" already bound to "+getjv2vObj(jvobj),new Exception("Excessive call to bindjvvobj")); + }*/ + // we just update the hash's regardless! + vobj2jv.put(vobj.getVorbaId(), jvobj); + // JBPNote - better implementing a hybrid invertible hash. + jv2vobj.put(jvobj, vobj.getVorbaId()); } /** @@ -967,7 +971,13 @@ public class VamsasDatastore { valseq.getSequence().replace(valGapchar, gapChar), valseq.getStart(), valseq.getEnd() ); - alseq.setDatasetSequence((SequenceI)getvObj2jv((Vobject)valseq.getRefid())); // exceptions if AlignemntSequence reference isn't a simple SequenceI + + Vobject datsetseq = (Vobject)valseq.getRefid(); + if (datsetseq!=null) { + alseq.setDatasetSequence((SequenceI)getvObj2jv(datsetseq)); // exceptions if AlignemntSequence reference isn't a simple SequenceI + } else { + Cache.log.error("Invalid dataset sequence id (null) for alignment sequence "+valseq.getVorbaId()); + } bindjvvobj(alseq, valseq); alseq.setVamsasId(valseq.getVorbaId().getId()); dsseqs.add(alseq); @@ -1207,9 +1217,10 @@ public class VamsasDatastore { } return new Object[] { AeContent, rangeMap, anot[0], anot[1] }; } else { - // no annotations to parse. + // no annotations to parse. Just return an empty annotationElement[] array. + return new Object[] { AeContent, rangeMap, anot[0], anot[1] }; } - return null; + // return null; } /** * @param jal the jalview alignment to which the annotation will be attached (ideally - freshly updated from corresponding vamsas alignment) @@ -1237,7 +1248,11 @@ public class VamsasDatastore { if (a_descr==null || a_descr.length()==0) { a_descr = "Annotation of type '"+annotation.getType()+"'"; } - if (parsedRangeAnnotation!=null) { + if (parsedRangeAnnotation==null) { + Cache.log.debug("Inserting empty annotation row elements for a whole-alignment annotation."); + + + } else { if (parsedRangeAnnotation[3]!=null) { Cache.log.warn("Ignoring 'After' annotation row in "+annotation.getVorbaId()); } @@ -1301,9 +1316,7 @@ public class VamsasDatastore { return jan; - } else { - Cache.log.debug("(Ignoring so ... not) Inserting empty annotation row for whole-alignment annotation."); - } + } return null; } @@ -1386,7 +1399,7 @@ public class VamsasDatastore { se = getSegRange(dseta.getSeg(s), false); int se_end=se[1-se[2]]+(se[2]==0 ? 1 : -1); for (int p=se[se[2]]; p!=se_end; p+=se[2]==0 ? 1 : -1 ) { - posList.add(Integer.valueOf(p)); + posList.add(new Integer(p)); } } } @@ -1397,7 +1410,7 @@ public class VamsasDatastore { for (int p = 0, pSize = dseta.getPosCount(); p < pSize; p++) { pos = dseta.getPos(p).getI(); - posList.add(Integer.valueOf(pos)); + posList.add(new Integer(pos)); } } } -- 1.7.10.2