saezlab / liana

LIANA: a LIgand-receptor ANalysis frAmework
https://saezlab.github.io/liana/
GNU General Public License v3.0
181 stars 31 forks source link

Error in generate_homologs() / recode_character2() #170

Open kimberle9 opened 2 months ago

kimberle9 commented 2 months ago

Hello,

I'm having an error with the generate_homologs() function, stemming from recode_character2(). Any idea how to fix it? I tried changing parameters in generate_homologs, like setting the max_homologs to 1, adding a symbols_dict.... but always got the same error.

Otherwise, how can I run liana_wrap with a mouse dataset?

Many thanks in advance!

op_resource <- select_resource("Consensus")[[1]]
ortholog_resource <- generate_homologs(op_resource = op_resource,
                                       target_organism = 10090, 
                                       .missing_fun = "str_to_title")
[2024-08-15 23:15:34] [SUCCESS] [OmnipathR] NCBI HomoloGene (rescued.omnipathdb.org): loaded 275237 records from cache
One-to-many homolog matches: 
Error in `mutate()`:
ℹ In argument: `across(all_of(columns), ~recode.character2(.x, .missing_fun = .missing_fun))`.
Caused by error in `across()`:
! Can't compute column `source_genesymbol`.
Caused by error in `recode.character2()`:
! No replacements provided.
Run `rlang::last_trace()` to see where the error occurred.

> rlang::last_trace()

<error/dplyr:::mutate_error>
Error in `mutate()`:
ℹ In argument: `across(all_of(columns), ~recode.character2(.x, .missing_fun = .missing_fun))`.
Caused by error in `across()`:
! Can't compute column `source_genesymbol`.
---
Backtrace:
     ▆
  1. ├─liana::generate_homologs(...)
  2. │ └─op_notmany %>% left_join(op_resource, by = columns) %>% ...
  3. ├─liana:::.handle_complexes(...)
  4. │ └─op_resource_decomplex %>% ...
  5. ├─dplyr::mutate(...)
  6. ├─dplyr:::mutate.data.frame(...)
  7. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
  8. │   ├─base::withCallingHandlers(...)
  9. │   └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
 10. │     ├─base::withCallingHandlers(...)
 11. │     └─mask$eval_all_mutate(quo)
 12. │       └─dplyr (local) eval()
 13. ├─liana:::recode.character2(source_genesymbol, .missing_fun = .missing_fun)
 14. │ └─dplyr:::find_template(values, .default, .missing)
 15. │   └─rlang::abort("No replacements provided.", call = error_call)
 16. │     └─rlang:::signal_abort(cnd, .file)
 17. │       └─base::signalCondition(cnd)
 18. └─dplyr (local) `<fn>`(`<rlng_rrr>`)
Caused by error in `recode.character2()`:
! No replacements provided.
---
Backtrace:
     ▆
  1. ├─liana::generate_homologs(...)
  2. │ └─op_notmany %>% left_join(op_resource, by = columns) %>% ...
  3. ├─liana:::.handle_complexes(...)
  4. │ └─op_resource_decomplex %>% ...
  5. ├─dplyr::mutate(...)
  6. ├─dplyr:::mutate.data.frame(...)
  7. │ └─dplyr:::mutate_cols(.data, dplyr_quosures(...), by)
  8. │   ├─base::withCallingHandlers(...)
  9. │   └─dplyr:::mutate_col(dots[[i]], data, mask, new_columns)
 10. │     ├─base::withCallingHandlers(...)
 11. │     └─mask$eval_all_mutate(quo)
 12. │       └─dplyr (local) eval()
 13. └─liana:::recode.character2(source_genesymbol, .missing_fun = .missing_fun)
Run rlang::last_trace(drop = FALSE) to see 5 hidden frames.
wgao688 commented 2 months ago

I am also running into the same issue, running the code from this tutorial: https://saezlab.github.io/liana/articles/liana_ortho.html

deeenes commented 2 months ago

Try install from this PR #174

remotes::install_github('saezlab/liana#174')
wgao688 commented 2 months ago

Thanks, this works