On Mon, Feb 3, 2014 at 7:06 AM, Philip Lijnzaad <p.lijnzaad@umcutrecht.nl>wrote:

>  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.
>
>
>
If you read it as a GRanges, then it should work.


>   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("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)
>
>
>
Time to update ;)


>
>   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("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.
>
>

To clarify, I'm interested in what you're doing downstream of getting the
numbers. Are you summarizing it, e.g., by taking the average coverage? It
so, RleViews is what you want.


> 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 intended
> exclusively for the addressee. If you receive this message unintentionally,
> please do not use the contents but notify the sender immediately by return
> e-mail. University Medical Center Utrecht is a legal person by public law
> and is registered at the Chamber of Commerce for Midden-Nederland under no.
> 30244197. *
>
> * Please consider the environment before printing this e-mail. *
>

	[[alternative HTML version deleted]]

