EZmultiExLoad.m 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317
  1. % EZmultiExLoad
  2. % Calls to EZVimDisplay (ln 185) EZmultiGeneRFsLst (ln213) EZdiagRFsSheet(ln218)
  3. % TODO this file could use some elseif's
  4. global Exp
  5. global zonePB
  6. global Expaa
  7. global Expbb
  8. global exDlst
  9. global exFolder
  10. % Load .mat file
  11. expN=zonePB; % added to accomodate AppDesigner limitations 230821
  12. Exp(expN).UgeneCnt=0;
  13. Exp(expN).DexpLength=size(matFile,2); DexpLength=size(matFile,2);
  14. for n=1:Exp(expN).DexpLength % size(matFile,2)
  15. if expN==1
  16. orfLstSel=get(handles.GeneOrfTog,'value');
  17. end
  18. if expN==2
  19. orfLstSel=get(handles.GeneOrfTog,'value');
  20. end
  21. if expN==3
  22. orfLstSel=get(handles.GeneOrfTog,'value');
  23. end
  24. Exp(expN).Dexp(n).srtGnLst={('CheckMP/MPDMfile')};
  25. Exp(expN).Dexp(n).srtOrfLst={('CheckMP/MPDMfile')};
  26. set(handles.listboxGnOrf,'value',1) %Fix accomodation for bug in App Designer .. .wlapp converter 230918
  27. set(handles.listboxGnOrf,'string',cellstr([{'Failed To Load'}; {' '}]));
  28. % try
  29. ExpOutmat=matFile(n)
  30. load(char(ExpOutmat));
  31. %cd(scansDir)
  32. %cd ..;
  33. %resDir=pwd;
  34. Exp(expN).Dexp(n).resDir=cell2mat(resDir(n));
  35. cd(Exp(expN).Dexp(n).resDir)
  36. cd ..;
  37. ExpPath=pwd;
  38. Exp(expN).Dexp(n).ExpFoldr=ExpPath;
  39. cd(w)
  40. % Experiment LOADs
  41. load(fullfile(Exp(expN).Dexp(n).ExpFoldr,'MasterPlateFiles','MPDMmat.mat'))
  42. load(fullfile(Exp(expN).Dexp(n).resDir,'Fotos','Coordinates'))
  43. load(fullfile(Exp(expN).Dexp(n).resDir,'Fotos','anlZones'))
  44. load(fullfile(Exp(expN).Dexp(n).resDir,'Fotos','BGatTpts'))
  45. load(fullfile(Exp(expN).Dexp(n).resDir,'PTmats','NImParameters'))
  46. % Backup for cond. sothat failure to load is recovered back prev. ExpJob data
  47. % test in temp
  48. Exp(expN).Dexp(n).temp.DM=DM;
  49. Exp(expN).Dexp(n).temp.MP=MP;
  50. Exp(expN).Dexp(n).temp.scan=scan;
  51. Exp(expN).Dexp(n).temp.FexpScanSpots=FexpScanSpots;
  52. Exp(expN).Dexp(n).temp.FexpScanBMtp=FexpScanBMtp;
  53. Exp(expN).Dexp(n).temp.anlZoneRefs=anlZoneRefs;
  54. Exp(expN).Dexp(n).temp.ImParMat=ImParMat;
  55. Exp(expN).Dexp(n).DM=Exp(expN).Dexp(n).temp.DM;
  56. Exp(expN).Dexp(n).MP=Exp(expN).Dexp(n).temp.MP;
  57. Exp(expN).Dexp(n).scan=Exp(expN).Dexp(n).temp.scan;
  58. Exp(expN).Dexp(n).FexpScanSpots=Exp(expN).Dexp(n).temp.FexpScanSpots;
  59. Exp(expN).Dexp(n).FexpScanBMtp=Exp(expN).Dexp(n).temp.FexpScanBMtp;
  60. Exp(expN).Dexp(n).anlZoneRefs=Exp(expN).Dexp(n).temp.anlZoneRefs;
  61. Exp(expN).Dexp(n).ImParMat=Exp(expN).Dexp(n).temp.ImParMat;
  62. Exp(expN).Dexp((Exp(expN).DexpLength+1):end)=[];
  63. Exp(expN).Dexp(n).temp=[];
  64. end
  65. % Load First new ExpJOb
  66. if expN==1
  67. tPtsSize=size(Exp(expN).Dexp(1).FexpScanBMtp{1,1},(3)); %size(FexpScanBMtp{1,1},3);
  68. set(handles.MPsldr1,'max',MPnum); %length(MP)
  69. set(handles.DMsldr1,'max',length(DM.drug));
  70. set(handles.Tptsldr1,'max',tPtsSize);
  71. % MPnum=length(Exp(expN).Dexp(1).MP);
  72. set(handles.MPsldr1,'min',1,'max',MPnum)
  73. DMnum=length(Exp(expN).Dexp(1).DM.drug);
  74. set(handles.DMsldr1,'min',1,'max',DMnum)
  75. tPtsSize=size(Exp(expN).Dexp(1).FexpScanBMtp{1,1},(3));
  76. set(handles.Tptsldr1,'min',1,'max',tPtsSize)
  77. set(handles.MPsldr1,'value',1)
  78. set(handles.DMsldr1,'value',1)
  79. set(handles.Tptsldr1,'value',1)
  80. set(handles.MPed1,'string','1')
  81. set(handles.DMed1,'string','1')
  82. set(handles.Tpted1,'string','1')
  83. set(handles.MPsldr1,'SliderStep',[1/MPnum 1/MPnum]); % [1/length(MP) 1/length(MP)])
  84. set(handles.DMsldr1,'SliderStep',[1/length(DM.drug) 1/length(DM.drug)]);
  85. set(handles.Tptsldr1,'SliderStep',[1/tPtsSize 1/tPtsSize]);
  86. set(handles.DN1,'value',1)
  87. set(handles.DN1,'string',1)
  88. end
  89. if expN==2,
  90. tPtsSize=size(Exp(expN).Dexp(1).FexpScanBMtp{1,1},(3)); % size(FexpScanBMtp{1,1},3);
  91. set(handles.MPsldr2,'max',MPnum);
  92. set(handles.DMsldr2,'max',length(DM.drug));
  93. set(handles.Tptsldr2,'max',tPtsSize);
  94. % MPnum=length(Exp(expN).Dexp(1).MP);
  95. set(handles.MPsldr2,'min',1,'max',MPnum) % length(MP))
  96. DMnum=length(Exp(expN).Dexp(n).DM.drug);
  97. set(handles.DMsldr2,'min',1,'max',DMnum)
  98. tPtsSize=size(Exp(expN).Dexp(1).FexpScanBMtp{1,1},(3));
  99. set(handles.Tptsldr2,'min',1,'max',tPtsSize)
  100. set(handles.MPsldr2,'value',1)
  101. set(handles.DMsldr2,'value',1)
  102. set(handles.Tptsldr2,'value',1)
  103. set(handles.MPed2,'string','1')
  104. set(handles.DMed2,'string','1')
  105. set(handles.Tpted2,'string','1')
  106. set(handles.MPsldr2,'SliderStep',[1/MPnum 1/MPnum]); %1/length(MP) 1/length(MP)])
  107. set(handles.DMsldr2,'SliderStep',[1/length(DM.drug) 1/length(DM.drug)]);
  108. set(handles.Tptsldr2,'SliderStep',[1/tPtsSize 1/tPtsSize]);
  109. set(handles.DN2,'value',1)
  110. set(handles.DN2,'string',1)
  111. end
  112. if expN==3
  113. % Exp(3).traceN=0;
  114. tPtsSize=size(Exp(expN).Dexp(1).FexpScanBMtp{1,1},(3)); % size(FexpScanBMtp{1,1},3);
  115. set(handles.MPsldr3,'max',MPnum);
  116. set(handles.DMsldr3,'max',length(DM.drug));
  117. set(handles.Tptsldr3,'max',tPtsSize);
  118. % MPnum=length(Exp(expN).Dexp(1).MP);
  119. set(handles.MPsldr3,'min',1,'max',MPnum)
  120. DMnum=length(Exp(expN).Dexp(1).DM.drug);
  121. set(handles.DMsldr3,'min',1,'max',DMnum)
  122. tPtsSize=size(Exp(expN).Dexp(1).FexpScanBMtp{1,1},(3));
  123. set(handles.Tptsldr3,'min',1,'max',tPtsSize)
  124. set(handles.MPsldr3,'value',1)
  125. set(handles.DMsldr3,'value',1)
  126. set(handles.Tptsldr3,'value',1)
  127. set(handles.MPed3,'string','1')
  128. set(handles.DMed3,'string','1')
  129. set(handles.Tpted3,'string','1')
  130. set(handles.MPsldr3,'SliderStep',[1/MPnum 1/MPnum]); % 1/length(MP) 1/length(MP)])
  131. set(handles.DMsldr3,'SliderStep',[1/length(DM.drug) 1/length(DM.drug)]);
  132. set(handles.Tptsldr3,'SliderStep',[1/tPtsSize 1/tPtsSize]);
  133. set(handles.DN3,'value',1)
  134. set(handles.DN3,'string',1)
  135. end
  136. if expN==1
  137. set(handles.GeneOrfLoc1,'string',{''});
  138. set(handles.graphStrLoc1,'string',{''});
  139. cla(handles.Paxes1)
  140. end
  141. if expN==2
  142. set(handles.GeneOrfLoc2,'string',{''});
  143. set(handles.graphStrLoc2,'string',{''});
  144. cla(handles.Paxes2)
  145. end
  146. if expN==3
  147. set(handles.GeneOrfLoc3,'string',{''});
  148. set(handles.graphStrLoc3,'string',{''})
  149. cla(handles.Paxes3)
  150. end
  151. Exp(expN).Dexp(1).srtGnLst={('CheckMP/MPDMfile')};
  152. Exp(expN).Dexp(1).srtOrfLst={('CheckMP/MPDMfile')};
  153. set(handles.listboxGnOrf,'value',1) %Fix accomodation for bug in App Designer .. .wlapp converter 230918
  154. set(handles.listboxGnOrf,'string',Exp(expN).Dexp(1).srtGnLst)
  155. set(handles.listboxGnOrf,'string',Exp(expN).Dexp(1).srtOrfLst)
  156. EZVimDisplay
  157. usrRefFg=0;
  158. prompt={'Enter GeneName to use as Reference:',...
  159. 'Enter Specifics Term if used to futher specify Reference '}
  160. dlg_title='User Reference Input';
  161. num_lines=1;
  162. def={'RF1','None'};
  163. answer=inputdlg(prompt,dlg_title,num_lines,def);
  164. if iscell(answer(1))
  165. rfGene=cell2mat(answer(1));
  166. else
  167. rfGene=answer(1);
  168. end
  169. if ~strcmpi(rfGene,'RF1')|| ~strcmpi(rfGene,'RF2'), usrRefFg=1; end
  170. rfSpec=answer(2); % if strcmpi(answer(2),'None'), rfSpec=''; end
  171. rfGnSp=strcat(rfGene,rfSpec);
  172. if strcmpi(rfSpec,'None'), rfGnSp={strcat(rfGene,'-')}; end
  173. % Added 17-1023 For User Addition of Gene Composites to ListBox
  174. Expaa{expN,1}=[]
  175. Expbb{expN,1}=[];
  176. for n=1:size(matFile,2)
  177. try
  178. EZmultiGeneRFsLst
  179. catch
  180. msg='EZmultiGeneRFLst failed possibly Too Few non-zero Median spots'
  181. end
  182. EZdiagRFsSheet
  183. Exp(expN).Dexp(n).RFrnames=rnames;
  184. Exp(expN).Dexp(n).RFdata=data;
  185. RFconfig=0;
  186. if sum(ismember(fieldnames(Exp(expN).Dexp(n)),'RFmean')) ...
  187. && ~isempty(Exp(expN).Dexp(n).RFmean) ...
  188. && sum(ismember(fieldnames(Exp(expN).Dexp(n)),'RFmeanG')) ...
  189. && isempty(Exp(expN).Dexp(n).RFmeanG)
  190. RFconfig=1;
  191. end
  192. if sum(ismember(fieldnames(Exp(expN).Dexp(n)),'RFmean'))==0 ...
  193. || isempty(Exp(expN).Dexp(n).RFmean) ...
  194. && sum(ismember(fieldnames(Exp(expN).Dexp(n)),'RFmeanG')) ...
  195. && ~isempty(Exp(expN).Dexp(n).RFmeanG)
  196. RFconfig=2;
  197. end
  198. if sum(ismember(fieldnames(Exp(expN).Dexp(n)),'RFmean')) ...
  199. && ~isempty(Exp(expN).Dexp(n).RFmean) ...
  200. && sum(ismember(fieldnames(Exp(expN).Dexp(n)),'RFmeanG')) ...
  201. && ~isempty(Exp(expN).Dexp(n).RFmeanG)
  202. RFconfig=3;
  203. end
  204. Exp(expN).RFconfig=RFconfig;
  205. Exp(expN).Dexp(n).RFconfig=RFconfig;
  206. try msgBadGeneName
  207. catch, end
  208. try
  209. Exp(expN).Dexp(n).resetHtmpTg =5; %Exp(expN).resetHtmpTg =5;
  210. if RFconfig==0
  211. RFconfigMsg='No RF1 references in this Experiment Job'
  212. Exp(expN).Dexp(n).resetHtmpTg =3; %Exp(expN).resetHtmpTg =3;
  213. end
  214. catch
  215. end
  216. end
  217. % Auto Select Zone And Load Listboxgnorf Data
  218. DexpN=1;
  219. zeroCLn=zeros(1,DMnum);
  220. Exp(expN).expLoadCnt=Exp(expN).expLoadCnt+1; expLdCnt=Exp(expN).expLoadCnt;
  221. if expN==1 % Adapted to accomodate AppDesigner 230821
  222. set(handles.zonePB1,'value',1)
  223. set(handles.zonePB2,'value',0)
  224. set(handles.zonePB3,'value',0)
  225. set(handles.zonePB1,'BackgroundColor',[1.0 0.6 0.6])
  226. set(handles.zonePB2,'BackgroundColor',[1.0 1.0 1.0])
  227. set(handles.zonePB3,'BackgroundColor',[1.0 1.0 1.0])
  228. orfLstSel=get(handles.GeneOrfTog,'value')
  229. if orfLstSel==1
  230. set(handles.listboxGnOrf,'string',Exp(1).Dexp(1).srtOrfLst)
  231. else
  232. set(handles.listboxGnOrf,'string',Exp(1).Dexp(1).srtGnLst)
  233. end
  234. DNLaxes1=handles.DNLaxes1;
  235. Exp(1).hzeroCLn(expLdCnt)=plot(DNLaxes1,zeroCLn,1:DMnum,'y');
  236. end
  237. if expN==2 % Adapted to accomodate AppDesigner 230821
  238. set(handles.zonePB1,'value',0)
  239. set(handles.zonePB3,'value',0)
  240. set(handles.zonePB2,'value',1)
  241. set(handles.zonePB2,'BackgroundColor',[1.0 0.6 0.6])
  242. set(handles.zonePB1,'BackgroundColor',[1.0 1.0 1.0])
  243. set(handles.zonePB3,'BackgroundColor',[1.0 1.0 1.0])
  244. orfLstSel=get(handles.GeneOrfTog,'value');
  245. if orfLstSel==1
  246. set(handles.listboxGnOrf,'string',Exp(2).Dexp(1).srtOrfLst)
  247. else
  248. set(handles.listboxGnOrf,'string',Exp(2).Dexp(1).srtGnLst)
  249. end
  250. DNLaxes2=handles.DNLaxes2;
  251. Exp(2).hzeroCLn(expLdCnt)=plot(DNLaxes2,zeroCLn,1:DMnum,'y');
  252. end
  253. if expN==3 % Adapted to accomodate AppDesigner 230821
  254. set(handles.zonePB1,'value',0)
  255. set(handles.zonePB2,'value',0)
  256. set(handles.zonePB3,'value',1)
  257. set(handles.zonePB3,'BackgroundColor',[1.0 0.6 0.6]);
  258. set(handles.zonePB1,'BackgroundColor',[1.0 1.0 1.0]);
  259. set(handles.zonePB2,'BackgroundColor',[1.0 1.0 1.0]);
  260. orfLstSel=get(handles.GeneOrfTog,'value');
  261. if orfLstSel==1
  262. set(handles.listboxGnOrf,'string',Exp(3).Dexp(1).srtOrfLst)
  263. else
  264. set(handles.listboxGnOrf,'string',Exp(3).Dexp(1).srtGnLst)
  265. end
  266. DNLaxes3=handles.DNLaxes3;
  267. Exp(3).hzeroCLn(expLdCnt)=plot(DNLaxes3,zeroCLn,1:DMnum,'y');
  268. end
  269. if Exp(4).interacPBsel==0 %if interaction "raw" don't show a center line
  270. for i=1:Exp(expN).expLoadCnt,
  271. try set(Exp(expN).hzeroCLn(i),'visible','off');
  272. catch
  273. catchissue='Ln521'
  274. i
  275. end
  276. end
  277. end
  278. % HtMapTog 'string', 'Current user L/N' selection'
  279. Exp(expN).Dexp(DexpN).spotIndx=[];
  280. if expN==1,
  281. Exp(1).htmapPBsel=0;
  282. set(handles.HtMapTog1,'string','L')
  283. EZhtMap
  284. end
  285. if expN==2,
  286. Exp(2).htmapPBsel=0;
  287. set(handles.HtMapTog2,'string','L')
  288. EZhtMap
  289. end
  290. if expN==3,
  291. Exp(3).htmapPBsel=0;
  292. set(handles.HtMapTog3,'string','L')
  293. EZhtMap
  294. end
  295. htMapTogPBfg=0;