Auto-annotate dna_segs

Share:

Description

Annotate dna_segs in a smart way. This is especially designed for dna_segs read from genbank or embl files, but can be extended for other uses. In short, it produces annotations from dna_segs, grouping the tags for operons (atpA, atpB, atC) into one tag (atpA-C), and similarly for numbered genes (bep1-9).

Usage

1
2
auto_annotate(dna_seg, locus_tag_pattern=NULL, names=dna_seg$gene,
              keep_genes_only=TRUE, ...)

Arguments

dna_seg

A dna_seg object.

locus_tag_pattern

NULL by default. A character giving a pattern, that is used to simplify names. Specially useful to transform long locus tags into numbers (e.g. Eco003456 becomes 3456).

names

A character vector with as many elements as there are rows in the dna_seg. By default, the gene column of the dna_seg is taken. Gives the names to be summarized.

keep_genes_only

A logical, TRUE by default. If set, the genes that have a name that is "-" or empty are not annotated.

...

Further arguments to be passed to annotation function, like rot or color.

Value

An annotation object.

Author(s)

Lionel Guy

See Also

annotation, dna_seg.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## Prepare dna_seg
names <- paste("Eco", sprintf("%04d", 1:20), sep="")
gene <- c("-", "atpC", "atpB", "atpA", "atp2", 
          "-", "-", "cda1", "cda2", "cda3",
          "vcx23", "vcx22", "vcx21", "cde20",
          "-", "gfrU", "gfrT", "gfrY", "gfrX", "gfrW")
ds <- dna_seg(data.frame(name=names, start=(1:20)*3, end=(1:20)*3+2,
                         strand=rep(1, 20), gene=gene,
                         stringsAsFactors=FALSE))
## Original annotation
annot1 <- annotation(x1=middle(ds), text=ds$gene, rot=30)
## auto_annotate with various options
annot2 <- auto_annotate(ds)
annot3 <- auto_annotate(ds, keep_genes_only=FALSE, rot=45)
annot4 <- auto_annotate(ds, keep_genes_only=FALSE,
                        locus_tag_pattern="Eco", col="red")
## Plot
plot_gene_map(list(ds, ds, ds, ds),
              annotations=list(annot1, annot2, annot3, annot4))