Programming involving database

This is the first “official” trial and my early learning experiences doing program involving interaction with a database. Here I am using postgreSQL database as an example, which is our SeqWare MetaDB as well our SeqWareLIMS are relying on.

Some background knowledge about postgreSQL goes here…

Some SeqWare know-how goes here….

First of all, test some database query

To log in database, issue the following command (for the best results from swmaster.med.unc.edu)
psql -h swmaster.bioinf.unc.edu -U seqware -W seqware_meta_db
u: seqware
p: seqware

Here comes queries:

The first script involves DB query is /home/jyli/svnroot/TCGA-dev/scripts/user/jyli/QC_modules/retro_IllQualStat.pl and it performs the following two tasks:

1. Query the database and get all available runfolder
2. Find the most recently RNAseqAlignmentBWA output folder
3. Run sw_module_IllQualStat.pl (/home/jyli/svnroot/seqware-complete/trunk/seqware-pipeline/perl/bin/sw_module_IllQualStat.pl) for per lane based vendorQC

For DB study

Question: to find out how many flowcells do we have in DB and out of which how many have RNAseqAlignmentBWA event?
Answer: sequence_run table, lane table, sequencer_run linked to lane, lane is linked to processing_lanes, and processing_lanes is linked to processing