get_sample_variants: Retrieving and filtering variants

Description Usage Arguments Value Note Author(s) See Also Examples

Description

These functions provide the mechanism for retrieval and processing of variants. The assumption is that the data retrieved has essentially been limited to variants of interest. Further filtering of text labels from the genotyping procedure is provided by information specified in the priorDbParams class.

Usage

1
2
get.sample.variants(sample.id.list, db.con, param.obj)
filter.variant.annots(var.dta, filter.list, var.id.col, filter.sep, collapse.col="filter", ignore.cols="variant_qual_id")

Arguments

sample.id.list

A list with three elements: 'recon' is the human readable name, 'ind' is the database index value and 'num.pats' is the number of samples in the database.

db.con

An object inherited from DBIConnection which represents the datasource.

param.obj

A priorDbParams object.

var.dta

A data.frame containing the retrieved variant data.

filter.list

A list containing the names of the filters to be applied. Each list element should contain a vector with filter labels.

var.id.col

The column of var.dta uniquely identifying variants (and potentially alleles) for a given sample.

filter.sep

The character used to seperate filter values as specified in variantFilter.

collapse.col

The column to be collapsed if necessary, (e.g. the filter column).

ignore.cols

The columns redundant with the collapse.col that should be removed as well (e.g. an autoincremented DB index). NULL if none are present.

Value

get.sample.variants

returns a list containing two elements:

var.dta

The filtered data.frame containing the variant results.

summary.id

The core or summary ID used for this function

filter.variant.annots

returns a data.frame containing the remaining elements of var.dta after filtering

Note

filter.variant.annots will likely never be called directly by the user, instead it will be called according to the variantFilter class by get.sample.variants.

Author(s)

Daniel Bottomly

See Also

priorDbParams, variantFilter

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
if (require(RSQLite) && require(HitWalkerData))
{
        set.seed(123)
	data(params)
        db.con <- dbConnect("SQLite", hitwalker.db.path())
        graph.obj <- loadGraph(graph.file.path(), examp.prior.param)
        sample.id.list <- reconcile.sample.name("08-00102", db.con, examp.prior.param)
	raw.vars <- dbGetQuery(db.con, HitWalker:::testVariantQuery(sample.id.list, examp.prior.param))
	filter.values <- getFilterValues(examp.prior.param)		
	filt.list <- strsplit(names(filter.values)[filter.values == "SNV;INDEL"], getFilterSep(examp.prior.param))
	pat.var.id <- patVarID(examp.prior.param)
	filt.vars <- filter.variant.annots(var.dta=raw.vars, filter.list=filt.list, var.id.col=pat.var.id, filter.sep=";", collapse.col="filter", ignore.cols="variant_qual_id")
	nrow(raw.vars)##286
	nrow(filt.vars)##206
	
}

dbottomly/HitWalker documentation built on May 15, 2019, 1:22 a.m.