federicomarini / GeneTonic

Enjoy your transcriptomic data and analysis responsibly - like sipping a cocktail
https://federicomarini.github.io/GeneTonic
Other
75 stars 8 forks source link

error with enrichment_map() #29

Open lucolotto opened 2 years ago

lucolotto commented 2 years ago

Hi there, I am writing because I keep finding an error while trying to produce an enrichment_map. When I call the enrichment_map like this:

emg <- enrichment_map(
  res_enrich = res_enrich,
  res_de = DEseqdata$DESeq2_results,
  annotation_obj = annotation,
  n_gs = 100, #number of gene sets to be considered.
  overlap_threshold = 0.5,
  scale_edges_width = 200,
  color_by = 'gs_pvalue'
)

I get the following error:

Error in `stop_subscript()`:
! Can't subset columns that don't exist.
x Locations 99 and 100 don't exist.
ℹ There are only 98 columns.
Run `rlang::last_error()` to see where the error occurred.

If I type rlang::last_error() I get:

Backtrace:
  1. GeneTonic::enrichment_map(...)
  3. tidyr:::pivot_longer.data.frame(om_df, seq_len(length(gs_to_use)))
  4. tidyr::build_longer_spec(...)
  5. tidyselect::eval_select(enquo(cols), data[unique(names(data))])
  6. tidyselect:::eval_select_impl(...)
 14. tidyselect:::vars_select_eval(...)
 15. tidyselect:::loc_validate(pos, vars)
 16. vctrs::vec_as_location(pos, n = length(vars))
 17. vctrs `<fn>`()
 18. vctrs:::stop_subscript_oob(...)
 19. vctrs:::stop_subscript(...)
Run `rlang::last_trace()` to see the full context.

The majority of the remaining functions do work, so I cannot really explain why this error. Any suggestion would really help! Thanks Luca

federicomarini commented 2 years ago

How many rows are in for the res_enrich object? Looks like to me it has less than 100

lucolotto commented 2 years ago

I've got 159 rows. The error appears even if I set n_gs=5

federicomarini commented 2 years ago

Hm, weird. I actually never encountered that error till now. Assuming the data might be unpublished, it would be difficult to have a reproducible example for us - at least here publicly on GitHub. Can you consider sharing the object as GeneTonicList?

lucolotto commented 2 years ago

Ehm, it is actually difficult for me to share publicly because, as you said, it is unpublished data that we are currently working on. I could send you the res_enrich, res_de and annotation objects which should let you reproduce the error I am encountering? But I would like to send them privately to you, not publicly uploading them here on GitHub (I know you will understand me and I trust you will not share them).

Would that be ok for you?

Thanks Luca

P.S. I do not know it this could be of any help or not but, I noticed that my res_enrich object (which has been created using shake_gprofilerResult and then get_aggrscores) has, for some gs_id, missing values in the z_score and aggr_score columns, while for other gs_id the z_score and aggr_score are present....

federicomarini commented 2 years ago

Yeah, that is what I meant - email should do it, you can find the one I use in the DESCRIPTION file.

Following up on your post scriptum - that could also be it. Happy to check it out myself, if you feel ok with it - I'll keep the whole info/exchange as confidential

lucolotto commented 2 years ago

Dear Federico, Sorry for the late reply. I am happy to send you all the relevant material, thanks for your support! I found your email on the description and I have sent you the relevant file. Should you have doubts, don't hesitate to ask me.

Looking forward to hearing from you soon All the best Luca