I used this script (found in the forum) to convert a sorted BAM with uniquely mapped reads to wig format:
samtools mpileup -BQ0 run.sorted.bam | perl -pe '($c, $start, undef, $depth) = split;if ($c ne $lastC || $start != $lastStart+1) {print "fixedStep chrom=$c start=$start step=1 span=1\n";}$_ = $depth."\n";($lastC, $lastStart) = ($c, $start);' | gzip -c > run.wig.gz
However, when trying to upload to USCS I get an error saying:
Unrecognized format line 1 "fixedStep chrom=chr1 start=9957 step=1 span=1" (note: chrom names are case sensitive, e.g.: correct: 'chr1', incorrect: 'Chr1', incorrect: '1')
What is causing the error? Format seems to be Ok...
Thanks
EDIT: Trying to convert to bigWig with wigtoBigwig yields:
invalid unsigned integer: "chrom=chr1"
Do you mean USCS or UCSC?
Apologies, I meant UCSC