Skip to content

Instantly share code, notes, and snippets.

View vjcitn's full-sized avatar

Vince Carey vjcitn

View GitHub Profile
@vjcitn
vjcitn / maf2key.R
Last active October 23, 2024 12:10
create data.frames to help merge AlphaMissense pathogenicity scores to MAF objects from maftools
#' from a MAF instance create a key with ref, alt and positional information,
#' return in a data.frame with key and gene symbol
#' @param mafinst instance of S4 class MAF from maftools
#' @param altfield character(1) name of field to use for mutation substitution
#' @param donorfield character(1) name of field to use for donor
#' @param uniprot_ok character() or NULL, defaults to NULL, if non-NULL, data to be returned will
#' only include records with UNIPROT id matching an element in this vector
#' @export
maf2key = function(mafinst, altfield="Tumor_Seq_Allele2", donorfield="Tumor_Sample_Barcode",
@vjcitn
vjcitn / curlminitest.Rmd
Created October 11, 2024 11:55
triggers segfault on ubuntu 24.04 under R 4.4.1, when compiled with rmarkdown::render
---
title: "Triggers a curl/httr segfault during R CMD build"
author: Hervé Pagès
output:
BiocStyle::html_document:
toc: true
toc_depth: 2
vignette: >
%\VignetteEngine{knitr::rmarkdown}
%\VignetteEncoding{UTF-8}
@vjcitn
vjcitn / sessioinfo.txt
Created October 11, 2024 11:40
ubuntu 24.04 gdb trace
> sessionInfo()
R version 4.4.1 Patched (2024-09-30 r87215)
Platform: x86_64-pc-linux-gnu
Running under: Ubuntu 24.04.1 LTS
Matrix products: default
BLAS: /usr/local/lib/R/lib/libRblas.so
LAPACK: /usr/local/lib/R/lib/libRlapack.so; LAPACK version 3.12.0
locale:
@vjcitn
vjcitn / intel_mac_log.txt
Created October 11, 2024 10:56
hard to trigger error first seen in ubuntu 24.04, now similar on intel mac
##############################################################################
##############################################################################
###
### Running command:
###
### /Library/Frameworks/R.framework/Resources/bin/R CMD build --keep-empty-dirs --no-resave-data BiocFileCache
###
##############################################################################
##############################################################################
@vjcitn
vjcitn / litapp.R
Created September 19, 2024 04:55
small app for zarr store of xenium
library(shiny)
library(xenLite)
library(SpatialExperiment)
what = "LUAD"
ui = fluidPage(
sidebarLayout(
sidebarPanel(
uiOutput("topbox"),
@vjcitn
vjcitn / r-dev.noload.txt
Created September 19, 2024 02:06
error with attempt to install impute from bioc.r-universe.dev
setup:
> options(repos=c(BioCsoft="https://bioc.r-universe.dev", CRAN="https://cloud.r-project.org"))
> getOption("repos")
BioCsoft CRAN
"https://bioc.r-universe.dev" "https://cloud.r-project.org"
> install.packages("impute")
Installing package into ‘/Users/papa/Library/R/arm64/4.4/library’
@vjcitn
vjcitn / ggplot_seg.R
Created September 1, 2024 21:06
code that uses ggplot and some cell-level summaries on XenSPEP/XenSCE
library(plotly)
library(ggplot2)
library(XenSCE)
if (!exists("gbm")) load("gbm.rda")
print.xen_ggprep = function(x, ...) {
cat(sprintf("xen_ggprep instance for %d cells with %d cell boundary vertices.\n", ncol(x$sampd), nrow(x$bounds)))
}
ggprep_seg = function(xsce, xlim=c(5800,6200), ylim=c(6300, 6700), show_tx=TRUE) {
library(plotly)
library(ggplot2)
library(XenSCE)
if (!exists("gbm")) load("gbm.rda")
plotly_seg = function(xsce, xlim=c(5800,6000), ylim=c(6300, 6500), show_tx=TRUE) {
bounds = getCellBoundaries(xsce)
bounds = bounds[bounds$vertex_x > xlim[1] &
bounds$vertex_x < xlim[2] & bounds$vertex_y > ylim[1] & bounds$vertex_y < ylim[2],]
c4 <- as.data.frame(bounds)
#ggplot(c4, aes(x=vertex_x, y=vertex_y, group=cell_id)) + geom_path() -> pas
@vjcitn
vjcitn / vizapp.R
Created August 31, 2024 15:43
interactive xenium exploration
library(shiny)
library(ParquetDataFrame)
library(XenSCE)
if (!exists("gbm")) load("gbm.rda")
ui = fluidPage(
sidebarLayout(
sidebarPanel(
helpText("view gbm"),
@vjcitn
vjcitn / simple.txt
Last active August 22, 2024 10:14
get DESCRIPTIONs
get_bioc_packagelist = function(rel = "RELEASE_3_19") {
system("git clone https://git.bioconductor.org/admin/manifest")
owd = getwd()
setwd("manifest")
on.exit(setwd(owd))
system(paste("git checkout ", rel))
proc_software.txt = function() {
x = readLines("software.txt")[-1] # first line is comment
nn = which(nchar(x)==0)
tmp = x[-nn]