convertToAllelicFractions {SNPhood} | R Documentation

## Convert read counts across read groups to relative fractions from a SNPhood object.

### Description

`convertToAllelicFractions` convert read counts across read groups to their relative fractions among all read groups (all read counts will be between 0 and 1, with 1 for a particular read group depicting that all reads from this particular position originate from the one read group) Affected slots are `readCountsUnbinned` and `readCountsBinned`. It is recommended to save the resulting `SNPhood` object with a new name because it is not possible to go back from fractions to read counts at a later point.

### Usage

    convertToAllelicFractions(SNPhood.o, roundDigits = 2, setNaNToZero = FALSE,
      verbose = TRUE)

### Arguments

`SNPhood.o` | Object of class `SNPhood`
`roundDigits` | Numeric(1). Default 2. Number of digits after the decimal place when converting read counts to fractions
`setNaNToZero` | Logical(1). Default FALSE. Should NaN (not a number) be converted to 0? NaN may result from individual regions or bins with no reads across all read groups due to a division by zero.
`verbose` | Logical(1). Default TRUE. Should the verbose mode (i.e., diagnostic messages during execution of the script) be enabled?

### Value

an object of class `SNPhood` with read counts across read groups (both for the slots readCountsUnbinned and readCountsBinned) replaced by their respective relative fractions. Otherwise identical to the input `SNPhood` object.

### See Also

`deleteReadGroups`

### Examples

    data(SNPhood.o, package="SNPhood")
    SNPhood_allelicFractions.o = convertToAllelicFractions(SNPhood.o)

    # Convert all NaN to 0 for subsequent analyses
    SNPhood_allelicFractions.o = convertToAllelicFractions(SNPhood.o, setNaNToZero = TRUE)

[Package SNPhood version 1.14.0 Index]