This is a test version of Biostars. For the public version, visit https://www.biostars.org.
use a input file to a mysql query to retrieve genomic coordinates from a list of genes

Hi, I have a really silly question but my brain is a bit lazy today, and google is not helping at all. I want to retrieve, using a mysql query, genomic coordinates from a list of genes, I already have the query to get the information I want:

mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -D hg19 -P 3306   -e "select chrom,txStart,txEnd,name2 as name,strand,exonStarts,exonEnds from refGene;"

However how I use my file gene.list as an input to the mysql query?

genome bed

1 answer

Something along the lines of:

for i in $(cat gene.list) ; do echo "select chrom,txStart,txEnd,name2  from refGene where (name2=\"$i\")"  |\
mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -D hg19 -P 3306 > $i.out  ;
done ;

Log in to answer this question.