clear all, close all %% read in the data [data,headerNames]=tblread('system_example_nf.gdat'); % this is a function from NFsim [x,y]=size(data); h1=figure(); % create a figure in matlab subplot(2,2,[1;2]) % divide the figure, so that multiple graphs can be visualized in one figure semilogx(data(:,1),data(:,2:y),'LineWidth',2) legend(headerNames(2:y,:)) % create a legend title('Molecules of the system') % give the graph a title xlabel(headerNames(1,:)) % label the x-axis ylabel('Molecules') % label the y-axis %% analyze NFdump baseDirectory='dumpDir_example_dump'; systemName='system_example'; [results]=readNFdump(baseDirectory,systemName); % this is a function from NFsim amount=length(results); TIME = zeros(amount,1); for i=1:amount index=i; TIME(index)=results(index).time; % extract the time points end [names] = getMolTypeNames(results,TIME(1)); % this is a function from NFsim % names(1)=Protein1 % names(2)=Protein2 % names(3)=Inducer %% use the three functions for complex size analysis [avgSize1, totalMolecules1, totalComplexes1] = getAvgComplexSize(results,names); [avgSize2, totalMolecules2, totalComplexes2, sizeOneCount] = getAvgComplexSizeLargerThanOne(results,names); [avgSize3, totalMolecules3, totalComplexes3] = getAvgComplexSizeAll(results); % [avgSize2, totalMolecules2, totalComplexes2, sizeOneCount] = getAvgComplexSizeLargerThanOne(results,names); subplot(2,2,3) semilogx(TIME,totalComplexes2,TIME,totalComplexes3,TIME,sizeOneCount,'LineWidth',2) % 'Color',[0 0 128/255],'LineWidth',2) legend('Complexes method 1', 'Complexes mthod 2','Single Molecules') % make a legend title('Total Amount of Complexes') % give the graph a title xlabel('Time [s]') % label the x-axis ylabel('Molecules') % label the y-axis subplot(2,2,4) semilogx(TIME,avgSize1,TIME,avgSize3,'LineWidth',2)% 'Color',[0 0 128/255],'LineWidth',2) legend('Size method 1', 'Size method 3') % make a legend title('Average Complex Size') % give the graph a title xlabel('Time [s]') % label the x-axis ylabel('Molecules') % label the y-axis %% save separate figures h2=figure(); semilogx(data(:,1),data(:,2:y),'LineWidth',2) legend(headerNames(2:y,:)) % create a legend title('Molecules of the system') xlabel(headerNames(1,:)) ylabel('Molecules') saveas(h2,'system_example_a.png') h3=figure(); semilogx(TIME,totalComplexes1,TIME,totalComplexes3,TIME,sizeOneCount,'LineWidth',2) % 'Color',[0 0 128/255],'LineWidth',2) legend('Complexes method 1', 'Complexes mthod 3','Single Molecules') % make a legend title('Total Amount of Complexes') % give the graph a title xlabel('Time [s]') % label the x-axis ylabel('Molecules') % label the y-axis saveas(h3,'system_example_b.png') h4=figure(); semilogx(TIME,avgSize1,TIME,avgSize3,'LineWidth',2)% 'Color',[0 0 128/255],'LineWidth',2) legend('Size method 1', 'Size method 3') % make a legend title('Average Complex Size') % give the graph a title xlabel('Time [s]') % label the x-axis ylabel('Molecules') % label the y-axis saveas(h4,'system_example_c.png')