User:Timothee Flutre/Notebook/Postdoc/2012/02/01

From OpenWetWare
Jump to: navigation, search
Owwnotebook icon.png Project name Report.pngMain project page
Resultset previous.pngPrevious entry      Next entryResultset next.png

Find SNPs in cis of genes

  • retrieve annotations from the UCSC:
wget -O Ensembl_hg19_UCSC_20111019.txt.gz

To view the description of the format, go to the UCSC Table Browser. Then choose the relevant parameters, in our case: clade="Mammal", genome="Human", assembly="hg19", group="Genes and Gene Prediction Tracks", track="Ensembl Genes" and table="ensGene". Finally, click on "describe table schema".

  • convert transcripts into the BED format, and then gather coordinates at the gene level (TSS and TES):
zcat Ensembl_hg19_UCSC_20111019.txt.gz | awk '{print $3"\t"$5"\t"$6"\t"$13"|"$2}' | gzip > Ensembl_transcripts.bed.gz Ensembl_hg19_UCSC_20111019.txt.gz Ensembl_genes.bed.gz
  • identify SNPs in cis of each gene (500kb in 5' of TSS and 3' of TES) assuming the SNP coordinates are taken from a file in the IMPUTE format and we have BEDTools installed:
for i in {1..22}; do echo "chr"${i}"..."; awk -v i=${i} -F" " '{print "chr"i"\t"$3-1"\t"$3"\t"$2}' /path/to/chr${i}.impute | \
windowBed -w 500000 -a Ensembl_genes.bed.gz -b stdin | \
awk '{print $4"\t"$9"|"$8}' | \
gzip > chr${i}_genes_cisSNPs.txt.gz; done