annotation.cols.match: A position annotation utils that can be used to write a...

Description Usage Arguments Examples

View source: R/annotation.R

Description

A position annotation utils that can be used to write a yourself annotation function

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
annotation.cols.match(dat = data.table(), anno.name = "",
  buildver = "hg19", database.dir = Sys.getenv("annovarR_DB_DIR", ""),
  db.col.order = 1:5, index.cols = c("chr", "start"),
  matched.cols = c("chr", "start", "end", "ref", "alt"),
  return.col.index = 6, return.col.names = "",
  return.col.names.profix = "", format.dat.fun = format.cols,
  dbname.fixed = NULL, table.name.fixed = NULL, setdb.fun = set.db,
  set.table.fun = set.table, format.db.tb.fun = format.db.tb,
  db.type = "sqlite", db.file.prefix = NULL,
  mysql.connect.params = list(), sqlite.connect.params = list(),
  fread.db.params = list(), verbose = FALSE)

Arguments

dat

A data.table including all of your data, eg. data.table(chr=c(1,2,3), start=c(1111,1112,1113))

anno.name

Annotation name, eg. avsnp138, avsnp147, 1000g2015aug_all

buildver

Genome version, hg19, hg38, mm10 and others

database.dir

Dir of the databases (mysql no need)

db.col.order

Using the index, you can rename the database table, and can be matched using matched.cols.

index.cols

Using the selected cols to match data with sqlite database. eg. c('chr', 'start'), 'rs'

matched.cols

Using the selected cols to match data with selected partial data by index.cols limited.

return.col.index

Setting the colnums need be returned

return.col.names

Setting the returned colnum names

return.col.names.profix

Setting the returned colnum names profix

format.dat.fun

A function to process input data. eg. as.numeric(dat$start); as.character(dat$chr)

dbname.fixed

Database path (txt, sqlite) or name (MySQL), default is NULL, and get from setdb.fun (Set value will fix the dbname, and will be added in sqlite.connenct.params and mysql.connect.params)

table.name.fixed

Table name, default is NULL, and get from set.table.fun (Set value will fix the table.name) (Set value will fix the table.name, and will be added in sqlite.connenct.params and mysql.connect.params)

setdb.fun

A function to process the name, buildver, database.dir and get the database path (MySQL return NULL)

set.table.fun

A function to process the name, buildver and get the final table name

format.db.tb.fun

A function to process the selected database table that can be used to matched with your data

db.type

Setting the database type (sqlite, txt or mysql)

db.file.prefix

Only be setted when db.type is local databae like sqlite or txt

mysql.connect.params

Connect MySQL database other parameters, e.g. list(host='11.11.11.1', port = '3306', user = ”, password = '123456')

sqlite.connect.params

Connect SqLite database other paramertes, default is not need

fread.db.params

For text format database, you can use fread.db.params to control the fread behavior

verbose

Logical indicating wheather print the extra log infomation

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
library(data.table)
chr <- c('chr1', 'chr2', 'chr1')
start <- c('10020', '10020', '10020')
end <- c('10020', '10020', '10020')
ref <- c('A', 'A', 'A')
alt <- c('-', '-', '-')
database <- system.file('extdata', 'demo/hg19_avsnp147.txt', package = 'annovarR')
database.dir <- dirname(database)
dat <- data.table(chr = chr, start = start, end = end, ref = ref, alt = alt)
x <- annotation.cols.match(dat, 'avsnp147', database.dir = database.dir, 
return.col.names = 'avSNP147', db.type = 'txt')

annovarR documentation built on Jan. 9, 2018, 5:05 p.m.