Class about stochastic optimization

Figures for parabolic costs in 1D:

>> x=-10:.1:10;
>> plot(x,x.^2)
>> close all
>> plot(x,x.^2)
>> plot(x,x.^2+randn(1,length(x)))
>> plot(x,x.^2+randn(1,length(x))*10)
>> hold on
>> plot(x,x.^2,’r’,’LineWidth’,3)
>> set(gca,’FontSize’,15)
>> xlabel(‘x_1′,’FontSize’,15)
>> ylabel(‘Cost’,’FontSize’,15)
>> figure
>> plot(x,5*x.^2+randn(1,length(x))*10)
>> axis([-10 10 0 120])
>> axis([-10 10 0 120])
>> axis auto
>> axis([-10 10 -20 120])
>> hold on
>> plot(x,5*x.^2,’r’,’LineWidth’,3)
>> set(gca,’FontSize’,15)
>> xlabel(‘x_2′,’FontSize’,15)
>> ylabel(‘Cost’,’FontSize’,15)
>> plot(x,5*x.^2+randn(1,length(x))*10)
>> plot(x,5*x.^2+randn(1,length(x))*10)
>> plot(x,5*x.^2+randn(1,length(x))*10)
>> plot(x,5*x.^2+randn(1,length(x))*10)
>> plot(x,5*x.^2+randn(1,length(x))*10)


Figures for the cost of two different neurons:

x=0:.01:1;
>> plot(x,2*x.^2,’b’,’LineWidth’,2)
>> set(gca,’FontSize’,15,’Box’,’off’,’LineWidth’,2)
>> xlabel(‘x_1′,’FontSize’,15)
>> ylabel(‘Cost’,’FontSize’,15)
>> plot(x,2*x.^2,’b’,’LineWidth’,3)
>> set(gca,’FontSize’,15,’Box’,’off’,’LineWidth’,3)
>> xlabel(‘x_1′,’FontSize’,15)
>> ylabel(‘Cost’,’FontSize’,15)


Advertisements

Preparation of class about the genetic code (II): Stop codons

Probability of not finding a stop codón after frame-shift for random sequences:

x=0:100;
plot(x,(61/64).^x,’LineWidth’,2)

Preparation of class about the genetic code

Replication of the calculation in HaigHurst91:

cd geneticcode

>> load codigo
>> MS0=NaN(10^5,1);
MS_bases=NaN(10^5,3);
for c=1:10^5
codigo_perm=permutacodigo(codigo);
[MS0(c),MS_bases(c,1:3)]=codigo2MS(codigo_perm.codon2aa,codigo.aa_prop(:,1));
if mod(c,10000)==0
fprintf(‘%g,’,c)
end
end
10000,20000,30000,40000,50000,60000,70000,80000,90000,100000,>>
>> [MS0_real,MS_bases_real]=codigo2MS(codigo.codon2aa,codigo.aa_prop(:,1));
>> hist(MS0,100)
>> hold on
>> ejes=axis;
>> plot(MS0_real*[1 1],ejes(3:4),’k’)

Global MS:

First base:

hist(MS_bases(:,1),100)
>> ejes=axis;
>> hold on
>> plot(MS_bases_real(1)*[1 1],ejes(3:4),’k’)

Second base:

hist(MS_bases(:,2),100)
ejes=axis;
hold on
plot(MS_bases_real(2)*[1 1],ejes(3:4),’k’)

Third base:

>> hist(MS_bases(:,3),100)
ejes=axis;
hold on
plot(MS_bases_real(3)*[1 1],ejes(3:4),’k’)

Proportion of single-point mutations that lead to synonymous codons (permutations do not maintain family boxes):

MS0_nobox=NaN(10^4,1);
MS_bases_nobox=NaN(10^4,3);
prop_syn=NaN(10^4,1);
for c=1:10^4
codigo_perm=permutacodigo_noboxes(codigo);
[MS0_nobox(c),MS_bases_nobox(c,1:3),prop_syn(c)]=codigo2MS(codigo_perm.codon2aa,codigo.aa_prop(:,1));
if mod(c,10000)==0
fprintf(‘%g,’,c)
end
end
hist(prop_syn,50)
hold on
ejes=axis;
plot(prop_syn_real*[1 1],ejes(3:4),’k’)
>> set(gca,’FontSize’,15)
>> xlabel(‘Proportion of synonymous single-point mutations’,’FontSize’,15)
>> ylabel(‘Number of cases’,’FontSize’,15)