123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125 |
- global Expaa
- global Expbb
- global expType
- global scansDir
- global zonePB
- w=pwd;
- % Single Exp or Chronological Study
- % Construct a questdlg with three options
- Exp(expN).expLoadCnt=0;
- % Initiation for composite plotting cPlots
- Exp(expN).cTraceN=1;
- Exp(expN).cTraceIndx=1;
- Exp(expN).CompositPlot=0;
- choice='Cancel';
- expType=0;
- choice=questdlg('Choose Single Exp, Chronological Study OR Multi Exp', ...
- 'Experiment Type Menu', ...
- 'Single Exp','Chronological Study','Multi Exp','Single Exp');
- % Handle response
- switch choice
- case 'Single Exp'
- disp([choice 'Single Exp Selected'])
- expType=1;
- case 'Chronological Study'
- disp([choice 'Chronological Study Selected'])
- expType=2;
- case 'Multi Exp'
- disp([choice 'Multi Exp Selected'])
- expType=3;
- case 'Cancel'
- disp('Cancel Load Exp')
- expType=0
- end
- fprintf('expType=%d\n',expType);
- if expType==0, return; end
- zonePB=expN;
- % Pre Load setup incase failure to Load occurs
- % updated 230818 to migrate to AppDesigner
- if expN==1
- set(handles.zonePB1,'value',1);
- set(handles.zonePB2,'value',0);
- set(handles.zonePB3,'value',0);
- set(handles.zonePB1,'BackgroundColor',[1.0 0.6 0.6]);
- set(handles.zonePB2,'BackgroundColor',[1.0 1.0 1.0]);
- set(handles.zonePB3,'BackgroundColor',[1.0 1.0 1.0]);
- end
- if expN==2
- set(handles.zonePB2,'value',1);
- set(handles.zonePB1,'value',0);
- set(handles.zonePB3,'value',0);
- set(handles.zonePB2,'BackgroundColor',[1.0 0.6 0.6]);
- set(handles.zonePB1,'BackgroundColor',[1.0 1.0 1.0]);
- set(handles.zonePB3,'BackgroundColor',[1.0 1.0 1.0]);
- end
- if expN==3
- set(handles.zonePB3,'value',1);
- set(handles.zonePB1,'value',0);
- set(handles.zonePB2,'value',0);
- set(handles.zonePB3,'BackgroundColor',[1.0 0.6 0.6]);
- set(handles.zonePB1,'BackgroundColor',[1.0 1.0 1.0]);
- set(handles.zonePB2,'BackgroundColor',[1.0 1.0 1.0]);
- end
- Exp(expN).htmapRFanswer={'G','L'}; %ZoneData
- if expType==1
- Exp(expN).DexpType='single';
- % Test for Bad MP cell array (usually 384 [NaN}'s)
- % replaced length(Exp(expN).Dexp(1).MP) with MPnum
- for mx=1:length(Exp(expN).Dexp(1).MP)
- try
- char((Exp(expN).Dexp(1).MP(mx).genename{1}(384)))
- MPnum=mx;
- catch
- break
- end
- end
- datacursormode off;
-
- % Return without execution if user cancels or doesn't select a .mat file
- try
- if matFile==0 || scansDir==0
- return
- end
- catch
- end
- if expN==1 || expN==2 || expN==3
- orfLstSel=get(handles.GeneOrfTog,'value')
- end
- Exp(expN).Dexp(1).srtGnLst={('CheckMP/MPDMfile')};
- Exp(expN).Dexp(1).srtOrfLst={('CheckMP/MPDMfile')};
- set(handles.listboxGnOrf,'value',1) %Fix accomodation for bug in App Designer .. .wlapp converter 230906
- set(handles.listboxGnOrf,'string',cellstr([{'Failed To Load'}; {' '}]));
- load(matFile);
- cd(scansDir)
- cd ..;
- resDir=pwd;
- Exp(expN).Dexp(1).resDir=resDir;
- cd ..;
- try % this try-catch is to go up one more dir if the images aren't found (from /OtherResults)
- test4imageDir=imread(fullfile(pwd,'1','1.bmp'));
- ExpPath=pwd;
- Exp(expN).Dexp(1).ExpFoldr=ExpPath;
- catch
- try
- cd ..
- test4imageDir=imread(fullfile(pwd,'1','1.bmp'));
- ExpPath=pwd;
- Exp(expN).Dexp(1).ExpFoldr=ExpPath;
- catch
- cd(w)
- end
- end
- cd(w)
- % Experiment Loads
- % load (fullfile(ExpFoldr,'MasterPlateFiles','MPDMmat.mat'))
- load(fullfile(Exp(expN).Dexp(1).ExpFoldr,'MasterPlateFiles','MPDMmat.mat'))
- load(fullfile(resDir,'Fotos','Coordinates'))
- load(fullfile(resDir,'Fotos','anlZones'))
- load(fullfile(resDir,'Fotos','BGatTpts'))
- load(fullfile(resDir,'PTmats','NImParameters'))
- %Backup for cond. sothat failure to load is recovered back prev. ExpJob data
- Exp(expN).Dexp(1).temp.DM=DM;
- Exp(expN).Dexp(1).temp.MP=MP;
- Exp(expN).Dexp(1).temp.scan=scan;
- Exp(expN).Dexp(1).temp.FexpScanSpots=FexpScanSpots;
- Exp(expN).Dexp(1).temp.FexpScanBMtp=FexpScanBMtp;
- Exp(expN).Dexp(1).temp.anlZoneRefs=anlZoneRefs;
- Exp(expN).Dexp(1).temp.ImParMat=ImParMat;
- Exp(expN).Dexp(1).DM=Exp(expN).Dexp(1).temp.DM;
- Exp(expN).Dexp(1).MP=Exp(expN).Dexp(1).temp.MP;
- Exp(expN).Dexp(1).scan=Exp(expN).Dexp(1).temp.scan;
- Exp(expN).Dexp(1).FexpScanSpots=Exp(expN).Dexp(1).temp.FexpScanSpots;
- Exp(expN).Dexp(1).FexpScanBMtp=Exp(expN).Dexp(1).temp.FexpScanBMtp;
- Exp(expN).Dexp(1).anlZoneRefs=Exp(expN).Dexp(1).temp.anlZoneRefs;
- Exp(expN).Dexp(1).ImParMat=Exp(expN).Dexp(1).temp.ImParMat;
- Exp(expN).DexpLength=1;
- Exp(expN).Dexp((Exp(expN).DexpLength+1):end)=[];
- % Load new ExpJob
- if expN==1,
- % Exp(1).traceN=0;
- tPtsSize=size(FexpScanBMtp{1,1},3);
- set(handles.MPsldr1,'max',length(MP));
- set(handles.DMsldr1,'max',length(DM.drug));
- set(handles.Tptsldr1,'max',tPtsSize);
- % MPnum=length(Exp(expN).Dexp(1).MP);
- set(handles.MPsldr1,'min',1) %,'max',MPnum+.1)
- DMnum=length(Exp(expN).Dexp(1).DM.drug);
- set(handles.DMsldr1,'min',1,'max',DMnum)
- tPtsSize=size(Exp(expN).Dexp(1).FexpScanBMtp{1,1},(3));
- set(handles.Tptsldr1,'min',1,'max',tPtsSize)
- set(handles.MPsldr1,'value',1)
- set(handles.DMsldr1,'value',1)
- set(handles.Tptsldr1,'value',1)
- set(handles.MPed1,'string','1')
- set(handles.DMed1,'string','1')
- set(handles.Tpted1,'string','1')
- set(handles.MPsldr1,'SliderStep',[1/length(MP) 1/length(MP)]);
- set(handles.DMsldr1,'SliderStep',[1/length(DM.drug) 1/length(DM.drug)]);
- set(handles.Tptsldr1,'SliderStep',[1/tPtsSize 1/tPtsSize]);
- set(handles.DN1,'value',1)
- set(handles.DN1,'string',1)
- end
- if expN==2,
- %Exp(2).traceN=0;
- tPtsSize=size(FexpScanBMtp{1,1},3);
- set(handles.MPsldr2,'max',length(MP));
- set(handles.DMsldr2,'max',length(DM.drug));
- set(handles.Tptsldr2,'max',tPtsSize);
- %MPnum=length(Exp(expN).Dexp(1).MP);
- set(handles.MPsldr2,'min',1) %,'max',MPnum)
- DMnum=length(Exp(expN).Dexp(1).DM.drug);
- set(handles.DMsldr2,'min',1,'max',DMnum)
- tPtsSize=size(Exp(expN).Dexp(1).FexpScanBMtp{1,1},(3));
- set(handles.Tptsldr2,'min',1,'max',tPtsSize)
- set(handles.MPsldr2,'value',1)
- set(handles.DMsldr2,'value',1)
- set(handles.Tptsldr2,'value',1)
- set(handles.MPed2,'string','1')
- set(handles.DMed2,'string','1')
- set(handles.Tpted2,'string','1')
- set(handles.MPsldr2,'SliderStep',[1/length(MP) 1/length(MP)]);
- set(handles.DMsldr2,'SliderStep',[1/length(DM.drug) 1/length(DM.drug)]);
- set(handles.Tptsldr2,'SliderStep',[1/tPtsSize 1/tPtsSize]);
- set(handles.DN2,'value',1)
- set(handles.DN2,'string',1)
- end
- if expN==3,
- % Exp(3).traceN=0;
- tPtsSize=size(FexpScanBMtp{1,1},3);
- set(handles.MPsldr3,'max',length(MP));
- set(handles.DMsldr3,'max',length(DM.drug));
- set(handles.Tptsldr3,'max',tPtsSize);
- % MPnum=length(Exp(expN).Dexp(1).MP);
- set(handles.MPsldr3,'min',1) %,'max',MPnum)
- DMnum=length(Exp(expN).Dexp(1).DM.drug);
- set(handles.DMsldr3,'min',1,'max',DMnum)
- tPtsSize=size(Exp(expN).Dexp(1).FexpScanBMtp{1,1},(3));
- set(handles.Tptsldr3,'min',1,'max',tPtsSize)
- set(handles.MPsldr3,'value',1)
- set(handles.DMsldr3,'value',1)
- set(handles.Tptsldr3,'value',1)
- set(handles.MPed3,'string','1')
- set(handles.DMed3,'string','1')
- set(handles.Tpted3,'string','1')
- set(handles.MPsldr3,'SliderStep',[1/length(MP) 1/length(MP)]);
- set(handles.DMsldr3,'SliderStep',[1/length(DM.drug) 1/length(DM.drug)]);
- set(handles.Tptsldr3,'SliderStep',[1/tPtsSize 1/tPtsSize]);
- set(handles.DN3,'value',1)
- set(handles.DN3,'string',1)
- end
- if expN==1,
- set(handles.GeneOrfLoc1,'string',{''});
- set(handles.graphStrLoc1,'string',{''});
- cla(handles.Paxes1);
- end
- if expN==2
- set(handles.GeneOrfLoc2,'string',{''});
- set(handles.graphStrLoc2,'string',{''});
- cla(handles.Paxes2)
- end
- if expN==3
- set(handles.GeneOrfLoc3,'string',{''});
- set(handles.graphStrLoc3,'string',{''})
- cla(handles.Paxes3)
- end
- Exp(expN).Dexp(1).srtGnLst={('CheckMP/MPDMfile')};
- Exp(expN).Dexp(1).srtOrfLst={('CheckMP/MPDMfile')};
- set(handles.listboxGnOrf,'string',Exp(expN).Dexp(1).srtGnLst)
- set(handles.listboxGnOrf,'string',Exp(expN).Dexp(1).srtOrfLst)
- EZVimDisplay
- % Capture Exp Name
- try
- xp=char(Exp(expN).Dexp(1).resDir);
- if ispc,
- slashPos=strfind(char(Exp(expN).Dexp(1).resDir),'\');
- else
- slashPos=strfind(char(Exp(expN).Dexp(1).resDir),'/');
- end
- startPos=slashPos(length(slashPos)-2) +1;
- endPos=(slashPos(length(slashPos)) -1);
- expStrn=xp(startPos:end);
- if expN==1,set(handles.expName1,'string',expStrn);end
- if expN==2,set(handles.expName2,'string',expStrn);end
- if expN==3,set(handles.expName3,'string',expStrn);end
- catch
- catchissue='Ln198'
- end % nested try-catch-end
- % Compile GeneList and OrfList
- % Sort and add the medians of Ref Plates if RF1,RF2 exist
- % Added 17-1023 For User Addition of Gene Composites to ListBox
- Expaa{expN,1}=[];
- Expbb{expN,1}=[];
- lstindx=0;
- lstindxOrf=0;
- spN=0;
- rfcnt=0;
- dRF1indx=0;
- RF1mp=[];
- RF2mp=[];
- for mp=1:MPnum % length(Exp(expN).Dexp(1).MP)
-
- for ind384=1:384
- spN=spN+1;
- try % Temp find data error
- r=ceil(ind384/24);
- if rem(ind384,24)==0, c=24; else c=rem(ind384,24); end
- % Insert test for numeric in genename and orf if isnumeric
- % Correct common EXCEL problem of converting OCT1 into a date numeric
- if cell2mat(Exp(expN).Dexp(1).MP(mp).genename{1}(ind384))==38991,
- Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)={'OCT1_'};
- elseif isnumeric(cell2mat(Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)))
- Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)={' '};
- end
- % Check for full(384spot) Reference Plates (RF1 or/and RF2)
- RF1fullPlate=0;
- try RF1fullPlate=sum(ismember((Exp(expN).Dexp(1).MP(mp).genename{1}),'RF1'))==384; catch, mp, msg=strcat(num2str(mp),' genename ERROR'), end
- RF2fullPlate=0;
- try RF2fullPlate=sum(ismember((Exp(expN).Dexp(1).MP(mp).genename{1}),'RF2'))==384; catch, mp, msg=strcat(num2str(mp),' genename ERROR'), end
-
- if isempty(regexpi(char((Exp(expN).Dexp(1).MP(mp).orf{1}(ind384))),'blank'))... % '\<blank\>'
- && ~isnumeric(Exp(expN).Dexp(1).MP(mp).orf{1}(ind384))...
- && ~strcmpi((Exp(expN).Dexp(1).MP(mp).orf{1}(ind384)),' ')...
- && ~strcmpi((Exp(expN).Dexp(1).MP(mp).orf{1}(ind384)),' ')...
- && ~strcmpi((Exp(expN).Dexp(1).MP(mp).orf{1}(ind384)),'')...
- && ~isempty((Exp(expN).Dexp(1).MP(mp).orf{1}(ind384)))...
- && (~strcmpi((Exp(expN).Dexp(1).MP(mp).orf{1}(ind384)),'RF1'))... %||~strcmpi((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),'RF1'))... %&& mp==1)...
- && (~strcmpi((Exp(expN).Dexp(1).MP(mp).orf{1}(ind384)),'RF2'))... %||~strcmpi((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),'RF2'))... %&& mp==length(Exp(expN).Dexp(1).MP))...
- && iscellstr((Exp(expN).Dexp(1).MP(mp).orf{1}(ind384)))
- lstindxOrf=lstindxOrf+1;
- Exp(expN).Dexp(1).MP(mp).orf{1}(ind384)=strrep((Exp(expN).Dexp(1).MP(mp).orf{1}(ind384)),':',' ');
- bb(lstindxOrf,1)=(Exp(expN).Dexp(1).MP(mp).orf{1}(ind384));
- bb(lstindxOrf,2)={strcat(':',num2str(mp),':',num2str(r),':',num2str(c))};
- bb(lstindxOrf,3)={mp};
- bb(lstindxOrf,4)={r};
- bb(lstindxOrf,5)={c};
- mutorfs(lstindxOrf)=spN; %16_0318 added for Interaction EZinteract
- %Exp(expN).Dexp(1).mutSpotIndx(lstindxOrf)=spN; %16_0318 added for Interaction EZinteract
- end
- if isempty(regexpi(char((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384))),'blank'))... % '\<blank\>'
- && ~isnumeric(Exp(expN).Dexp(1).MP(mp).genename{1}(ind384))...
- && ~strcmpi((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),' ')...
- && ~strcmpi((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),' ')...
- && ~strcmpi((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),'')...
- && ~isempty((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)))...
- && (~strcmpi((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),'RF1'))... %&& ~RF1fullPlate)...
- && (~strcmpi((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),'RF2'))... %&& ~RF2fullPlate)...
- && iscellstr((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)))
- lstindx=lstindx+1;
- Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)=strrep((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),':',' ');
- aa(lstindx,1)=(Exp(expN).Dexp(1).MP(mp).genename{1}(ind384));
- aa(lstindx,2)={strcat(':',num2str(mp),':',num2str(r),':',num2str(c))};
- aa(lstindx,3)={mp};
- aa(lstindx,4)={r};
- aa(lstindx,5)={c};
- mutgenes(lstindx)=spN;
- elseif (RF1fullPlate==1 ... % sum(ismember((Exp(expN).Dexp(1).MP(mp).genename{1}),'RF1'))==384 || ...
- || (((length(unique(Exp(expN).Dexp(1).MP(mp).genename{1}(1:384))))==1 && mp==1 ) ... %(isequal((Exp(expN).Dexp(1).MP(mp).genename{1}(1:384)), (Exp(expN).Dexp(1).MP(mp).genename{1}(384:-1:1)))&& mp==1 )) && ...
- && ~exist('RF1scanN','var')))
- rfcnt=rfcnt+1;
- RFs(spN:spN+383)=spN:spN+383;
- RF1mp=mp
- RF1scanN=(mp*DMnum)-(DMnum-1)
- elseif (RF2fullPlate==1||... % sum(ismember((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),'RF2'))==384 ||...
- (((length(unique(Exp(expN).Dexp(1).MP(mp).genename{1}(1:384))))==1 && mp==MPnum ) ...
- && ~exist('RF2scanN','var')))
- rfcnt=rfcnt+1;
- RFs(spN:spN+383)=spN:spN+383;
- RF2mp=mp
- RF2scanN=(mp*DMnum)-(DMnum-1)
- % Dispersed Reference capture and find Medians
- elseif strcmpi((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),'RF1') ...
- && (RF1fullPlate~=1)
- dRF1indx=dRF1indx+1;
- Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)=strrep((Exp(expN).Dexp(1).MP(mp).genename{1}(ind384)),':',' ');
- drf(dRF1indx,1)=(Exp(expN).Dexp(1).MP(mp).genename{1}(ind384));
- drf(dRF1indx,2)={strcat(':',num2str(mp),':',num2str(r),':',num2str(c))};
- drf(dRF1indx,3)={mp}; drfMP(dRF1indx,mp)=mp;
- drf(dRF1indx,4)={r}; drfr(dRF1indx,mp)=r;
- drf(dRF1indx,5)={c}; drfc(dRF1indx,mp)=c;
- drf(dRF1indx,6)={ind384}; drfPindx(dRF1indx,mp)=ind384;
- end
- catch
- error='EZexpSel lineAfter 236 EZexpSel.m'
- mp
- ind384
- msgBadGeneName=strcat('check genename at mp=',num2str(mp),' indx=',num2str(ind384))
- end
- end
- mp
- end
- % Cover case if mutorfs RFs are labeled RF1 or RF2
- try
- Exp(expN).Dexp(1).mutSpotIndx.wRFs=union(RFs, mutorfs);
- catch
- msg='No RFs Found in Exp! wRFs'
- Exp(expN).Dexp(1).mutSpotIndx.wRFs=mutorfs;
- end
- try
- Exp(expN).Dexp(1).mutSpotIndx.woRFs=setdiff(mutorfs,RFs);
- catch
- Exp(expN).Dexp(1).mutSpotIndx.woRFs=mutorfs;
- msg='No RFs Found in Exp! woRFs'
- end
- Exp(expN).Dexp(1).RFmd1indx=[];
- Exp(expN).Dexp(1).RFmd1LB={[]};
- Exp(expN).Dexp(1).RFmd1pltN={};
- Exp(expN).Dexp(1).RFmd1val=[];
- Exp(expN).Dexp(1).mean1=[];
- Exp(expN).Dexp(1).std1=[];
- Exp(expN).Dexp(1).min1=[];
- Exp(expN).Dexp(1).max1=[];
- Exp(expN).Dexp(1).RFcmpK=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpL=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFmd2indx=[];
- Exp(expN).Dexp(1).RFmd2LB={[]};
- Exp(expN).Dexp(1).RFmd2pltN={};
- Exp(expN).Dexp(1).RFmd2val=[];
- Exp(expN).Dexp(1).mean2=[];
- Exp(expN).Dexp(1).std2=[];
- Exp(expN).Dexp(1).min2=[];
- Exp(expN).Dexp(1).max2=[];
- Exp(expN).Dexp(1).RFmean=[];
- Exp(expN).Dexp(1).RFstd=[];
- Exp(expN).Dexp(1).RFmin=[];
- Exp(expN).Dexp(1).RFmax=[];
- Exp(expN).Dexp(1).RFmdPLvals=[]; %17_1201 TrendOL
- Exp(expN).Dexp(1).RFmdPLB={[]};
- Exp(expN).Dexp(1).RFmdPindx=[];
- Exp(expN).Dexp(1).RFmdPpltN=[];
- Exp(expN).Dexp(1).RFmdPscanN=[];
- Exp(expN).Dexp(1).RFmedianP=[];
- Exp(expN).Dexp(1).stdP=[];
- Exp(expN).Dexp(1).meanP=[];
- Exp(expN).Dexp(1).minP=[];
- Exp(expN).Dexp(1).maxP=[];
- Exp(expN).Dexp(1).RFcmpPK=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpPr=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpPL=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFmdGLB={[]};
- Exp(expN).Dexp(1).RFmdGindx=[];
- Exp(expN).Dexp(1).RFmdGpltN=[];
- Exp(expN).Dexp(1).RFmdGscanN=[];
- Exp(expN).Dexp(1).RFmedianG=[];
- Exp(expN).Dexp(1).RFmeanG=[];
- Exp(expN).Dexp(1).RFstdG=[];
- Exp(expN).Dexp(1).RFminG=[];
- Exp(expN).Dexp(1).RFmaxG=[];
- Exp(expN).Dexp(1).RFcmpGK=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGr=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGL=[]; %For Ref Composite 17_1009
- %{
- Exp(expN).Dexp(1).RFmeanGK=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFstdGK=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFminGK=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFmaxGK=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFmeanGr=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFstdGr=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFminGr=[]; %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFmaxGr=[]; %For Ref Composite 17_1009
- %}
- if exist('RF1scanN','var')
- for d=0:(DMnum-1)
- medianIndx=[];
- nonZeroIndx=[];
- medValList=[];
- rf1scN=RF1scanN+d;
- try % if RF1scanN doesn't exist this addition to list will be skipped
- nonZeroIndx=find(Exp(expN).Dexp(1).scan(rf1scN).plate(1).CFout(1:384,5));
- if isempty(nonZeroIndx)
- nonZeroCnt=0
- medianIndx=nonZeroIndx;
- else
- nonZeroCnt=length(nonZeroIndx);
- end
- if ~isempty(nonZeroIndx) && mod(nonZeroCnt,2)==0, medianIndx=nonZeroIndx(1:nonZeroCnt-1); end
- if ~isempty(nonZeroIndx) && mod(nonZeroCnt,2)~=0, medianIndx=nonZeroIndx; end
- clear medValLst
- clear kValLst
- clear rValLst
- if ~isempty(nonZeroIndx) && length(medianIndx) > (.15*384) %To calc. a median, more than 15% of spots must be nonZero
- medValLst=Exp(expN).Dexp(1).scan(rf1scN).plate(1).CFout(medianIndx,5);
- medValList1{d+1}=medValLst;
- min1=min(medValLst);
- max1=max(medValLst);
- std1=std(medValLst);
- mean1=mean(medValLst);
- kValLst=Exp(expN).Dexp(1).scan(rf1scN).plate(1).CFout(medianIndx,3); %For Ref Composite 17_1009
- rValLst=Exp(expN).Dexp(1).scan(rf1scN).plate(1).CFout(medianIndx,4); %For Ref Composite 17_1009
- mval1=median(medValLst); %mval1=median(Exp(expN).Dexp(1).scan(RF1mps).plate(1).CFout(1:384,5)); %CFout(1:383,5));
- RFmd1pos=find(mval1==(Exp(expN).Dexp(1).scan(rf1scN).plate(1).CFout(1:384,5)));
- RFmd1loc(1)=ceil(RFmd1pos/24); %calc r value
- RFmd1loc(2)=RFmd1pos - ((RFmd1loc(1)-1)*24); %calc c value
- lstindx=lstindx+1;
- lstindxOrf=lstindxOrf+1;
- aa(lstindx,1)={strcat('RF1md(',num2str(d+1),')')}; %{'RF1md'};
- aa(lstindx,2)={strcat(':',num2str(RF1mp),':',num2str(RFmd1loc(1)),':',num2str(RFmd1loc(2)))}; %,'std_',num2str(std1))};
- bb(lstindxOrf,1)={strcat('RF1md(',num2str(d+1),')')}; %{'RF1md'};
- bb(lstindxOrf,2)={strcat(':',num2str(RF1mp),':',num2str(RFmd1loc(1)),':',num2str(RFmd1loc(2)))}; %,'std_',num2str(std1))};
- % Composite Reference Amalgum Plot *********************
- lstindx=lstindx+1;
- lstindxOrf=lstindxOrf+1;
- aa(lstindx,1)={strcat('RF1cmp(',num2str(d+1),')')};
- aa(lstindx,2)={''};
- bb(lstindxOrf,1)={strcat('RF1cmp(',num2str(d+1),')')};
- bb(lstindxOrf,2)={''};
- Exp(expN).Dexp(1).RFmd1LB(d+1)=strcat(aa(lstindx,1),aa(lstindx,2));
- Exp(expN).Dexp(1).RFmd1indx(d+1)=RFmd1pos;
- Exp(expN).Dexp(1).RFmd1pltN=RF1mp;
- Exp(expN).Dexp(1).RFmd1val(d+1)=mval1;
- Exp(expN).Dexp(1).RFmd1Lvals=medValLst; %17_1201 TrendOL
- Exp(expN).Dexp(1).mean1(d+1)=mean1;
- Exp(expN).Dexp(1).std1(d+1)=std1;
- Exp(expN).Dexp(1).min1(d+1)=min1;
- Exp(expN).Dexp(1).max1(d+1)=max1;
- Exp(expN).Dexp(1).RFcmpL(1).dm(d+1).Lvals=medValLst; %17_1201 TrendOL
- Exp(expN).Dexp(1).RFcmpL(1).dm(d+1).med=median(medValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpL(1).dm(d+1).mean=mean(medValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpL(1).dm(d+1).std=std(medValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpL(1).dm(d+1).min=min(medValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpL(1).dm(d+1).max=max(medValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpK(1).dm(d+1).Kvals=kValLst; %17_1201 TrendOL
- Exp(expN).Dexp(1).RFcmpK(1).dm(d+1).med=median(kValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpK(1).dm(d+1).mean=mean(kValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpK(1).dm(d+1).std=std(kValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpK(1).dm(d+1).min=min(kValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpK(1).dm(d+1).max=max(kValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr(1).dm(d+1).rvals=rValLst; %17_1201 TrendOL
- Exp(expN).Dexp(1).RFcmpr(1).dm(d+1).med=median(rValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr(1).dm(d+1).mean=mean(rValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr(1).dm(d+1).std=std(rValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr(1).dm(d+1).min=min(rValLst); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr(1).dm(d+1).max=max(rValLst); %For Ref Composite 17_1009
- else
- % Need to set L r K values to zeros or pick the first spot with zeros
- % Spot 1 could be other than zero as the median isn't calculated if
- % fewer than some percent are nonzero
- medianCalcFailed='To Few nonZero spots for valid median RF1 selection'
- firstZero=find(((Exp(expN).Dexp(1).scan(rf1scN).plate(1).CFout(1:384,5))==0),1,'first')
- Exp(expN).Dexp(1).RFmd1indx(d+1)=firstZero;
- Exp(expN).Dexp(1).RFmd1pltN=RF1mp;
- try
- medValList1{d+1}=Exp(expN).Dexp(1).scan(rf1scN).plate(1).CFout(medianIndx,5); nonZeroCnt;
- catch
- catcherror='Ln356'
- end
- end % ~isempty(nonZeroIndx) && length(medianIndx) > (.15*384)
- catch
- medianCalcTryFailed1='Failed! Failed! Ln362 But process continued with bogus P1ind384 spot value!'
- try
- firstZero=find(((Exp(expN).Dexp(1).scan(rf1scN).plate(1).CFout(1:384,5))==0),1,'first')
- Exp(expN).Dexp(1).RFmd1indx(d+1)=firstZero;
- catch
- catchissue='Ln366'
- Exp(expN).Dexp(1).RFmd1indx(d+1)=384; % if crapout,Then use spot384 as default to keep going
- end
- try
- Exp(expN).Dexp(1).RFmd1pltN=RF1mp;
- catch
- catchissue='Ln372'
- Exp(expN).Dexp(1).RFmd1pltN=1;
- end
- end
- end
- end
- % Calc RF2 median if a full plate of RF2s exist
- Exp(expN).Dexp(1).RFmd2indx=[];
- Exp(expN).Dexp(1).RFmd2pltN=[];
- if exist('RF2scanN','var')
- for d=0:(DMnum-1)
- medianIndx2=[];
- nonZeroIndx2=[];
- medValList2=[];
- rf2scN=RF2scanN+d;
- try % if RF2scanN doesn't exist this addition to list will be skipped
- nonZeroIndx2=find(Exp(expN).Dexp(1).scan(rf2scN).plate(1).CFout(1:384,5));
- if isempty(nonZeroIndx2)
- nonZeroCnt2=0
- medianIndx2=nonZeroIndx2;
- else nonZeroCnt2=length(nonZeroIndx2);
- end
- if ~isempty(nonZeroIndx2) && mod(nonZeroCnt2,2)==0, medianIndx2=nonZeroIndx2(1:nonZeroCnt2-1); end
- if ~isempty(nonZeroIndx2) && mod(nonZeroCnt2,2)~=0, medianIndx2=nonZeroIndx2; end
- clear medValLst2
- clear kValLst2
- clear rValLst2
- if ~isempty(nonZeroIndx2) && length(medianIndx2) > (.15*384) % to calc. a median, more than 15% of spots must be nonZero
- medValLst2=Exp(expN).Dexp(1).scan(rf2scN).plate(1).CFout(medianIndx2,5);
- medValList2{d+1}=medValLst2;
- min2=min(medValLst2);
- max2=max(medValLst2);
- std2=std(medValLst2);
- mean2=mean(medValLst2);
- kValLst2=Exp(expN).Dexp(1).scan(rf2scN).plate(1).CFout(medianIndx2,3); % for Ref Composite 17_1009
- rValLst2=Exp(expN).Dexp(1).scan(rf2scN).plate(1).CFout(medianIndx2,4); % for Ref Composite 17_1009
- mval2=median(medValLst2); %mval2=median(Exp(expN).Dexp(1).scan(RF2mps).plate(1).CFout(1:383,5));
- RFmd2pos=find(mval2==(Exp(expN).Dexp(1).scan(rf2scN).plate(1).CFout(1:384,5)));
- RFmd2loc(1)=ceil(RFmd2pos/24); %calc r value
- RFmd2loc(2)=RFmd2pos - ((RFmd2loc(1)-1)*24); %calc c value
- lstindx=lstindx+1;
- lstindxOrf=lstindxOrf+1;
- aa(lstindx,1)={strcat('RF2md(',num2str(d+1),')')}; %{'RF2md'};
- aa(lstindx,2)={strcat(':',num2str(RF2mp),':',num2str(RFmd2loc(1)),':',num2str(RFmd2loc(2)))}; %,'std_',num2str(std2))};
- bb(lstindxOrf,1)={strcat('RF2md(',num2str(d+1),')')}; %{'RF2md'};
- bb(lstindxOrf,2)={strcat(':',num2str(RF2mp),':',num2str(RFmd2loc(1)),':',num2str(RFmd2loc(2)))}; %,'std_',num2str(std2))};
- %Composite Reference Amalgum Plot (CRAP)
- lstindx=lstindx+1;
- lstindxOrf=lstindxOrf+1;
- aa(lstindx,1)={strcat('RF2cmp(',num2str(d+1),')')};
- aa(lstindx,2)={''};
- bb(lstindxOrf,1)={strcat('RF2cmp(',num2str(d+1),')')};
- bb(lstindxOrf,2)={''};
- Exp(expN).Dexp(1).RFmd2LB(d+1)=strcat(aa(lstindx,1),aa(lstindx,2));
- Exp(expN).Dexp(1).RFmd2indx(d+1)=RFmd2pos;
- Exp(expN).Dexp(1).RFmd2pltN=RF2mp;
- Exp(expN).Dexp(1).RFmd2val(d+1)=mval2;
- Exp(expN).Dexp(1).RFmd1Lvals=medValLst2; %17_1201 TrendOL
- Exp(expN).Dexp(1).mean2(d+1)=mean2;
- Exp(expN).Dexp(1).std2(d+1)=std2;
- Exp(expN).Dexp(1).min2(d+1)=min2;
- Exp(expN).Dexp(1).max2(d+1)=max2;
- Exp(expN).Dexp(1).RFcmpL(2).dm(d+1).Lvals=medValLst2; %17_1201 TrendOL
- Exp(expN).Dexp(1).RFcmpL(2).dm(d+1).med=median(medValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpL(2).dm(d+1).mean=mean(medValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpL(2).dm(d+1).std=std(medValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpL(2).dm(d+1).min=min(medValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpL(2).dm(d+1).max=max(medValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpK(2).dm(d+1).Kvals=kValLst2; %17_1201 TrendOL
- Exp(expN).Dexp(1).RFcmpK(2).dm(d+1).med=median(kValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpK(2).dm(d+1).mean=mean(kValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpK(2).dm(d+1).std=std(kValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpK(2).dm(d+1).min=min(kValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpK(2).dm(d+1).max=max(kValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr(2).dm(d+1).rvals=rValLst2; %17_1201 TrendOL
- Exp(expN).Dexp(1).RFcmpr(2).dm(d+1).med=median(rValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr(2).dm(d+1).mean=mean(rValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr(2).dm(d+1).std=std(rValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr(2).dm(d+1).min=min(rValLst2); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpr(2).dm(d+1).max=max(rValLst); %For Ref Composite 17_1009
- else
- % Pick the first spot with zeros
- % Use that position to satisfy and keep process OK
- medianCalcFailed2='Too Few nonZero spots for valid median RF2 selection'
- firstZero2=find(((Exp(expN).Dexp(1).scan(rf2scN).plate(1).CFout(1:384,5))==0),1,'first')
- Exp(expN).Dexp(1).RFmd2indx(d+1)=firstZero2;
- Exp(expN).Dexp(1).RFmd2pltN=RF2mp;
- try medValList2{d+1}=Exp(expN).Dexp(1).scan(rf2scN).plate(1).CFout(medianIndx2,5); nonZeroCnt2; catch, catchissue='Ln431', end
- end
- catch
- medianCalcTryFailed2='Failed! Failed! Ln436 No RF1median But process continued with bogus P1ind384 spot value!'
- try
- firstZero2=find(((Exp(expN).Dexp(1).scan(rf2scN).plate(1).CFout(1:384,5))==0),1,'first');
- Exp(expN).Dexp(1).RFmd2indx(d+1)=firstZero2;
- catch
- Exp(expN).Dexp(1).RFmd2indx(d+1)=384; %if crapout,Then use spot384 as default to keep going
- end
- try
- Exp(expN).Dexp(1).RFmd2pltN=RF2mp;
- catch
- catchissue='Ln448'
- Exp(expN).Dexp(1).RFmd2pltN=1;
- end
- end
- clear RFcombValList
- RFcombValList=cat(1,medValList1{d+1},medValList2{d+1});
- Exp(expN).Dexp(1).RFmean(d+1)=mean(RFcombValList);
- Exp(expN).Dexp(1).RFstd(d+1)=std(RFcombValList);
- try, Exp(expN).Dexp(1).RFmin(d+1)=min(RFcombValList);
- catch, Exp(expN).Dexp(1).RFmin(d+1)=0; end
- try, Exp(expN).Dexp(1).RFmax(d+1)=max(RFcombValList);
- catch, Exp(expN).Dexp(1).RFmax(d+1)=0; end
- end
- elseif exist('RF1scanN','var')
- Exp(expN).Dexp(1).RFmean=Exp(expN).Dexp(1).mean1;
- Exp(expN).Dexp(1).RFstd=Exp(expN).Dexp(1).std1;
- Exp(expN).Dexp(1).RFmin=Exp(expN).Dexp(1).min1;
- Exp(expN).Dexp(1).RFmax=Exp(expN).Dexp(1).max1;
- end
- % Disperse Reference Plates
- Exp(expN).Dexp(1).RFmdPindx=[];
- Exp(expN).Dexp(1).RFmdPpltN=[];
- if exist('drf','var')
- % Det. index of change from one MP to the next
- i=2;
- chgIndx(1)=1;
- for j=1:length(drf(:,3))
- if j>1
- if cell2mat(drf(j,3))~=cell2mat(drf((j-1),3)), chgIndx(i)=j; i=i+1; end
- end
- end
- chgIndx(length(chgIndx)+1)=length(drf)+1;
- uu=zeros(size(drf,1),4);
- uu(:,1:4)=cell2mat(drf(:,3:6))
- vv=zeros(length(drf),DMnum);
- dMPs=unique(cell2mat(drf(:,3)));
- for mm=1:length(dMPs) % length(chgIndx)
- for d=1:(DMnum)
- medianIndxDisp=[];
- NZrefIndxP=[];
- nonZeroValsP=[];
- medValLstDisp=[];
- rf1scNdisp=((dMPs(mm)-1)*DMnum)+(d);
- try % Determine the dispersed RFs median mean and std if such exist
- NZrefIndxP=drfPindx((find(drfPindx(:,dMPs(mm)))),dMPs(mm)); %find(Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(drf(chgIndx(cI):chgIndx(cI+1)),5));
- %vv=Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(NZrefIndxP,5);
- vv(chgIndx(mm):(chgIndx(mm+1)-1),d)=Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(NZrefIndxP,5);
- %For Global Ref Composite 17_1009
- vvK(chgIndx(mm):(chgIndx(mm+1)-1),d)=Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(NZrefIndxP,3);
- vvr(chgIndx(mm):(chgIndx(mm+1)-1),d)=Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(NZrefIndxP,4);
- nonZeroValsP=nonzeros(Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(NZrefIndxP,5));
- std1Disp=std(nonZeroValsP);
- mean1Disp=mean(nonZeroValsP);
- minDisp=min(nonZeroValsP);
- maxDisp=max(nonZeroValsP);
- drfVals=Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(NZrefIndxP,5);
- % MEDIAN Determination for PLATES with Dispersed RFs
- % NZrefIndxP=NZrefIndxP %find(Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(NZrefIndxP,5));
- if isempty(NZrefIndxP)
- nonZeroCntDisp=0
- medianIndxDisp=NZrefIndxP;
- else
- nonZeroCntDisp=length(NZrefIndxP);
- end
-
- if ~isempty(NZrefIndxP) && mod(nonZeroCntDisp,2)==0, medianIndxDisp=NZrefIndxP(1:nonZeroCntDisp-1); end
- if ~isempty(NZrefIndxP) && mod(nonZeroCntDisp,2)~=0, medianIndxDisp=NZrefIndxP; end
- if ~isempty(NZrefIndxP) && length(medianIndxDisp) > 3 %(.15*384) % to calc. a median, more than 15% of spots must be nonZero
- medValLstDisp=Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(medianIndxDisp,5);
- % medValList1Disp{d}=medValLstDisp;
- mval1Disp=median(medValLstDisp); % mval1=median(Exp(expN).Dexp(1).scan(RF1mps).plate(1).CFout(1:384,5)); %CFout(1:383,5));
- nonZeroMedPosIndx=find(mval1Disp==nonZeroValsP); % (Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(NZrefIndxP,5))); %(nonZeroIndxDisp,5))); %((nonZrfIndx.mp{dMPs(mm),:}),5)));
- RFmd1posD=NZrefIndxP(nonZeroMedPosIndx); % drfPindx((RFmd1posIndx),dMPs(mm));
- RFmd1locD(1)=ceil(RFmd1posD/24); % calc r value
- RFmd1locD(2)=RFmd1posD - ((RFmd1locD(1)-1)*24); % calc c value
- lstindx=lstindx+1;
- lstindxOrf=lstindxOrf+1;
- aa(lstindx,1)={strcat('RF1mdP(',num2str(d),')')};
- aa(lstindx,2)={strcat(':',num2str(dMPs(mm)),':',num2str(RFmd1locD(1)),':',num2str(RFmd1locD(2)))};
- bb(lstindxOrf,1)={strcat('RF1mdP(',num2str(d),')')};
- bb(lstindxOrf,2)={strcat(':',num2str(dMPs(mm)),':',num2str(RFmd1locD(1)),':',num2str(RFmd1locD(2)))};
- Exp(expN).Dexp(1).RFmdPLvals(d,dMPs(mm))=mval1Disp; %17_1201 TrendOL
- Exp(expN).Dexp(1).RFmdPLB(d,dMPs(mm))=strcat(aa(lstindx,1),aa(lstindx,2));
- Exp(expN).Dexp(1).RFmdPindx(d,dMPs(mm))=RFmd1posD;
- Exp(expN).Dexp(1).RFmdPpltN(d,dMPs(mm))=dMPs(mm); %This is a storage of the MasterPlate used NOT the ScanPlate? WeMight wish to store the ScanPlateNumber also???
- Exp(expN).Dexp(1).RFmdPscanN(d,dMPs(mm))=rf1scNdisp;
- Exp(expN).Dexp(1).RFmedianP(d,dMPs(mm))=mval1Disp;
- Exp(expN).Dexp(1).stdP(d,dMPs(mm))=std1Disp;
- Exp(expN).Dexp(1).meanP(d,dMPs(mm))=mean1Disp;
- Exp(expN).Dexp(1).minP(d,dMPs(mm))=minDisp;
- Exp(expN).Dexp(1).maxP(d,dMPs(mm))=maxDisp;
- else
- % Need to set L r K values to zeros or pick the first spot with zeros
- % Spot 1 could be other than zero as the median isn't calculated if fewer than some percent are nonzero
- medianCalcFailedD='To Few nonZero spots for valid median RF1 selection'
- firstZeroDindx=find(((Exp(expN).Dexp(1).scan(rf1scNdisp).plate(1).CFout(NZrefIndxP,5))==0),1,'first');
- firstZeroD=drfPindx((firstZeroDindx),dMPs(mm));
- Exp(expN).Dexp(1).RFmdPindx(d,dMPs(mm))=firstZeroD;
- Exp(expN).Dexp(1).RFmdPpltN(d,dMPs(mm))=dMPs(mm); %RF1mp; %Is this supposed to be the MP number or the ScanPlate number???
- end
- catch
- medianCalcTryFailed1D='Failed! Failed! Ln565 {Dispersed RF1s} "try" But process continued with bogus Plate spot value!'
- try
- firstZeroindxD=find(vv((chgIndx(d):chgIndx(d+1)-1),5)==0,1,'first');
- firstZeroPindx=uu(firstZeroindxD,4);
- Exp(expN).Dexp(1).RFmdPpltN(d,dMPs(mm))=dMPs(mm);
- Exp(expN).Dexp(1).RFmdPindx(d,dMPs(mm))=firstZeroPindx;
- catch
- catchissue='try at Ln565'
- Exp(expN).Dexp(1).RFmdPpltN(d,dMPs(mm))=dMPs(mm);
- Exp(expN).Dexp(1).RFmdPindx(d,dMPs(mm))=384; %if crapout,Then use spot384 as default to keep going
- end
- try
- Exp(expN).Dexp(1).RFmdPpltN=dMPs(mm);
- catch
- catchissue='Ln619'
- Exp(expN).Dexp(1).RFmdPpltN=1; %This might keep from breaking BUT ???
- end
- end
- end
- end
- % Calc. Global Mean, Std, And Median For Distributed References
- uu=horzcat(uu,vv);
- for d=1:DMnum
- medianIndxG=[];
- NZrfIndxG=[];
- minG=min(nonzeros(vv(:,d)));
- maxG=max(nonzeros(vv(:,d)));
- RFmeanG=mean(nonzeros(vv(:,d)));
- RFstdG=std(nonzeros(vv(:,d)));
- NZrfIndxG=find(vv(:,d)); % find(nonzeros(vv(:,d))); WWRONG FOR A WHILE!
- if isempty(RFmeanG)
- nonZeroCntD=0; % medianIndxDisp=RFmeanG(d);
- else
- nonZeroCntD=length(nonzeros(vv(:,d)));
- end
- % Calc. of median requires an odd number of indx items
- if ~isempty(NZrfIndxG) && mod(nonZeroCntD,2)==0, medianIndxD=NZrfIndxG(1:(size(NZrfIndxG,1)-1)); end
- if ~isempty(NZrfIndxG) && mod(nonZeroCntD,2)~=0, medianIndxD=NZrfIndxG(:); end
- if ~isempty(NZrfIndxG) && length(medianIndxD) > (.15*size(drf,1)) % to calc. a median, more than 15% of spots must be nonZero
- mvalsDG=median(vv(medianIndxD,d)); % (nonzeros(vv(:,d)));
- nzPosIndxDG=find(mvalsDG==vv(:,d));
- RFmdDGloc(d,1)=uu(nzPosIndxDG,1); % MP of distributedGlobal Median value
- RFmdDGloc(d,2)=uu(nzPosIndxDG,2); % calc r value
- RFmdDGloc(d,3)=uu(nzPosIndxDG,3); % calc c value
- lstindx=lstindx+1;
- lstindxOrf=lstindxOrf+1;
- aa(lstindx,1)={strcat('RF1mdG(',num2str(d),')')};
- aa(lstindx,2)={strcat(':',num2str(RFmdDGloc(d,1)),':',num2str(RFmdDGloc(d,2)),':',num2str(RFmdDGloc(d,3)))}; %,'std_',num2str(std2))};
- bb(lstindxOrf,1)={strcat('RF1mdG(',num2str(d),')')};
- bb(lstindxOrf,2)={strcat(':',num2str(RFmdDGloc(d,1)),':',num2str(RFmdDGloc(d,2)),':',num2str(RFmdDGloc(d,3)))}; %,'std_',num2str(std2))};
- % Composite Reference Amalgum Plot
- lstindx=lstindx+1;
- lstindxOrf=lstindxOrf+1;
- aa(lstindx,1)={strcat('RFcmpG(',num2str(d),')')};
- aa(lstindx,2)={''};
- bb(lstindxOrf,1)={strcat('RFcmpG(',num2str(d),')')};
- bb(lstindxOrf,2)={''};
- % Exp(expN).Dexp(1).RFmdGLvals=vv(medianIndxD,d); %17_1201 TrendOL
- Exp(expN).Dexp(1).RFmdGLB(d)=strcat(aa(lstindx,1),aa(lstindx,2));
- Exp(expN).Dexp(1).RFmdGindx(d)=nzPosIndxDG;
- Exp(expN).Dexp(1).RFmdGpltN(d)=RFmdDGloc(d,1);
- Exp(expN).Dexp(1).RFmdGscanN(d)=uu(nzPosIndxDG,4);
- Exp(expN).Dexp(1).RFmedianG(d)=mvalsDG;
- Exp(expN).Dexp(1).RFminG(d)=minG;
- Exp(expN).Dexp(1).RFmaxG(d)=maxG;
- Exp(expN).Dexp(1).RFstdG(d)=RFstdG;
- Exp(expN).Dexp(1).RFmeanG(d)=RFmeanG;
- Exp(expN).Dexp(1).RFcmpGL.dm(d).Lvals=vv(medianIndxD,d); %17_1201 TrendOL
- Exp(expN).Dexp(1).RFcmpGL.dm(d).med=median(vv(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGL.dm(d).mean=mean(vv(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGL.dm(d).std=std(vv(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGL.dm(d).min=min(vv(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGL.dm(d).max=max(vv(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGK.dm(d).Kvals=vvK(medianIndxD,d); %17_1201 TrendOL
- Exp(expN).Dexp(1).RFcmpGK.dm(d).med=median(vvK(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGK.dm(d).mean=mean(vvK(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGK.dm(d).std=std(vvK(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGK.dm(d).min=min(vvK(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGK.dm(d).max=max(vvK(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGr.dm(d).rvals=vvr(medianIndxD,d); %17_1201 TrendOL
- Exp(expN).Dexp(1).RFcmpGr.dm(d).med=median(vvr(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGr.dm(d).mean=mean(vvr(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGr.dm(d).std=std(vvr(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGr.dm(d).min=min(vvr(medianIndxD,d)); %For Ref Composite 17_1009
- Exp(expN).Dexp(1).RFcmpGr.dm(d).max=max(vvr(medianIndxD,d)); %For Ref Composite 17_1009
- end
- end
- end
- for mp=1:MPnum % length(Exp(expN).Dexp(1).MP)
- for ind384=1:384
- spN=spN+1;
- end
- end
- gnLstRaw=strcat(aa(:,1),aa(:,2));
- Exp(expN).Dexp(1).srtGnLst=sort(gnLstRaw);
- orfLstRaw=strcat(bb(:,1),bb(:,2));
- Exp(expN).Dexp(1).srtOrfLst=sort(orfLstRaw);
- % Auto select Zone and load listboxGnOrf data
- zeroCLn=zeros(1,DMnum);
- Exp(expN).expLoadCnt=Exp(expN).expLoadCnt+1; expLdCnt=Exp(expN).expLoadCnt;
- zonePB=expN;
- if expN==1
- set(handles.zonePB1,'value',1)
- set(handles.zonePB2,'value',0)
- set(handles.zonePB3,'value',0)
- set(handles.zonePB1,'BackgroundColor',[1.0 0.6 0.6])
- set(handles.zonePB2,'BackgroundColor',[1.0 1.0 1.0])
- set(handles.zonePB3,'BackgroundColor',[1.0 1.0 1.0])
- orfLstSel=get(handles.GeneOrfTog,'value')
- if orfLstSel==1
- set(handles.listboxGnOrf,'string',Exp(1).Dexp(1).srtOrfLst)
- else
- set(handles.listboxGnOrf,'string',Exp(1).Dexp(1).srtGnLst)
- end
- DNLaxes1=handles.DNLaxes1; % ZoneRelated
- Exp(1).hzeroCLn(expLdCnt)=plot(DNLaxes1,zeroCLn,1:DMnum,'y');
- end
- if expN==2
- set(handles.zonePB1,'value',0)
- set(handles.zonePB3,'value',0)
- set(handles.zonePB2,'value',1)
- set(handles.zonePB2,'BackgroundColor',[1.0 0.6 0.6])
- set(handles.zonePB1,'BackgroundColor',[1.0 1.0 1.0])
- set(handles.zonePB3,'BackgroundColor',[1.0 1.0 1.0])
- orfLstSel=get(handles.GeneOrfTog,'value');
- if orfLstSel==1
- set(handles.listboxGnOrf,'string',Exp(2).Dexp(1).srtOrfLst)
- else
- set(handles.listboxGnOrf,'string',Exp(2).Dexp(1).srtGnLst)
- end
- DNLaxes2=handles.DNLaxes2; % ZoneRelated
- Exp(2).hzeroCLn(expLdCnt)=plot(DNLaxes2,zeroCLn,1:DMnum,'y');
- end
- if expN==3
- set(handles.zonePB1,'value',0)
- set(handles.zonePB2,'value',0)
- set(handles.zonePB3,'value',1)
- set(handles.zonePB3,'BackgroundColor',[1.0 0.6 0.6]);
- set(handles.zonePB1,'BackgroundColor',[1.0 1.0 1.0]);
- set(handles.zonePB2,'BackgroundColor',[1.0 1.0 1.0]);
- orfLstSel=get(handles.GeneOrfTog,'value');
- if orfLstSel==1
- set(handles.listboxGnOrf,'string',Exp(3).Dexp(1).srtOrfLst)
- else
- set(handles.listboxGnOrf,'string',Exp(3).Dexp(1).srtGnLst)
- end
- DNLaxes3=handles.DNLaxes3; % ZoneRelated
- Exp(3).hzeroCLn(expLdCnt)=plot(DNLaxes3,zeroCLn,1:DMnum,'y');
- end
- if Exp(4).interacPBsel==0 % if interaction "raw" don't show a center line
- for i=1:Exp(expN).expLoadCnt
- try
- set(Exp(expN).hzeroCLn(i),'visible','off');
- catch
- end
- end
- end
- EZdiagRFsSheet
- RFconfig=0;
- if sum(ismember(fieldnames(Exp(expN).Dexp(1)),'RFmean')) ...
- && ~isempty(Exp(expN).Dexp(1).RFmean) ...
- && sum(ismember(fieldnames(Exp(expN).Dexp(1)),'RFmeanG')) ...
- && isempty(Exp(expN).Dexp(1).RFmeanG)
- RFconfig=1;
- end
- if sum(ismember(fieldnames(Exp(expN).Dexp(1)),'RFmean'))==0 ...
- || isempty(Exp(expN).Dexp(1).RFmean) ...
- && sum(ismember(fieldnames(Exp(expN).Dexp(1)),'RFmeanG')) ...
- && ~isempty(Exp(expN).Dexp(1).RFmeanG)
- RFconfig=2;
- end
- if sum(ismember(fieldnames(Exp(expN).Dexp(1)),'RFmean')) ...
- && ~isempty(Exp(expN).Dexp(1).RFmean) ...
- && sum(ismember(fieldnames(Exp(expN).Dexp(1)),'RFmeanG')) ...
- && ~isempty(Exp(expN).Dexp(1).RFmeanG)
- RFconfig=3;
- end
- Exp(expN).RFconfig=RFconfig; % ZoneRelated
- if RFconfig~=0
- Exp(expN).Dexp(1).RFrnames=rnames;
- Exp(expN).Dexp(1).RFdata=data;
- Exp(expN).Dexp(1).resetHtmpTg=5; % ZoneRelated
- % HtMapTog 'string', 'Current user L/N' selection'
- Exp(expN).Dexp(1).spotIndx=[];
- if expN==1
- Exp(1).htmapPBsel=0;
- set(handles.HtMapTog1,'string','L')
- EZhtMap
- end
- if expN==2
- Exp(2).htmapPBsel=0;
- set(handles.HtMapTog2,'string','L')
- EZhtMap
- end
- if expN==3,
- Exp(3).htmapPBsel=0;
- set(handles.HtMapTog3,'string','L')
- EZhtMap
- end
- htMapTogPBfg=0;
- elseif RFconfig==0
- RFconfigMsg='No RF1 references in this Experiment Job'
- try
- EZsingleExUserRF
- % EZmultiDayGui
- % cd(w)
- % EZmultiDay
- % EZmultiExLoad
- catch
- RFconfigMsg='No RF1 or User selected references in this Experiment Job'
- Exp(expN).Dexp(1).resetHtmpTg=3; % ZoneRelated
- end
- % Exp(expN).Dexp(1).resetHtmpTg=3; %ZoneRelated
- end
- %{
- try msgBadGeneName, catch, end
- try
- if RFconfig==0,
- RFconfigMsg='No RF1 references in this Experiment Job'
- Exp(expN).Dexp(1).resetHtmpTg=3; %ZoneRelated
- end
- catch
- end
- %}
- elseif expType==2 %Multiple Experiment from in one Folder extraction
- Exp(expN).DexpType='chrono';
- % Test for Bad MP cell array (usually 384 [NaN}'s)
- % replaced length(Exp(expN).Dexp(1).MP) with MPnum
- for mx=1:length(Exp(expN).Dexp(1).MP)
- try
- char((Exp(expN).Dexp(1).MP(mx).genename{1}(384)))
- MPnum=mx;
- catch
- break
- end
- end
- ww=pwd;
- try EZmultiDayGui; catch ME
- msg=ME.message, cd(ww); end
- try EZmultiDay; catch ME
- msg=ME.message, cd(ww); end
- try EZmultiExLoad; catch ME
- msg=ME.message, cd(ww); end
- elseif expType==3
- Exp(expN).DexpType='multi';
- % Test for Bad MP cell array (usually 384 [NaN}'s)
- % replaced length(Exp(expN).Dexp(1).MP) with MPnum
- for mx=1:length(Exp(expN).Dexp(1).MP)
- try
- char((Exp(expN).Dexp(1).MP(mx).genename{1}(384)))
- MPnum=mx;
- catch
- break
- end
- end
- ww=pwd;
- try EZmultiDayGui; catch ME
- msg=ME.message,cd(ww); end
- try EZmultiDay; catch ME
- msg=ME.message, cd(ww); end
- try EZmultiExLoad; catch ME
- msg=ME.message, cd(ww); end
- else
- disp('Cancel Load Exp')
- end
-
- % Deprecated Functions
- %{
- %Exp(expN).Dexp(1).RF1cmpK.[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).std1K=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).min1K=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).max1K=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1)RF1cmpr=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).std1r=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).min1r=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).max1r=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).RF=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).std2K=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).min2K=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).max2K=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).RF2cmpr=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).std2r=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).min2r=[]; %For Ref Composite 17_1009
- %Exp(expN).Dexp(1).max2r=[]; %For Ref Composite 17_1009
- %kValList1{d+1}=kValLst; %For Ref Composite 17_1009
- %kmin1=min(kValLst); %For Ref Composite 17_1009
- %kmax1=max(kValLst); %For Ref Composite 17_1009
- %kstd1=std(kValLst); %For Ref Composite 17_1009
- %kmean1=mean(kValLst); %For Ref Composite 17_1009
- %rValList1{d+1}=rValLst; %For Ref Composite 17_1009
- %rmin1=min(rValLst); %For Ref Composite 17_1009
- %rmax1=max(rValLst); %For Ref Composite 17_1009
- %rstd1=std(rValLst); %For Ref Composite 17_1009
- %rmean1=mean(rValLst); %For Ref Composite 17_1009
- %kValList2{d+1}=kValLst2; %For Ref Composite 17_1009
- %kmin2=min(kValLst2); %For Ref Composite 17_1009
- %kmax2=max(kValLst2); %For Ref Composite 17_1009
- %kstd2=std(kValLst2); %For Ref Composite 17_1009
- %kmean2=mean(kValLst2); %For Ref Composite 17_1009
- %rValList2{d+1}=rValLst2; %For Ref Composite 17_1009
- % rmin2=min(rValLst2); %For Ref Composite 17_1009
- %rmax2=max(rValLst2); %For Ref Composite 17_1009
- %rstd2=std(rValLst2); %For Ref Composite 17_1009
- %rmean2=mean(rValLst2); %For Ref Composite 17_1009
- %User Reference Input Dialog Box used in the multiExperiment Chrono setup
- prompt={'Enter GeneName to use as Reference:',...
- 'Enter Specifics Term if used to futher specify Reference '}
- dlg_title='User Reference Input';
- num_lines=1;
- def={'RF1','None'};
- answer=inputdlg(prompt,dlg_title,num_lines,def);
- rfGene=cell2mat(answer(1));
- if ~strcmpi(rfGene,'RF1')|| ~strcmpi(rfGene,'RF2'), usrRefFg=1; end
- rfSpec=answer(2); %if strcmpi(answer(2),'None'), rfSpec=''; end
- rfGnSp=strcat(rfGene,rfSpec);
- %First user input prototype code
- if ~exist('RF1scanN','var') && ~exist('RF2scanN','var') %change || &&
- prompt={'Enter Masterplate Number(s) of Your Reference GeneName spots:',...
- 'Enter GeneName of Your Reference:'};
- dlg_title='User Reference Input';
- num_lines=1;
- def={'Ref MP(s)','USRrefGeneName'};
- answer=inputdlg(prompt,dlg_title,num_lines,def);
- rfMPstr=cell2mat(answer(1));
- rfMPcomas=strfind((cell2mat(answer(1))),',');
- n=0;
- if isempty(rfMPcomas)|| max(rfMPcomas)==length(rfMPstr)
- usrMPs=rfMPstr
- else
- for i=rfMPcomas,
- n=n+1
- usrMPs(n)=str2double(rfMPstr(i-1:i))
- if i==max(rfMPcomas)
- usrMPs(n+1)=str2double(rfMPstr(i:end))
- end
- end
- end
- usrMPs=answer(1);
- refGene=answer(2);
- end
- %}
|