Making gene annotation file to draw regional plots for GWAS, a shell script


for i in {{1..22},"X","Y"}

do

mysql --user=genome --host=genome-mysql.cse.ucsc.edu -A -D hg18 
-e 'select distinct name, chrom, txStart, txEnd,strand,
name2, IF(NOT(txEnd<248956422 OR txStart>1),0,
IF(txStart>1,txStart-1,248956422-txEnd)) as distance
from refGene where chrom="chr'$i'" order by distance' > temp1 sort -u -n -k 3,3 -k 4,4 -s temp1 >temp2 rm -fr temp1 echo "START STOP SIZE STRAND GENE" >"chr"$i"_hg18.txt" awk '{print $3,$4,$4-$3,$5,$6}' temp2 | sed '1d;$d' >> "chr"$i"_hg18.txt" echo "Done with chr$i" rm -fr temp2 done

Comments

Popular posts from this blog

Scatter Plot Matrix in Lattice: A way to join multiple scatter plot matrices in one plot

CollabNet: a Subversion client for Netbeans

Way to mount remote directory in linux and accessing it over apache