Remove custom annotations in batch
Hello,
I'm trying to adapt a script for removal of annotations. This script is for the removal of standard annotations like Concatenated Sequence and Ligation.
However when I change the TYPE to a custom annotation type I get an error: The compilation failed at Line 9: error: cannot find symbol
// Remove Concatenated Sequence annotations
import java.util.stream.Collectors;
public static void modifySequence(DefaultSequenceDocument sequence) {
sequence
.setAnnotations(
sequence.getSequenceAnnotations()
.stream()
.filter(annotation -> !annotation.getType().equals(SequenceAnnotation.TYPE_CONCATENATED_SEQUENCE))
.collect(Collectors.toList()));
}
How can I adapt this script to remove custom annotations?
Thanks,
Paul
-
Hi Paul,
The annotation type is just a String. The various TYPE_XYZ variables are available for any built in types, but you can also just specify the String. For example replacing TYPE_LIGATION with "ligation" will do the same thing.
So for custom types that you have created, you can just specify the same String that was used to create it.
0 -
Hello Matthew,
That doesn't work. I get these errors also with standard annotations:
Standard annotation: Ligation:
Custom annotation: Vhh Gene:
This works for standard annotation LIGATION:
0 -
Hi Paul,
You need to replace the whole variable with a String. e.g.
.filter(annotation -> !annotation.getType().equals("ligation"))
0 -
Hi Matthew,
Sorry for the late reply. But your solution did work very well. Thank you!
0
Please sign in to leave a comment.
Comments
4 comments