getZScores {FourCSeq} | R Documentation

## Calculate z-scores using the residuals of the general trend fit.

### Description

`getZScores` calculates the z-score for each fragment within a distance from the viewpoint defined by `distAroundVP`. For the calculation the count data is first transformed with a variance stabilizing transformation from the `DESeq2` package. The decay trend of this transformed data with distance from the viewpoint is fitted either with local regression model using `locfit` or a monotone decay fit using the `fda` package. z-scores are finally calculated from the residuals of the fit values.

### Usage

    getZScores(object, removeZeros = TRUE, minCount = 40, minDist = NULL,
      fitFun = "distFitMonotoneSymmetric", sdFun = mad, ...)

### Arguments

`object` | A `FourC` object.
`removeZeros` | Parameter to define if fragments with zero counts across all replicates and conditions should be removed from the calculation. Default is `TRUE`.
`minCount` | The minimum median count value across replicates, a fragment has to have to be used for the calculation of z-scores. Default is `40`
`minDist` | Define a minimum distance to both sides of the viewpoint that is discarded for analysis. If undefined (`NULL`), the borders of the viewpoint peak are estimated as the minimum values next to the viewpoint before the signal rises again.
`fitFun` | Fit function to be used. Either `distFitMonotoneSymmetric` (default), `distFitMonotone` or any self-defined function to fit the distance dependency.
`sdFun` | Function to calculate the variation of the data. Default is `mad`.
`...` | Additional Parameters passed to the distance fit function specified in fitFun (e.g. `distFitMonotone`, `distFitMonotoneSymmetric`).

### Value

Returns a `FourC` object for the selected viewpoint with z-score values for all fragments on the viewpoint chromosome that passed the `minCount` threshold and that were not too close to the viewpoint. All additional required data is saved in the object. Especially the following information is added to the `FourC` object:

1. metadata: parameters passed to the getZScore function.

2. colData: sdFun values calculated from the fit residuals

3. rowRanges: the distance information to the viewpoint and information calculated for the variance stabilizing data are added.

4. assays: variance stabilized count values (trafo), fit values (fit), z-score values (zScore), associated p-values (pValue) and adjusted p-values (pAdjusted)

### Author(s)

Felix A. Klein, felix.klein@embl.de

### See Also

`FourC`, `countFragmentOverlaps`, `distFitMonotone`, `distFitMonotoneSymmetric`

### Examples

    data(fc, package="FourCSeq")

    fcf <- getZScores(fc)

    fcf

[Package FourCSeq version 1.21.0 Index]