matdoering / openPrimeR

An R Package for Multiplex PCR Primer Design and Analysis
http://openprimer.mpi-inf.mpg.de
23 stars 6 forks source link

Error: Failed to open file for writing while calling compute.structure.vienna on Windows #4

Closed juferban closed 3 years ago

juferban commented 4 years ago

Hi,

I had an issue while trying to run the design_primers function using openPrimeR. Here is my description of the problem and my findings: My system is Windows 10. Have all the tool dependencies installed and properly configure. Running the latest version of R (see sessionInfo at the end of the message).

While trying to run the metnioned function I get an error that says that "ERROR: Failed to open file for reading" when trying to run ViennaRNA RNAfold.exe. After some debugging I found that the error is generated in the compute.structure.vienna function part of the con_primer_secondary_structures.R

Basically the issue is with the out.file. When generating the input.file and out.file, in the windows system the string contains the drive info (e.g. "C:"). While this doesn't seem to cause any problem when specifying the input file it seems to break the RNAfold.exe for the out.file parameter. One quick solution I found was to substitute out.file <- paste0(input.file, "_out") with out.file <- paste0(gsub("^C:","",input.file), "_out")

This fix works on my case though I think a more generalized solution would be better.

Not sure if this is a bug or something specific to my system but I thought on reporting in case anybody else runs into the same issue.

Thanks

` R version 4.0.2 (2020-06-22) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.1252

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

other attached packages: [1] Biostrings_2.56.0 XVector_0.28.0 IRanges_2.22.2 S4Vectors_0.26.1 BiocGenerics_0.34.0 seqinr_3.6-1 openPrimeR_1.10.0

loaded via a namespace (and not attached): [1] Rcpp_1.0.5 pillar_1.4.4 compiler_4.0.2 RColorBrewer_1.1-2 GenomeInfoDb_1.24.2 plyr_1.8.6
[7] bitops_1.0-6 iterators_1.0.12 tools_4.0.2 zlibbioc_1.34.0 digest_0.6.25 bit_1.1-15.2
[13] memoise_1.1.0 RSQLite_2.2.0 lifecycle_0.2.0 tibble_3.0.1 gtable_0.3.0 pkgconfig_2.0.3
[19] rlang_0.4.6 foreach_1.5.0 DBI_1.1.0 rstudioapi_0.11 GenomeInfoDbData_1.2.3 stringr_1.4.0
[25] dplyr_1.0.0 generics_0.0.2 vctrs_0.3.1 bit64_0.9-7 ade4_1.7-15 grid_4.0.2
[31] tidyselect_1.1.0 glue_1.4.1 R6_2.4.1 XML_3.99-0.4 blob_1.2.1 DECIPHER_2.16.1
[37] reshape2_1.4.4 ggplot2_3.3.2 purrr_0.3.4 magrittr_1.5 MASS_7.3-51.6 scales_1.1.1
[43] codetools_0.2-16 ellipsis_0.3.1 GenomicRanges_1.40.0 colorspace_1.4-1 uniqtag_1.0 stringi_1.4.6
[49] lpSolveAPI_5.5.2.0-17.7 RCurl_1.98-1.2 munsell_0.5.0 crayon_1.3.4 `

matdoering commented 3 years ago

Thanks for the great bug description. ViennaRNA does not really support output paths for the outfile argument, so I fixed the problem by writing to the local path instead of using the full path identifier.

The fix should be propagated to BioC soon.