oh wait, sorry, you are talking about plotGranlinear, not layout
karyogram... I guess I need a coffee in the morning first :) let me check
to see if there is any quick workaround.

cheers

Tengfei


On Wed, Mar 26, 2014 at 10:08 AM, Tengfei Yin <tengfei.yin@sbgenomics.com>wrote:

> Hi Julian,
>
> yes, you could use ylim parameter in layout_karyogram() to control this
> and to layout different group at different height layer by layer, because
> by default the chromosome height limits are [0, 10], if you set ylim
> outside the region like [10, 15], it will plot them outside, an example to
> plot different group at different height is shown below, I know it's just a
> workaround, I probably need to provide a simpler way
>
> ########
> library(ggbio)
> data(hg19IdeogramCyto, package = "biovizBase")
> data(hg19Ideogram, package = "biovizBase")
> library(GenomicRanges)
> ##  simul_snp
> chrs <- as.character(levels(seqnames(hg19IdeogramCyto)))
> seqlths <- seqlengths(hg19Ideogram)[chrs]
> set.seed(1)
> nchr <- length(chrs)
> nsnps <- 100
> gr.snp <- GRanges(rep(chrs,each=nsnps),
>                   IRanges(start =
>                             do.call(c, lapply(chrs, function(chr){
>                               N <- seqlths[chr]
>                               runif(nsnps,1,N)
>                             })), width = 1),
>                   SNP=sapply(1:(nchr*nsnps), function(x)
> paste("rs",x,sep='')),
>                   pvalue =  -log10(runif(nchr*nsnps)),
>                   group = sample(c("Normal", "Tumor"), size = nchr*nsnps,
>                                  replace = TRUE)
> )
> gr.snp
> ##names(seqlths) <- gsub("chr", "", names(seqlths))
> seqlths
> seqlengths(gr.snp) <- seqlths[names(seqlengths(gr.snp))]
> gr.snp.bac <- gr.snp
> seqinfo(gr.snp)
> gr.snp <- keepSeqlevels(gr.snp, c("chr1", "chr2", "chr3", "chr4"))
>
> ## above this line is just creating simulated data
> ## suppose you have your snp data store in gr.snp
> ## you have to split the group for now, sorry
> grl.snp <- split(gr.snp, gr.snp$group)
> grl.snp
>
> autoplot(seqinfo(grl.snp)) + layout_karyogram(data = grl.snp[[1]], color
> = "red", ylim = c(0, 10) ) +
>   layout_karyogram(data = grl.snp[[2]], color = "blue", ylim = c(10, 20) )
>
> #########
>
> HTH
>
> Tengfei
>
>
> On Wed, Mar 26, 2014 at 8:49 AM, Julian Gehring <julian.gehring@embl.de>wrote:
>
>> Hi,
>>
>> The 'plotGrandLinear' or the respective 'autoplot' function of the
>> 'ggbio' package make it easy to visualize all the chromosomes of a
>> genomes together.  For example:
>>
>> autoplot(gr.snp, coord = "genome", geom = "point", aes(y = pvalue),
>> space.skip = 0.01) ## taken from 'example(plotGrandLinear'
>>
>> produces a plot for all human chromosomes with vertical lines in the
>> middle of each chromosome.  Can one easily adapt this, in the way that
>> the vertical lines fall between the chromosomes?  This would be helpful
>> for distinguishing/separating them.
>>
>> Best wishes
>> Julian
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor@r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>
>
>
> --
> Tengfei Yin, PhD
> Seven Bridges Genomics
> sbgenomics.com
> 625 Mt. Auburn St. Suite #208
> Cambridge, MA 02138
> (617) 866-0446
>



-- 
Tengfei Yin, PhD
Seven Bridges Genomics
sbgenomics.com
625 Mt. Auburn St. Suite #208
Cambridge, MA 02138
(617) 866-0446

	[[alternative HTML version deleted]]

