## this will let you install R packages in a directory where you have access .libPaths('~/Rlibs/') ## create directory ~/Rlibs if it doesnt exist install.packages(RMySQL) ## call the RMySQL library library(RMySQL) ## connect to UCSC server channel = dbConnect(MySQL(), user="genome", host="genome-mysql.cse.ucsc.edu") ## for a list of tables check url below ## http://hgdownload.cse.ucsc.edu/goldenPath/hg19/database/ ## convenience function to run SQL queries query <- function(...) dbGetQuery(channel, ...) ## use hg19 database in UCSC to use query("USE hg19") ## see table content query("DESCRIBE snpArrayAffy5") ## get number of rows from table print( query("select count(*) from snpArrayAffy6") ) ## get number of rows from table tempo6 = query("select * from snpArrayAffy6")
Tuesday, July 1, 2014
R script to query UCSC database - RMySQL
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment