[BioC] selecting score(GRanges_object) based on coordinates
Philip Lijnzaad
p.lijnzaad at umcutrecht.nl
Mon Feb 3 16:06:20 CET 2014
Hi Michael,
thanks for the elaborate anwer.
Note that this solution assumes that the data are on one chromosome.
hmm, it seems to work with the coverage being for all chromomes; I iterate
over the features (each of them contiguous and on one chromosome only).
You want:
scores <- coverage(coverage, weight="score")
OK, but the coverage was read from a bigwig file, so in this case it would
not work I think.
scores[as(feature, "RangesList")]
Make sure that the seqlevels are the same between "coverage" and "feature".
OK, good point.
However, in this case fastest way is to have rtracklayer load the coverage
directly as an Rle. In release, this is just
scores <- import("[1]my.bw", asRle=TRUE)
scores[ as(feature, "RangesList") ]
I was actually been looking for something that, but this is not available
my version (R 3.0.1, Bioconductor 2.12, rtracklayer 1.20.4)
If you are *only* interested in the data over "feature", then you could tell
rtracklayer to only load that data (the rest of the RleList will be zeroed
out).
scores <- import("[2]my.bw", asRle=TRUE, which=feature)
feature.scores <- scores[ as(feature, "RangesList") ]
If "feature" is contained within one chromosome, then you might want to
simply:
unlist(feature.scores, use.names=FALSE)
OK
With all that explained, it would be nice to know your use case. Often these
types of problems are solvable with RleViews[List].
Well, I was interested in the behaviour of protein-DNA binding data (for
which I have external bigwig files) over the promoters of a certain set of
genes. I would have hoped there to be a clear-cut example on the interwebs.
I guess there is one now (i.e. this thread :-), but still it would be nice
to be in one of the vignettes.
Thanks again,
Philip
_________________________________________________________________
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht
ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct
te informeren door het bericht te retourneren. Het Universitair Medisch
Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de
W.H.W. (Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat
geregistreerd bij de Kamer van Koophandel voor Midden-Nederland onder nr.
30244197.
Denk s.v.p aan het milieu voor u deze e-mail afdrukt.
_________________________________________________________________
This message may contain confidential information and is...{{dropped:14}}
References
1. http://my.bw/
2. http://my.bw/
More information about the Bioconductor
mailing list