plotExpression: Overlap with expression data

Description Usage Arguments Value Author(s) See Also Examples

View source: R/expressionAnalysis.R

Description

Get the expression values that overlap with each combinatorial state.

Usage

1
plotExpression(hmm, expression, combinations = NULL, return.marks = FALSE)

Arguments

hmm

A multiHMM or combinedMultiHMM object or file that contains such an object.

expression

A GRanges-class object with metadata column 'expression', containing the expression value for each range.

combinations

A vector with combinations for which the expression overlap will be calculated. If NULL all combinations will be considered.

return.marks

Set to TRUE if expression values for marks instead of combinations should be returned.

Value

A ggplot2 object if a multiHMM was given or a named list with ggplot2 objects if a combinedMultiHMM was given.

Author(s)

Aaron Taudt

See Also

plotting

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
## Load an example multiHMM
file <- system.file("data","multivariate_mode-combinatorial_condition-SHR.RData",
                    package="chromstaR")
model <- get(load(file))

## Obtain expression data
data(expression_lv)
head(expression_lv)

## We need to get coordinates for each of the genes
library(biomaRt)
ensembl <- useMart('ENSEMBL_MART_ENSEMBL', host='may2012.archive.ensembl.org',
                  dataset='rnorvegicus_gene_ensembl')
genes <- getBM(attributes=c('ensembl_gene_id', 'chromosome_name', 'start_position',
                           'end_position', 'strand', 'external_gene_id',
                           'gene_biotype'),
              mart=ensembl)
expr <- merge(genes, expression_lv, by='ensembl_gene_id')
# Transform to GRanges
expression.SHR <- GRanges(seqnames=paste0('chr',expr$chromosome_name),
                         ranges=IRanges(start=expr$start, end=expr$end),
                         strand=expr$strand, name=expr$external_gene_id,
                         biotype=expr$gene_biotype,
                         expression=expr$expression_SHR)
# We apply an asinh transformation to reduce the effect of outliers
expression.SHR$expression <- asinh(expression.SHR$expression)

## Plot
plotExpression(model, expression.SHR) +
 theme(axis.text.x=element_text(angle=0, hjust=0.5)) +
 ggtitle('Expression of genes overlapping combinatorial states')
plotExpression(model, expression.SHR, return.marks=TRUE) +
 ggtitle('Expression of marks overlapping combinatorial states')

chromstaR documentation built on Nov. 8, 2020, 8:29 p.m.