slowkow / CENTIPEDE.tutorial

:bug: How to use CENTIPEDE to determine if a transcription factor is bound.
https://slowkow.github.io/CENTIPEDE.tutorial
25 stars 13 forks source link

Conservation analysis (site_cons) fails #14

Closed KrRi4 closed 5 years ago

KrRi4 commented 5 years ago

Hi, I tried running your tutorial, but ran into the following issue when running the conservation analysis. Any suggestions on getting this to work would be appreciated!

Note, that the object can be viewed as it is already in the tutorial, however, using the listed commands it fails.

Thanks, Kris

> xs <- findOverlaps(sites, cons)
> site_cons <- sapply(1:length(sites), function(i) {
+   # Conservation scores for each positions in a PWM match.
+   ys <- cons[subjectHits(xs[queryHits(xs) == i])]
+   vals <- rep(ys$score, width(ys))
+   idx <- seq(
+     from = start(sites[i]) - min(start(ys)) + 1,
+     length.out = width(sites[i])
+   )
+   vals <- vals[idx]
+   mean(vals)
+ })
Error in seq.default(from = start(sites[i]) - min(start(ys)) + 1, length.out = width(sites[i])) : 
  'from' must be a finite number
In addition: Warning message:
In min(start(ys)) : no non-missing arguments to min; returning Inf
Called from: seq.default(from = start(sites[i]) - min(start(ys)) + 1, length.out = width(sites[i]))
slowkow commented 5 years ago

Looks like min(start(ys)) is returning Inf (infinity):

In min(start(ys)) : no non-missing arguments to min; returning Inf

You might consider double-checking that you have the correct data in sites and cons.