Skip to content

Instantly share code, notes, and snippets.

View vjcitn's full-sized avatar

Vince Carey vjcitn

View GitHub Profile
@vjcitn
vjcitn / log.txt
Created June 8, 2026 11:27
osta build error 1
processing file: bkg-python-interoperability.qmd
1/41
2/41 [unnamed-chunk-1]
3/41
4/41 [libraries]
5/41
6/41 [venv-]
7/41
8/41 [req]
9/41
@vjcitn
vjcitn / OSTA4anvil.md
Created June 8, 2026 10:56
Markdown for description of OSTA for AnVIL workspace

an instance of the Orchestrating Spatial Transcriptomics Analysis book

Jun 8 2026: use us.gcr.io/broad-dsp-gcr-public/terra-base:1.0.1 to have sudo capabilities.

To install the infrastructure, et a machine with 4 CPUs and 150 GB disk.

We use r2u to get packages and ubuntu infrastructure. Specifically, we use the script

#!/bin/bash
@vjcitn
vjcitn / efademo7.R
Created June 3, 2026 16:34
some shape analysis with xenium example
#' sfe_efa_bridge.R
#'
#' Bridge between SpatialFeatureExperiment cell boundary polygons
#' and Elliptic Fourier Analysis (Momocs).
#'
#' Extracts cell segmentation polygons from an SFE object,
#' computes EFA coefficients per cell, stores them as a
#' reducedDim or colData, and provides reconstruction/visualization.
#'
#' Dependencies:
@vjcitn
vjcitn / docirc.R
Created May 28, 2026 22:52
produce data in an elliptical pattern
# Set seed for reproducibility
set.seed(123)
# Generate 15 uniform points in the unit circle
n <- 15
# Method: Generate points uniformly in unit circle using polar coordinates
# We need to use square root to ensure uniform distribution
r <- sqrt(runif(n)) # Square root to get uniform distribution
theta <- runif(n, 0, 2*pi)
@vjcitn
vjcitn / gist:6e85b37cce065f1a67027d483219cabd
Created May 28, 2026 09:17
first draft of zarr-based SpatialData viewer
library(shiny)
library(plotly)
library(SpatialData)
library(SpatialData.plot)
library(ggplot2)
load("abund500.rda")
gene_choices <- sort(abund500)
dd <- readSpatialData("data.zarr", images = FALSE)
@vjcitn
vjcitn / doGaussianIntegral.Rmd
Created May 12, 2026 16:50
some tasks in integration carried out with local LLM
> library(ellmer)
1/4 packages newly attached/loaded, see sessionInfo() for details.
> ch = chat_ollama(model="qwen3-coder:30b")
> ch$chat("Discuss how to evaluate the integral of the Gaussian density function over the whole real line.")
# Evaluating the Gaussian Integral over the Entire Real Line
The integral of the Gaussian density function over the whole real line is a fundamental result in mathematics and
statistics:
$$\int_{-\infty}^{\infty} e^{-x^2/2} dx = \sqrt{2\pi}$$
@vjcitn
vjcitn / measure_cnn.R
Created May 11, 2026 10:48
use macmon to develop report on GPU usage on m4 mac
library(littleDeep)
library(processx)
tf = tempfile()
fstr = paste0(">>", tf)
#file.create(tf)
basecmd = sprintf("/Users/vincentcarey/INSTRUMENTATION/macmon/target/release/macmon")
pp = process$new(basecmd, c("pipe"), stdout=fstr)
suppress_keras_warnings()
r1 = run_cifar100(nEpochs=3)
pp$kill()
@vjcitn
vjcitn / ldremo.R
Last active April 29, 2026 11:54
simple implementation of logistic regression
#> dput(dev)
alogit = function(x) exp(x)/(1+exp(x))
dev = function (y, x)
function(b) {
phat = alogit(x %*% b)
-2 * sum(y * log(phat) + (1 - y) * (log(1 - phat)))
}
Y = 1*(iris$Species == "virginica")
X = data.matrix(cbind(1., iris[,1:4]))
@vjcitn
vjcitn / sdioerr.txt
Created April 6, 2026 19:14
error for sdio
available_sdio produces:
> reticulate::py_last_error()
── Python Exception Message ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Traceback (most recent call last):
File "C:\Users\stvjc\AppData\Local\R\win-library\4.6\reticulate\python\rpytools\loader.py", line 122, in _find_and_load_hook
return _run_hook(name, _hook)
^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\stvjc\AppData\Local\R\win-library\4.6\reticulate\python\rpytools\loader.py", line 96, in _run_hook
module = hook()
@vjcitn
vjcitn / dogencode.R
Created March 12, 2026 10:31
Explore GenomicState+txdbmaker functions for working with Gencode V49
library(GenomicState)
library(RSQLite)
library(txdbmaker)
hgenc49 = gencode_txdb(
version = "49",
genome = c("hg38"),
chrs = paste0("chr", c(seq_len(22), "X", "Y", "M"))
)
hgenc49$conn # 'path' is empty
md = dbGetQuery(hgenc49$conn, "select * from metadata") # lacks 'Resource URL' record in metadata