pachterlab / sleuth

Differential analysis of RNA-Seq
http://pachterlab.github.io/sleuth
GNU General Public License v3.0
305 stars 95 forks source link

Error in sleuth_prep #195

Closed caberger1 closed 6 years ago

caberger1 commented 6 years ago

Hello,

I'm trying to run sleuth on 4 kallisto-generated abundance files, 2 for each of 2 conditions. My samples-to-covariances table is as follows:

sample condition path 1 stela_C WB ../quant/results/stela_C 2 stela_H WB ../quant/results/stela_H 3 waika_A nonWB ../quant/results/waika_A 4 waika_K nonWB ../quant/results/waika_K

I'm running into an error constructing the sleuth object:

so <- sleuth_prep(s2c, extra_bootstrap_summary = TRUE)

reading in kallisto results
dropping unused factor levels
....
normalizing est_counts
Error in if (sum(filter_bool) == 0) { : 
  missing value where TRUE/FALSE needed

I looked at the sleuth_prep code and I couldn't find that exact error message, but it seems to be at this step:

if (normalize ) {

    msg("normalizing est_counts")
    est_counts_spread <- spread_abundance_by(obs_raw, "est_counts",
      sample_to_covariates$sample)
    if(!is.null(filter_target_id)) {
       msg("A list of target IDs for filtering was found. Using this for filtering")
       target_ids <- rownames(est_counts_spread)
       filter_bool <- target_ids %in% filter_target_id
       names(filter_bool) <- target_ids
    } else {
      filter_bool <- apply(est_counts_spread, 1, filter_fun)
    }
    filter_true <- filter_bool[filter_bool]

    if (sum(filter_bool) == 0) {
      stop("Zero targets passed the filter you used. Please double check the filter used.")
    }

and it also returns the same error if I run it with normalize = FALSE. I also thought it might have something to do with the basic_filter function, but changing filter_fun didn't help.

I've double-checked that the s2c table is constructed correctly and the kallisto data should be in order, and at this point I'm stuck. I'm new to R, so apologies if it's something obvious!

Thanks for your help!

heskad commented 2 years ago

hello! how did you solve this problem???

caberger1 commented 2 years ago

I don't think I ever did to be honest! This was years ago and I don't recall using this software much after this.

GurveerG commented 2 years ago

@heskad @caberger1 I ran into the same error and it's because of your metadata.txt file containing identical names for your samples. This choice in identical sample names then causes the spread_abundance_by function to yield est_counts_spread data that cannot pass the basic_filter or filter_fun.

Edit: Based on the s2c file you mention, I think my solution wouldn't apply. I would try encoding the conditions by 0 and 1 for WB and nonWB, respectively. I am three years late, but it might be worth a try for anyone else who encounters this issue in the future.