This is a script that takes indexed bam files (as delimited by ucsc_config.txt), and generates a single-file track for all of the bam files that can be easily uploaded and viewed on UCSC Genome Browser in the event that one doesn't have a public server on which to host a large bigwig file. Note: this works for both genomic and transcriptomic data!
Python 3+
Pandas
When run the user will be prompted with two questions:
- Chromosome location
- Input a chromosomal location like this: chr17:70,844,205-70,851,210
- Gene of interest
- This is merely for track nomenclature - any single-word name works
You need to configure your ucsc_config.txt file to have four columns:
- Sample name
- Bam name (must match the name of the bam file exactly)
- Normalized read depth
- Color - this should be in 'R.G.B.' format. Alternatively, leave at '0' and it will generate random colors for each track.
normalized_read_depth is calculated by dividing 1x10^6 by the read depth of the bam file.
Get read depth using:
samtools view -F 0x4 foo.sorted.bam | cut -f 1 | uniq | wc -l