xie186 / miscellaneous_note

0 stars 0 forks source link

pyGenomeTrack #1

Open xie186 opened 5 years ago

xie186 commented 5 years ago

GTF to bedgrah12

How to convert GTF format into BED12 or BIGBED format?

# see below for UPDATES that include more shorter ways of conversions

# How to convert GTF format into BED12 format (Human-hg19)?
# How to convert GTF or BED format into BIGBED format?
# Why BIGBED (If GTF or BED file is very large to upload in UCSC, you can use trackHubs. However trackHubs do not accept either of the formats. Therefore you would need bigBed format)

# First, download UCSC scripts
wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/gtfToGenePred
wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/genePredToBed
wget http://hgdownload.cse.ucsc.edu/admin/exe/linux.x86_64/bedToBigBed

# Second, download chromosome sizes and filter out unnecessary chromosomes
wget http://hgdownload.cse.ucsc.edu/goldenPath/hg19/bigZips/hg19.chrom.sizes
grep -v chrM hg19.chrom.sizes| grep -v _hap | grep -v Un_gl |grep -v random > hg19.chrom.filtered.sizes
rm hg19.chrom.sizes

# Third, make them executable
chmod +x gtfToGenePred genePredToBed bedToBigBed

# Convert Gtf to genePred
./gtfToGenePred 1st_53_tissues.combined.gtf 1st_53_tissues.combined.genePred

# Convert genPred to bed12
./genePredToBed 1st_53_tissues.combined.genePred 1st_53_tissues.combined.bed12

# sort bed12
sort -k1,1 -k2,2n 1st_53_tissues.combined.bed12 > 1st_53_tissues.combined.sorted.bed

To run pyGenomeTracks a configuration file describing the tracks is required. The easiest way to create this file is using the program make_tracks_file which creates a configuration file with defaults that can be easily changed. The format is:

make_tracks_file --trackFiles DNMT3B_2.srt.bw Saccharomyces_cerevisiae.R64-1-1.95.bed12 -o tracks.ini
bamCoverage -p10 --bam ../PKD_aln.filq20.hg19.bam -o PKD_aln.filq20.hg19.bw --region chr16:2137711:2189899
pyGenomeTracks --tracks tracks.ini --region XV:505794-506767 --outFileName nice_image.pdf

image

xie186 commented 5 years ago
bamCoverage -p10 --bam ../PKD_aln.filq20.hg19.bam -o PKD_aln.filq20.hg19.bw --region chr16:2137711:2189899
xie186 commented 5 years ago
pyGenomeTracks --tracks tracks.ini --region XV:505794-506767 --outFileName nice_image.pdf

image