[Bioc-sig-seq] overlaying coverage plots

Martin Morgan mtmorgan at fhcrc.org
Thu Aug 12 19:00:01 CEST 2010


On 08/12/2010 09:20 AM, LU Zen wrote:
> I'm trying to overlay coverage plots of individual chromosomes from
> different experiments to get a quick overview of probable CNVs. I've
> tried using simple plot, ggplot and plotrix packages of R (and I'm a
> real novice in R) but it seems that my linux machine with 64GB of
> memory is unable to handle the task. I've also reduced my file size
> by putting only the coordinates and the coverages derived from
> samtools pileup into a single file.
> 
> My understanding is that I should be able to plot the coverage of a
> single chromosome with the bioconductor package but is it possible to
> overlay multiple plots using the package? I'll be really grateful if
> someone can advice on the way to do this.

One easy possibility is to use HilbertVis' plotLongVector function with
standard R graphics commands. So here's some long data (simulated with
another function in HlibertVis)

  library(HilbertVis)
  x <- makeRandomTestData() # 1e7 entries

Then we set up a device so that we'll plot into 4 'rows' and 1 'column',
with margins on each plot fairly tight (see ?par)

  par(mfcol=c(4, 1), mar=c(1, 4, 2, 2))

And then we'll create four plots, showing progressively more extreme peaks

  par(mfcol=c(4, 1), mar=c(1, 4, 2, 2))
  plotLongVector(x)
  plotLongVector(x * (abs(x) > 50))
  plotLongVector(x * (abs(x) > 100))
  plotLongVector(x * (abs(x) > 200))

This would also work with IRanges' Rle objects

  library(IRanges)
  r <-	Rle(x)
  plotLongVector(r)
  plotLongVector(r * (abs(r) > 50))
  plotLongVector(r * (abs(r) > 100))
  plotLongVector(r * (abs(r) > 200))

One could also easily 'zoom in'

  len = length(r)
  plotLongVector(r)
  plotLongVector(seqselect(r, len/10, 9 * len / 10))
  plotLongVector(seqselect(r, len/100, 9 * len / 100))
  plotLongVector(seqselect(r, len/1000, 9 * len / 1000))

(though here the x-coordinates are not correct).

Also of course one might explore the raison d'etre of the package, and
its companion HilbertVisGUI

  showHilbertImage(hilbertImage(x))

Martin

> 
> Thank you.
> 
> Zen
> 
> 
> 
> 
> 
> The University of Edinburgh is a charitable body, registered in 
> Scotland, with registration number SC005336.
> 
> 
> 
> _______________________________________________ Bioc-sig-sequencing
> mailing list Bioc-sig-sequencing at r-project.org 
> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing


-- 
Martin Morgan
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioc-sig-sequencing mailing list