scaling {ChIPSeqSpike} | R Documentation

## Applies different type of scaling/normalization procedures

### Description

Applies or reverse different type of scaling/normalization to bigwig files contained in 'ChIPSeqSpikeDataset', 'ChIPSeqSpikeDatasetBoost', 'ChIPSeqSpikeDatasetList' or 'ChIPSeqSpikeDatasetListBoost' objects

### Usage

    scaling(theObject, reverse = FALSE, type = "endo", verbose = TRUE,
            outputFolder = NULL)

    ## S4 method for signature 'ChIPSeqSpikeDataset'
    scaling(theObject, reverse = FALSE,
    type = "endo", verbose = TRUE, outputFolder = NULL)

    ## S4 method for signature 'ChIPSeqSpikeDatasetBoost'
    scaling(theObject, reverse = FALSE,
    type = "endo", verbose = TRUE, outputFolder = NULL)

    ## S4 method for signature 'ChIPSeqSpikeDatasetList'
    scaling(theObject, reverse = FALSE,
    type = "endo", verbose = TRUE, outputFolder = NULL)

    ## S4 method for signature 'ChIPSeqSpikeDatasetListBoost'
    scaling(theObject, reverse = FALSE,
    type = "endo", verbose = TRUE, outputFolder = NULL)

### Arguments

`theObject` | `ChIPSeqSpike` dataset (see ?spikeDataset)
`reverse` | If TRUE, reverse the scaling applied previously (see details). Default is FALSE
`type` | Should be 'endo' or 'exo' to apply the endogenous or exogenous scaling factor respectively.
`verbose` | If FALSE, do not output processing messages. Default is TRUE
`outputFolder` | Define the folder where scaled bigwig are output. Default is NULL (see details).

### Details

Scaling is performed after estimating scaling factors with '?estimateScalingFactors'.

Different type of scaling can be performed according to the steps of spike-in normalization. The first type is to transform the data by performing a RPM scaling. The second type is to reverse the RPM scaling after having performed input subtraction with '?inputSubtraction'. The third and last type is to apply the exogenous scaling factor which finalizes the spike-in normalization (see example below for parameter settings).

To perform all steps in one call and in the right order, one can consider using the '?spikePipe' function.

If not in boost mode, the bigwig files are written to the folder containing the currently processed bigwig files. In boost mode, use the method ?exportBigWigs to output the transformed files.

If outputFolder is not NULL, the original bigwig files should be copied to this folder before performing the analysis. This parameter was created to test the package with the provided files in extdata/.

On Windows operating system, due to the Bioconductor package rtracklayer >= 1.37.6 not supporting bigWig files, this method is not available.

### Value

Return an object of the same class of the input object and output scaled bigwig files if not in boost mode (see ?ChIPSeqSpikeDatasetBoost).

'-RPM', 'reverse' or 'spiked' suffixes are added to the bigwig file name if performing RPM scaling, reversing RPM scaling or applying exogenous scaling factors respectively.

### Methods (by class)

- `ChIPSeqSpikeDataset`: Method for signature theObject= 'ChIPSeqSpikeDataset'

- `ChIPSeqSpikeDatasetBoost`: Method for signature theObject= 'ChIPSeqSpikeDatasetBoost'

- `ChIPSeqSpikeDatasetList`: Method for signature theObject= 'ChIPSeqSpikeDatasetList'

- `ChIPSeqSpikeDatasetListBoost`: Method for signature theObject= 'ChIPSeqSpikeDatasetListBoost'

### Author(s)

Nicolas Descostes

### See Also

`spikeDataset` `ChIPSeqSpikeDatasetBoost` `spikePipe` `inputSubtraction` `exportBigWigs`

### Examples

    ## Mock example on a restricted number of reads
    info_file_csv <- system.file("extdata/info.csv", package="ChIPSeqSpike")
    bam_path <- system.file(c("extdata/bam_files"), package="ChIPSeqSpike")
    bigwig_path <- system.file(c("extdata/bigwig_files"), package="ChIPSeqSpike")

    csds <- spikeDataset(infoFile = info_file_csv, bamPath = bam_path,
                         bigWigPath = bigwig_path)

    ## Copying test files to the current folder
    originalBW_vec <- as.character(getBigWigFile(csds))
    dir.create("./test_chipseqspike")
    result <- file.copy(originalBW_vec, "test_chipseqspike")

    csds <- estimateScalingFactors(csds)

    if(.Platform$OS.type != 'windows') {
        ## Apply RPM scaling
        csds <- scaling(csds, outputFolder = "test_chipseqspike")

        ## Apply input subtraction
        csds <- inputSubtraction(csds)

        ## Reverse RPM scaling after input subtraction
        csds <- scaling(csds, reverse = TRUE)

        ## Apply exogenous scaling factors
        csds <- scaling(csds, type = "exo")
    }

    ## Delete all files generated in this example
    unlink("test_chipseqspike/", recursive = TRUE)

[Package ChIPSeqSpike version 1.6.0 Index]