-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmRNA.jl
61 lines (51 loc) · 1.42 KB
/
mRNA.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using BridgeStan
using MCMCChains
using Pigeons
using Plots
using StatsPlots
using CairoMakie
using PairPlots
function start_job(; n_chains, n_rounds)
# hack(n_chains)
post_prior = Pigeons.stan_mRNA_post_prior_pair()
pigeons(;
target = post_prior.posterior,
reference = post_prior.prior,
n_rounds,
n_chains,
record = [traces; round_trip; record_default()],
checkpoint = true,
on = MPI(
n_mpi_processes = n_chains,
dependencies = [BridgeStan])
)
end
function toy()
pigeons(;
target = toy_mvn_target(2),
record = [traces; round_trip; record_default()],
checkpoint = true,
on = ChildProcess(
dependencies = [BridgeStan])
)
end
function make_plots(r)
pt = load(r)
samples = Chains(pt)
CairoMakie.save(
"$(r.exec_folder)/pair_plot.pdf",
PairPlots.pairplot(samples))
StatsPlots.savefig(
StatsPlots.plot(samples),
"$(r.exec_folder)/posterior_densities_and_traces.pdf")
params, internals = MCMCChains.get_sections(samples)
StatsPlots.savefig(
StatsPlots.plot(internals),
"$(r.exec_folder)/logdensity.pdf");
StatsPlots.savefig(
meanplot(samples),
"$(r.exec_folder)/meanplot.pdf")
StatsPlots.savefig(
autocorplot(samples),
"$(r.exec_folder)/autocorplot.pdf")
end