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
12
13
14
15
16
17
18
19
20
21
22
23
24
annotation.cols.match(
  dat = data.table(),
  anno.name = "",
  buildver = "hg19",
  database.dir = Sys.getenv("anor_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 = 'anor')
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')

JhuangLab/annovarR documentation built on April 23, 2020, 10:51 p.m.