Skip to content

Instantly share code, notes, and snippets.

View vjcitn's full-sized avatar

Vince Carey vjcitn

View GitHub Profile
@vjcitn
vjcitn / exploreCN.R
Created March 8, 2025 11:19
explore cellNexus metadata
exploreCN = function() {
md = cellNexus::get_metadata()
vbls = colnames(md)
ui = fluidPage(
sidebarLayout(
sidebarPanel(
helpText("navigate metadata of cellNexus"),
checkboxGroupInput("vars", "vbls",
choices=sort(colnames(md)), inline=TRUE)
),
@vjcitn
vjcitn / exploreCAQ.R
Created March 7, 2025 23:00
simple descriptive data interactively filtered, for CuratedAtlasQueryR
library(shiny)
library(CuratedAtlasQueryR)
library(dplyr)
library(rlang)
library(DT)
#' explore the CuratedAtlasQueryR metadata
#' @export
exploreCAQ = function() {
md = CuratedAtlasQueryR::get_metadata()
vbls = colnames(md)
@vjcitn
vjcitn / gist:4e6af8b67103e78d599b104b091c0abe
Created March 2, 2025 11:13
AnnotationPipeline step -- from preliminary sqlite to sanctionedSqlite for a single organism
# This function can be run in a 'newPkgs' folder after sufficient
# results have been obtained in annosrc/db, to produce a sanctionedSqlite database
# for a single organism
# the following constants are crucial
whattype <- tolower("OrgDb")
wheretoput <- 20250301
theversion <- "3.21.0"
@vjcitn
vjcitn / chkInclusion.R
Created February 16, 2025 22:18
extraction of shapes and counts of transcripts within shape boundaries
library(SpatialData)
library(SpatialData.data)
library(sf)
library(SummarizedExperiment)
if (!exists("mb")) mb = MouseBrainMERFISH()
make_circles = function(spd, shapetype="cells") {
cshape = SpatialData::shapes(spd)[[shapetype]]
df1 = data(cshape) |> as.data.frame()
@vjcitn
vjcitn / gist:c2a7d034b84cfc33ee1e9e3b1f9354c7
Created February 16, 2025 18:58
code for producing sf ellipse geometry from data frame with center, lengths of major/minor radii, and orientation angle in degrees
df2ellipses = function(datf, npts=100) {
requireNamespace("sfdep")
requireNamespace("sf")
stopifnot(all(c("X_centroid", "Y_centroid", "maj", "min", "angdeg") %in% names(datf)))
dd = data.matrix(datf[,c("X_centroid", "Y_centroid")])
cens = lapply(seq_len(nrow(datf)), function(x) sf::st_point(dd[x,]))
maj = datf$maj
min = datf$min
angle_in_deg = datf$angdeg # angle_in_rad/0.01745329
dd = data.matrix(cbind(dd, angdeg=datf[,"angdeg"])) #angle_in_deg)
@vjcitn
vjcitn / app1.R
Created December 14, 2024 13:47
learning how to use click, too much rerendering
library(shiny)
library(SpatialData)
library(SpatialData.plot)
library(SpatialData.data)
library(ggmap)
library(ggplot2)
library(sf)
if (!exists("brdat")) brdat = Breast2fov_10x()
@vjcitn
vjcitn / litbr.R
Created December 14, 2024 12:57
simple subregion select and crop
library(SpatialData)
library(SpatialData.data)
library(sf)
library(ggplot2)
if (!exists("br")) br = Breast2fov_10x()
brsh = shape(br)
library(SpatialData.plot)
# some points to form a subregion
pick = structure(list(x = c(355.185319678255, 353.624236083554, 510.140679646861,
@vjcitn
vjcitn / parqanno.R
Created November 23, 2024 15:34
bioc anno in OSN
make_parq_url = function(stub) {
stub = sub("parquet$", "", stub)
sprintf("https://mghp.osn.xsede.org/bir190004-bucket01/BiocParquetAnno/%s.parquet", stub)
}
if (!dbIsValid(con)) con = dbConnect(duckdb())
query_osn = function(con, stub="gene_info") {
url = make_parq_url(stub)
dbExecute(con, "INSTALL httpfs from core_nightly;")
---
title: "`Some SpatialData visualizations`"
date: "`r format(Sys.Date(), '%B %d, %Y')`"
package: "`r BiocStyle::pkg_ver('SpatialData')`"
author:
- name: Helena Lucia Crowell
- name: Louise Deconinck
- name: Artür Manukyan
- name: Dario Righelli
- name: Estella Dong
@vjcitn
vjcitn / noble_err.txt
Created November 21, 2024 13:15
error in noble
trying URL 'https://bioconductor.org/packages/3.21/bioc/src/contrib/parody_1.65.0.tar.gz'
Content type 'application/x-gzip' length 499981 bytes (488 KB)
==================================================
downloaded 488 KB
Error: ERROR: no permission to install to directory ‘/usr/local/lib/R/host-site-library’