On Thu, Jul 23, 2009 at 10:59 AM, Michael Lawrence <mflawren@fhcrc.org>wrote:

>
>
> On Thu, Jul 23, 2009 at 10:45 AM, Simon Anders <anders@ebi.ac.uk> wrote:
>
>> Hi Michael
>>
>> Michael Lawrence wrote:
>> > Well, to get the scores:
>> >
>> > track <- import("foo.wig")
>> > scores <- score(track)
>> >
>> > Now you are free to use any of the functions in R for smoothing a
>> numeric
>> > vector. Like loess(), runmed(), etc.
>>
>> Careful! This does not work, as you ignore the ranges.
>>
>
> Thanks for pointing that out. One easy way is to just get the 'x' variable,
> as in:
>
> chr1 <- track["chr1"] # limit to single chromosome
> y <- score(chr1)
>

Oops, I meant:
y <- rep(score(chr1), width(chr1))


>
> x <- as.integer(unlist(ranges(chr1)))
> lo <- loess(y ~ x)
>
> Michael
>
>
>> Take, for example, this wiggle file here, which starts with:
>>
>> track type=wiggle_0 name="coverage 06-GL3"
>> 06      1       40128   0
>> 06      40128   40164   0.881
>> 06      40164   40245   0
>> 06      40245   40257   0.881
>> 06      40257   40281   1.444
>> [...]
>>
>> Observe:
>>
>> > w <- import( "igb/06-GL3-coverage.wig" )
>> > s <- score( w )
>> > str(s)
>>  num [1:338864] 0 0.881 0 0.881 1.444 ...
>>
>> The score vector 's' should start with 40127 times a '0' but we have
>> only a single 0.
>>
>>
>>  Simon
>>
>
>

	[[alternative HTML version deleted]]

