Is it possible to run WSL Ubuntu in RStudio?

Hi,

I am analysing genomic sequencing data, currently. For the analyis I am using R studio for data visualisation and tools that run via the Windows Linux subsystem (WSL) for data pre-processing. Now, I want to embed all analysis steps into a R shiny app. An app for the data visualisation is easy to implement. An app for the pre-processing is less trivial for me.

One example tool I am using for the pre-processing is Overview – Salmon: Fast, accurate and bias-aware transcript quantification from RNA-seq data. Unfortunately, there is no salmon implementation as a R package. There are comparable packages, but for my downstream anlyses, I specifically need this tool.

In WSL, I installed this tool with conda. How can I pass commands from R Studio to WSL?

I already read into shell(), system() and system2(), but none of this seems to do the trick.

With shell.exec(file = "C:/Windows/System32/wsl.exe") I get a WSL shell and can manually type in my commands. But I would prefer a solution where WSL runs in the background and stdout is printed in the R console.

system("wsl /home/kevin/miniconda3/condabin/conda --help") also works. However when it comes to calling conda installed programs or activate environments, I either get no output or an error that conda has not initialised a shell.

Do you have an idea what I could try?

What are your ultimate plans for deploying this app? Do you actually plan to deploy it on a Windoze server?

It seems like a cleaner architectural solution would be to bypass Windoze entirely and go 100% Linux. Either dual-boot your development machine or just switch to Linux permanently.

Thanks for your reply! For now, it would just suffice to have an app that runs locally and covers all analysis steps. Do you think the installation of a RStudio server on WSL could be a solution? Could this allow me to call the shiny app from there and have access to all programs installed via conda on WSL?

I've had good experiences running RStudio Server on WSL and accessing it using Chrome, and it sounds to me like it's well worth a try for your case.

Do you mean that this is a python library? if so, You can install python packages natively on Windows and use them from R using the reticulate package.

WSL is almost like a virtual machine so I think there is no practical way of getting output from it into a shiny app running on Windows or at least is not the simplest approach.