X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fio%2Fvamsas%2FSequencefeature.java;h=a48f8c8d7f7ff27341d59730f995a77baa245149;hb=a1984b1c8c273ed33c7ce9283039f4027dcae2de;hp=31d64f594253b01e44229225276356521a6a17e2;hpb=3d0101179759ef157b088ea135423cd909512d9f;p=jalview.git diff --git a/src/jalview/io/vamsas/Sequencefeature.java b/src/jalview/io/vamsas/Sequencefeature.java index 31d64f5..a48f8c8 100644 --- a/src/jalview/io/vamsas/Sequencefeature.java +++ b/src/jalview/io/vamsas/Sequencefeature.java @@ -97,7 +97,7 @@ public class Sequencefeature extends Rangetype DataSetAnnotations dsa = (DataSetAnnotations) vobj; if (dsa.getSeqRefCount() != 1) { - Cache.log.warn("Not binding " + dsa.getVorbaId() + Cache.warn("Not binding " + dsa.getVorbaId() + " to Sequence Feature - has multiple dataset sequence references."); return; } @@ -128,7 +128,7 @@ public class Sequencefeature extends Rangetype if (dsa.getSeqRefCount() != 1) { replaceJvObjMapping(feature, null); - Cache.log.warn( + Cache.warn( "Binding of annotation to jalview feature has changed. Removing binding and recreating."); doSync(); // re-verify bindings. } @@ -139,8 +139,7 @@ public class Sequencefeature extends Rangetype getDSAnnotationFromJalview(dsa, feature); if (oldref != dsa.hashCode()) { - Cache.log - .debug("Updated dataset sequence annotation from feature."); + Cache.debug("Updated dataset sequence annotation from feature."); addProvenance(dsa.getProvenance(), "modified"); } } @@ -156,7 +155,7 @@ public class Sequencefeature extends Rangetype { // conflicting update from document - we cannot map this feature anymore. replaceJvObjMapping(feature, null); - Cache.log.warn("annotation (" + dsa.getVorbaId() + Cache.warn("annotation (" + dsa.getVorbaId() + " bound to jalview feature cannot be mapped. Removing binding, deleting feature, and deleting feature."); // - consider deleting the feature ? dsSeq.deleteFeature(feature); @@ -198,7 +197,7 @@ public class Sequencefeature extends Rangetype vSeg.setInclusive(true); if (dsa.getSegCount() > 1) { - Cache.log.debug( + Cache.debug( "About to destroy complex annotation in vamsas document mapped to sequence feature (" + dsa.getVorbaId() + ")"); } @@ -281,9 +280,39 @@ public class Sequencefeature extends Rangetype private SequenceFeature getJalviewSeqFeature(RangeAnnotation dseta) { int[] se = getBounds(dseta); - SequenceFeature sf = new jalview.datamodel.SequenceFeature( - dseta.getType(), dseta.getDescription(), dseta.getStatus(), - se[0], se[1], dseta.getGroup()); + + /* + * try to identify feature score + */ + boolean scoreFound = false; + float theScore = 0f; + String featureType = dseta.getType(); + if (dseta.getScoreCount() > 0) + { + Enumeration scr = dseta.enumerateScore(); + while (scr.hasMoreElements()) + { + Score score = (Score) scr.nextElement(); + if (score.getName().equals(featureType)) + { + theScore = score.getContent(); + scoreFound = true; + } + } + } + + SequenceFeature sf = null; + if (scoreFound) + { + sf = new SequenceFeature(featureType, dseta.getDescription(), se[0], + se[1], theScore, dseta.getGroup()); + } + else + { + sf = new SequenceFeature(featureType, dseta.getDescription(), se[0], + se[1], dseta.getGroup()); + } + sf.setStatus(dseta.getStatus()); if (dseta.getLinkCount() > 0) { Link[] links = dseta.getLink(); @@ -299,11 +328,7 @@ public class Sequencefeature extends Rangetype while (scr.hasMoreElements()) { Score score = (Score) scr.nextElement(); - if (score.getName().equals(sf.getType())) - { - sf.setScore(score.getContent()); - } - else + if (!score.getName().equals(sf.getType())) { sf.setValue(score.getName(), "" + score.getContent()); } @@ -325,7 +350,7 @@ public class Sequencefeature extends Rangetype { try { - val = new Boolean(p.getContent()); + val = Boolean.valueOf(p.getContent()); } catch (Exception e) { } @@ -334,7 +359,7 @@ public class Sequencefeature extends Rangetype { try { - val = new Float(p.getContent()); + val = Float.valueOf(p.getContent()); } catch (Exception e) { @@ -344,7 +369,7 @@ public class Sequencefeature extends Rangetype { try { - val = new Integer(p.getContent()); + val = Integer.valueOf(p.getContent()); } catch (Exception e) { }