Skip to content

Instantly share code, notes, and snippets.

View vjcitn's full-sized avatar

Vince Carey vjcitn

View GitHub Profile
@vjcitn
vjcitn / summ.R
Created June 25, 2026 01:06
for AnVIL AI work, demonstrate ollama with updated model
text = "Voyager to SpatialFeatureExperiment (SFE) aims to be analogous scater to SFE, implementing basic exploratory spatial data analysis (ESDA) and plotting. SFE inherits from SCE and SpatialExperiment (SPE), so all methods written for SCE and SPE can be used for SFE as well.
In this first version, ESDA is based on the classic geospatial package spdep, but future versions will incorporate methods from GWmodel, adespatial, and etc.
These are the main functionalities of the Voyager at present:
Univariate global spatial statistics, such as Moran’s I, Geary’s C, permutation testing of I and C, correlograms, global G, and semivariogram.
Univariate local spatial statistics, such as local Moran’s I, local Geary’s C, Getis-Ord Gi*, Moran scatter plot, and local spatial heteroscedasticity (LOSH).
Multivariate spatial statistics, such as MULTISPATI PCA and a multivariate generalization of local Geary’s C.
Bivariate spatial statistics, such as Lee’s L (global and local) and cross variograms.
@vjcitn
vjcitn / makeMAGEtqtl.R
Last active June 18, 2026 00:56
script to produce a tQTLExperiment
library(tQTLExperiment)
data(mageSEfilt, package="CSHLvc2026")
plink_paths <- cache_mage_chr17_plink()
## [ cache hit ] CCDG_mage_chr17.fam
## [ cache hit ] CCDG_mage_chr17.bim
## [ cache hit ] CCDG_mage_chr17.bed
## [ validate ] Checking .bed magic bytes ...
## [ validate ] .bed magic bytes OK.
plpre <- tools::file_path_sans_ext(plink_paths[["bed"]]) # works but not a list!
cd <- as.data.frame(colData(mageSEfilt))
@vjcitn
vjcitn / get_mageplink.R
Created June 16, 2026 15:26
obtain PLINK resources for CCDG 1KG genotypes for MAGE chr17
@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()