From: jprocter Date: Wed, 24 Jun 2009 08:22:47 +0000 (+0000) Subject: take the average of the three consecutive codon sites when translating annotation... X-Git-Tag: Release_2_5~241 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=1e5fe67a3cfd5b0dbae0847d3cff7dc93c31f174;hp=b685f8d04ee267818d28c4377fe2ae4778082cd0;p=jalview.git take the average of the three consecutive codon sites when translating annotation row scores from cDNA to protein. --- 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; } /**