From 73f226e73b1afbc901ca15cb10f15e78fe2fba79 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 1 May 2010 20:06:05 -0400 Subject: [PATCH] Convert expt-sawtooth from Gnuplot to Asymptote. Also: * Stripped old comments from sim-sawtooth.asy * Added title to sim-sawtooth --- tex/src/figures/expt-sawtooth/SConscript | 25 ++++++- .../figures/expt-sawtooth/expt-sawtooth.asy | 71 +++++++++++++++++++ .../expt-sawtooth/{expt.d => expt.dat} | 0 tex/src/figures/expt-sawtooth/fig.gp | 27 ------- tex/src/figures/expt-sawtooth/sawmodel.xml | 2 +- tex/src/figures/sim-sawtooth/sim-sawtooth.asy | 29 +------- tex/src/introduction/main.tex | 2 +- 7 files changed, 97 insertions(+), 59 deletions(-) create mode 100644 tex/src/figures/expt-sawtooth/expt-sawtooth.asy rename tex/src/figures/expt-sawtooth/{expt.d => expt.dat} (100%) delete mode 100644 tex/src/figures/expt-sawtooth/fig.gp diff --git a/tex/src/figures/expt-sawtooth/SConscript b/tex/src/figures/expt-sawtooth/SConscript index d8ff28f..9b06b3c 100644 --- a/tex/src/figures/expt-sawtooth/SConscript +++ b/tex/src/figures/expt-sawtooth/SConscript @@ -1,8 +1,29 @@ +from site_cons.site_init import link_wtk_graph + + +FIGURES = ['expt-sawtooth'] + # Get the passed in environment. Import('env') -for gp in Glob('*.gp'): - env.Gnuplot(gp) +wtk_graph = link_wtk_graph(env) + +xml_fit = File('sawmodel.xml') +expt_sawtooth_data = [ + env.Command( + 'expt-Ls.dat', + [xml_fit], + r"sed -n 's/^ *\(.*\)<\/L>/\1/p' $SOURCE > $TARGET"), + ] + +for fig in FIGURES: + asyfile = '%s.asy' % fig # static .asy file + pyfig = fig.replace('-', '_') + data = '%s_data' % (pyfig) + asydata = [] + if data in globals(): # generated data dependencies + asydata = globals()[data] + env.Asymptote([asyfile, wtk_graph] + asydata) # Pass back the modified environment. Return('env') diff --git a/tex/src/figures/expt-sawtooth/expt-sawtooth.asy b/tex/src/figures/expt-sawtooth/expt-sawtooth.asy new file mode 100644 index 0000000..6cfabe9 --- /dev/null +++ b/tex/src/figures/expt-sawtooth/expt-sawtooth.asy @@ -0,0 +1,71 @@ +import wtk_graph; + +size(15cm,10cm,IgnoreAspect); + +scale(Linear, Linear); +real k = infinity; /* spring constant in N/m, already accounted for (0.05) */ +real xscale=1e9; +real fscale=1e12; + +real xmin = -5e-9; +real xmax = 300e-9; +real fmin = -100e-12; +real fmax = 1000e-12; +real fnmax = 300e-12; + +real kB = 1.3806504e-23; +real T = 300; +real p = 3.7e-10; +real WLC(real x, real L, real p=p, real T=T, real kB=kB, + real xLmax=0.99, real fmax=fnmax) { + real f = infinity; + if (x < 0) + return infinity; + if (x/L <= xLmax) + f = kB*T/p*(0.25*(1/(1-x/L)^2 - 1) + x/L); + if (f > fnmax) + return infinity; + return f; +} + +void graphSawtooth(string file="datafile", real k, + int xcol=0, int fcol=1, + real xscale=1, real fscale=1, real dx=0, real df=0, + pen p=red) { + file fin=input(file).line(); + real[][] a=fin.dimension(0,0); + a=transpose(a); + real[] x=a[xcol]; + real[] f=a[fcol]; + x = x - f/k; /* Remove cantilever extension */ + graphData(x=x, y=f, xscale=xscale, yscale=fscale, + dx=dx, dy=df, p=p, dots=false); +} + +/* expt.dat already scaled to nm and pN */ +graphSawtooth("expt.dat", k=k, p=psoft); + +file fin = input('expt-Ls.dat').line(); +real[][] a = fin.dimension(0,0); +a = transpose(a); +real[] Ls = a[0]; +int i; +for (i=0; i=0 && x < L && f(x,L) <= 300) ? f(x,L) : 1/0 -plot 'expt.d' with lines, \ - F(x,41.0063) lt 2, \ - F(x,65.2187) lt 2, \ - F(x,88.4682) lt 2, \ - F(x,110.442) lt 2, \ - F(x,133.067) lt 2, \ - F(x,155.498) lt 2, \ - F(x,177.802) lt 2, \ - F(x,199.098) lt 2, \ - F(x,221.89) lt 2 diff --git a/tex/src/figures/expt-sawtooth/sawmodel.xml b/tex/src/figures/expt-sawtooth/sawmodel.xml index 200cc33..5475279 100644 --- a/tex/src/figures/expt-sawtooth/sawmodel.xml +++ b/tex/src/figures/expt-sawtooth/sawmodel.xml @@ -2,7 +2,7 @@ - expt.d + expt.dat 0 298.15 diff --git a/tex/src/figures/sim-sawtooth/sim-sawtooth.asy b/tex/src/figures/sim-sawtooth/sim-sawtooth.asy index 2a8032d..a75d84e 100644 --- a/tex/src/figures/sim-sawtooth/sim-sawtooth.asy +++ b/tex/src/figures/sim-sawtooth/sim-sawtooth.asy @@ -27,33 +27,6 @@ graphSawtooth("fig2.dat", k=k, xscale=xscale, fscale=fscale, graphSawtooth("fig3.dat", k=k, xscale=xscale, fscale=fscale, df=400e-12, p=phard); -//xlimits(xmin, xmax); -//ylimits(ymin, ymax); xaxis(sLabel("Distance (nm)"), BottomTop, LeftTicks); yaxis(sLabel("Force (pN)"), LeftRight, RightTicks); -/* -set xrange [-5:250] -set yrange [-10:400] -set ytics 0,100 - -set multiplot - -set size 1,0.42; -set origin 0.0,0.0; -set xlabel 'Extension (nm)' -plot 'fig1.d' using (($1-$2/0.05)*1e9):($2*1e12) - -set size 1,0.29; -set origin 0.0,0.42; -set bmargin 0 -unset xlabel -set xtics format "" -set ylabel 'Force (pN)' -plot 'fig2.d' using (($1-$2/0.05)*1e9):($2*1e12) - -set origin 0.0,0.71; -set bmargin 0 -set xtics format "" -unset ylabel -plot 'fig3.d' using (($1-$2/0.05)*1e9):($2*1e12) -*/ +label(sLabel("Simulated force curves"), point(N), N); diff --git a/tex/src/introduction/main.tex b/tex/src/introduction/main.tex index ef8c4b7..12375c6 100644 --- a/tex/src/introduction/main.tex +++ b/tex/src/introduction/main.tex @@ -182,7 +182,7 @@ multi-domain test proteins. \subfloat[][]{\asyfig{figures/schematic/unfolding}% \label{fig:unfolding-schematic}} % \hspace{.25in}% - \subfloat[][]{\includegraphics{figures/expt-sawtooth/fig}% + \subfloat[][]{\asyfig{figures/expt-sawtooth/expt-sawtooth}% \label{fig:expt-sawtooth}} \caption{(a) Schematic of the experimental setup for mechanical unfolding of proteins using an AFM (not to scale). An experiment -- 2.26.2