From d26f07df0b28b692f369ea4d901d834ea55ba786 Mon Sep 17 00:00:00 2001 From: gmungoc Date: Fri, 12 Sep 2014 14:59:38 +0100 Subject: [PATCH] JAL-1516 handle null annotations --- examples/groovy/annotationForSelectedSequence.groovy | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/examples/groovy/annotationForSelectedSequence.groovy b/examples/groovy/annotationForSelectedSequence.groovy index 851e035..f071beb 100644 --- a/examples/groovy/annotationForSelectedSequence.groovy +++ b/examples/groovy/annotationForSelectedSequence.groovy @@ -30,9 +30,15 @@ if (curviewport.getSelectionGroup()) { String csv="" gaps.eachWithIndex{col,spos -> if (col>=selreg.getStartRes() && col<=selreg.getEndRes()) { // add sequence for debugging - if (count>sseq.length()) { sseq+=sep+selreg.getSequenceAt(0).getCharAt(col); count=sseq.length()+1;}; + if (count>sseq.length()) { + sseq+=sep+selreg.getSequenceAt(0).getCharAt(col); count=sseq.length()+1; + }; // output height of histogram - csv+=sep+aa.annotations[col].value; + csv+=sep; + def annot = aa.annotations[col]; + if (annot != null) { + csv+=aa.annotations[col].value; + } // Uncomment to output string shown in tooltip // csv+=sep+aa.annotations[col].description; }} -- 1.7.10.2