feats {gggenomes} | R Documentation |
Use tracks inside and outside geom_*
calls
Description
Track selection works like dplyr::pull()
and supports unquoted ids and
positional arguments. ...
can be used to subset the data in
dplyr::filter()
fashion. pull
-prefixed variants return the specified
track from a gggenome object. Unprefixed variants work inside geom_*
calls.
Usage
feats(.track_id = 1, ..., .ignore = "genes", .geneify = FALSE)
feats0(.track_id = 1, ..., .ignore = NA, .geneify = FALSE)
genes(..., .gene_types = c("CDS", "mRNA", "tRNA", "tmRNA", "ncRNA", "rRNA"))
links(.track_id = 1, ..., .ignore = NULL, .adjacent_only = NULL)
seqs(...)
bins(..., .group = vars())
track(.track_id = 1, ..., .track_type = NULL, .ignore = NULL)
pull_feats(.x, .track_id = 1, ..., .ignore = "genes", .geneify = FALSE)
pull_genes(
.x,
...,
.gene_types = c("CDS", "mRNA", "tRNA", "tmRNA", "ncRNA", "rRNA")
)
pull_links(.x, .track_id = 1, ..., .ignore = NULL, .adjacent_only = NULL)
pull_seqs(.x, ...)
pull_bins(.x, ..., .group = vars())
## S3 method for class 'gggenomes_layout'
pull_bins(.x, ..., .group = vars())
pull_track(.x, .track_id = 1, ..., .track_type = NULL, .ignore = NULL)
Arguments
.track_id |
The track to pull out, either as a literal variable name or as a positive/negative integer giving the position from the left/right. |
... |
Logical predicates passed on to dplyr::filter. "seqs", "feats", "links". Affects position-based selection. |
.ignore |
track names to ignore when selecting by position.
Default is "genes", if using |
.geneify |
add dummy type, introns and geom_id column to play nicely with geoms supporting multi-level and spliced gene models. |
.gene_types |
return only feats of this type ( |
.adjacent_only |
filter for links connecting direct neighbors
( |
.group |
what variables to use in grouping of bins from seqs in addition
to |
.track_type |
restrict to these types of tracks - any combination of "seqs", "feats", "links". |
.x |
A gggenomes or gggenomes_layout object. |
Value
A function that pulls the specified track from a gggenomes object.
A function that pulls the specified track from a gggenomes object.
A function that pulls the specified track from a gggenomes object.
A function that pulls the specified track from a gggenomes object.
A function that pulls the specified track from a gggenomes object.
A function that pulls the specified track from a gggenomes object.
A function that pulls the specified track from a gggenomes object.
Functions
-
feats()
: by default pulls out the first feat track not named "genes". -
feats0()
: by default pulls out the first feat track. -
genes()
: pulls out the first feat track (genes), filtering for records withtype=="CDS"
, and adding a dummygene_id
column if missing to play nice with multi-exongeom
s. -
links()
: by default pulls out the first link track. -
seqs()
: pulls out the seqs track (there is only one). -
bins()
: pulls out a binwise summary table of the seqs data poweringgeom_bin_*()
calls. The bin table is not a real track, but recomputed on-the-fly. -
track()
: pulls from all tracks in order seqs, feats, links.
Examples
gg <- gggenomes(emale_genes, emale_seqs, emale_tirs, emale_ava)
gg %>% track_info() # info about track ids, positions and types
# get first feat track that isn't "genes" (all equivalent)
gg %>% pull_feats() # easiest
gg %>% pull_feats(feats) # by id
gg %>% pull_feats(1) # by position
gg %>% pull_feats(2, .ignore = NULL) # default .ignore="genes"
# get "seqs" track (always track #1)
gg %>% pull_seqs()
# plot integrated transposons and GC content for some viral genomes
gg <- gggenomes(seqs = emale_seqs, feats = list(emale_ngaros, GC = emale_gc))
gg + geom_seq() +
geom_feat(color = "skyblue") + # defaults to data=feats()
geom_line(aes(x, y + score - .6, group = y), data = feats(GC), color = "gray60")