Open daler opened 7 years ago
Hi - sorry for the late reply but I was traveling this month. I would be interested in seeing the bedgraphs and also the stats file. Not sure why it only works for k=4.
Thanks. I'm actually unable to consistently reproduce, and still trying to get a minimally working example. However, would it be possible to add some error checking in merge_windows
to avoid such issues? It seems that finding less than 2 interacting regions in a replicate will cause a crash.
@rr1859 is there an email I could send you some problematic bedgraphs?
rraviram@ucsd.edu
This error still seems to happen randomly. Admittedly the data did not pass QC. But the nearbait
analysis failed at k=5
, and k=4
, but worked with k=3
.
Hi @rr1859 -
For a 4-bp cutter experiment with 3 replicates, using the recommend k=3 or k=5 in a near-bait analysis causes lots of warnings ("Warning: only 1 iteration. Using starting parameters") followed by the error
Error in 2:nrow(windows) : argument of length 0
. Interestingly this does not happen with k=4.This appears to be from repeated calls to
parameterEstimationCis
, which is returning parameters identical to the starting parameters. When this happens enough times, the value oflower
is finally small enough to exit out of the while-loop in nearBaitAnalysis. At that point, thepar_est_results$mod_fit
is still the same as the starting parameters.So that explains the "Using starting parameters" errors, but not the "Error in 2:nrow(windows)" error.
Tracking this down further, it appears that the error is from
viterbi3State
, in this line: https://github.com/rr1859/R.4Cker/blob/db41c4d54eafa2489a3817bc36b84854c188a55c/R/viterbi3State.R#L106. The problem is that in thetable_intersect
dataframe, there are no regions that are called as high-interacting in all replicates, and sofinal_intersect_trim_hi
is NULL andmerge_windows
raises the error.I tried changing
set.seed(7)
toset.seed(NULL)
but this did not solve the issue.Can you provide some insight into why this error is occurring on k=3 and k=5 but not k=4? I'd be happy to provide bedGraphs. Thanks.