Hi

I'm stupid, I've forgotten the "1:".

>> system.time({
> +    cvg2 <- GenomeData( list() )
> +    for( i in length(lanes) )
                 ^^^^^^^^^^^^^
> +       cvg2 <- cvg2 + coverage( lanes[[i]], width=seqlens )
> + })
>    user  system elapsed
>  56.551   9.050  65.634

No wonder that the for loop was so drastically faster; it was iterated
only once.

Here are the correct timings:

> system.time({
+    cvg2 <- GenomeData( list() )
+    for( i in seq_along(lanes) )
+       cvg2 <- cvg2 + coverage( lanes[[i]], width=seqlens )
+ })
   user  system elapsed
378.704 102.946 482.406

> system.time(
+    cvg1 <- Reduce( `+`, lapply( lanes, coverage, width=seqlens ) )
+ )
   user  system elapsed
377.510 101.509 484.885

So, there is no performance difference between 'Reduce' and 'for'. Sorry
for the nonsense.

  Simon

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

Reply via email to