On Tue, Feb 15, 2011 at 5:01 PM, supat thongjuea
<[email protected]>wrote:

> Hi,
>
> I have two Rle views call chip.views and contr.views. I would like to speed
> up the iteration for getting the coefficient values from the linear
> regression model.
> I used sapply for those two Views but it is quite slow to get  coefficient
> value from around 10,000 Views. Do you have any suggestion how to speed up
> this?.
>
>                    chip.cov <-coverage(chip.GRanges.uniq)
>                    contr.cov<-coverage(contr.GRanges.uniq)
>                    window.size=100000
>                    step.size = window.size
>                    ends <- seq(from=window.size,to=chr.size,by=step.size)
>                    starts <-
> seq(from=1,to=chr.size-window.size,by=step.size)
>                    chip.views<-Views(chip.cov[[1]],starts,ends)
>                    contr.views<-Views(contr.cov[[1]],starts,ends)
>
>                    factor<-sapply(1:length(chip.views),function(x)
>
> lsfit(as.integer(chip.views[[x]]),as.integer(contr.views[[x]]))$coefficients[[2]])
>
>
Not sure about speeding this up, but for the sake of clarity anyway, you
might want to use the viewApply() function instead of sapply here.

Michael

Best regards,
> Supat Thongjuea
>
>        [[alternative HTML version deleted]]
>
> _______________________________________________
> Bioc-sig-sequencing mailing list
> [email protected]
> https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing
>

        [[alternative HTML version deleted]]

_______________________________________________
Bioc-sig-sequencing mailing list
[email protected]
https://stat.ethz.ch/mailman/listinfo/bioc-sig-sequencing

Reply via email to