
% DNAdesign demos for web page

addpath /research/src/DNAdesign

%% oligo melt demo

S10 = randbase('N'*ones(1,10));
S20 = randbase('N'*ones(1,20));
S30 = randbase('N'*ones(1,30));
T=10:0.5:80; C=1e-6;
ds10=oligo_melt(S10,1,T,C);        
ds20=oligo_melt(S20,1,T,C);
ds30=oligo_melt(S30,1,T,C);
plot(T,1-ds10./C,T,1-ds20./C,T,1-ds30./C)
legend('10-mer', '20-mer', '30-mer',2)
title('oligo\_melt demo')
xlabel('temperature (deg C)')
ylabel('fraction single-stranded')
print -djpeg95 oligo_demo.jpeg

addpath /research/src/SpuriousDesign

%% mickey-mouse ears demo
St = 'N'*ones(1,72);
helices = [1 1 1 72 5; 1 13 1 34 5; 1 39 1 60 5];
[St,wc,eq] = constraints(St, helices, []);
S = constrain(randbase(St),wc,eq);
DNAfold(S); unix('sed y/U/T/ <rna.ps >fold_S.ps');
% THE SLOW WAY: MATLAB
% global bestS
% optimize(S,St,wc,eq, 'score_spurious')
save_spuriousC_files(S,St,wc,eq,'Mmouse')
unix('spuriousC wc=Mmouse.wc tmax=30 score=spurious W_verboten=1')
% cut-and-paste output to MATLAB variable 'bestS'
DNAfold(bestS); unix('sed y/U/T/ <rna.ps >fold_spuriousS.ps');
unix('spuriousC wc=Mmouse.wc tmax=30 score=struct W_verboten=1')
% cut-and-paste output to MATLAB variable 'bestS'
DNAfold(bestS); unix('sed y/U/T/ <rna.ps >fold_structS.ps');






%% dotplot demo
[Mwc,Mbp] = dotplot(S,wc,eq,Inf);
figure(1); imagesc(1-exp(-Mwc/16)); figure(2); imagesc(1-exp(-Mbp/16));
