Description Usage Arguments Examples
A regeion annotation utils that can be used to write a yourself annotation function
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | annotation.region.match(
dat = data.table(),
anno.name = "",
buildver = "hg19",
database.dir = Sys.getenv("anor_DB_DIR", ""),
db_col_order = 1:3,
index_cols = c("chr", "start", "end"),
full.matched_cols = "chr",
inferior_col = "start",
superior_col = "end",
return_col_index = 4,
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.region.tb,
db.type = "sqlite",
db.file.prefix = NULL,
mysql.connect.params = list(),
sqlite.connect.params = list(),
fread.db.params = list(),
verbose = FALSE
)
|
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' |
full.matched_cols |
Using the selected cols to match data with selected partial data by index_cols limited. |
inferior_col |
Inferior limit col, e.g. start |
superior_col |
Superior limit col, e.g. end |
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 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | library(data.table)
bed.file <- system.file('extdata', 'demo/example.bed', package = 'anor')
bed.sqlite <- sprintf('%s/%s.sqlite', tempdir(), basename(bed.file))
connect.params <- list(dbname = bed.sqlite, table.name = 'bed')
sqlite.build(bed.file, connect.params)
chr <- c('chr10', 'chr1')
start <- c('100188904', '100185955')
end <- c('100188904', '100185955')
dat <- data.table(chr = chr, start = start, end = end)
x <- annotation.region.match(dat = dat, database.dir = tempdir(),
dbname_fixed = bed.sqlite, table_name_fixed = 'bed',
db.type = 'sqlite', format_dat_fun = function(...) {
params = list(...);return(params[[1]])})
file.remove(bed.sqlite)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.