123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652 |
- global projectScansDir
- global projectName
- global matFile
- global defImParMat
- global printResultsDir
- global fotosResultsDir
- global pointMapsFile
- global pointMapsResultsDir
- ln=1;
- % Version compatability fixes
- if verLessThan('matlab','8.3')
- fd4=diff(sym('K / (1 + exp(-r* (t - l )))'),4);
- sols=solve(fd4);
- else % accomodate new matlab changes after 2014a
- syms t K r l;
- fd4=diff(K / (1 + exp(-r* (t - l ))),t,4);
- sols=solve(fd4);
- tmpswap=sols(1);
- sols(1)=sols(3);
- sols(3)=tmpswap;
- end
- % MPnum=ImParMat(1);
- % opt=questdlg('Print Results Only (RES), DB Only (DB), or Both','Results Printout Options','Res','DB','Both','Both');
- opt='Res';
- if ~exist('defImParMat','var') || isempty(defImParMat) % TODO needs explanation
- load(pointMapsFile);
- end
- destPerMP=ImParMat(2); % TODO this is weird, needs explanation
- load(matFile);
- load(mpdmFile)
- numOfDrgs=length(DM.drug);
- numOfMeds=length(DM.media);
- destPerMP=numOfDrgs;
- % TODO this should be rewritten or is unnecessary, what is this for
- % Determine the longest set of intensity(tPts) for the Experiment Data Set
- maxNumIntens=0;
- for n=1:size(scan,2)
- for m=1:size(scan(n).plate,2)
- maxNumIntens=max(maxNumIntens,size(scan(n).plate(m).intens,2));
- end
- end
- % if length(projectScansDir) == max(strfind(projectScansDir,'\'))
- % localprojectScansDir=projectScansDir(1:end-1);
- % else
- % localprojectScansDir=projectScansDir;
- % end
- % DBupload=fullfile(drive,'EZdbFiles','DBupLOADfiles');
- resultsFilename=fullfile(printResultsDir, 'results_elr.txt');
- DBfilename=fullfile(printResultsDir, 'DbaseELr.txt');
- if isequal(opt,'Res')||isequal(opt,'Both'),fid=fopen(resultsFilename,'w');end
- if isequal(opt,'DB')||isequal(opt,'Both'),fid2=fopen(DBfilename,'w');end
- if isequal(opt,'Res')||isequal(opt,'Both')
- fprintf(fid,'%d\t',ln); % Results header
- fprintf(fid,'%s\t\n',projectScansDir);
- ln=ln+1;
- fprintf(fid,'%d\t',ln);
- end
- mpCnt=0;
- totPlCnt=0;
- drgCnt=0;
- medCnt=0;
- try
- load(fullfile(fotosResultsDir,'Nbdg')) % Convolute scan array data into plates
- catch
- load(fullfile(pointMapsResultsDir,'Nbdg')) % Convolute scan array data into plates
- end
- for s=1:size(scan,2)
- % Convolute scan array data into plates DconB for DBcombo
- clear Diag
- try
- Diag(:,:,:,1)=sbdg{s}(1:1:24,16:-1:1,:);
- catch
- sbdg{s};
- end
- for p=1:size((scan(s).plate),2)
- totPlCnt=totPlCnt+1;
- if destPerMP>1 && rem(totPlCnt,destPerMP)==1
- mpCnt=mpCnt+1;
- end
- if destPerMP==1
- mpCnt=mpCnt+1;
- end
- pertCnt=rem(totPlCnt,destPerMP);
- if pertCnt==0
- pertCnt=destPerMP;
- end
- pert=strcat('Perturb_',num2str(pertCnt));
- s % TODO seems wrong
- p % TODO seems wrong
- clear outCmat
- outCmat=scan(s).plate(p).CFout;
- % Print Time Point HEADER for each plate for newly added intensity data
- if isequal(opt,'Res')||isequal(opt,'Both')
- fprintf(fid, '\n');
- ln=ln+1;
- fprintf(fid,'%d\t',ln);
- fprintf(fid,'Scan\tPlate\tRow\tCol\t');
- try
- asd=cell2mat(scan(s).plate(1).CFparameters(1));
- aucEndPt=strcat('AUC',num2str(asd(9)));
- catch
- asd=cell2mat(scan(s).plate(1).CFparameters{1,1}(1,384));
- aucEndPt=strcat('AUC',num2str(asd(9)));
- end
-
- fprintf(fid, 'Num.\tDiagnostics\tDrug\tConc\tMedia\tModifier1\tConc1\tModifier2\tConc2\tORF\tGene');
- fprintf(fid, '\t %s',aucEndPt);
- fprintf(fid, '\triseTm\tK\tr\tl\tR-squared\tK-lower\tK-upper\tr-lower\tr-upper\tl-lower\tl-upper\tArea\tLastInten\tSplineMaxRateTm\tLastFitTm\t1stFitTm\tMedianBase\tFitBase\tMinTm\tThreshTm');
-
- if size(outCmat,2)==27
- fprintf(fid, '\ttc11Cut\ttc12Cut\ttc21Cut\ttc22Cut'); % '\tEarly1\tEarly2\tLate1\tLate2'); 17_0629 MinBaseIntens update for MedianBase label
- end
- fprintf(fid, '\tTotFitPts\tPostThreshFitPts\t1stBackgrd\tLstBackgrd\t1stMeanTotBackgrd\tLstMeanTotBackgrd');
- end
- clear outTseries
- outTseries=[];
- outTseries=scan(s).plate(p).tSeries;
- TseriesSize=size(outTseries,1);
-
- clear outIntens
- outIntens=[];
- RawIntens=[];
- RawIntens=scan(s).plate(p).intens;
- RawIntensSize=size(RawIntens,2)
-
- clear Ag; %Ag is Growth Area
- Ag=scan(s).plate(p).Ag;
- AgSize=size(Ag);
-
- dataLength=min(TseriesSize,RawIntensSize);
- if isequal(opt,'Res')||isequal(opt,'Both')
- for j=1:dataLength
- fprintf(fid, '\t%.5f', outTseries(j));
- end
- end
- numBlkCol=(maxNumIntens - dataLength); % size(outTseries,1));
- if isequal(opt,'Res')||isequal(opt,'Both')
- for nn=1:numBlkCol % extend to col beyond longest rawDataSet
- fprintf(fid, '\t');
- end
- fprintf(fid,'\tOrfRep');
- fprintf(fid,'\tSpecifics');
- fprintf(fid,'\tStrainBkGrd');
- fprintf(fid, '\n');
- ln=ln+1;
- fprintf(fid,'%d\t',ln);
- end
- % Data
- n=0;
- for r=1:16
- for c=1:24
- n=n+1;
- clear selcode;
- Kval=outCmat(n,3);
- rSq=outCmat(n,6);
- lval=outCmat(n,5);
- if Kval>160, selcode='K_Hi'; else selcode=' ';end
- if Kval<40, selcode=strcat(selcode,' K_Lo');end
- if rSq<.97 && rSq>0, selcode=strcat(selcode,' rSqLo');end
- if lval>(0.85*(max(outTseries))), selcode=strcat(selcode,' late');end
- if isnan(outCmat(n,7))||isnan(outCmat(n,8))||isnan(outCmat(n,9))...
- || isnan(outCmat(n,10))||isnan(outCmat(n,11))...
- || isnan(outCmat(n,12)), selcode=strcat(selcode,' NaN');
- end
-
- % RiseTime Calculation
- K=(outCmat(n,3));
- R=(outCmat(n,4));
- L=(outCmat(n,5));
- if R>0 && L>0 && K>0
- rr=R; ll=L;
- tc1=eval(sols(2));
- tc2=eval(sols(3));
- LL=eval(sols(1));
- riseTm=LL-tc1;
- else
- riseTm=0;
- end
-
- if Ag(n)< .30*(scan(s).Awindow),selcode=strcat(selcode,' smArea'); end
- if outCmat(n,3)==0,selcode=strcat('0 ',selcode);end
-
- orf=cell2mat(MP(mpCnt).orf{1}(n));
- gene=cell2mat(MP(mpCnt).genename{1}(n));
- orfRep=cell2mat(MP(mpCnt).orfRep{1}(n));
- specifics=cell2mat(MP(mpCnt).specifics{1}(n));
- strain=cell2mat(MP(mpCnt).strain{1}(n));
- drug=char(DM.drug{pertCnt});
- conc=char(DM.conc{pertCnt});
- media=char(DM.media{pertCnt});
- try
- mod1=char(DM.mod1{pertCnt});
- conc1=char(DM.conc1{pertCnt});
- catch
- mod1=' ';
- conc1=' ';
- end
- try
- mod2=char(DM.mod2{pertCnt});
- conc2=char(DM.conc2{pertCnt});
- catch
- mod2=' ';
- conc2=' ';
- end
-
- if ~isempty(outCmat)
- if isequal(opt,'Res')||isequal(opt,'Both')
- fprintf(fid,'%d\t %d\t %d\t %d\t %d\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t',s,p,r,c,n,selcode,drug,conc,media,mod1,conc1,mod2,conc2,orf,gene);
- fprintf(fid, '%.5f\t %.5f\t %.5f\t %.5f\t %.5f\t %.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f',...
- outCmat(n,1),riseTm,outCmat(n,3),outCmat(n,4),...
- outCmat(n,5),outCmat(n,6),outCmat(n,7),outCmat(n,8),...
- outCmat(n,9),outCmat(n,10),outCmat(n,11),outCmat(n,12),...
- outCmat(n,13),outCmat(n,14),outCmat(n,15),outCmat(n,16));
-
- fprintf(fid, '\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f',...
- outCmat(n,17),outCmat(n,18),outCmat(n,19),...
- outCmat(n,20),outCmat(n,21));
- % Added for data cut times used in 'r'optomized method 06/14/2018
- if (size(outCmat,2) == 27)
- fprintf(fid, '\t%.5f\t%.5f\t%.5f\t%.5f',...
- outCmat(n,24),outCmat(n,25),outCmat(n,26),outCmat(n,27));
- end
- fprintf(fid, '\t%d\t%d\t%d\t%d\t%d\t%d',...
- outCmat(n,22),outCmat(n,23),Diag(c,r,1,p),Diag(c,r,2,p),Diag(c,r,3,p),Diag(c,r,4,p)); %,Diag(r,c,3,p),Diag(r,c,4,p));
- end
- % DBfile
- if isequal(opt,'DB')||isequal(opt,'Both')
- dbRsq=0;dbKup=0; dbKlo=0; dbrup=0; dbrlo=0; dbLlo=0; dbLup=0;
- if isnumeric(outCmat(n,6)), dbRsq=outCmat(n,6);end
- if isnumeric(outCmat(n,7)), dbKup=outCmat(n,7);end
- if isnumeric(outCmat(n,8)), dbKlo=outCmat(n,8);end
- if isnumeric(outCmat(n,9)), dbrup=outCmat(n,9);end
- if isnumeric(outCmat(n,10)), dbrlo=outCmat(n,10);end
- if isnumeric(outCmat(n,11)), dbLlo=outCmat(n,11);end
- if isnumeric(outCmat(n,12)), dbLup=outCmat(n,12);end
- end
- if isequal(opt,'DB')||isequal(opt,'Both')
- fprintf(fid2,'%s\t %d\t %d\t %d\t %d\t %d\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t',projectName,s,p,r,c,n,selcode,drug,conc,media,mod1,conc1,mod2,conc2,orf,gene);
- fprintf(fid2, '%.5f\t %.5f\t %.5f\t %.5f\t %.5f\t %.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f',...
- outCmat(n,1),riseTm,outCmat(n,3),outCmat(n,4),...
- outCmat(n,5),dbRsq,dbKup,dbKlo,dbrup,dbrlo,dbLlo,dbLup); %\t%.5f\t%.5f\t%.5f\t%.5f
- end
- % Add Intensities series to end of curve fit data
- outIntens=[];
- outIntens=zeros(384,dataLength);
- intensBlob='';
- tmBlob='';
-
- for j=1:dataLength %size(RawIntens,2) %size(outTseries,1)
- if Ag(n)==0,Ag(n)=scan(s).Awindow;end
- outIntens(n,j)=RawIntens(n,j)/Ag(n);
- if isequal(opt,'Res')||isequal(opt,'Both')
- fprintf(fid, '\t%.5f', outIntens(n,j)); % Results print Intens
- end
- if isequal(opt,'DB')||isequal(opt,'Both')
- if j<dataLength
- intensBlob=strcat(intensBlob,num2str(outIntens(n,j)),';');
- else
- intensBlob=strcat(intensBlob,num2str(outIntens(n,j)));
- end
- if outTseries(j)<.0001,outTseries(j)=0;end
- if j<dataLength
- tmBlob=strcat(tmBlob,num2str(outTseries(j)),';');
- else
- tmBlob=strcat(tmBlob,num2str(outTseries(j)));
- end
- end
- end
- % Results
- if isequal(opt,'Res')||isequal(opt,'Both')
- for nn=1:numBlkCol %extend to col beyond longest rawDataSet
- fprintf(fid, '\t');
- end
- % Masterplate sheet
- if ~isnan(orfRep)
- fprintf(fid, '\t%s', orfRep); %print OrfRep
- else
- fprintf(fid, '\t%s', ' ');
- end
- if ~isnan(specifics)
- fprintf(fid, '\t%s', specifics);
- else
- fprintf(fid, '\t%s', ' ');
- end
- if ~isnan(strain)
- fprintf(fid, '\t%s', strain);
- else
- fprintf(fid, '\t%s', ' ');
- end
- fprintf(fid, '\n');
- ln=ln+1;
- fprintf(fid,'%d\t',ln);
- end
- % DB Raw Intensities and Timepoints
- if isequal(opt,'DB')||isequal(opt,'Both')
- fprintf(fid2, '\t%s\t%s',intensBlob,tmBlob );
- % Masterplate sheet
- if ~isnan(orfRep)
- fprintf(fid2, '\t%s',orfRep );
- else
- fprintf(fid2, '\t%s', ' ');
- end
- if ~isnan(specifics)
- fprintf(fid2, '\t%s',specifics );
- else
- fprintf(fid2, '\t%s', ' ');
- end
- if ~isnan(strain)
- fprintf(fid2, '\t%s',strain );
- else
- fprintf(fid2, '\t%s', ' ');
- end
- fprintf(fid2, '\n');
- end
- end
- end
- end
- end
- end
- if isequal(opt,'Res')||isequal(opt,'Both')
- fclose(fid);
- end
- % if isequal(opt,'DB')||isequal(opt,'Both')
- % fclose(fid2);
- % try
- % copyfile(DBfilename,DBupload)
- % catch ME
- % fprintf('DB upload failed with error: %s\n', getReport(ME, 'basic'));
- % rep=sprintf('Failed copyfile to %s - %s', DBupload, rep);
- % errordlg(rep);
- % end
- % end
- % Print results using the standard method
- try
- scan(1).plate(1).CFoutStd(1,1) %Test for 2018 r_refined version
- ln=1;
- resultsFilename=fullfile(printResultsDir, 'results_std.txt');
- DBfilename=fullfile(printResultsDir, 'DbaseStd.txt');
- if isequal(opt,'Res')||isequal(opt,'Both'),fid=fopen(resultsFilename,'w');end
- if isequal(opt,'DB')||isequal(opt,'Both'),fid2=fopen(DBfilename,'w');end %121012 Combo
- if isequal(opt,'Res')||isequal(opt,'Both') %print Results
- fprintf(fid,'%d\t',ln); %Results header
- fprintf(fid,'%s\t\n',projectScansDir);
- ln=ln+1;
- fprintf(fid,'%d\t',ln);
- end
- mpCnt=0;
- totPlCnt=0;
- drgCnt=0;
- medCnt=0;
- for s=1:size(scan,2)
- %Convolute scan array data into plates DconB for DBcombo
- clear Diag
- try
- Diag(:,:,:,1)= sbdg{s}(1:1:24,16:-1:1,:);
- catch
- sbdg{s};
- end
- for p=1:size((scan(s).plate),2)
- totPlCnt=totPlCnt+1;
- if destPerMP>1 &&rem(totPlCnt,destPerMP)==1, mpCnt=mpCnt+1; end
- if destPerMP==1,mpCnt=mpCnt+1; end
- pertCnt=rem(totPlCnt,destPerMP);
- if pertCnt==0, pertCnt= destPerMP;end
- pert=strcat('Perturb_',num2str(pertCnt));
- s % BCR seems wrong
-
- %Print Time Point HEADER for each plate for newly added intensity data
- if isequal(opt,'Res')||isequal(opt,'Both')
- fprintf(fid, '\n');
- ln=ln+1;
- fprintf(fid,'%d\t',ln);
- fprintf(fid,'Scan\tPlate\tRow\tCol\t');
-
- try
- asd=cell2mat(scan(s).plate(1).CFparameters(1));
- aucEndPt=strcat('AUC',num2str(asd(9)));
- catch
- asd=cell2mat(scan(s).plate(1).CFparameters{1,1}(1,384));
- aucEndPt=strcat('AUC',num2str(asd(9)));
- end
- fprintf(fid, 'Num.\tDiagnostics\tDrug\tConc\tMedia\tModifier1\tConc1\tModifier2\tConc2\tORF\tGene');
- fprintf(fid, '\t %s',aucEndPt);
- fprintf(fid, '\triseTm\tK\tr\tl\tR-squared\tK-lower\tK-upper\tr-lower\tr-upper\tl-lower\tl-upper\tArea\tLastInten\tSplineMaxRateTm\tLastFitTm\t1stFitTm\tMedianBase\tFitBase\tMinTm\tThreshTm\tTotFitPts\tPostThreshFitPts\t1stBackgrd\tLstBackgrd\t1stMeanTotBackgrd\tLstMeanTotBackgrd'); %17_0629 MinBaseIntens update for MedianBase label
- end
- clear outTseries
- outTseries=[];
- outTseries=scan(s).plate(p).tSeries;
- TseriesSize= size(outTseries,1);
- clear outCmat
- outCmat=scan(s).plate(p).CFoutStd;
- clear outIntens
- outIntens=[];
- RawIntens=[];
- RawIntens=scan(s).plate(p).intens;
- RawIntensSize=size(RawIntens,2);
- clear Ag; %Ag is Growth Area
- Ag=scan(s).plate(p).Ag;
- AgSize= size(Ag);
-
- dataLength= min(TseriesSize,RawIntensSize);
- if isequal(opt,'Res')||isequal(opt,'Both')
- for j=1:dataLength
- fprintf(fid, '\t%.5f', outTseries(j));
- end
- end
- numBlkCol=(maxNumIntens - dataLength); %size(outTseries,1));
- if isequal(opt,'Res')||isequal(opt,'Both')
- for nn=1:numBlkCol %extend to col beyond longest rawDataSet
- fprintf(fid, '\t');
- end
- fprintf(fid,'\tOrfRep');
- fprintf(fid,'\tSpecifics');
- fprintf(fid,'\tStrainBkGrd');
- fprintf(fid, '\n');
- ln=ln+1;
- fprintf(fid,'%d\t',ln);
- end
- % Data
- n=0;
- for r=1:16
- for c=1:24
- n=n+1;
- clear selcode;
- Kval=outCmat(n,3);
- rSq=outCmat(n,6);
- lval=outCmat(n,5);
- if Kval>160, selcode='K_Hi'; else selcode=' ';end
- if Kval<40, selcode=strcat(selcode,' K_Lo');end % TODO sprintf if you want a space
- if rSq<.97 && rSq>0, selcode=strcat(selcode,' rSqLo');end
- if lval>(0.85*(max(outTseries))), selcode=strcat(selcode,' late');end
- if isnan(outCmat(n,7))||isnan(outCmat(n,8))||isnan(outCmat(n,9))...
- ||isnan(outCmat(n,10))||isnan(outCmat(n,11))...
- ||isnan(outCmat(n,12)), selcode=strcat(selcode,' NaN');
- end
-
- % RiseTime Calculation
- K=(outCmat(n,3));
- R=(outCmat(n,4));
- L=(outCmat(n,5));
- if R>0 && L>0 && K>0
- rr=R; ll=L;
- tc1=eval(sols(2));
- tc2=eval(sols(3));
- LL=eval(sols(1));
- riseTm= LL-tc1;
- else
- riseTm=0;
- end
-
- if Ag(n)< .30*(scan(s).Awindow),selcode=strcat(selcode,' smArea'); end % same, need sprintf for space
- if outCmat(n,3)==0,selcode=strcat('0 ',selcode); end
- orf=cell2mat(MP(mpCnt).orf{1}(n));
- gene=cell2mat(MP(mpCnt).genename{1}(n));
- orfRep=cell2mat(MP(mpCnt).orfRep{1}(n));
- specifics=cell2mat(MP(mpCnt).specifics{1}(n));
- strain=cell2mat(MP(mpCnt).strain{1}(n));
- drug=char(DM.drug{pertCnt});
- conc=char(DM.conc{pertCnt});
- media=char(DM.media{pertCnt});
- try
- mod1=char(DM.mod1{pertCnt});
- conc1=char(DM.conc1{pertCnt});
- catch
- mod1=' ';
- conc1=' ';
- end
- try
- mod2=char(DM.mod2{pertCnt});
- conc2=char(DM.conc2{pertCnt});
- catch
- mod2=' ';
- conc2=' ';
- end
-
- if ~isempty(outCmat)
- if isequal(opt,'Res')||isequal(opt,'Both')
- fprintf(fid,'%d\t %d\t %d\t %d\t %d\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t',s,p,r,c,n,selcode,drug,conc,media,mod1,conc1,mod2,conc2,orf,gene);
- fprintf(fid, '%.5f\t %.5f\t %.5f\t %.5f\t %.5f\t %.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f',...
- outCmat(n,1),riseTm,outCmat(n,3),outCmat(n,4),...
- outCmat(n,5),outCmat(n,6),outCmat(n,7),outCmat(n,8),...
- outCmat(n,9),outCmat(n,10),outCmat(n,11),outCmat(n,12),...
- outCmat(n,13),outCmat(n,14),outCmat(n,15),outCmat(n,16));
-
- fprintf(fid, '\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%d\t%d',...
- outCmat(n,17),outCmat(n,18),outCmat(n,19),...
- outCmat(n,20),outCmat(n,21),outCmat(n,22),outCmat(n,23));
-
- fprintf(fid, '\t%d\t%d\t%d\t%d',...
- Diag(c,r,1,p),Diag(c,r,2,p),Diag(c,r,3,p),Diag(c,r,4,p)); %,Diag(r,c,3,p),Diag(r,c,4,p));
- end
- % DBFile
- % RiseTime calculation
- if isequal(opt,'DB')||isequal(opt,'Both')
- dbRsq= 0;dbKup= 0; dbKlo= 0; dbrup= 0; dbrlo= 0; dbLlo= 0; dbLup= 0;
- if isnumeric(outCmat(n,6)), dbRsq= outCmat(n,6);end
- if isnumeric(outCmat(n,7)), dbKup= outCmat(n,7);end
- if isnumeric(outCmat(n,8)), dbKlo= outCmat(n,8);end
- if isnumeric(outCmat(n,9)), dbrup= outCmat(n,9);end
- if isnumeric(outCmat(n,10)), dbrlo= outCmat(n,10);end
- if isnumeric(outCmat(n,11)), dbLlo= outCmat(n,11);end
- if isnumeric(outCmat(n,12)), dbLup= outCmat(n,12);end
- end
- if isequal(opt,'DB')||isequal(opt,'Both')
- fprintf(fid2,'%s\t %d\t %d\t %d\t %d\t %d\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t %s\t',projectName,s,p,r,c,n,selcode,drug,conc,media,mod1,conc1,mod2,conc2,orf,gene);
- fprintf(fid2, '%.5f\t %.5f\t %.5f\t %.5f\t %.5f\t %.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f\t%.5f',...
- outCmat(n,1),riseTm,outCmat(n,3),outCmat(n,4),...
- outCmat(n,5),dbRsq,dbKup,dbKlo,...
- dbrup,dbrlo,dbLlo,dbLup);
- end
- % DB Analysis
- % Add Intensities series to end of curve fit data
- outIntens=[];
- outIntens=zeros(384,dataLength);
- intensBlob='';
- tmBlob='';
- for j=1:dataLength %size(RawIntens,2) %size(outTseries,1)
- if Ag(n)==0,Ag(n)=scan(s).Awindow;end
- outIntens(n,j)= RawIntens(n,j)/Ag(n);
- if isequal(opt,'Res')||isequal(opt,'Both')
- fprintf(fid, '\t%.5f', outIntens(n,j)); % Results print Intens
- end
- if isequal(opt,'DB')||isequal(opt,'Both')
- if j<dataLength
- intensBlob=strcat(intensBlob,num2str(outIntens(n,j)),';');
- else
- intensBlob=strcat(intensBlob,num2str(outIntens(n,j)));
- end
- if outTseries(j)<.0001,outTseries(j)=0;end
- if j<dataLength
- tmBlob=strcat(tmBlob,num2str(outTseries(j)),';');
- else
- tmBlob=strcat(tmBlob,num2str(outTseries(j)));
- end
- end
- end
- % Results fprint
- if isequal(opt,'Res')||isequal(opt,'Both')
- for nn=1:numBlkCol %extend to col beyond longest rawDataSet
- fprintf(fid, '\t');
- end
- % Masterplate sheet
- if ~isnan(orfRep)
- fprintf(fid, '\t%s', orfRep); %print OrfRep
- else
- fprintf(fid, '\t%s', ' ');
- end
- if ~isnan(specifics)
- fprintf(fid, '\t%s', specifics);
- else
- fprintf(fid, '\t%s', ' ');
- end
- if ~isnan(strain)
- fprintf(fid, '\t%s', strain);
- else
- fprintf(fid, '\t%s', ' ');
- end
- fprintf(fid, '\n');
- ln=ln+1;
- fprintf(fid,'%d\t',ln);
- end
- % Raw Intensities and Timepoints
- if isequal(opt,'DB')||isequal(opt,'Both')
- fprintf(fid2, '\t%s\t%s',intensBlob,tmBlob );
- % Masterplate sheet
- if ~isnan(orfRep)
- fprintf(fid2, '\t%s',orfRep );
- else
- fprintf(fid2, '\t%s', ' ');
- end
- if ~isnan(specifics)
- fprintf(fid2, '\t%s',specifics );
- else
- fprintf(fid2, '\t%s', ' ');
- end
- if ~isnan(strain)
- fprintf(fid2, '\t%s',strain );
- else
- fprintf(fid2, '\t%s', ' ');
- end
- fprintf(fid2, '\n');
- end %DB print
- end %if ~isempty(outCmat)
- end %c
- end %r
- end %p
- end %s
- if isequal(opt,'Res')||isequal(opt,'Both')
- fclose(fid);
- end
- % if isequal(opt,'DB')||isequal(opt,'Both')
- % fclose(fid2);
- % try
- % copyfile(DBfilename,DBupload)
- % catch ME
- % fsprintf('DB upload failed with error: %s\n', getReport(ME, 'basic'));
- % rep=sprintf('Failed copyfile to %s - %s\n', DBupload, rep);
- % errordlg(rep)
- % end
- % end
- msgbox([sprintf('Printing script complete. Check results sheets in %s for results.', printResultsDir)])
- catch ME
- fprintf('Printing script failed with error: %s\n', getReport(ME, 'basic'));
- end
|