findBestNormal {PureCN} | R Documentation

## Find best normal sample in database

### Description

Function to find the best matching normal for a provided tumor sample.

### Usage

    findBestNormal(tumor.coverage.file, normalDB, pcs = 1:3, num.normals = 1,
      ignore.sex = FALSE, sex = NULL, normal.coverage.files = NULL,
      pool = FALSE, pool.weights = c("voom", "equal"), plot.pool = FALSE, ...)

### Arguments

`tumor.coverage.file` | Coverage file or data of a tumor sample.
`normalDB` | Database of normal samples, created with `createNormalDatabase`.
`pcs` | Principal components to use for distance calculation.
`num.normals` | Return the `num.normals` best normals.
`ignore.sex` | If `FALSE`, detects sex of sample and returns best normals with matching sex.
`sex` | Sex of sample. If `NULL`, determine with `getSexFromCoverage` and default parameters. Valid values are `F` for female, `M` for male. If all chromosomes are diploid, specify `diploid`.
`normal.coverage.files` | Only consider these normal samples. If `NULL`, use all in the database. Must match `normalDB$normal.coverage.files`.
`pool` | If `TRUE`, use `poolCoverage` to pool best normals.
`pool.weights` | Either find good pooling weights by optimization or weight all best normals equally.
`plot.pool` | Allows the pooling function to create plots.
`...` | Additional arguments passed to `poolCoverage`.

### Value

Filename of the best matching normal.

### Author(s)

Markus Riester

### See Also

`createNormalDatabase getSexFromCoverage`

### Examples

    normal.coverage.file <- system.file("extdata", "example_normal.txt",
        package="PureCN")
    normal2.coverage.file <- system.file("extdata", "example_normal2.txt",
        package="PureCN")
    normal.coverage.files <- c(normal.coverage.file, normal2.coverage.file)
    normalDB <- createNormalDatabase(normal.coverage.files)

    tumor.coverage.file <- system.file("extdata", "example_tumor.txt",
        package="PureCN")
    best.normal.coverage.file <- findBestNormal(tumor.coverage.file, normalDB)

    pool <- findBestNormal(tumor.coverage.file, normalDB, num.normals=2,
        pool=TRUE)

[Package PureCN version 1.8.1 Index]