This file contains 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
# Multithreading is the most straightforward type of parallel processing supported by Julia | |
# https://docs.julialang.org/en/v1/manual/multi-threading/#man-multithreading | |
# If your parallel computing problem doesn't involve shared memory state | |
# then this is probably the way to go | |
Nthreads = Threads.nthreads(); | |
Ncalcs = Nthreads * 5 | |
# Let's distribute Ncalcs operations across Nthreads threads | |
# We can have a look at which thread carries out each operation |
This file contains 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
# Simulating two schemes for irregular sampling from regular timeseries | |
deltasim = 0.1 | |
deltarec = 1/3 | |
tmax = 10.0 | |
simtimes = seq(0,tmax,0.1) | |
rectargets = seq(0,tmax,deltarec) | |
recindex = 1 |
This file contains 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
flength = function(fname) length(readLines(fname)) | |
for(droot in c("agent","gillespie")){ | |
dirname = paste0(droot,"_csv_files") | |
fnames = file.path(dirname,list.files(dirname,pattern="*.csv")) | |
nfiles = length(fnames) | |
ntimes = flength(fnames[1])-1 | |
times = 0:(ntimes-1) # You might want to change this to get the right units |
This file contains 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
# Warren et al. (2020) https://doi.org/10.1038/s41598-020-70885-3 | |
op = par(mfrow=c(2,2)) | |
# Healthy control subjects (all proteins) | |
# C01, C02, C03 | |
plot(function(x) dbeta(x,1,75),from=0,to=1.0,xlab="pi",ylab="Density",lwd=2, main="Controls") | |
abline(v=c(0,1),col="red",lwd=3) | |
# Note that we would expect RC defect to manifest in old age, so, in principle, | |
# this prior could change with age of patient at biopsy |
This file contains 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
# How to separate plotting from CPU intensive analysis | |
plotfuns = list() | |
Npts = 1000 | |
Nsims = 12 | |
# Visualising a 1D random walk, for example | |
makewalk = function(Npts){ | |
# Do some like real heavy computing man | |
deltas = sample(c(-1,1),Npts,replace=TRUE) | |
walk = cumsum(deltas) |
This file contains 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(MASS) | |
xdat = rnorm(1000) | |
ydat = rnorm(1000) | |
# https://stackoverflow.com/questions/16225530/contours-of-percentiles-on-level-plot | |
dens = kde2d(xdat, ydat, n=200); ## estimate the z counts | |
prob = c(0.95, 0.5) | |
dx = diff(dens$x[1:2]) | |
dy = diff(dens$y[1:2]) |
This file contains 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
N=10000 | |
noise = rnorm(N,mean=0,sd=0.5) | |
random_walk=cumsum(noise) | |
ylim = range(random_walk) | |
op = par(mfrow=c(1,2)) | |
plot(noise,type="l",ylim=ylim,xlab="time",cex.lab=1.75,cex.axis=1.75) | |
plot(random_walk,type="l",ylim=ylim,xlab="time",cex.lab=1.75,cex.axis=1.75) | |
par(op) |
This file contains 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 some synthetic data, like patient with v-shaped 2Dmito scatterplot | |
N = 500 | |
mu_x = 5 | |
sd_x = 2.5 | |
intercept = 0.1 | |
slope_normal = 1.0 | |
slope_deficient = 0.0 | |
sd_err = 1.0 | |
x_normal = rnorm(N/2,mu_x,sd_x) |
This file contains 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
RATE OR STOICHIOMETRY | |
REACTIONS HAZARD (W) (M) PROBABILITIES | |
Synthesis W -> 2W ks*W +1 0 ks*W/CH | |
M -> 2M ks*M 0 +1 ks*M/CH | |
Degradation W -> NULL kd*W -1 0 kd*W/CH | |
M -> NULL kd*M 0 -1 kd*M/CH | |
__________ | |
Combined Hazard (CH): (ks+kd)*(W+M) |
This file contains 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<title>Annotation|IMC images</title> | |
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@recogito/annotorious@2.4.0/dist/annotorious.min.css"> | |
<script src="https://cdn.jsdelivr.net/npm/@recogito/annotorious@2.4.0/dist/annotorious.min.js"></script> | |
<script language="javascript" type="text/javascript"> | |
var key = 2; |