Search
Question: Error running the function permTest
0
gravatar for tharveshliyakat
7 months ago by
tharveshliyakat10 wrote:

Hi,

I found following error when I tried running the following example code from regioneR vignette. 

pt_Rad21_5k_vs_Ctcf <- permTest(A=HepG2_Rad21_5K, B=HepG2_Ctcf, ntimes=1000,
                                randomize.function=circularRandomizeRegions,
                                evaluate.function=numOverlaps, count.once=TRUE,
                                + genome="hg19", mc.set.seed=FALSE, mc.cores=4)

Error in if (alt == "less") { : missing value where TRUE/FALSE needed
In addition: Warning messages:
1: In mclapply(c(1:ntimes), randomize_and_evaluate, ...) :
  all scheduled cores encountered errors in user code
2: In mean.default(rand.ev, na.rm = TRUE) :
  argument is not numeric or logical: returning NA

 

Thank you

ADD COMMENTlink modified 7 months ago by bernatgel70 • written 7 months ago by tharveshliyakat10
1
gravatar for bernatgel
7 months ago by
bernatgel70
Spain
bernatgel70 wrote:

I just run the full example in and it run without errors for me.  If you take a closer look at the error message it produced you can see it said

1: In mclapply(c(1:ntimes), randomize_and_evaluate, ...) : all scheduled cores encountered errors in user code

That means that all parallel jobs sent errored. However you cannot see the exact problem, since when running in parallel the errors get hidden.

I would recommend making sure you downloaded all needed data (with the code in the prior page in the vignette) and the running without parallel execution (and a lower number of permutations, so it finishes faster) with this:

pt_Rad21_5k_vs_Ctcf <- permTest(A=HepG2_Rad21_5K, B=HepG2_Ctcf, ntimes=10,
                                randomize.function=circularRandomizeRegions,
                                evaluate.function=numOverlaps, count.once=TRUE,
                                genome="hg19", force.parallel = FALSE)

With this, more clear and evident error messages should appear.

ADD COMMENTlink written 7 months ago by bernatgel70

I found the following error message.

Error in which(genome == inst_pkgs[, "provider_version"]) :
  error in evaluating the argument 'x' in selecting a method for function 'which': Error in `[.data.frame`(inst_pkgs, , "provider_version") :
  undefined columns selected

Thank you.

ADD REPLYlink written 7 months ago by tharveshliyakat10
1

Hmm... I think it might come from an unavailable genome, although the error message should be quite more clear. 

Could you check if the genome is available with 

installed.genomes()

You should see "BSgenome.Hsapiens.UCSC.hg19.masked" in the output.

If it's not installed, try installing it with biocLite.

It could also be due to out-of-date packages. Maybe you can try with biocValid and see if your setup is up-to date

source("https://bioconductor.org/biocLite.R")
biocValid()
ADD REPLYlink written 7 months ago by bernatgel70
1

Thank you. The issue is with the installed genome.

Cheers

ADD REPLYlink written 7 months ago by tharveshliyakat10
1
gravatar for James W. MacDonald
7 months ago by
United States
James W. MacDonald45k wrote:

Part of permTest is to determine what the alternative hypothesis is, and if you don't specify the alternative, it will figure it out by itself (which is sort of bootleg - you shouldn't decide on the test based on your data, but whatever). It does this by looking at the mean of the randomized data (which is captured in a variable called rand.ev).

You have a warning and an error that in essence tell you what the problem is. The warning is

In mean.default(rand.ev, na.rm = TRUE) :
  argument is not numeric or logical: returning NA

Which can be translated to 'when I generated random data, the results aren't numeric, so what's up with that?'. This probably means that you are feeding character data into permTest, but only you can know that for sure. I get the same warning if I do something like

> mean(c(1,2,3,"a"))
[1] NA
Warning message:
In mean.default(c(1, 2, 3, "a")) :
  argument is not numeric or logical: returning NA

The error is

Error in if (alt == "less") { : missing value where TRUE/FALSE needed

which comes from a test

if(alternative == "auto") {
alt <- ifelse(orig.ev < mean(rand.ev, na.rm=TRUE), "less", "greater")

and you have a missing value because rand.ev isn't numeric, as the warning already noted, so in this case alt won't be less or greater, it will be NA, so when you do the test of alt == "less", you get the error because  NA == "less", returns NA, not TRUE or FALSE.

ADD COMMENTlink written 7 months ago by James W. MacDonald45k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.2.0
Traffic: 119 users visited in the last hour