tzhu-bio / cisDynet

An integrated platform for modeling gene-regulatory dynamics and networks
MIT License
22 stars 3 forks source link

Error when running "quant_mat <- quantification(...)" #1

Open yashi99 opened 8 months ago

yashi99 commented 8 months ago

Hi, I find the error as shown below when running

 quant_mat <- quantification(sample_list= c("hESC_rep1"),
                            peak_path="./atac3/peaks",
                            cut_path="./atac3/cut_sites/",
                            save_file_path="./atac3/")
Error in `summarize()`:
i In argument: `sum = sum(X4)`.
i In group 1: `.id.x = 1`.
Caused by error:
! object 'X4' not found
Traceback:

1. quantification(sample_list = c("hESC_rep1"), peak_path = "./atac3/peaks/", 
 .     cut_path = "./atac3/cut_sites/", save_file_path = "./atac3/")
2. lapply(sample_list, function(x) {
 .     cut <- valr::read_bed(sprintf("%s/%s_q30_cut_sites.bed", 
 .         cut_path, x))
 .     res <- valr::bed_map(merged_peaks, cut, sum = sum(X4))[4]
 .     return(res)
 . })
3. FUN(X[[i]], ...)
4. valr::bed_map(merged_peaks, cut, sum = sum(X4))
5. summarize(res_int, !!!quos(...))
6. summarise.grouped_df(res_int, !!!quos(...))
7. summarise_cols(.data, dplyr_quosures(...), by, "summarise")
8. withCallingHandlers({
 .     for (i in seq_along(dots)) {
 .         poke_error_context(dots, i, mask = mask)
 .         context_poke("column", old_current_column)
 .         dot <- dots[[i]]
 .         dot <- expand_pick(dot, mask)
 .         quosures <- expand_across(dot)
 .         quosures_results <- map(quosures, summarise_eval_one, 
 .             mask = mask)
 .         for (k in seq_along(quosures)) {
 .             quo <- quosures[[k]]
 .             quo_data <- attr(quo, "dplyr:::data")
 .             quo_result <- quosures_results[[k]]
 .             if (is.null(quo_result)) {
 .                 next
 .             }
 .             types_k <- quo_result$types
 .             chunks_k <- quo_result$chunks
 .             results_k <- quo_result$results
 .             if (!quo_data$is_named && is.data.frame(types_k)) {
 .                 chunks_extracted <- .Call(dplyr_extract_chunks, 
 .                   chunks_k, types_k)
 .                 types_k_names <- names(types_k)
 .                 for (j in seq_along(chunks_extracted)) {
 .                   mask$add_one(name = types_k_names[j], chunks = chunks_extracted[[j]], 
 .                     result = results_k[[j]])
 .                 }
 .                 chunks <- append(chunks, chunks_extracted)
 .                 types <- append(types, as.list(types_k))
 .                 results <- append(results, results_k)
 .                 out_names <- c(out_names, types_k_names)
 .             }
 .             else {
 .                 name <- dplyr_quosure_name(quo_data)
 .                 mask$add_one(name = name, chunks = chunks_k, 
 .                   result = results_k)
 .                 chunks <- append(chunks, list(chunks_k))
 .                 types <- append(types, list(types_k))
 .                 results <- append(results, list(results_k))
 .                 out_names <- c(out_names, name)
 .             }
 .         }
 .     }
 .     sizes <- .Call(dplyr_summarise_recycle_chunks_in_place, chunks, 
 .         results)
 .     for (i in seq_along(chunks)) {
 .         result <- results[[i]] %||% vec_c(!!!chunks[[i]], .ptype = types[[i]])
 .         cols[[out_names[i]]] <- result
 .     }
 . }, error = function(cnd) {
 .     if (inherits(cnd, "dplyr:::summarise_incompatible_size")) {
 .         action <- "recycle"
 .         i <- cnd$dplyr_error_data$index
 .     }
 .     else {
 .         action <- "compute"
 .         i <- i
 .     }
 .     handler <- dplyr_error_handler(dots = dots, mask = mask, 
 .         bullets = summarise_bullets, error_call = error_call, 
 .         action = action)
 .     handler(cnd)
 . }, warning = dplyr_warning_handler(state = warnings_state, mask = mask, 
 .     error_call = error_call))
9. map(quosures, summarise_eval_one, mask = mask)
10. lapply(.x, .f, ...)
11. FUN(X[[i]], ...)
12. mask$eval_all_summarise(quo)
13. eval()
14. .handleSimpleError(function (cnd) 
  . {
  .     if (inherits(cnd, "dplyr:::summarise_incompatible_size")) {
  .         action <- "recycle"
  .         i <- cnd$dplyr_error_data$index
  .     }
  .     else {
  .         action <- "compute"
  .         i <- i
  .     }
  .     handler <- dplyr_error_handler(dots = dots, mask = mask, 
  .         bullets = summarise_bullets, error_call = error_call, 
  .         action = action)
  .     handler(cnd)
  . }, "object 'X4' not found", base::quote(NULL))
15. h(simpleError(msg, call))
16. handler(cnd)
17. abort(message, class = error_class, parent = parent, call = error_call)
18. signal_abort(cnd, .file)

When I check the function quantification(), I also could not understand what is "X4". Could you please give some advice?

tzhu-bio commented 8 months ago

Please print a few lines for each of the peak and cuts files.

yashi99 commented 8 months ago

Ok:

(R4.3) head peaks/hESC_rep1_peaks_unique.narrowPeak.bed
chr1    629727  630148  hESC_rep1_peak_1a   588 .   9.55503 65.6055 58.8901 108
chr1    633821  634239  hESC_rep1_peak_2    1140    .   14.2724 122.383 114.053 276
chr1    778440  779080  hESC_rep1_peak_3a   101 .   7.74818 13.3176 10.1935 145
chr1    827336  827539  hESC_rep1_peak_4    80  .   7.16418 10.9988 8.08006 93
chr1    858578  858779  hESC_rep1_peak_5    80  .   7.28477 11.0206 8.09981 95
chr1    869734  870102  hESC_rep1_peak_6    44  .   5.19481 6.95419 4.43936 272
chr1    904526  904676  hESC_rep1_peak_7    51  .   5.52486 7.7937  5.1944  72
chr1    959089  959271  hESC_rep1_peak_8    20  .   3.61446 4.18426 2.05775 101
chr1    970652  970802  hESC_rep1_peak_9    57  .   5.36083 8.3673  5.70486 106
chr1    975979  976514  hESC_rep1_peak_10a  67  .   6.11765 9.58171 6.79647 141

(R4.3)  head cut_sites/hESC_rep1_q30_cut_sites.bed 
chr1    10007   10008   1
chr1    10124   10125   1
chr1    10030   10031   1
chr1    10047   10048   1
chr1    10113   10114   1
chr1    10049   10050   1
chr1    10138   10139   1
chr1    10078   10079   1
chr1    10138   10139   1
chr1    10138   10139   1
tzhu-bio commented 8 months ago

This error was reported because the version of valr I was using was v0.6.8 (your version might be v0.7.0). Now that I have fixed the bug and adapted valr for v0.7.0, please reinstall cisDynet.

yashi99 commented 8 months ago

It works after reinstalling cisDynet. Thank you!