%% INPUTS clear clc warning('off', 'Bioinfo:oligoprop:SeqLengthTooShort'); file1 = fopen('genetext.txt'); file2 = fopen('output.txt','w'); file3 = fopen('fastaoutput','w'); gene = textscan(file1, '%s'); sequence= char(gene{1}) sequencei= sequence(34:(length(sequence)-33)); h=basecount(sequencei); b=h.A+h.G+h.C+h.T; bp=b; Illumniaforward=('gttcagagttctacagtccgacgatc'); Illumniareverse=('ccttggcacccgagaattcca'); labels={'Forward and Reverse ' 'Section '} labelnumber={1:35} %% Choses the amount and how long of primers codons=bp/3; primers=codons/42; ap = ceil(primers); avgcodon = floor(codons/ap); pl=avgcodon*(ones(1,ap)); remainder=round((ap*(abs(avgcodon-(codons/ap))))); for i=1:remainder; pl(i)=pl(i)+1; end pl=pl*3 p=pl; for k=2:length(pl); p(k)=pl(k)+p(k-1); end % initial division of the sequence P=cell(length(pl),1); P{1}=sequencei(1:(pl(1))); for j=2:length(p) P{j}=sequencei((p(j-1)+1):(p(j))); end %{Creation of the L, B, and SECTION variable. L will be the leading sections %for each of the primers while the B is the lagging and PRIMER is the %finally assembled primers. leadingsection=sequence(1:33); Lag=cell(length(pl),1); Lead=cell(length(pl),1); L=cell(length(pl),1); B=cell(length(pl),1); SECTION=cell(length(pl),1); FORWARDPRIMER=cell(length(pl),1); REVERSEPRIMER=cell(length(pl),1); %Creat the Lead and Lag so that the later code can sort through them and %make the best primers based on the melting temperatures Lead{1}=sequence(1:33); Lag{end}=seqrcomplement(sequence((length(sequence)-32):length(sequence))); for index = 2:length(pl); Lead{index}=P{index-1}((length(P{index-1})-33):(length(P{index-1}))); Lag{index-1}=seqrcomplement(P{index}(1:33)); end IFN=0 %Need to create the the first leading section out of the preliminary "junk %base pairs. The code will create all the possible leading sections, check %the mealting point and then choose the closest to the set point of 55C. %It will then move on and check the lagging section of the primer and see %if they are close in temp, if they are not it will choose a new leading %and lagging section that are closer. leadtestsec=cell(length(pl),33); lagtestsec=cell(length(pl),33); for index = 1:length(pl); for jindex = 1:33; leadtestsec{index,jindex}=Lead{index}((34-jindex):33); propslead=oligoprop(leadtestsec{index,jindex}); TMlead(jindex)=propslead.Tm(5)+6; lagtestsec{index,jindex}=(Lag{index}(34-jindex:33)); propslag=oligoprop(lagtestsec{index,jindex}); TMlag(jindex)=propslag.Tm(5)+6; end TMdifflead=abs(TMlead-55); TMdifflag=abs(TMlag-55); winnerleadindex=find(TMdifflead==min(TMdifflead)); winnerlagindex= find(TMdifflag==min(TMdifflag)); TMwinnerlag(index) = TMlag(winnerlagindex); TMwinnerlead(index) = TMlead(winnerleadindex); if TMwinnerlag(index) > TMwinnerlead(index)+2 || TMwinnerlag(index) < TMwinnerlead(index)-2 IFN=IFN+1 if abs(TMwinnerlag(index)-55)