# Combinatorial and Differential Chromatin State Analysis for ChIP-Seq Data

## Documentation for package ‘chromstaR’ version 1.8.1

- DESCRIPTION file.
- User guides, package vignettes and other documentation.
- Package NEWS.

## Help Pages

chromstaR-package | Combinatorial and differential chromatin state analysis for ChIP-seq data
bin2dec | Conversion of decimal and binary states
binned.data | Binned read counts
binning | Convert aligned reads from various file formats into read counts in equidistant bins
binReads | Convert aligned reads from various file formats into read counts in equidistant bins
callPeaksMultivariate | Fit a Hidden Markov Model to multiple ChIP-seq samples
callPeaksReplicates | Fit a multivariate Hidden Markov Model to multiple ChIP-seq replicates
callPeaksUnivariate | Fit a Hidden Markov Model to a ChIP-seq sample.
callPeaksUnivariateAllChr | Fit a Hidden Markov Model to a ChIP-seq sample.
changeFDR | Adjust sensitivity of peak detection
changeMaxPostCutoff | Adjust sensitivity of peak detection
changePostCutoff | Change the posterior cutoff of a Hidden Markov Model
Chromstar | Wrapper function for the 'chromstaR' package
chromstaR | Combinatorial and differential chromatin state analysis for ChIP-seq data
chromstaR-objects | chromstaR objects
collapseBins | Collapse consecutive bins
combinatorialStates | Get the (decimal) combinatorial states of a list of univariate HMM models
combinedHMM | Combined multivariate HMM object
combinedMultiHMM | Combined multivariate HMM object
combineMultivariates | Combine combinatorial states from several Multivariates
conversion | Conversion of decimal and binary states
dec2bin | Conversion of decimal and binary states
differentialScoreMax | chromstaR scores
differentialScoreSum | chromstaR scores
dzinbinom | The Zero-inflated Negative Binomial Distribution
enrichmentAtAnnotation | Enrichment of (combinatorial) states for genomic annotations
enrichment_analysis | Enrichment analysis
experiment.table | Experiment data table
exportCombinations | Export genome browser uploadable files
exportCounts | Export genome browser uploadable files
exportFiles | Export genome browser uploadable files
exportGRangesAsBedFile | Export genome browser viewable files
exportPeaks | Export genome browser uploadable files
fixedWidthBins | Make fixed-width bins
genes_rn4 | Gene coordinates for rn4
genomicFrequencies | Frequencies of combinatorial states
getCombinations | Get combinations
getDistinctColors | Get distinct colors
getStateColors | Get state colors
heatmapCombinations | Plot a heatmap of combinatorial states
heatmapCountCorrelation | Read count correlation heatmap
heatmapTransitionProbs | Heatmap of transition probabilities
loadHmmsFromFiles | Load 'chromstaR' objects from file
mergeChroms | Merge several 'multiHMM's into one object
model.combined | Combined multivariate HMM for demonstration purposes
model.multivariate | Multivariate HMM for demonstration purposes
model.univariate | Univariate HMM for demonstration purposes
multi.hmm | Multivariate HMM object
multiHMM | Multivariate HMM object
multivariateSegmentation | Multivariate segmentation
plotEnrichCountHeatmap | Enrichment analysis
plotEnrichment | Enrichment analysis
plotExpression | Overlap with expression data
plotFoldEnrichHeatmap | Enrichment analysis
plotGenomeBrowser | #' Plot a genome browser view #' #' Plot a simple genome browser view. This is useful for scripted genome browser snapshots. #' #' @param counts A 'GRanges-class' object with meta-data column 'counts'. #' @param peaklist A named list() of 'GRanges-class' objects containing peak coordinates. #' @param chr,start,end Chromosome, start and end coordinates for the plot. #' @param countcol A character giving the color for the counts. #' @param peakcols A character vector with colors for the peaks in 'peaklist'. #' @param style One of 'c('peaks', 'density')'. #' @param peakTrackHeight Relative height of the tracks given in 'peaklist' compared to the 'counts'. #' @return A 'ggplot' object. #' @examples #'## Get an example multiHMM ## #'file <- system.file("data","multivariate_mode-combinatorial_condition-SHR.RData", #' package="chromstaR") #'model <- get(load(file)) #'## Plot genome browser snapshot #'bins <- model$bins #'bins$counts <- model$bins$counts.rpkm[,1] #'plotGenomeBrowser(counts=bins, peaklist=model$peaks, #' chr='chr12', start=1, end=1e6) #' plotGenomeBrowser2 <- function(counts, peaklist=NULL, chr, start, end, countcol='black', peakcols=NULL, style='peaks', peakTrackHeight=5) ## Select ranges to plot ranges2plot <- reduce(counts[counts@seqnames == chr & start(counts) >= start & start(counts) <= end]) ## Counts counts <- subsetByOverlaps(counts, ranges2plot) if (style == 'peaks') df <- data.frame(x=(start(counts)+end(counts))/2, counts=counts$counts) # plot triangles centered at middle of the bin ggplt <- ggplot(df) + geom_area(aes_string(x='x', y='counts')) + theme(panel.grid = element_blank(), panel.background = element_blank(), axis.text.x = element_blank(), axis.title = element_blank(), axis.ticks.x = element_blank(), axis.line = element_blank()) maxcounts <- max(counts$counts) ggplt <- ggplt + scale_y_continuous(breaks=c(0, maxcounts)) else if (style == 'density') df <- data.frame(xmin=start(counts), xmax=end(counts), counts=counts$counts) ggplt <- ggplot(df) + geom_rect(aes_string(xmin='xmin', xmax='xmax', ymin=0, ymax=4, alpha='counts')) + theme(panel.grid = element_blank(), panel.background = element_blank(), axis.text = element_blank(), axis.title = element_blank(), axis.ticks = element_blank(), axis.line = element_blank()) else stop("Unknown value '", style, "' for parameter 'style'. Must be one of c('peaks', 'density').") ## Peaks if (!is.null(peaklist)) if (is.null(peakcols)) peakcols <- getDistinctColors(length(peaklist)) for (i1 in 1:length(peaklist)) p <- peakTrackHeight peaks <- subsetByOverlaps(peaklist[[i1]], ranges2plot) if (length(peaks) > 0) df <- data.frame(start=start(peaks), end=end(peaks), ymin=-p*i1, ymax=-p*i1+0.9*p) ggplt <- ggplt + geom_rect(data=df, mapping=aes_string(xmin='start', xmax='end', ymin='ymin', ymax='ymax'), col=peakcols[i1], fill=peakcols[i1]) trackname <- names(peaklist)[i1] df <- data.frame(x=start(counts)[1], y=-p*i1+0.5*p, label=trackname) ggplt <- ggplt + geom_text(data=df, mapping=aes_string(x='x', y='y', label='label'), vjust=0.5, hjust=0.5, col=peakcols[i1]) return(ggplt) Plot a genome browser view
plotHistogram | Histogram of binned read counts with fitted mixture distribution
plotHistograms | Histograms of binned read counts with fitted mixture distribution
plotting | chromstaR plotting functions
print.combinedMultiHMM | Print combinedMultiHMM object
print.multiHMM | Print multiHMM object
print.uniHMM | Print uniHMM object
pzinbinom | The Zero-inflated Negative Binomial Distribution
qzinbinom | The Zero-inflated Negative Binomial Distribution
readBamFileAsGRanges | Import BAM file into GRanges
readBedFileAsGRanges | Import BED file into GRanges
readConfig | Read chromstaR configuration file
readCustomBedFile | Read bed-file into GRanges
removeCondition | Remove condition from model
rzinbinom | The Zero-inflated Negative Binomial Distribution
scanBinsizes | Find the best bin size for a given dataset
scores | chromstaR scores
simulateMultivariate | Simulate multivariate data
simulateReadsFromCounts | Simulate read coordinates
simulateUnivariate | Simulate univariate data
state.brewer | Obtain combinatorial states from specification
stateBrewer | Obtain combinatorial states from experiment table
subsample | Normalize read counts
transitionFrequencies | Transition frequencies of combinatorial states
uni.hmm | Univariate HMM object
uniHMM | Univariate HMM object
unis2pseudomulti | Combine univariate HMMs to a multivariate HMM
variableWidthBins | Make variable-width bins
writeConfig | Write chromstaR configuration file
zinbinom | The Zero-inflated Negative Binomial Distribution