Skip to content

Instantly share code, notes, and snippets.

conda create --name tmp python=3.10
mamba install scvi-tools=1.1.2 jaxlib=0.4.16 jax=0.4.16 -c conda-forge
mamba install conda-forge::flax
image
@timtreis
timtreis / read_stereoseq.py
Created June 26, 2023 14:02
read stereoseq files
pass
@timtreis
timtreis / get_legend_title.R
Created June 21, 2022 07:45
Method to extract the title from a ggplot legend
library("visR")
get_legend_title <- function(gg) {
ggb <- ggplot2::ggplot_build(gg)
ggt <- ggplot2::ggplot_gtable(ggb)
legend_grob_id <- which(sapply(ggt$grobs, function(x) x$name) == "guide-box")
legend_grob <- ggt$grobs[[legend_grob_id]]
@timtreis
timtreis / spec_helper.R
Last active July 8, 2021 15:17
visR - specifications helper
#!/usr/bin/env Rscript
args = commandArgs(trailingOnly = TRUE)
get_all_tests = function(file_path) {
txt = base::paste(base::readLines(file_path, warn = FALSE), collapse = "\n")
matches = base::gregexpr("testthat::test_that\\(\\\"(.+?)\"", txt)
return(matches)
@timtreis
timtreis / helpers.py
Last active May 3, 2020 15:34
Python helper functions
print("Successfully imported ttreis helper functions")
def rgb2hex(r,g,b):
return "#{:02x}{:02x}{:02x}".format(r,g,b)
somsault_1 = rgb2hex( 0, 0, 0) # black
somsault_2 = rgb2hex( 0, 73, 73) # dark grey
somsault_3 = rgb2hex( 0, 146, 146) #009999, approx. "Persian Green"
somsault_4 = rgb2hex(255, 109, 182)