X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=examples%2Fgroovy%2FannotationForSelectedSequence.groovy;h=c9e8563b4fbf2f84bccddf62ca2faabb28c4f1fe;hb=64fb69927bb37d8773a75b684a3e7ab3f0c5c212;hp=851e035a1618b5d2f404d3295a9c9a0ad3384248;hpb=a60611ba87555ed0e135eb4a3b858d5768ff0506;p=jalview.git diff --git a/examples/groovy/annotationForSelectedSequence.groovy b/examples/groovy/annotationForSelectedSequence.groovy index 851e035..c9e8563 100644 --- a/examples/groovy/annotationForSelectedSequence.groovy +++ b/examples/groovy/annotationForSelectedSequence.groovy @@ -11,7 +11,7 @@ import java.awt.datatransfer.StringSelection import static java.awt.Toolkit.* -def curviewport = Jalview.getAlignframes()[Jalview.getAlignframes().length-1].getViewport(); +def curviewport = Jalview.getAlignFrames()[Jalview.getAlignFrames().length-1].getViewport(); // TSV output by default. // change "\t" to "," to output CSV file @@ -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; }}