') + ')', 'gi'); if (regex.test(text)) { found = true; var frag = document.createDocumentFragment(); var parts = text.split(regex); parts.forEach(function(part, i) { if (i % 2 === 0) { frag.appendChild(document.createTextNode(part)); } else { var span = document.createElement('span'); span.className = 'userscript-highlight'; span.textContent = part; frag.appendChild(span); } }); node.parentNode.replaceChild(frag, node); } }); } else if (node.nodeType === 1 && node.childNodes) { // element var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT']; if (!skipTags.includes(node.tagName)) { Array.from(node.childNodes).forEach(highlight); } } } highlight(document.body); // Re-highlight on dynamic content var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1 || node.nodeType === 3) highlight(node); }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Strip utm_, fbclid, gclid, etc. from all links on page (function() { var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid', 'ref', 'ref_src', 'source', 'medium', 'campaign']; function cleanUrl(url) { try { var u = new URL(url, window.location.origin); var changed = false; trackingParams.forEach(function(p) { if (u.searchParams.has(p)) { u.searchParams.delete(p); changed = true; } }); return changed ? u.toString() : url; } catch (e) { return url; } } function cleanLinks() { document.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } cleanLinks(); var observer = new MutationObserver(function(mutations) { mutations.forEach(function(m) { m.addedNodes.forEach(function(node) { if (node.nodeType === 1) { if (node.tagName === 'A') cleanLinks(); node.querySelectorAll('a[href]').forEach(function(a) { var clean = cleanUrl(a.href); if (clean !== a.href) a.href = clean; }); } }); }); }); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Auto-enable theater mode on YouTube (function() { function tryTheater() { var btn = document.querySelector('button[aria-label="Theater mode"], ytd-player #player button[title="Theater mode"]'); if (btn && !btn.classList.contains('activated')) { btn.click(); } } // Try immediately tryTheater(); // Try after navigation (SPA) var lastUrl = location.href; setInterval(function() { if (location.href !== lastUrl) { lastUrl = location.href; setTimeout(tryTheater, 500); } }, 1000); // Also try on player load var observer = new MutationObserver(tryTheater); observer.observe(document.body, { childList: true, subtree: true }); })(); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + ', 'i'); if (__m === '*' || __re.test(location.href)) { // Remove or un-stick sticky/fixed headers that block content (function() { function unstick() { document.querySelectorAll('header, nav, [role="banner"], .header, .navbar, .sticky, .fixed-top, [style*="position: fixed"], [style*="position:sticky"]').forEach(function(el) { if (el.style.position === 'fixed' || el.style.position === 'sticky' || getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') { el.style.position = 'static'; el.style.top = 'auto'; el.style.zIndex = 'auto'; } }); } unstick(); var observer = new MutationObserver(unstick); observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); })(); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); })(); add table and image sizes to metadata by Artur-man · Pull Request #27 · HelenaLC/SpatialData.data · GitHub
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .Rbuildignore
Original file line numberDiff line numberDiff line change
Expand Up@@ -5,3 +5,4 @@
^docs$
^pkgdown$
^\.github$
^\.claude$
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line numberDiff line numberDiff line change
Expand Up@@ -11,6 +11,6 @@ importFrom(basilisk,BasiliskEnvironment)
importFrom(spatialdataR,readSpatialData)
importFrom(stats,setNames)
importFrom(utils,
read.csv,
read.table,
unzip
)
24 changes: 12 additions & 12 deletions R/demo_SDdata.R
Original file line numberDiff line numberDiff line change
Expand Up@@ -7,22 +7,22 @@
#' Returns metadata of available data from Bioc OSN and scverse spatialdata-
#' sandbox S3 buckets
#'
#' @param extended if TRUE, all columns will be returned, e.g. File size,
#' @param metadata if TRUE, all columns will be returned, e.g. File size,
#' License etc.
#'
#' @importFrom utils read.csv
#' @importFrom utils read.table
#'
#' @returns a vector of dataset names or a data.frame
#'
#' @export
#'
#' @examples
#' SD.data_list()
#' SD.data_list(extended = TRUE)
SD.data_list <- function(extended = FALSE) {
data_file <- system.file("extdata", "datasets.csv", package = "SpatialData.data")
x <- utils::read.csv(data_file, sep = ";")
if(extended) x else unique(x$Name)
#' SD.data_list(metadata = TRUE)
SD.data_list <- function(metadata = FALSE) {
data_file <- system.file("extdata", "datasets.txt", package = "SpatialData.data")
x <- read.table(data_file, sep = ";", check.names = FALSE, header = TRUE)
if(metadata) x else unique(x$Name)
}

#' @title retrieve scverse-curated `SpatialData` .zarr archive
Expand DownExpand Up@@ -130,18 +130,18 @@ SD.data_list <- function(extended = FALSE) {
SD.data_load = function(id,
target = tempfile(),
source) {
msg <- c("Please run SD.data_list(extended = TRUE) to see available ",
msg <- c("Please run SD.data_list(metadata = TRUE) to see available ",
"datasets and their S3 buckets.")
opts <- SD.data_list(extended = TRUE)
opts <- SD.data_list(metadata = TRUE)
if(!id %in% opts$Name)
stop("Dataset '", id, "' not found! ", msg)
if(missing(source)){
source <- opts$S3_buckets[opts$Name == id][1]
} else if(!source %in% opts$S3_buckets[opts$Name == id]){
source <- opts$`S3 buckets`[opts$Name == id][1]
} else if(!source %in% opts$`S3 buckets`[opts$Name == id]){
stop("Mismatching source/bucket '", source, "' with dataset '",
id, "'! ", msg)
}
opts <- opts[opts$S3_buckets == source,]
opts <- opts[opts$`S3 buckets` == source,]
.DATASETS <- setNames(opts$Pattern, opts$Name)
.read_demo_SDdata(.DATASETS[[id]], target=target, source = source)
}
Expand Down
24 changes: 0 additions & 24 deletions inst/extdata/datasets.csv

This file was deleted.

24 changes: 24 additions & 0 deletions inst/extdata/datasets.txt
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
Name;Technology;Sample;Table (Nfeat,Nobs);Image (dim);Nmolecules;File Size;S3 buckets;Zarr Format;License;Pattern
MouseIntestineVisHD;Visium HD;Mouse intestine;(19059,5479660);(3,21943,23618);;1 GB;biocOSN;v2;CCA;visium_hd_3.0.0
MouseIntestineVisHD;Visium HD;Mouse intestine;(19059,5479660);(3,21943,23618);;1 GB;sandbox;v3;CCA;visium_hd_3.0.0
MouseBrainVisHD;Visium HD;Mouse brain;(33696,84031);(3,5492,6000);;174 MB;sandbox;v3;CC BY 4.0 DEED;visium_hd_4.0.1
MouseBrainVis;Visium;Mouse brain;(31053,6484);(3,2000,1969);;65 MB;sandbox;v3;CC BY 4.0 DEED;visium_spatialdata
LungAdenocarcinomaMCMICRO;CyCIF (MCMICRO output);Human small lung adenocarcinoma;(12,11607);(12,3139,2511);;250 MB;biocOSN;v2;CC BY-NC 4.0 DEED;mcmicro_io
MouseBrainMERFISH;MERFISH;Mouse brain;(268,2389);(1,522,575);3714642;50 MB;biocOSN;v2;CC0 1.0 DEED;merfish
MouseBrainMERFISH;MERFISH;Mouse brain;(268,2389);(1,522,575);3714642;50 MB;sandbox;v3;CC0 1.0 DEED;merfish
MouseLiverMERFISH;MERFISH;Mouse liver ;(99,3375);(1,6432,6432);1153548;66 MB;sandbox;v3;CC BY 4.0 DEED;mouse_liver
ColorectalCarcinomaMIBITOF;MIBI-TOF;Human colorectal carcinoma;(36,3309);(3,1024,1024);;25 MB;biocOSN;v2;CC BY 4.0 DEED;mibitof
ColorectalCarcinomaMIBITOF;MIBI-TOF;Human colorectal carcinoma;(36,3309);(3,1024,1024);;25 MB;sandbox;v3;CC BY 4.0 DEED;mibitof
MulticancerSteinbock;IMC (Steinbock output);4 different cancers (SCCHN, BCC, NSCLC, CRC);(40,47859);(40,600,600);;820 MB;biocOSN;v2;CC BY 4.0 DEED;steinbock_io
JanesickBreastVisiumEnh;Visium;Human breast cancer;(18085,4992);(3,21571,19505);;1.5 GB;biocOSN;v2;CCA;visium_associated_xenium_io
JanesickBreastVisiumEnh;Visium;Human breast cancer;(18085,4992);(3,21571,19505);;1.5 GB;sandbox;v3;CCA;visium_associated_xenium_io
JanesickBreastXeniumRep1;Xenium;Human breast cancer;(313,167780);(1,25778,35416);42638083;2.8 GB;biocOSN;v2;CCA;xenium_rep1_io
JanesickBreastXeniumRep1;Xenium;Human breast cancer;(313,167780);(1,25778,35416);42638083;2.8 GB;sandbox;v3;CCA;xenium_rep1_io
JanesickBreastXeniumRep2;Xenium;Human breast cancer;(313,118752);(1,25779,35411);31997227;3.7 GB;biocOSN;v2;CCA;xenium_rep2_io
HumanLungMulti_10x;Xenium;Human lung Cancer;(377,162254);(5,17098,51187);12165021;5.4 GB;biocOSN;v2;CC BY 4.0 DEED;HuLungXenmulti
HumanLungMulti_10x;Xenium;Human lung Cancer;(377,162254);(5,17098,51187);12165021;5.4 GB;sandbox;v3;CC BY 4.0 DEED;xenium_2.0.0
Breast2fov_10x;Xenium (trimmed);Breast (2 FOVs);(280,7275);(4,3529,5792);1113950;380 MB;biocOSN_Xenium;v2;CCA;Xenium_V1_human_Breast_2fov
Breast2fov_10x;Xenium (trimmed);Breast (2 FOVs);(280,7275);(4,3529,5792);1113950;380 MB;biocOSN_Xenium;v3;CCA;Xenium_V1_human_Breast_2fov
Lung2fov_10x;Xenium (trimmed);Lung (2 FOVs);(289,11898);(1,3553,5791);825885;280 MB;biocOSN_Xenium;v2;CCA;Xenium_V1_human_Lung_2fov
Lung2fov_10x;Xenium (trimmed);Lung (2 FOVs);(289,11898);(1,3553,5791);825885;280 MB;biocOSN_Xenium;v3;CCA;Xenium_V1_human_Lung_2fov
SpaceMHelaniH3T3;SpaceM;Hepa and NIH3T3 cells;(327,14425);(2,2675,2675);;49 MB;sandbox;v3;CC BY 4.0 DEED;spacem_helanih3t3
6 changes: 3 additions & 3 deletions man/SD.data_list.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/testthat/test_load.R
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,7 +4,7 @@ test_that("invalid id", {
})

test_that("source list", {
expect_true(all(unlist(strsplit(SD.data_list(TRUE)$S3_buckets, ", ")) %in%
expect_true(all(unlist(strsplit(SD.data_list(TRUE)$`S3 buckets`, ", ")) %in%
c("biocOSN", "biocOSN_Xenium", "sandbox")))
})

Expand Down
2 changes: 1 addition & 1 deletion vignettes/SpatialData.data.Rmd
Original file line numberDiff line numberDiff line change
Expand Up@@ -85,7 +85,7 @@ SD.data_list()
or as below for a detailed overview and metadata on all datasets:

```{r view-data-list, eval=FALSE}
View(SD.data_list(extended = TRUE))
View(SD.data_list(metadata = TRUE))
```

You can also interrogate the sources (S3 buckets) for available (zipped) .zarr archives:
Expand Down