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.
For a more scientific description of the package, check out our associated publication "Semla: a versatile toolkit for spatially resolved transcriptomics analysis and visualization" in Bioinformatics (DOI:10.1093/bioinformatics/btad626). Please cite this article if you use semla
in your studies, and we'd be very grateful!
[!NOTE]\ Regarding Seurat v5, most
semla
functionalities should work as expected, however, we have not tested compatibility with new Seurat v5 functions and many other packages built upon Seurat have not yet been made compatible with v5. You may therefore experience unexpected issues when using Seurat v5.
The dev version of the package can be installed through GitHub using;
install.packages("remotes")
remotes::install_github("ludvigla/semla")
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
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.
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.
Larsson L, Franzén L, Ståhl PL, Lundeberg J. Semla: a versatile toolkit for spatially resolved transcriptomics analysis and visualization. Bioinformatics. 2023 Oct 3;39(10):btad626. doi: 10.1093/bioinformatics/btad626. PMID: 37846051; PMCID: PMC10597621. https://academic.oup.com/bioinformatics/article/39/10/btad626/7319366
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".