msaprettyprint error in R
2
0
Entering edit mode
liripo • 0
@liripo-24038
Last seen 4.3 years ago

msaPrettyPrint

I use msa package by Rstudio in widowns,but the msaPrettyPrint keep reporting errors. This is my code.

mySequenceFile <- system.file("examples", "exampleAA.fasta", package="msa")
mySequences <- readAAStringSet(mySequenceFile)
mySequences
myFirstAlignment <- msa(mySequences)
msaPrettyPrint(myFirstAlignment, output="pdf", showNames="none",
showLogo="none", askForOverwrite=FALSE, verbose=FALSE)

And it Error in file(con, "r") : Unable to open link so I use output = "tex",It can work well.but when I open the tex ,found the

\begin{texshade}{C:/Users/ADMINI~1/AppData/Local/Temp/Rtmpo7310M/seq114c7f3453.fasta}

I can't open this fasta file.so I have to change it look this

\begin{texshade}{C:/Users/Administrator/AppData/Local/Temp/Rtmpo7310M/seq114c7f3453.fasta}

I guess it maybe by chinese. But when I change it,I use Rstduio compile pdf.It have an error. enter image description here Is there any good solution? This is my sessionInfo

> sessionInfo()
R version 4.0.0 (2020-04-24)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 18363)

Matrix products: default

locale:
[1] LC_COLLATE=Chinese (Simplified)_China.936 
[2] LC_CTYPE=Chinese (Simplified)_China.936   
[3] LC_MONETARY=Chinese (Simplified)_China.936
[4] LC_NUMERIC=C                              
[5] LC_TIME=Chinese (Simplified)_China.936    

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

other attached packages:
[1] dplyr_1.0.1         msa_1.20.0          Biostrings_2.56.0  
[4] XVector_0.28.0      IRanges_2.22.2      S4Vectors_0.26.1   
[7] BiocGenerics_0.34.0

loaded via a namespace (and not attached):
 [1] Rcpp_1.0.4.6          rstudioapi_0.11       magrittr_1.5         
 [4] knitr_1.29            zlibbioc_1.34.0       tidyselect_1.1.0     
 [7] RcppTOML_0.1.6        R6_2.4.1              rlang_0.4.7          
[10] tools_4.0.0           xfun_0.16             ellipsis_0.3.1       
[13] htmltools_0.5.0       yaml_2.2.1            digest_0.6.25        
[16] tibble_3.0.3          lifecycle_0.2.0       crayon_1.3.4         
[19] bookdown_0.20         purrr_0.3.4           BiocManager_1.30.10.5
[22] vctrs_0.3.2           rsconnect_0.8.16      glue_1.4.1           
[25] evaluate_0.14         rmarkdown_2.3         blogdown_0.20        
[28] pillar_1.4.6          compiler_4.0.0        generics_0.0.2       
[31] pkgconfig_2.0.3      
msa • 3.2k views
ADD COMMENT
2
Entering edit mode
UBod ▴ 300
@ubodenhofer-5425
Last seen 7 months ago
University of Applied Sciences Upper Au…

If I run your code in plain R on Windows without RStudio, everything works fine. Running the same on RStudio on Windows, I can reproduce the error. If I add verbose=TRUE to the msaPrettyPrint() command, then texi2dvi() shows the entire LaTeX output and everything works fine. I have no idea what the source of the error is. It seems that texi2dvi() does not work properly on RStudio with the setting index=FALSE and quiet=TRUE. The simplest workaround is to include the option verbose=TRUE.

ADD COMMENT
0
Entering edit mode

I have the same problem, that is not suppresed with verbose=TRUE
It seems to be when you have a long username in Windows then tempfile() makes a short version containing ~
TeXShade then has a issue that it converts the ~ to \nobreakspace {} before trying to load the FASTA file which fails.

I worked around this by getting msaPrettyPrint() to output a tex file, then substituting ~ in that file with \string~ which stops TeXShade converting ~ in the path e.g. with

x <- readLines(fileName)
y <- gsub( "~", "\\\\string~", x )
cat(y, file=fileName, sep="\n")

then converting the corrected tex file to pdf

ADD REPLY
0
Entering edit mode
UBod ▴ 300
@ubodenhofer-5425
Last seen 7 months ago
University of Applied Sciences Upper Au…

Unfortunately, LaTeX is a bit picky about file names and paths. It often has problems to accept file names and paths with spaces and also with some special characters or, as in your case, abbreviated Windows file names. As a quick workaround, I suggest you use the file and/or alFile arguments of msaPrettyPrint() to direct the output to directories with paths that LaTeX can handle.

ADD COMMENT

Login before adding your answer.

Traffic: 517 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6