This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library( irlba ) | |
m <- 10000 # nbr of features (rows) | |
n <- 5000 # nbr of cells (colums) | |
r <- 5 # nbr of latent components | |
## The true latent values | |
# True importance of latent factors | |
true_importance <- c( 1, .8, .4, .2, .1 ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## Beispiel für Plot-Größe | |
Tidyverse laden: | |
```{r} | |
library( tidyverse ) | |
``` | |
Wir benutzen `mtcars`, eine Standard-Beispiel-Tabelle von R mit technischen Daten | |
für (recht alte) Autos: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gzip, random | |
# Load FASTQ file for Chromosome 10 from GRCm38 | |
with gzip.open("data/Mus_musculus.GRCm38.dna.chromosome.10.fa.gz") as f: | |
firstline = f.readline() | |
assert firstline.startswith(b'>') | |
chrom_seq = b"".join(l.rstrip() for l in f) | |
# This here is the file from papagei:mnt/raid/scnmt_data/CpG_filtered | |
cpg = scipy.sparse.load_npz( "data/CpG_10.npz" ).tocoo() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Make example data | |
n <- 15 | |
x <- runif( n, 0, 10 ) | |
y <- sin(x) + rnorm( n, sd=.1 ) | |
# Make grid to plot smooth curves | |
xg <- seq( 0, 10, length.out=1000 ) | |
# Determine knot positions: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library( rstan ) | |
options(mc.cores=6) | |
n <- 1000 | |
s <- round( 10^rnorm( n, 3, .5 ) ) | |
fracs <- 10^ifelse( runif(n)<.7, rnorm( n, -3.3, .4 ), rnorm( n, -1.7, .2 ) ) | |
k <- rpois( n, fracs*s ) | |
model <- stan_model( model_code=" | |
data { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
format: | |
html: | |
embed-resources: true | |
--- | |
# Density estimation for single-cell gene expression with MCMC | |
Simon Anders, 2024-10-23 |
OlderNewer