Hi, I just started to use Gviz. I got some problem when I tried to plot the sequence coverage of my own Bam file. So I used those lines:
afrom <- 142299011
ato <-142813287
alTrack <- AlignmentsTrack(range='/Users/yuyaxuan/Desktop/lymDB/trb_real.bam')
plotTracks(alTrack, from = afrom, to = ato,chromosome = "7")
And this gives me an empty plot. Here I attached some lines of the bam file:
HWI-BRUNOP16X_0001:2:7:16511:51313#0 16 7 142299129 37 75M * 0 0 TGGGCTGAAGTCTCCACTGTGGTGTGGTCCATTGTCTCAGGCTCCATGGATACTGGAATTACCCAGACACCAAAA gdcc`gg]gedggfgaggeg`YdebgRgggggggddggbggddgegggfgfgggggfgfggfgggeecca\\Y]] RG:Z:lymph_75_fcb XT:A:U NM:i:28 X0:i:1 X1:i:0 XM:i:28 XO:i:0 XG:i:0 MD:Z:0G0T0C0C0T0A1G0C0T1A0G0T1T0G0A0A1T0T0G1C0T0T0C0T0T3T2A0T37
Thanks! it does the trick!
A follow up question about this, so I want to add more tracks along with the alignment track. For example this track,
itrack <- IdeogramTrack(genome = "hg38", chromosome = "chr7")
plotTracks(c(alTrack, itrack), chromosome = "7", from = afrom, to = ato, cex = 0.5, min.height = 8)
However, this will give me error:
Error in .local(.Object, ...) :
Chromosome '7' does not exist on UCSC genome 'hg38'
I think it's a problem with my BAM file using "7" as the chromosome name, How can I plot them together them?
Thanks!
I believe this might do the trick:
This will work, but I'd recommend to stick to a standard chromosome notation already when creating you BAM files. If you have aligned your reads against a UCSC reference genome then you should get the chrXYZ notation. The ideograms are also based on USCS data, so if you want to combine your BAM file with that you better be sure that the two are pointing to the same reference genome. Otherwise you are comparing apples to pears a bit...