Description Usage Arguments Value Author(s) See Also Examples
View source: R/expressionAnalysis.R
Get the expression values that overlap with each combinatorial state.
1 | plotExpression(hmm, expression, combinations = NULL, return.marks = FALSE)
|
hmm |
A |
expression |
A |
combinations |
A vector with combinations for which the expression overlap will be calculated. If |
return.marks |
Set to |
A ggplot2
object if a multiHMM
was given or a named list with ggplot2
objects if a combinedMultiHMM
was given.
Aaron Taudt
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 | ## 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 <- useEnsembl(biomart='ENSEMBL_MART_ENSEMBL', dataset='rnorvegicus_gene_ensembl')
genes <- getBM(attributes=c('ensembl_gene_id', 'chromosome_name', 'start_position',
'end_position', 'strand', 'external_gene_name',
'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_name,
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')
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.