function [] = unity(file, leader) % These files need to be in the include path or working directory (GSPdemos). load TAV.mat; load Codons.mat; % Load prfb and convert to lowercase whatever format. S = getseq(file); try S = num2char(char2num(S, 1, 0), 0, 1); catch error('I cannot run char2num. Ensure your current working directory is correct (e.g. K:).'); end % Generate a fasta file for free2bind. Fasta = strcat(file, '.fasta'); write2fasta(Fasta, [S leader], 'prfb', 60); % Run free2bind. Make sure to include its directory into -I. Include = sprintf('-I"%s"', fileparts(which('FreeAlign.pm'))); [status, Signal] = system(sprintf('perl %s %s -r -e -q auuccuccacuag %s', Include, which('free_scan.pl'), Fasta)); % Simulate load() on a string instead of a file. Signal = str2num(Signal); if(isempty(Signal) && isempty(which('perl.exe'))) E = 'I cannot pull signals. Ensure `perl.exe` is in your path (`dos(''path'')`).'; error(E); end % Magic numbers. cp = 0; phi_sp=-13*(pi/180); initialx = 0.001; C1 = 0.005; C2 = initialx; Nstop=1000; spc=1; % For debugging. % disp(length(Signal) - length(S)); %%% demo4 code %%% % Run it through the model [mag,theta,x] = calcmpx(S(3*cp+1:end),Signal,phi_sp,Names,TAV,C1,C2,Nstop,spc); % Polar plot figure(1); polar(theta,mag); % Displacement plot figure(2); plot(1+cp:length(x)+cp, x); axis([1 length(x)+cp min(-4,min(x)) max(4,max(x))]); grid; xlabel('Codon Number'); ylabel('x(k)'); % Newline. fprintf('\n');