Skip to main content

How to remove annotations

Comments

2 comments

  • Geneious Team

    Hi Adrian,

     

    The AnnotationGeneratorResult approach will only work if you're returning that AnnotationGeneratorResult from a SequenceAnnotationGenerator. But it sounds like you need to do this in a DocumentOperation, in which case the way to do it is like this:

    public void removeAnnotations(AnnotatedPluginDocument alignmentDocument, int sequenceIndex) throws DocumentOperationException {
    SequenceAlignmentDocument alignment = (SequenceAlignmentDocument) alignmentDocument.getDocument();
    if (alignment.canSetAnnotations()) {
    List<SequenceAnnotation> sequenceAnnotations = new ArrayList<>(alignment.getSequence(sequenceIndex).getSequenceAnnotations());
    // remove the annotations you want to remove from sequenceAnnotations here
    alignment.setAnnotations(sequenceIndex, sequenceAnnotations, true);
    alignmentDocument.save();
    }
    }

    Best regards,

    Matt.

    0
  • Adrian

    Hi Matt,

     

    That worked like a charm.

     

    Thank you,

    Adrian

    0

Please sign in to leave a comment.