Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
mirror essential tables from UCSC to a local mysql database. (change $ORG to mm8/hg18/dm3 or your organism of choice.)
ORG=hg19
USER=brentp
# from: http://nsaunders.wordpress.com/2011/05/18/how-to-create-a-partial-ucsc-genome-mysql-database/
# create database
mysql -u $USER -e "CREATE DATABASE $ORG";
mkdir -p ucsc-data/$ORG
cd ucsc-data/$ORG
for table in knownGene refGene ensGene kgXref chromInfo cpgIslandExt cytoBand
do
mysql -u $USER $ORG -e "DROP TABLE $table;"
# obtain table schema
wget http://hgdownload.cse.ucsc.edu/goldenPath/$ORG/database/${table}.sql
# create table
mysql -u $USER $ORG < ${table}.sql
# obtain and import table data
wget http://hgdownload.cse.ucsc.edu/goldenPath/$ORG/database/${table}.txt.gz
gunzip ${table}.txt.gz
mysqlimport -u $USER --local $ORG ${table}.txt
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.