The Stacks application can use a MySQL database for data processing. If you have a Standard account, and would like to make use of this feature - you can request a database and we’ll get one set up for you.

The Stacks perl scripts will look for a .my.cnf file in your home directory and use that for the mysql settings. That file should contain:

[client]
user=your_user_name
password=the_password_rcds_provides
host=variant.ibest.uidaho.edu
port=3306
local-infile=1

Then when you run either denovo_map.pl or ref_map.pl use the -B flag to set the database name (typically your user name)

The database is empty to start, to set up the tables, run

mysql -u your_user_name -p -h variant.ibest.uidaho.edu the_db_name < /opt/modules/biology/stacks/1.42/share/stacks/sql/stacks.sql

That script may error out on the first line (which isn’t needed). If so, drop the first line and then run it like this:

tail -n +2 /opt/modules/biology/stacks/1.42/share/stacks/sql/stacks.sql > fixed_stacks.sql
mysql -u your_user_name -p -h variant.ibest.uidaho.edu the_db_name < fixed_stacks.sql

To clear the database between runs, try:

MYSQL="mysql -h variant.ibest.uidaho.edu -u your_user_name -pThePassword -D the_db_name"
$MYSQL -BNe "show tables" | awk '{print "set foreign_key_checks=0; drop table `" $1 "`;"}' | $MYSQL
unset MYSQL