X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=src%2Fjalview%2Fanalysis%2FDna.java;h=5ff6751450507150237ee1bc16a5d1fc49168302;hb=1660a4fe03b8dda74b008ae4de2d804f8044a463;hp=ce13665cdf2dfb60812c1f81695d5aa7490ce82d;hpb=2de8acfae59aced665e4c37ad0f7dcc2ed68818e;p=jalview.git diff --git a/src/jalview/analysis/Dna.java b/src/jalview/analysis/Dna.java index ce13665..5ff6751 100644 --- a/src/jalview/analysis/Dna.java +++ b/src/jalview/analysis/Dna.java @@ -364,14 +364,44 @@ public class Dna { // Have a look at all the codon positions for annotation and put the first // one found into the translated annotation pos. + int contrib=0; + Annotation annot = null; for (int p = 0; p < 3; p++) { if (annotations[is[p]] != null) { - return new Annotation(annotations[is[p]]); + if (annot==null) { + annot = new Annotation(annotations[is[p]]); + contrib = 1; + } else { + // merge with last + Annotation cpy = new Annotation(annotations[is[p]]); + if (annot.colour==null) + { + annot.colour = cpy.colour; + } + if (annot.description==null || annot.description.length()==0) + { + annot.description = cpy.description; + } + if (annot.displayCharacter==null) + { + annot.displayCharacter = cpy.displayCharacter; + } + if (annot.secondaryStructure==0) + { + annot.secondaryStructure = cpy.secondaryStructure; + } + annot.value+=cpy.value; + contrib++; + } } } - return null; + if (contrib>1) + { + annot.value/=(float)contrib; + } + return annot; } /**