-
Notifications
You must be signed in to change notification settings - Fork 0
Working with annotations
An annotation is anything that can be represented as a genomic interval. An annotation
- is found on a particular chromosome or reference
- has a start coordinate
- has an end coordinate
- is either positive-stranded, negative-stranded, or double-stranded
Previous versions of the codebase made a distinction between a SingleInterval, representing a single continuous genomic block, and a BlockedAnnotation, composed of multiple blocks or exons. The current codebase eliminates this distinction. An Annotated object represents any number of genomic blocks or exons, provided that they all belong to the same reference and are on the same strand.
Making an annotation with one block is straightforward:
Annotated annot = new Annotation("chr1", 3000, 4000, Strand.POSITIVE);
Annotations with more than one block can be made using a builder. The following constructs an annotation with two blocks, one at chr1:1000-2000(+) and the other at chr1:3000-4000(+).
Annotated annot = (new AnnotationBuilder())
.addAnnotation(new Annotation("chr1", 1000, 2000, Strand.POSITIVE))
.addAnnotation(new Annotation("chr1", 3000, 4000, Strand.POSITIVE))
.build();
The builder will merge blocks if they overlap or are adjacent. Despite having three blocks added to it, this builder produces the single-block annotation chr1:1000-4000(+) when build() is called.
Annotated annot = (new AnnotationBuilder())
.addAnnotation(new Annotation("chr1", 1000, 2000, Strand.POSITIVE))
.addAnnotation(new Annotation("chr1", 2000, 3000, Strand.POSITIVE))
.addAnnotation(new Annotation("chr1", 3000, 4000, Strand.POSITIVE))
.build();