YosefLab / scone

53 stars 12 forks source link

Error in score_matrix(expr = adjusted, eval_pcs = eval_pcs, eval_proj = eval_proj, : NA/Inf/NaN Expression Values #99

Open diyadas opened 6 years ago

diyadas commented 6 years ago

I'm getting this error on running scone and attempting to retrieve rankings. I checked my un-normalized data, and there are no NAs, Infs, or NaNs. I'm not sure how to resolve this - it looks like scone is producing the NA expression data as part of the normalization.

Code is as follows:

scone_fx <- function(SconeExperimentObj, ...){
  scone(SconeExperimentObj,
        scaling = list(none = identity,sum = SUM_FN, tmm = TMM_FN, uq = UQ_FN,
                       fq = FQT_FN, deseq = DESEQ_FN),
        k_ruv = 3,
        k_qc = 5,
        adjust_bio = "no",
        adjust_batch = "yes",
        eval_kclust = 5:15,
        zero = "postadjust", ...
  )
}
scone_obj <- SconeExperiment(se_filtered, #se_filtered is a SummarizedExperiment object
                             which_qc =
                               which(colnames(colData(se_filtered)) %in%
                                       colnames(qc)),
                             which_negconruv = 2L,
                             which_negconeval = 1L,
                            #  which_bio = 146L, #at the time, this wasn't specified - not sure if that would have triggered the issue
                             which_batch = 4L
)
scone_params <- scone_fx(scone_obj, run = FALSE)

N <- NCOL(scone_obj)
n <- ceiling(N * 0.05 )
sub_ranks <- replicate(10, {
idx <- sample(N, n)
scone_sub <- scone_obj[, idx]
scone_sub <- scone_sub[rowSums(assay(scone_sub)) > 0, ]    
scone_sub <- scone_fx(scone_sub)     
return(list(get_scores(scone_sub), get_score_ranks(scone_sub)))
  } , simplify = FALSE)