dba.contrast {DiffBind} | R Documentation

## Set up contrasts for differential binding affinity analysis

### Description

Sets up contrasts for differential binding affinity analysis

### Usage

    dba.contrast(DBA, group1, group2=!group1, name1="group1", name2="group2",
                 minMembers=3, block, bNot=FALSE,
                 categories=c(DBA_TISSUE,DBA_FACTOR,DBA_CONDITION,DBA_TREATMENT))

### Arguments

`DBA` | DBA object with count data

`group1` | mask of samples in first group (when adding a specific contrast). See `dba.mask`.
`group2` | mask of samples in second group (when adding a specific contrast). See `dba.mask`.
`name1` | label for samples in first group (when adding a specific contrast).
`name2` | label for samples in second group (when adding a specific contrast).
`minMembers` | when automatically generating contrasts, minimum number of unique samples in a group. Must be at least 2, as replicates are strongly advised. If you wish to do an analysis with no replicates, you can set the group1 and group2 parameters explicitly.
`bNot` | include contrasts consisting of a group and all other samples not in that group (indicated by a ! in the contrast name).
`categories` | when automatically generating contrasts, attribute or vector of attributes to base contrasts on: DBA_ID DBA_TISSUE DBA_FACTOR DBA_CONDITION DBA_TREATMENT DBA_REPLICATE DBA_CALLER
`block` | blocking attribute for multi-factor analysis. This may be specified as either a value, a vector, or a list. If block is a value, the specified metadata field is used to derive the blocking factor. One of: DBA_TISSUE DBA_FACTOR DBA_CONDITION DBA_TREATMENT DBA_REPLICATE DBA_CALLER If block is a vector, it can either be a mask (logical vector) or a vector of peakset numbers. In this case, the peaksets indicated in the blocking vector are all given the same value (true), while any peaksets not included in the vector take the alternative value (false). If block is a list, it should be a list of vectors (either logical masks or vectors of peakset numbers), with each indicating a set of peaksets that should share the same value. Each peasket should appear at most once, and any peaksets not specified will be given an default value (other).

### Details

MODE: Set up all possible contrasts:

dba.contrast(DBA, minMembers, categories)

MODE: Set up a specific contrast:

dba.contrast(DBA, group1, group2, name1, name2, block)

### Value

DBA object with contrast(s) set as DBA$contrasts. Contrast list can be retrieved using dba.show(DBA, bContrasts=T).

### Note

Contrasts will only be set up for peaksets where DBA_CALLER == "counts".

Contrasts can be cleared by DBA$contrasts=NULL.

### Author(s)

Rory Stark

### See Also

`dba.analyze`

### Examples

    data(tamoxifen_counts)
    tamoxifen <- dba.contrast(tamoxifen, categories=DBA_CONDITION)
    tamoxifen

    # Another way to do the same thing
    tamoxifen$contrasts=NULL
    tamoxifen <- dba.contrast(tamoxifen, tamoxifen$masks$Responsive, tamoxifen$masks$Resistant,
                                                  "Responsive", "Resistant")
    tamoxifen

    # Add add default contrasts
    tamoxifen$contrasts=NULL
    tamoxifen <- dba.contrast(tamoxifen)
    tamoxifen

    # Specify a blocking factor
    tamoxifen$contrasts=NULL
    tamoxifen <- dba.contrast(tamoxifen, categories=DBA_CONDITION, block=DBA_TISSUE)
    tamoxifen

    tamoxifen$contrasts=NULL
    tamoxifen <- dba.contrast(tamoxifen, categories=DBA_CONDITION, block=list(c(3,4,5,8,9),c(1,2,10,11)))
    tamoxifen

    tamoxifen$contrasts=NULL
    tamoxifen <- dba.contrast(tamoxifen, categories=DBA_CONDITION, block=tamoxifen$masks$MCF7)
    tamoxifen <- dba.analyze(tamoxifen)
    tamoxifen

[Package DiffBind version 2.14.0 Index]