plotExpression {chromstaR} | R Documentation |
Get the expression values that overlap with each combinatorial state.
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
## 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')