combineMultivariates {chromstaR} | R Documentation

## Combine combinatorial states from several Multivariates

### Description

Combine combinatorial states from several `multiHMM` objects. Combinatorial states can be combined for objects containing multiple marks (`mode='combinatorial'`) or multiple conditions (`mode='differential'`).

### Usage

    combineMultivariates(hmms, mode)

### Arguments

`hmms` | A `list()` with `multiHMM` objects. Alternatively a character vector with filenames that contain `multiHMM` objects.
`mode` | Mode of combination. See `Chromstar` for a description of the `mode` parameter.

### Value

A `combinedMultiHMM` objects with combinatorial states for each condition.

### Author(s)

Aaron Taudt

### Examples

    ### Multivariate peak calling for spontaneous hypertensive rat (SHR) ###
    # Get example BAM files for 2 different marks in hypertensive rat (SHR)
    file.path <- system.file("extdata","euratrans", package='chromstaRData')
    files <- list.files(file.path, full.names=TRUE, pattern='SHR.*bam$')[c(1:2,4:5)]
    # Construct experiment structure
    exp <- data.frame(file=files, mark=c("H3K27me3","H3K27me3","H3K4me3","H3K4me3"),
                     condition=rep("SHR",4), replicate=c(1:2,1:2), pairedEndReads=FALSE,
                     controlFiles=NA)
    states <- stateBrewer(exp, mode='combinatorial')
    # Bin the data
    data(rn4_chrominfo)
    binned.data <- list()
    for (file in files) {
     binned.data[[basename(file)]] <- binReads(file, binsizes=1000, stepsizes=500,
                                               experiment.table=exp,
                                               assembly=rn4_chrominfo, chromosomes='chr12')
    }
    # Obtain the univariate fits
    models <- list()
    for (i1 in 1:length(binned.data)) {
     models[[i1]] <- callPeaksUnivariate(binned.data[[i1]], max.time=60, eps=1)
    }
    # Call multivariate peaks
    multimodel.SHR <- callPeaksMultivariate(models, use.states=states, eps=1, max.time=60)

    #'### Multivariate peak calling for brown norway (BN) rat ###
    # Get example BAM files for 2 different marks in brown norway rat
    file.path <- system.file("extdata","euratrans", package='chromstaRData')
    files <- list.files(file.path, full.names=TRUE, pattern='BN.*bam$')[c(1:2,3:4)]
    # Construct experiment structure
    exp <- data.frame(file=files, mark=c("H3K27me3","H3K27me3","H3K4me3","H3K4me3"),
                     condition=rep("BN",4), replicate=c(1:2,1:2), pairedEndReads=FALSE,
                     controlFiles=NA)
    states <- stateBrewer(exp, mode='combinatorial')
    # Bin the data
    data(rn4_chrominfo)
    binned.data <- list()
    for (file in files) {
     binned.data[[basename(file)]] <- binReads(file, binsizes=1000, stepsizes=500,
                                               experiment.table=exp,
                                               assembly=rn4_chrominfo, chromosomes='chr12')
    }
    # Obtain the univariate fits
    models <- list()
    for (i1 in 1:length(binned.data)) {
     models[[i1]] <- callPeaksUnivariate(binned.data[[i1]], max.time=60, eps=1)
    }
    # Call multivariate peaks
    multimodel.BN <- callPeaksMultivariate(models, use.states=states, eps=1, max.time=60)

    ### Combine multivariates ###
    hmms <- list(multimodel.SHR, multimodel.BN)
    comb.model <- combineMultivariates(hmms, mode='combinatorial')

[Package chromstaR version 1.8.1 Index]