snystrom / memes

An R interface to the MEME Suite
https://snystrom.github.io/memes/
Other
44 stars 5 forks source link

runStreme() error #90

Closed ivangalvan closed 2 years ago

ivangalvan commented 2 years ago

Hi,

I found an error when using the runStreme() function in the following code:

data("example_peaks", package = "memes") dm.genome <- BSgenome.Dmelanogaster.UCSC.dm6::BSgenome.Dmelanogaster.UCSC.dm6 sequences <- example_peaks %>% resize(100, "center") %>% get_sequence(dm.genome) streme_results <- runStreme(sequences, control = "shuffle")

Error: Can't subset columns that don't exist. Column from doesn't exist.

Backtrace:

  1. memes::runStreme(sequences, control = "shuffle")
    1. dplyr:::select.data.frame(., -"from")
    2. tidyselect::eval_select(expr(c(...)), .data)
    3. tidyselect:::eval_select_impl(...)
    4. tidyselect:::vars_select_eval(...)
    5. tidyselect:::walk_data_tree(expr, data_mask, context_mask)
    6. tidyselect:::eval_c(expr, data_mask, context_mask)
    7. tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
    8. tidyselect:::walk_data_tree(new, data_mask, context_mask)
    9. tidyselect:::as_indices_sel_impl(...)
    10. tidyselect:::as_indices_impl(x, vars, strict = strict)
    11. tidyselect:::chr_as_locations(x, vars)
    12. vctrs::vec_as_location(x, n = length(vars), names = vars)
    13. vctrs:::stop_subscript_oob(...)
    14. vctrs:::stop_subscript(...)

Would you know what could be the bug? I tried to figure out without success where is the dplyr:::select.data.frame(., -"from") command in your code.

Could you provide an example code to run the runStreme() function properly?

Thank you

snystrom commented 2 years ago

Hey, thanks for reporting the issue & providing a reproducible example, I'll take a look this evening. runStreme has a few odd bugs in that recently cropped up that I need to chase down.

Can you try running it again with:

streme_results <- runStreme(sequences, control = sequences)

Just as a quick check to see if the issue is with the "shuffle" call?

ivangalvan commented 2 years ago

Thank you for your quick reply,

Unfortunately, the same error appears with your command and then the issue seems not to be related with the control argument.

snystrom commented 2 years ago

Great, thanks for trying that out! Swamped w/ work at the moment, but should have some time this evening. Hopefully can patch it quick for you.

snystrom commented 2 years ago

In the mean time, runDreme is probably the best substitute.

snystrom commented 2 years ago

Alternately, you can run the Streme webtool and import the XML results with importStremeXML()

snystrom commented 2 years ago

Hey Iván,

I'm having trouble reproducing this error. Can you post the output of sessionInfo() and the output of check_meme_install()?

Finally, can you try running:

streme_results <- runStreme(sequences, control = "shuffle", outdir = "debug")

Then upload the streme.xml file output from the debug/ directory (created in your R project working directory where you run the command).

Thanks for helping me get to the bottom of this!

snystrom commented 2 years ago

Oh and does:

x <- universalmotif::create_sequences()
runStreme(x)

Also cause the same error?

ivangalvan commented 2 years ago

Hi Spencer,

The runDremeworks well for me, however, I found the same error with your suggestions using the runStreme.

The check_meme_install seems good:

checking main install ✓ /home/igalvan/meme/bin checking util installs ✓ /home/igalvan/meme/bin/dreme ✓ /home/igalvan/meme/bin/ame ✓ /home/igalvan/meme/bin/fimo ✓ /home/igalvan/meme/bin/tomtom ✓ /home/igalvan/meme/bin/meme ✓ /home/igalvan/meme/bin/streme

My session ifno is:

sessionInfo() R version 4.1.2 (2021-11-01) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 20.04.3 LTS

Matrix products: default BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0 LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0

