I have a Bam file with several individuals (read groups) and I would like to plot each of them in a different track with gviz. If I split the bam file and load all individual bam files I can do the task. But I wonder if is there any option to say to gviz to split the tracks by readgroup.
If I plot my multisample bam like this
bamTracks <- DataTrack(range = bamFile , genome = genome , type = c("l","g") , name = "Coverage" , chromosome = chr , from = start , to = end , ylim = c(0,240) , background.panel = "#FFFFEB" )
I obtain only one track with the coverage sum of all individuals. Is there an option in the importFunction()
in the DataTrack class to split by the @RG when importing the bam?
Would it be better to read a bam with rsamtools or similar module, split them and convert to granges to load in gviz?