Skip to content

Instantly share code, notes, and snippets.

View FloWuenne's full-sized avatar
💻

Florian Wuennemann FloWuenne

💻
  • Seqera
  • Barcelona | Montreal
  • 22:29 (UTC -04:00)
  • X @FloWuenne
View GitHub Profile
@FloWuenne
FloWuenne / gist:3b28db88e6d0a86b49d13fb0da10ec22
Created July 10, 2023 17:19
Perform sliding window analysis on count data in a 2d array
## This code was entirely generated using OpenAIs Code Interpreter and prompting for the type of analysis that was desired
import pandas as pd
# Load the data
data = pd.read_csv('/mnt/data/example_rs_fish.csv')
# Calculate various quantiles
quantiles = data['intensity'].quantile([0.10, 0.25, 0.50, 0.75])
quantiles
@FloWuenne
FloWuenne / build_kbref_Gencode_release26_GRCm39
Last active February 25, 2021 23:34
Build kb-python reference for GENCODE release M26 GRCm39
## This is only on compute canada clusters where modules are available!
module load python/3.7.4
## Create virtual environment using python
python3 -m venv ./kb_python_env
## activate environment
source ./kb_python_env/bin/activate
## Install kb-python inside environment
@FloWuenne
FloWuenne / build_custom_kb_ref.sh
Last active February 25, 2021 23:31
Building a custom reference for kb-python in a virtual environment
## This is only on compute canada clusters where modules are available!
module load python/3.7.4
## Create virtual environment using python
python3 -m venv ./kb_python_env
## activate environment
source ./kb_python_env/bin/activate
## Install kb-python inside environment
@FloWuenne
FloWuenne / gist:83b8fea1b7fd970075a921ea5a91ef09
Created June 30, 2020 20:54
Make a Featureplot style plot using schex from a Seurat object
feature_schex <- function(seurat_object,
gene_ids,
label = FALSE,
nbins = 150,
reduction = "UMAP",
assay = "SCT",
slot = "data",
action = "mean"){
require(Seurat)
@FloWuenne
FloWuenne / gist:04cf19f8a3e666f0633aed1d7b147887
Created February 13, 2020 17:49
Get list of installed R packages
ip <- as.data.frame(installed.packages()[,c(1,3:4)])
rownames(ip) <- NULL
ip <- ip[is.na(ip$Priority),1:2,drop=FALSE]
print(ip, row.names=FALSE)
@FloWuenne
FloWuenne / gist:5d457456e239e75c3eb61ea210dea6b8
Last active August 22, 2019 20:27
Setup Gist for new Rshiny server VMs.
## Includes most packages commonly used in my workflows
install.packages("roxygen2")
install.packages("Rcpp")
install.packages("promises")
install.packages("httpuv")
install.packages("htmltools")
install.packages("xml2")
install.packages("digest")
install.packages("devtools")
library(devtools)
@FloWuenne
FloWuenne / gist:fca174d38ffd81c513fbd979e34f7062
Created November 9, 2018 16:30
Quick testing of the Jensen-Shannon implementation in the philentropy package
## Testing of JSD function in philentrop package
## Documentation at:
## https://www.rdocumentation.org/packages/philentropy/versions/0.2.0/topics/JSD
## Load library
library(philentropy)
## We will test the Jensen-Shannon divergence with the aplpication of scoring gene regulatory networks as described in this \
## paper: https://www.cell.com/cell-reports/fulltext/S2211-1247(18)31634-6?dgcid=raven_jbs_etoc_email#secsectitle0070
@FloWuenne
FloWuenne / gist:ff003a56a50d34acedaaa6512b6cb960
Last active July 20, 2018 15:35
Analyze and fix .gtf file for Drop-seq pipeline to remove warnings and skipping for genes with issues
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
# Load libraries
```{r}
library(refGenome)
library(dplyr)
@FloWuenne
FloWuenne / gist:098afe3bff11ed588cc6496bcf4312ac
Created June 14, 2018 20:15
Check correlation between number of genic reads and genes and transcripts detected per cell
## Read in summary file from Drop-seq pipe
infile =
DGE_info <- read.table(infile,
sep="\t",
header=T)
## Correlation Number of genic reads vs num of genes detected per cell
ggplot(DGE_info,aes(NUM_GENIC_READS,NUM_GENES,col=NUM_TRANSCRIPTS)) +
geom_point()
@FloWuenne
FloWuenne / gist:aec5aa1f6fcf3bf1721b4794247098ec
Created May 1, 2018 15:04
Save raw UMI counts and metadata for each object
## Create vector with timepoints
time_points <- c("E14.5","E16.5","E18.5","P1","P4","P7")
for(time in time_points){
rds_object <- readRDS(paste("/home/wueflo00/project/Dropseq/Andelfingerlab_Dropseq/Heart_Maturation/Analysis/Objects/",time,".expression_seurat.renamed_clusters.Rds",sep=""))
raw_umi <- as.matrix([email protected])
metadata <- [email protected]
raw_umi <- raw_umi[,rownames(metadata)]