Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

main -> dev #102

Merged
merged 11 commits into from
May 22, 2024
2 changes: 1 addition & 1 deletion R/annotation.R
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ annotateSpatialData <- function(object, label = "annotation", assay = NULL, use.
} else {
spatialpoints <- rownames(metadata)
}

new_label <- rep("undefined", length(spatialpoints))
names(new_label) <- spatialpoints
result_list <- list()
Expand Down Expand Up @@ -339,4 +340,3 @@ annotateSpatialData <- function(object, label = "annotation", assay = NULL, use.
shiny::runApp(shiny::shinyApp(ui, server))
}
}

12 changes: 10 additions & 2 deletions R/visualization.R
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,10 @@ vrSpatialPlot <- function(object, group.by = "Sample", plot.segments = FALSE, gr
return(gg[[1]] + theme(legend.position=legend.loc))
}
} else {
gg + theme(legend.position=legend.loc)
for(i in 1:length(assay_names)){
gg[[i]] <- gg[[i]] + theme(legend.position=legend.loc)
}
return(gg)
}
}

Expand Down Expand Up @@ -259,6 +262,7 @@ vrSpatialPlotSingle <- function(assay, metadata, group.by = "Sample", plot.segme
} else {
coords[[group.by]] <- metadata[,group.by]
}

