Skip to content

Commit

Permalink
updates to sir, group figures, couple other things
Browse files Browse the repository at this point in the history
  • Loading branch information
ptonner committed Oct 13, 2021
1 parent a06b5d1 commit b74e6e4
Show file tree
Hide file tree
Showing 12 changed files with 346 additions and 43 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ __pycache__/
docs/examples
docs/*.pt
docs/*.csv
docs/_build/
docs/_build/
manuscript/experiments/
30 changes: 19 additions & 11 deletions manuscript/Snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ rule train_torch:
"experiments/{dataset}/lantern/full/model.pt",
dataset=["gfp-brightness", "laci-joint", "covid-joint"],
),
expand(
"experiments/{dataset}/lantern/full-r{r}/model.pt",
dataset=["gfp-brightness", "laci-joint", "covid-joint"],
r = range(2)
),
expand(
"experiments/{dataset}/{model}/cv{cv}-n{n}000/model.pt",
dataset=["laci-joint", "gfp-brightness"],
Expand Down Expand Up @@ -169,7 +174,17 @@ rule exp_figures:
"covid-joint/bind",
"gfp-brightness/brightness",
],
fig=["surface", "gradient", "robustness", "laplacian", "additivity", "sir-effects", "sir-dims"],
fig=[
"surface",
"gradient",
"robustness",
"laplacian",
"additivity",
# "sir-effects",
# "sir-effects-corr",
# "sir-dims",
# "sir-variance",
],
),
expand(
"figures/{dataset}/anglehist.png",
Expand All @@ -195,10 +210,10 @@ rule pred_figures:
input:
"figures/cvr2.png",
"figures/laci-joint/sample-size-ec50-norm.png",
"figures/laci-joint/sample-size-ginf-norm.png",
#"figures/laci-joint/sample-size-ginf-norm.png",
"figures/gfp-brightness/sample-size-phenotype.png",
"figures/covid-joint/sample-size-func_score_norm_exp.png",
"figures/covid-joint/sample-size-func_score_norm_bind.png",
#"figures/covid-joint/sample-size-func_score_norm_exp.png",
#"figures/covid-joint/sample-size-func_score_norm_bind.png",
shell:
"tar -czf figures.tar.gz figures/*"

Expand All @@ -224,10 +239,3 @@ rule help:
rule environment:
shell:
"""conda env export -n lantern > environment.yml"""

# rule a:
# input: expand("tmp/in/{a}.txt", a=range(10))
# output: "tmp/out/a.txt"
#
# rule b:
# input: "tmp/{a}/out.txt"
12 changes: 6 additions & 6 deletions manuscript/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ gfp:

lantern:
prediction:
cuda: True
cuda: False

feedforward:
prediction:
cuda: True
cuda: False

alphabet: ["A","C","D","E","F","G","H","I","K","L","M","N","P","Q","R","S","T","V","W","Y","*"]

Expand All @@ -30,11 +30,11 @@ laci:

lantern:
prediction:
cuda: True
cuda: False

feedforward:
prediction:
cuda: True
cuda: False

covid:
N: 125000
Expand All @@ -54,11 +54,11 @@ covid:

lantern:
prediction:
cuda: True
cuda: False

feedforward:
prediction:
cuda: True
cuda: False

figures:
surface:
Expand Down
2 changes: 1 addition & 1 deletion manuscript/environment.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: lantern
name: lantern-response
channels:
- defaults
- conda-forge
Expand Down
2 changes: 1 addition & 1 deletion manuscript/smk/figures/calibration.smk
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ rule calibration:
expand("experiments/{dataset}-{phenotype}/{model}/cv{cv}/pred-val.csv", cv=range(10), allow_missing=True)
output:
"figures/{dataset}-{phenotype}/{model}/cv-calibration.png"

group: "figure"
run:
scores = pd.concat([pd.read_csv(pth) for pth in input])
D = len(get(config, f"{wildcards.dataset}/phenotypes/{wildcards.phenotype}"))
Expand Down
1 change: 1 addition & 0 deletions manuscript/smk/figures/diffops.smk
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ rule diffops:
output:
"figures/diffops-curvature.png",
"figures/diffops-slope.png"
group: "figure"
run:
df, ds, model = util.load_run("laci", "joint", "lantern", "full", 8)

Expand Down
1 change: 1 addition & 0 deletions manuscript/smk/figures/dimensions.smk
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ rule dimensions:
)
output:
"figures/dimensions.png"
group: "figure"
run:
mn = 1e-4
mx = 1
Expand Down
10 changes: 10 additions & 0 deletions manuscript/smk/figures/highlight.smk
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ rule gfp_surface_focus:
"experiments/gfp-brightness/lantern/full/model.pt"
output:
"figures/gfp-brightness/brightness/surface-focus.png"
group: "figure"
run:
df, ds, model = util.load_run("gfp", "brightness", "lantern", "full", 8)
model.eval()
Expand Down Expand Up @@ -52,6 +53,7 @@ rule gfp_surface_bfp1:
"experiments/gfp-brightness/lantern/full/model.pt"
output:
"figures/gfp-brightness/brightness/surface-bfp1.png"
group: "figure"
run:
df, ds, model = util.load_run("gfp", "brightness", "lantern", "full", 8)
model.eval()
Expand Down Expand Up @@ -124,6 +126,7 @@ rule gfp_surface_bfp2:
"experiments/gfp-brightness/lantern/full/model.pt"
output:
"figures/gfp-brightness/brightness/surface-bfp2.png"
group: "figure"
run:
df, ds, model = util.load_run("gfp", "brightness", "lantern", "full", 8)
model.eval()
Expand Down Expand Up @@ -196,6 +199,7 @@ rule gfp_surface_bfp_all:
"experiments/gfp-brightness/lantern/full/model.pt"
output:
"figures/gfp-brightness/brightness/surface-bfp-all.png"
group: "figure"
run:
import matplotlib.patches as mpatches

Expand Down Expand Up @@ -343,6 +347,7 @@ rule laci_parametric:
"experiments/laci-joint/lantern/full/model.pt"
output:
"figures/laci-joint/parametric.png"
group: "figure"
run:
df, ds, model = util.load_run("laci", "joint", "lantern", "full", 8)
model.eval()
Expand Down Expand Up @@ -521,6 +526,7 @@ rule covid_anglehist:
"experiments/covid-joint/lantern/full/model.pt"
output:
"figures/covid-joint/anglehist-highlight.png"
group: "figure"
run:
df, ds, model = util.load_run("covid", "joint", "lantern", "full", 8)
model.eval()
Expand Down Expand Up @@ -633,6 +639,7 @@ rule covid_axes_parametric:
"experiments/covid-joint/lantern/full/model.pt"
output:
"figures/covid-joint/axes-surface.png"
group: "figure"
run:
df, ds, model = util.load_run("covid", "joint", "lantern", "full", 8)
model.eval()
Expand Down Expand Up @@ -741,6 +748,7 @@ rule covid_parametric:
"experiments/covid-joint/lantern/full/model.pt"
output:
"figures/covid-joint/parametric.png"
group: "figure"
run:
df, ds, model = util.load_run("covid", "joint", "lantern", "full", 8)
model.eval()
Expand Down Expand Up @@ -852,6 +860,7 @@ rule covid_variants:
output:
"figures/covid-joint/variants.png",
"figures/covid-joint/variants_project.png"
group: "figure"
run:
from cycler import cycler

Expand Down Expand Up @@ -1085,6 +1094,7 @@ rule covid_axes_surface:
"figures/covid-joint/axes-binding.png",
"figures/covid-joint/axes-expression.png",
# "figures/covid-joint/axes-expression-with-hist.png"
group: "figure"
run:

df, ds, model = util.load_run("covid", "joint", "lantern", "full", 8)
Expand Down
Loading

0 comments on commit b74e6e4

Please sign in to comment.