[BioC] Gviz - Plot genes and data from - strand (3'-5') in 5'-3' direction
Hahne, Florian
florian.hahne at novartis.com
Fri Sep 13 09:39:53 CEST 2013
Since Gviz track objects are essentially GRanges, one could use the
reflect method to archive this. Not thoroughly tested, but something along
the lines of this:
library(GenomicFeatures)
samplefile <- system.file("extdata", "UCSC_knownGene_sample.sqlite",
package = "GenomicFeatures")
txdb <- loadDb(samplefile)
txTr <- GeneRegionTrack(txdb, chromosome="chr6", start=300000,
end=350000)
plotTracks(txTr)
txTr2 <- txTr
rr <- ranges(txTr2)
rrByChrom <- split(rr, seqnames(rr))
rrNew <- unlist(endoapply(rrByChrom, function(x){
ranges(x) <- reflect(ranges(x), range(ranges(x)))
x
}))
ranges(txTr2) <- rrNew
dev.new()
plotTracks(txTr2)
Not quite sure why one would like to do this, because the resulting
coordinates are no longer genomic coordinates, but you guys may have a
convincing use case I am sure.
Florian
On 9/12/13 3:57 PM, "Steve Lianoglou" <lianoglou.steve at gene.com> wrote:
>Hi,
>
>On Thu, Sep 12, 2013 at 6:14 AM, Robert Ivanek <robert.ivanek at unibas.ch>
>wrote:
>> Hi Dominik,
>>
>> You can achieve that by changing the strand in corresponding track
>> objects.
>[snip]
>
>While this might change the strand of a gene, I do not think this is
>what the OP is really after -- as I have previously been keen to try
>to implement the approach that (I think) the OP wants.
>
>I believe the OP would like to plot "the mirror image" of the plot
>that Gviz would "normally" show given the start/stop coordinates that
>the plotting functionality infers (or is given).
>
>The approach you suggest wouldn't properly "flip" my gene models and
>the data associated with them -- it would only show them on the
>positive strand. The 5'utr of the gene that was originally on the
>negative strand would look as if it were the 3'utr of the gene on the
>(now annotated) positive strand, and vice versa, and if I were (say)
>plotting ChIP-seq data over this locus, the TF would appear to be
>binding the 3'utr of a gene on the positive strand (or downstream of
>it), when that's not really the case.
>
>-steve
>
>--
>Steve Lianoglou
>Computational Biologist
>Bioinformatics and Computational Biology
>Genentech
>
>_______________________________________________
>Bioconductor mailing list
>Bioconductor at r-project.org
>https://stat.ethz.ch/mailman/listinfo/bioconductor
>Search the archives:
>http://news.gmane.org/gmane.science.biology.informatics.conductor
More information about the Bioconductor
mailing list