locale: [1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8 LC_MONETARY=es_ES.UTF-8 LC_MESSAGES=es_ES.UTF-8
[7] LC_PAPER=es_ES.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C

attached base packages: [1] stats4 stats graphics grDevices utils datasets methods base

other attached packages: [1] dplyr_1.0.7 GenomicRanges_1.46.1 GenomeInfoDb_1.30.0 IRanges_2.28.0 S4Vectors_0.32.3 BiocGenerics_0.40.0 magrittr_2.0.1 memes_1.2.0

loaded via a namespace (and not attached): [1] Rcpp_1.0.7 lattice_0.20-45 tidyr_1.1.4 ps_1.6.0
[5] Rsamtools_2.10.0 Biostrings_2.62.0 ggseqlogo_0.1 rprojroot_2.0.2
[9] utf8_1.2.2 R6_2.5.1 universalmotif_1.12.1 ggplot2_3.3.5
[13] pillar_1.6.4 zlibbioc_1.40.0 rlang_0.4.12 rstudioapi_0.13
[17] R.utils_2.11.0 R.oo_1.24.0 Matrix_1.3-4 BSgenome.Dmelanogaster.UCSC.dm6_1.4.1 [21] desc_1.4.0 BiocParallel_1.28.2 readr_2.1.1 cmdfun_1.0.2
[25] RCurl_1.98-1.5 munsell_0.5.0 DelayedArray_0.20.0 compiler_4.1.2
[29] rtracklayer_1.54.0 pkgconfig_2.0.3 tidyselect_1.1.1 SummarizedExperiment_1.24.0
[33] tibble_3.1.6 GenomeInfoDbData_1.2.7 matrixStats_0.61.0 XML_3.99-0.8
[37] fansi_0.5.0 crayon_1.4.2 tzdb_0.2.0 withr_2.4.3
[41] GenomicAlignments_1.30.0 MASS_7.3-54 bitops_1.0-7 R.methodsS3_1.8.1
[45] grid_4.1.2 gtable_0.3.0 lifecycle_1.0.1 scales_1.1.1
[49] cli_3.1.0 XVector_0.34.0 fs_1.5.1 testthat_3.1.0
[53] xml2_1.3.3 ellipsis_0.3.2 generics_0.1.1 vctrs_0.3.8
[57] rjson_0.2.20 restfulr_0.0.13 tools_4.1.2 BSgenome_1.62.0
[61] Biobase_2.54.0 glue_1.5.1 purrr_0.3.4 hms_1.1.1
[65] MatrixGenerics_1.6.0 processx_3.5.2 pkgload_1.2.4 parallel_4.1.2
[69] yaml_2.2.1 colorspace_2.0-2 BiocManager_1.30.16 BiocIO_1.4.0
[73] usethis_2.1.3

It seems there is in some place of the code the "from" column but data do not have this column. What do you think?

Thank you

ivangalvan commented 2 years ago

Hi again,

I realized that streme generated successfully the outputs in the debug folder and now, I found that the error comes by using the importStremeXML() function.

streme_results = importStremeXML("debug/streme.xml") Error: Can't subset columns that don't exist. x Column from doesn't exist.

rlang::last_error() <error/vctrs_error_subscript_oob> Can't subset columns that don't exist. x Column from doesn't exist. Backtrace:

  1. memes::importStremeXML("debug/streme.xml")
    1. dplyr:::select.data.frame(., -"from")
    2. tidyselect::eval_select(expr(c(...)), .data)
    3. tidyselect:::eval_select_impl(...)
    4. tidyselect:::vars_select_eval(...)
    5. tidyselect:::walk_data_tree(expr, data_mask, context_mask)
    6. tidyselect:::eval_c(expr, data_mask, context_mask)
    7. tidyselect:::reduce_sels(node, data_mask, context_mask, init = init)
    8. tidyselect:::walk_data_tree(new, data_mask, context_mask)
    9. tidyselect:::as_indices_sel_impl(...)
    10. tidyselect:::as_indices_impl(x, vars, strict = strict)
    11. tidyselect:::chr_as_locations(x, vars)
    12. vctrs::vec_as_location(x, n = length(vars), names = vars)
    13. vctrs:::stop_subscript_oob(...)
    14. vctrs:::stop_subscript(...)

However the importDremeXML() is working fine.

What do you think?

Thank you

snystrom commented 2 years ago

Yeah something is happening at the XML generation step I think where it's leaving out a metadata field called "from" that it usually has. Can you upload the streme.xml file to this issue and I'll take a look at it.

snystrom commented 2 years ago

This could be a bug in STREME or they may have changed the behavior of STREME. Can you also post the version of the meme suite you are using? On the bash terminal streme --version or in R: runStreme(sequences, "shuffle", version = TRUE, silent = FALSE).

ivangalvan commented 2 years ago

Sure, version is 5.4.1.

I can't upload the .xml file or copy here, github does not allow me, sorry.

snystrom commented 2 years ago

Thanks for checking!

Sometimes dragging + dropping the file into the text box works. I'll try something else on my end also.

snystrom commented 2 years ago

Ah, got it! I was a MEME version behind. They've changed STREME behavior. I'll try to add a way to catch this that works for old & current versions. Thanks for reporting, I'll ping when I get the issue resolved.

ivangalvan commented 2 years ago

It sounds good! Thanks!

snystrom commented 2 years ago

This should be fixed now. The changes will propagate to bioc release & devel in a few days. For now, you can install the development version from github with:

remotes::install_github("snystrom/memes")

Thanks so much for reporting the issue, I hope your analysis goes well! And feel free to reopen this issue if the bug persists.

ivangalvan commented 2 years ago

Thank you very much! I confirm that now importStremeXML() is working properly!