Error running the function permTest
2
0
Entering edit mode
@tharveshliyakat-9930
Last seen 7.6 years ago

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

regioner overlappingpeaks • 3.5k views
ADD COMMENT
1
Entering edit mode
bernatgel ▴ 150
@bernatgel-7226
Last seen 10 months ago
Spain

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 COMMENT
0
Entering edit mode

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 REPLY
1
Entering edit mode

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 REPLY
1
Entering edit mode

Thank you. The issue is with the installed genome.

Cheers

ADD REPLY
3
Entering edit mode
@james-w-macdonald-5106
Last seen 1 day ago
United States

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 COMMENT

Login before adding your answer.

Traffic: 518 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6