SnpSet-methods {oligoClasses} | R Documentation

## Accessors and methods for SnpSet objects

### Description

Utility functions for accessing data in `SnpSet` objects.

### Usage

    calls(object)
    calls(object) <- value
    confs(object, transform=TRUE)
    confs(object) <- value

### Arguments

`object` | A SnpSet object.
`transform` | Logical. Whether to transform the integer representation of the confidence score (for memory efficiency) to a probability. See details.
`value` | A matrix.

### Details

`calls` returns the genotype calls. CRLMM stores genotype calls as integers (1 - AA; 2 - AB; 3 - BB).

`confs` returns the confidences associated with the genotype calls. The current implementation of CRLMM stores the confidences as integers to save memory on disk by using the transformation:

round(-1000*log2(1-p)),

where 'p' is the posterior probability of the call. `confs` is a convenience function that transforms the integer representation back to a probability. Note that if the assayData elements of the `SnpSet` objects are `ff_matrix` or `ffdf`, the `confs` function will return a warning. For such objects, one should first subset the `ff` object and coerce to a matrix, then apply the above conversion. The function `snpCallProbability` for the `callProbability` slot of `SnpSet` objects. See the examples below.

`checkOrder` checks whether the object is ordered by chromosome and physical position, evaluating to TRUE or FALSE.

### Note

Note that the replacement method for `confs<-` expects a matrix of probabilities and will automatically convert the probabilities to an integer representation. See details for the conversion.

The accessor `snpCallProbability` is an accessor for the 'callProbability' element of the `assayData`. The name can be misleading, however, as the accessor will not return a probability if the call probabilities are represented as integers.

### See Also

The helper functions `p2i` converts probabilities to integers and `i2p` converts integers to probabilities.

See `order` and `checkOrder`.

### Examples

    	theCalls <- matrix(sample(1:3, 20, rep=TRUE), nc=2)
    	p <- matrix(runif(20), nc=2)
    	integerRepresentation <- matrix(as.integer(round(-1000*log(1-p))), 10, 2)
    	obj <- new("SnpSet2", call=theCalls, callProbability=integerRepresentation)
    	calls(obj)
            confs(obj)  ## coerces to probability scale
            int <- Biobase::snpCallProbability(obj) ## not necessarily a probability
            p3 <- i2p(int)  ## to convert back to a probability

[Package oligoClasses version 1.50.4 Index]