Skip to contents


semla is an R package that collects useful tools for Spatially Resolved Transcriptomics data analysis and visualization.

If you are visiting our Github page, please find more information at our package website. Here, you can find documentation of functions together with examples on how to use them, as well as tutorials showing how to use semla for analysis and visualization of 10x Visium data.


Installation

The dev version of the package can be installed through GitHub using;

install.packages("remotes")
remotes::install_github("ludvigla/semla")


Setting up a conda environment

If you are using a conda, you can follow the steps below:

conda create -n r-semla r-essentials r-base

Activate the environment:

conda activate r-semla

Then you can open RStudio from the environment. This should make sure that RStudio uses the R version and packages that are located in the conda environment. On Mac OS, you can open RStudio by typing the path to the RStudio application in the terminal:

/Applications/RStudio.app/Contents/MacOS/RStudio

Note that semla requires R v4.1 or higher, so you should double check that you have the correct version installed.

Now you should be able to install semla in your conda environment:

install.packages("remotes")
remotes::install_github("ludvigla/semla")

The magick R package might fail to install in your conda environment and in that case you can install it with conda instead:

conda install -c conda-forge r-magick


Renv

If you are familiar with renv, you can install all necessary R packages (with exact versions) using renv::restore() with the renv.lock file provided in our GitHub repo.


Docker

As an additional option, we provide a docker image on Docker Hub that you can download to run a container from. The image is based on the rocker RStudio Server image and comes with RStudio Server pre-installed.

To access the server we need to publish a port for our container, we’ll use the –publish flag (-p for short) on the docker run command. The format of the –publish command is [host port]:[container port]. So, if we wanted to expose port 8000 inside the container to port 8080 outside the container, we would pass 8080:8000 to the –publish flag. We can also expose multiple ports which will be useful to use some of the interactive features in semla (see our Interactive Viewer section here).

<YOURPASSWORD> can be any password you want to use for RStudio Server and the default username is rstudio. <SOURCEPATH> should be a path on your local machine which will be accessible from the docker container at /home/rstudio. Use source="$(pwd)" for current working directory.

sudo docker run -d -p 1337:8787 -p 3030:3030 --name semla -e PASSWORD=<YOURPASSWORD> --memory=16g --mount type=bind,source="<SOURCEPATH>",target=/home/rstudio -e ROOT=TRUE ludlar/semla:latest

Visit the docker docs for more information on how to run containers.


What is semla?

A semla is a delicious pastry, traditionally consumed around a specific day, “Semmeldagen” or “Fettisdagen” (“Fat Tuesday”), in Sweden. It is made up of a light cardamom flavored wheat bun, fluffy whipped cream, sweet crunchy almond paste, and topped with dusted icing sugar. If that’s not reason enough for us to name this package after this fantastic creation, let’s also say semla is an abbreviation for “Spatially rEsolved transcriptoMics tooLs for Analysis”.