sellerslab / gemini

GEMINI: A variational Bayesian approach to identify genetic interactions from combinatorial CRISPR screens
BSD 3-Clause "New" or "Revised" License
15 stars 3 forks source link

inizialize model error: median(x, : replacement has length zero #1

Closed Namiine closed 5 years ago

Namiine commented 5 years ago

Hi, I'm trying to apply GEMINI to combinatorial screening data (pDNA and end-timepoint in 3 replicates). I stuck to your example, which worked without issues. But with my data, I end up with the following error when trying to train the model (Input data and LFC calculation was successful):

Model <- gemini_initialize(Input = Input, 
                  nc_gene = "NHT", 
                  pattern_join = ';',
                  pattern_split = ';', 
                  cores = 1
                  #verbose = TRUE)

Error in y[i, ] <- apply(as.matrix(t(LFC[ind, ])), 2, function(x) median(x, : replacement has length zero
Traceback:
1. gemini_initialize(Input = Input, nc_gene = "NHT", pattern_join = ";", 
 .     pattern_split = ";", cores = 1)
2. Model %<>% initialize_x(concordance = concordance, cores = cores, 
 .     verbose = verbose) %>% initialize_y(verbose = verbose, cores = cores) %>% 
 .     initialize_s(verbose = verbose, cores = cores) %>% initialize_tau(CONSTANT = CONSTANT, 
 .     prior_shape = prior_shape, window = window, monotonize = monotonize, 
 .     verbose = verbose)
3. withVisible(eval(quote(`_fseq`(`_lhs`)), env, env))
4. eval(quote(`_fseq`(`_lhs`)), env, env)
5. eval(quote(`_fseq`(`_lhs`)), env, env)
6. `_fseq`(`_lhs`)
7. freduce(value, `_function_list`)
8. function_list[[i]](value)
9. initialize_y(., verbose = verbose, cores = cores)

Can you help me with this error message? Best wishes, Marie

MahdiZ11 commented 5 years ago

Hi Marie,

Thank you for using GEMINI.

Error at the initialization step often occurs due to a problem with guide annotation (Input$guide.pair.annot). Looking at your error, I think there might be some guides in your library that are not paired with your nc_gene ("NHT"), and probably not paired with any other guides. If this is the case, please remove those from the Input object. Otherwise I can go over your code to see if I can fix it. I will need your R code and your input objects (.rds or .Rdata), and my email address is mzamanig@broadinstitute.org.

Cheers, Mahdi

Namiine commented 5 years ago

Dear Mahdi, Thank you very much for the quick answer. It was indeed a problem with guide annotation, the data type was wrong due to an artifact from csv import (factor instead of character) and the hash function (Sgene2Pguides_hash) returned zero. Best, Marie

MahdiZ11 commented 5 years ago

Hi Marie,

Great! Let me know how GEMINI works for you, and glad to be of any help.

Best, Mahdi