if(!is.null(group.ids)){
if(length(setdiff(group.ids, coords[[group.by]])) > 0){
# warning("Some groups defined in group.ids does not exist in group.by!")
Expand Down Expand Up @@ -358,6 +362,7 @@ vrSpatialPlotSingle <- function(assay, metadata, group.by = "Sample", plot.segme

# add points
if(n.tile == 0){

g <- g +
geom_point(mapping = aes_string(x = "x", y = "y", fill = group.by, color = group.by), coords, shape = cell.shape, size = rel(pt.size), alpha = alpha) +
scale_fill_manual(values = colors, labels = names(colors), drop = FALSE, limits = names(colors)) +
Expand Down Expand Up @@ -591,7 +596,10 @@ vrSpatialFeaturePlot <- function(object, features, group.by = "label", plot.segm
return(gg[[1]] + theme(legend.position=legend.loc))
}
} else {
return(gg + theme(legend.position=legend.loc))
for(i in 1:(length(features)*length(assay_names))){
gg[[i]] <- gg[[i]] + theme(legend.position=legend.loc)
}
return(gg)
}
}

Expand Down
11 changes: 0 additions & 11 deletions cleanup
Original file line number Diff line number Diff line change
@@ -1,17 +1,6 @@
#!/bin/sh
rm -f src/Makevars configure.log autobrew
rm -Rf .deps

rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
rm -Rf .deps
Expand Down
2 changes: 1 addition & 1 deletion docs/conversion.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Conversion</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
2 changes: 1 addition & 1 deletion docs/deconvolution.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Niche Clustering</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
2 changes: 1 addition & 1 deletion docs/importingdata.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Importing Spatial Data</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>VoltRon</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
2 changes: 1 addition & 1 deletion docs/interactive.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Interactive</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
2 changes: 1 addition & 1 deletion docs/moleculeanalysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Molecule Analysis</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
2 changes: 1 addition & 1 deletion docs/multiomic.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ VoltRon can analyze and also integrate information from distinct spatial data ty

We will first import both histological images and manual annotations using the **importImageData** function which accepts both images to generate tile/pixel level datasets but also allows one to import either a list of segments or [GeoJSON](https://geojson.org/) objects for create ROI-level datasets as separate assays in a single VoltRon layer. The .geojson file was generated using [QuPath](https://qupath.github.io/) on the same section H&E image of one Xenium section with the acute COVID-19 case. We also have to flip the coordinates of ROI annotations also for they were directly imported from QuPath which incorporates a reverse coordinate system on the y-axis.

Once imported, the resulting VoltRon object will have two assays in a single layer, one for tile dataset of the H&E image and the other for ROI based annotations of again the same image.
Once imported, the resulting VoltRon object will have two assays in a single layer, one for tile dataset of the H&E image and the other for ROI based annotations of again the same image. You can download the H&E image from [here](https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Multiomics/acutecase1_HE.jpg).

```{r eval = FALSE, class.source="watch-out"}
# get image
Expand Down
6 changes: 4 additions & 2 deletions docs/multiomic.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Multi-omics</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down Expand Up @@ -553,7 +553,9 @@ <h2>Automated H&amp;E Registration</h2>
reverse coordinate system on the y-axis.</p>
<p>Once imported, the resulting VoltRon object will have two assays in a
single layer, one for tile dataset of the H&amp;E image and the other
for ROI based annotations of again the same image.</p>
for ROI based annotations of again the same image. You can download the
H&amp;E image from <a
href="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Multiomics/acutecase1_HE.jpg">here</a>.</p>
<pre class="r watch-out"><code># get image
imgdata &lt;- importImageData(&quot;acutecase1_HE.jpg&quot;,
segments = &quot;acutecase1_membrane.geojson&quot;,
Expand Down
2 changes: 1 addition & 1 deletion docs/pixelanalysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Importing Spatial Data</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
2 changes: 1 addition & 1 deletion docs/registration.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Image Registration</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
2 changes: 1 addition & 1 deletion docs/roianalysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>ROI Analysis</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
12 changes: 12 additions & 0 deletions docs/site_libs/header-attrs-2.27/header-attrs.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
// be compatible with the behavior of Pandoc < 2.8).
document.addEventListener('DOMContentLoaded', function(e) {
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
var i, h, a;
for (i = 0; i < hs.length; i++) {
h = hs[i];
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
a = h.attributes;
while (a.length > 0) h.removeAttribute(a[0].name);
}
});
2 changes: 1 addition & 1 deletion docs/spotanalysis.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Cell/Spot Analysis</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
5 changes: 3 additions & 2 deletions docs/tutorials.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Tutorials</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down Expand Up @@ -562,7 +562,8 @@ <h2>Other Utilities</h2>
<img width="80%" height="80%" src="https://bimsbstatic.mdc-berlin.de/landthaler/VoltRon/Package/images/conversion.png" class="center">
<br> <br>
<p style="margin: 3%">
Converting VoltRon objects into Seurat, Squidpy (anndata) etc. </strong>
Converting VoltRon objects into Seurat,de Squidpy (anndata) etc.
</strong>
</p>
</td>
</tr>
Expand Down
2 changes: 1 addition & 1 deletion docs/voltronobjects.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<title>Importing Spatial Data</title>

<script src="site_libs/header-attrs-2.26/header-attrs.js"></script>
<script src="site_libs/header-attrs-2.27/header-attrs.js"></script>
<script src="site_libs/jquery-3.6.0/jquery-3.6.0.min.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link href="site_libs/bootstrap-3.3.5/css/flatly.min.css" rel="stylesheet" />
Expand Down
24 changes: 9 additions & 15 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,20 +1,14 @@
VERSION = 4.7.0
RWINLIB = ../windows/opencv-$(VERSION)
RWINLIB = ../windows/opencv
PKG_CPPFLAGS = -I$(RWINLIB)/include/opencv4 -DHAVE_XFEATURES2D
TARGET = lib$(subst gcc,,$(COMPILED_BY))$(R_ARCH)
OLDLIBDIR = lib${subst gcc,,${COMPILED_BY}}${R_ARCH}

PKG_LIBS = \
$(LAPACK_LIBS) $(BLAS_LIBS) $(FLIBS) \
-L$(RWINLIB)/$(TARGET) \
-L$(RWINLIB)/lib$(R_ARCH) \
-lopencv_ml470 -lopencv_objdetect470 -lopencv_photo470 -lopencv_stitching470 \
-lopencv_video470 -lopencv_calib3d470 -lopencv_xfeatures2d470 -lopencv_features2d470 -lopencv_highgui470 -lopencv_flann470 \
-lopencv_videoio470 -lopencv_imgcodecs470 -lopencv_imgproc470 -lopencv_core470 -llibopenjp2 -lquirc -ltbb \
-ljpeg -lwebp -lpng -lz -ltiff \
-lcomctl32 -lgdi32 -lole32 -lsetupapi -lws2_32 -lavifil32 -lavicap32 -lwinmm -lmsvfw32 \
-lopengl32 -lglu32 -lcomdlg32 -lOleAut32 -luuid

CXX_STD=CXX11
-L$(RWINLIB)/$(OLDLIBDIR) \
-L$(RWINLIB)/lib \
-lopencv_ml481 -lopencv_objdetect481 -lopencv_photo481 -lopencv_stitching481 -lopencv_shape481 -lopencv_wechat_qrcode481 -lopencv_dnn481 \
-lopencv_video481 -lopencv_calib3d481 -lopencv_xfeatures2d481 -lopencv_features2d481 -lopencv_highgui481 -lopencv_flann481 \
-lopencv_videoio481 -lopencv_imgcodecs481 -lopencv_imgproc481 -lopencv_core481 -llibopenjp2 -lquirc \
-ljpeg -lwebp -lsharpyuv -lpng -lz -ltiff -lpthread -lgdi32 -lole32 -lopengl32 -lcomdlg32 -lOleAut32 -luuid

all: clean winlibs

Expand All @@ -24,4 +18,4 @@ clean:
winlibs:
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" ${VERSION}
mkdir -p ../inst
cp -r $(RWINLIB)/share ../inst/
cp -r $(RWINLIB)/share ../inst/
75 changes: 0 additions & 75 deletions src/manual_registration.cpp

This file was deleted.

28 changes: 17 additions & 11 deletions tools/winlibs.R
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
# We need https
if(getRversion() < "3.3.0") setInternet2()
VERSION <- commandArgs(TRUE)

# Downloads libssh2 + dependencies
options(timeout = 400)
if(!file.exists(sprintf("../windows/opencv-%s/include/opencv4/opencv2/opencv.hpp", VERSION))){
download.file(sprintf("https://github.com/rwinlib/opencv/archive/v%s.zip", VERSION), "lib.zip", quiet = TRUE)
if(!file.exists("../windows/opencv/include/opencv4/opencv2/opencv.hpp")){
unlink("../windows", recursive = TRUE)
url <- if(grepl("aarch", R.version$platform)){
"https://github.com/r-windows/bundles/releases/download/opencv-4.8.1/opencv-4.8.1-clang-aarch64.tar.xz"
} else if(grepl("clang", Sys.getenv('R_COMPILED_BY'))){
"https://github.com/r-windows/bundles/releases/download/opencv-4.8.1/opencv-4.8.1-clang-x86_64.tar.xz"
} else if(getRversion() >= "4.3") {
"https://github.com/r-windows/bundles/releases/download/opencv-4.8.1/opencv-4.8.1-ucrt-x86_64.tar.xz"
} else {
"https://github.com/rwinlib/opencv/archive/refs/tags/v4.8.1.tar.gz"
}
download.file(url, basename(url), quiet = TRUE)
dir.create("../windows", showWarnings = FALSE)
unzip("lib.zip", exdir = "../windows")
unlink("lib.zip")
}
untar(basename(url), exdir = "../windows", tar = 'internal')
unlink(basename(url))
setwd("../windows")
file.rename(list.files(), 'opencv')
}