697 lines
30 KiB
Matlab
Executable File
697 lines
30 KiB
Matlab
Executable File
%single gene L based interaction shift display
|
|
%function EZinteractDev5
|
|
|
|
global Exp
|
|
|
|
DexpLen= Exp(expN).DexpLength;
|
|
if expN==1,DexpN= (get(handles.DN1,'value')); end
|
|
if expN==2,DexpN= (get(handles.DN2,'value')); end
|
|
if expN==3,DexpN= (get(handles.DN3,'value')); end
|
|
Exp(expN).DexpN=DexpN;
|
|
if expN==1,pertSel=floor(get(handles.DMsldr1,'value')); end
|
|
if expN==2,pertSel=floor(get(handles.DMsldr2,'value')); end
|
|
if expN==3,pertSel=floor(get(handles.DMsldr3,'value')); end
|
|
if sum(ismember(fieldnames(Exp(expN).Dexp(DexpN)),'RFmean'))&&...
|
|
~isempty(Exp(expN).Dexp(DexpN).RFmean)&&...
|
|
sum(ismember(fieldnames(Exp(expN).Dexp(DexpN)),'RFmeanG'))&&...
|
|
isempty(Exp(expN).Dexp(DexpN).RFmeanG)
|
|
RFconfig=1;
|
|
end
|
|
if sum(ismember(fieldnames(Exp(expN).Dexp(DexpN)),'RFmean'))==0 ||...
|
|
isempty(Exp(expN).Dexp(DexpN).RFmean)&&...
|
|
sum(ismember(fieldnames(Exp(expN).Dexp(DexpN)),'RFmeanG'))&&...
|
|
~isempty(Exp(expN).Dexp(DexpN).RFmeanG)
|
|
RFconfig=2;
|
|
end
|
|
if sum(ismember(fieldnames(Exp(expN).Dexp(DexpN)),'RFmean'))&&...
|
|
~isempty(Exp(expN).Dexp(DexpN).RFmean)&&...
|
|
sum(ismember(fieldnames(Exp(expN).Dexp(DexpN)),'RFmeanG'))&&...
|
|
~isempty(Exp(expN).Dexp(DexpN).RFmeanG)
|
|
RFconfig=3;
|
|
end
|
|
if (sum(ismember(fieldnames(Exp(expN).Dexp(DexpN)),'RFmean'))==0 ||...
|
|
isempty(Exp(expN).Dexp(DexpN).RFmean))&&...
|
|
(sum(ismember(fieldnames(Exp(expN).Dexp(DexpN)),'RFmeanG'))==0||...
|
|
isempty(Exp(expN).Dexp(DexpN).RFmeanG))
|
|
return
|
|
end
|
|
|
|
%RFconfig= 2; %1= FullPlateOnly; 2= DistributedOnly; 3= Both FullPlate && Distributed
|
|
|
|
if RFconfig==1,
|
|
defaultanswer={'80','60','100','3,4,5','N','39','Y'};
|
|
end
|
|
|
|
if RFconfig==2,
|
|
QctrlRF= 'Select Distributed Control RF option: (G)Global, (L)Local';
|
|
QpertRF= 'Select Distributed Perturbation RF option: (G)Global, (L)Local';
|
|
defaultanswer={'80','60','100','3,4,5','N','39','Y','G','L'};
|
|
end
|
|
if RFconfig==3,
|
|
QctrlRF= 'Select Control RF option: (F)FullPlate, (G)GlobalDistributed, (L)LocalDistributed';
|
|
QpertRF= 'Select Perturbation RF option: (F)FullPlate, (G)GlobalDistributed, (L)LocalDistributed';
|
|
defaultanswer={'80','60','100','3,4,5','N','39','Y','F','L'};
|
|
|
|
end
|
|
|
|
|
|
%User Input decode for application ***************************
|
|
if RFconfig==1,
|
|
prompt={'Enter LeftSide Central Boundary in Percent:',...
|
|
'Enter RightSide Central Boundary in Percent:', ...
|
|
'Enter percent of Reference Standard Deviation to use', ...
|
|
'Enter Day Sequence Numbers for set intersect:' ...
|
|
'Remove No Growth Infinite Interactors:' ...
|
|
'Number of Bins for Histograms'...
|
|
'Subplots(Y), Multiple Plots(N), Suspend Plots(S)'};
|
|
else
|
|
prompt={'Enter LeftSide Central Boundary in Percent:',...
|
|
'Enter RightSide Central Boundary in Percent:', ...
|
|
'Enter percent of Reference Standard Deviation to use', ...
|
|
'Enter Day Sequence Numbers for set intersect:' ...
|
|
'Remove No Growth Infinite Interactors:' ...
|
|
'Number of Bins for Histograms'...
|
|
'Subplots(Y), Multiple Plots(N), Suspend Plots(S)',...
|
|
QctrlRF,...
|
|
QpertRF,...
|
|
};
|
|
end
|
|
name='Interaction User Input';
|
|
numlines=1;
|
|
%defaultanswer={'80','60','100','3,4,5','N','39','Y','0,',''};
|
|
answer=inputdlg(prompt,name,numlines,defaultanswer);
|
|
|
|
negPercent= str2double(cell2mat(answer(1)));
|
|
posPercent= str2double(cell2mat(answer(2)));
|
|
percentRs= str2double(cell2mat(answer(3)));
|
|
DMstr= cell2mat(answer(4));
|
|
DMcomas=strfind((cell2mat(answer(4))),',');
|
|
removInfinL= answer(5);
|
|
numBins= str2double(cell2mat(answer(6)));
|
|
subplotX= answer(7);
|
|
|
|
n=0;
|
|
for i= DMcomas,
|
|
n=n+1
|
|
DMsel(n)= str2double(DMstr(i-1:i))
|
|
if i== max(DMcomas)
|
|
DMsel(n+1)= str2double(DMstr(i:end));
|
|
end
|
|
end
|
|
if strcmp(Exp(expN).DexpType,'chrono'), daysSel= DMsel; end
|
|
%**************************************************************
|
|
dmN= length(Exp(expN).Dexp(DexpN).DM.drug);
|
|
mpN= length(Exp(expN).Dexp(DexpN).MP);
|
|
%Intc1=3; IntcLst=5;
|
|
%Calculate Interaction values (with and without
|
|
%standardDeviation/Upper-Lower boundary compensation
|
|
|
|
%{
|
|
if strcmp(Exp(expN).DexpType, 'single') || strcmp(Exp(expN).DexpType, 'multi')
|
|
DMs2use= DMsel;
|
|
Dexps2use= DexpN;
|
|
elseif strcmp(Exp(expN).DexpType, 'chrono')
|
|
DMs2use= pertSel;
|
|
nn= daysSel;
|
|
end
|
|
%}
|
|
|
|
for j= 1:1:DexpLen
|
|
%nn= daysSel(j);
|
|
for m=1:mpN
|
|
scnN= pertSel + (dmN*(m-1))
|
|
%****************
|
|
DM0= pertSel; %the DrugMedia choice is constant based on left screeen choice
|
|
DMj= pertSel; %j here is the Day experiment number Which
|
|
DexpN= j; %Day experiment is also where to find data%nn;
|
|
anN= [8 9];
|
|
%****************
|
|
EZintRFs %* Call subroutine to interpret user RF inputs
|
|
%****************
|
|
DexpN= Exp(expN).DexpN; %reestablish DexpN
|
|
%****************
|
|
Xn{m,j,:}=Exp(expN).Dexp(j).scan(scnN).plate(1).CFout(:,5); %Exp(expN).Dexp(nn).scan(DM{j}(m)).plate(1).CFout(:,5);
|
|
Xn{m,j,:}(Xn{m,j,:}==0)= 140;
|
|
Xln{m,j,:}=Exp(expN).Dexp(j).scan(scnN).plate(1).CFout(:,11); %Exp(expN).Dexp(nn).scan(DM{j}(m)).plate(1).CFout(:,11);
|
|
Xhn{m,j,:}=Exp(expN).Dexp(j).scan(scnN).plate(1).CFout(:,12); %Exp(expN).Dexp(nn).scan(DM{j}(m)).plate(1).CFout(:,12);
|
|
|
|
%methCalc=1;
|
|
intL{m,j,:} = ((Xn{m,j,:} - Xn{m,1,:}) - (Rn(j)-Rn(1)));
|
|
intL{m,j,:}(Xn{m,j,:}==140)= 100;
|
|
intL{m,j,:}(intL{m,j,:}==0)=-0.1;
|
|
|
|
RsReduced(j)= percentRs/100* Rs(j)
|
|
deltaRp(j)= (Rn(j)+RsReduced(j))-(Rn(1)+RsReduced(1));
|
|
deltaRn(j)=(Rn(j)-RsReduced(j))-(Rn(1)-RsReduced(1));
|
|
if deltaRp(j)==0, deltaRp(j)=0.2; end
|
|
if deltaRn(j)==0, deltaRn(j)=0.2; end
|
|
|
|
deltaYp= zeros(1,384); deltaYn= zeros(1,384);
|
|
deltaXRp= zeros(1,384); deltaXRn= zeros(1,384);
|
|
deltaXR{m,j}= zeros(1,384);
|
|
for i=1:384
|
|
%Select lower or upper boundary value based on Yn(1)
|
|
if Xn{m,j}(i) >= (Rn(j)+RsReduced(j));
|
|
deltaYp(i)= Xln{m,j}(i)-Xln{m,1}(i);
|
|
elseif Xn{m,j}(i) < (Rn(j)-RsReduced(j));
|
|
deltaYn(i)= Xhn{m,j}(i)-Xhn{m,1}(i);
|
|
% Insert else
|
|
end
|
|
%Calculate deltaXRp and deltaXRn for each plate based on growth relative to deltaRp or deltaRn
|
|
if deltaYp(i)>= deltaRp(j)
|
|
deltaXRp(i)= deltaYp(i)-deltaRp(j);
|
|
deltaXR{m,j}(i)= deltaXRp(i); %Consoludate into deltaXR{m,j}(i) cell array
|
|
elseif deltaYn(i) < deltaRn(j)
|
|
deltaXRn(i)= deltaYn(i)-deltaRn(j);
|
|
deltaXR{m,j}(i)= deltaXRn(i); %Consoludate into deltaXR{m,j}(i) cell array
|
|
if deltaYn(i)==0, deltaXR{m,j}(i)=0; end
|
|
end
|
|
|
|
%Ambiguous results that have delta gene values that are less than the variance of Reference+/-std
|
|
|
|
|
|
end %for i=1:384
|
|
|
|
%**************************************************************************
|
|
%end %if methCalc==0
|
|
|
|
deltaXR{m,j,:}(Xn{m,j,:}==140)= 100;
|
|
deltaXR{m,j,:}(Xln{m,j,:}==0)= 100;
|
|
deltaXR{m,j,:}(isnan(Xln{m,j,:}))= 120;
|
|
deltaXR{m,j,:}(Xhn{m,j,:}==0)= 100;
|
|
deltaXR{m,j,:}(isnan(Xhn{m,j,:}))= 120;
|
|
|
|
|
|
|
|
|
|
%Compile all gene related L values for the each Dexp sequencially(j).
|
|
addend= (1+((m-1)*384)) %((((m-1)*j)*384)+1);
|
|
intLcmp(addend:addend+383,j)= cell2mat(intL(m,j,:)); %For only pertSel across Dexps (((addend:addend+383),j)= cell2mat(intL(j,m,:));
|
|
intLadjcmp(addend:addend+383,j)= cell2mat(deltaXR(m,j,:)); %((addend:addend+383),j)= cell2mat(deltaXR(j,m,:));
|
|
|
|
end %m=1:mpN
|
|
%********END m loop assoc'd with MPs for loop***************
|
|
%***********************************************************
|
|
|
|
|
|
%Remove RFs and Blank (or non annotated ' ') orf data Then
|
|
%Filter data per user intput
|
|
intLc{j}= intLcmp(:,j); %j);
|
|
intLwoRFs{j}(1,:)= intLcmp(Exp(expN).Dexp(j).mutSpotIndx.woRFs,j);
|
|
intLwoRFs{j}(2,:)= Exp(expN).Dexp(j).mutSpotIndx.woRFs;%Index of non-RF non-blank spots
|
|
|
|
if strcmpi(removInfinL,'Y')
|
|
|
|
intLwoRFs0{j}(1,:)= intLwoRFs{j}(1,(intLwoRFs{j}(1,:)~= 100)); %Values intLcmp(Exp(1).mutSpotIndx.woRFs,j);
|
|
intLwoRFs0{j}(2,:)= intLwoRFs{j}(2,(intLwoRFs{j}(1,:)~= 100)); %MP Spot Index position intLcmp(385:(mpN-1)*384,j);
|
|
clear intLwoRFs
|
|
intLwoRFs{j}(1,:)= intLwoRFs0{j}(1,:);
|
|
intLwoRFs{j}(2,:)= intLwoRFs0{j}(2,:);
|
|
end
|
|
|
|
|
|
intLwoRFsorted{j}= sortrows(intLwoRFs{j}',1); %SortBy Values field
|
|
|
|
clear intLcmpSortGT0 intLcmpSortLT0
|
|
tempIntL= intLwoRFsorted{j}(:,1);
|
|
intLcmpSortGT0= tempIntL((tempIntL) >0);
|
|
if ~isempty(intLcmpSortGT0)
|
|
centPosCnt= round(posPercent/100 * length(intLcmpSortGT0));
|
|
intLposSel{j}=intLwoRFsorted{j}((length(intLcmpSortGT0)+centPosCnt): end,:);
|
|
posIntboundryCentralVal(j)= intLcmpSortGT0((centPosCnt),:); %For Histogram use
|
|
else
|
|
posIntboundryCentralVal(j)= 0;
|
|
end
|
|
|
|
intLcmpSortLT0= tempIntL((tempIntL) <0);
|
|
if ~isempty(intLcmpSortLT0)
|
|
centNegCnt= round(negPercent/100 * length(intLcmpSortLT0));
|
|
intLnegSel{j}=intLwoRFsorted{j}((1:(length(intLcmpSortLT0)-centNegCnt)),:);
|
|
negIntboundryCentralVal(j)= intLcmpSortLT0(((length(intLcmpSortLT0))-(centNegCnt)),:); %For Histogram use
|
|
else
|
|
negIntboundryCentralVal(j)=0;
|
|
end
|
|
|
|
|
|
%Find potential Interactors within selected range
|
|
jj=j;
|
|
daysSel= daysSel;
|
|
%maxNperts= Exp(expN).DexpLength; %(daysSel); %(daysSel);
|
|
|
|
if jj== daysSel(1) %Intc1,
|
|
InterslstPos{1}= intLposSel{daysSel(1)}(:,2) %intLcmpposInd{Intc1}
|
|
InterslstNeg{1}= intLnegSel{daysSel(1)}(:,2) %intLcmpnegInd{Intc1}
|
|
elseif sum(ismember(daysSel,jj))==1 %Intc1 && jj<=IntcLst
|
|
InterslstPos{1}=(intersect(InterslstPos{1},intLposSel{jj}(:,2))); %,intLcmpposInd{jj}))
|
|
InterslstNeg{1}=(intersect(InterslstNeg{1},intLnegSel{jj}(:,2))); %,intLcmpnegInd{jj}))
|
|
end
|
|
|
|
|
|
%Convolute experiment spot index to get scan#, MP# and plateIndx needed
|
|
%later to obtain genename and other descriptors and correlate data
|
|
if sum(ismember(daysSel,jj))==1 %might need to? restrict to only the 'daysSel' entered by user
|
|
try
|
|
intLposDIndx{jj}(:,4)= jj; %Dexp number
|
|
intLposDIndx{jj}(:,2)= ceil((intLposSel{jj}(:,2))/(384)); %mp plate numb column
|
|
intLposDIndx{jj}(:,3)=rem(intLposSel{jj}(:,2),(384)); %384));
|
|
tmp= intLposDIndx{jj}(:,3)==0;
|
|
intLposDIndx{jj}(tmp,3)= 384;
|
|
intLposDIndx{jj}(:,1)= pertSel + (dmN*((intLposDIndx{jj}(:,2))-1)); %((intLposDIndx{jj}(:,2))-1)); %scan numb column %intLposDIndx(:,2)* intLposDIndx(:,3);
|
|
catch
|
|
end
|
|
try
|
|
intLnegDIndx{jj}(:,4)= j; %Dexp number
|
|
intLnegDIndx{jj}(:,2)= ceil((intLposSel{jj}(:,2))/(384)); %384); %mp plate numb column
|
|
intLnegDIndx{jj}(:,3)= rem(intLnegSel{jj}(:,2),(384));
|
|
tmp=(intLnegDIndx{jj}(:,3)==0);
|
|
intLnegDIndx{jj}(tmp,3)= 384;
|
|
intLnegDIndx{jj}(:,1)= pertSel + (dmN*((intLnegDIndx{jj}(:,2))-1)); %scan numb
|
|
catch
|
|
end
|
|
end %might want to restrict to only the 'daysSel' entered by user
|
|
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
%********************************************************************************************
|
|
%ADJUSTED L for Reference Standard deviation(More conservative) Interaction List compilation
|
|
if strcmpi(removInfinL,'N')
|
|
intLadjwoRFs{jj}(1,:)=intLadjcmp(Exp(expN).Dexp(DexpN).mutSpotIndx.woRFs,jj);
|
|
intLadjwoRFs{jj}(2,:)= Exp(expN).Dexp(DexpN).mutSpotIndx.woRFs; %intLadjcmp(385:(mpN-1)*384,jj); %intLadjcmp(Exp(expN).Dexp(DexpN).mutSpotIndx.woRFs,jj);
|
|
|
|
elseif strcmpi(removInfinL,'Y')
|
|
intLadjwoRFs{jj}(1,:)=intLadjcmp(Exp(expN).Dexp(DexpN).mutSpotIndx.woRFs,jj);
|
|
intLadjwoRFs{jj}(2,:)= Exp(expN).Dexp(DexpN).mutSpotIndx.woRFs; %intLadjcmp(385:(mpN-1)*384,jj); %intLadjcmp(Exp(expN).Dexp(DexpN).mutSpotIndx.woRFs,jj);
|
|
intLadjwoRFs100{jj}(1,:)= intLadjwoRFs{jj}(1,(intLadjwoRFs{jj}(1,:)~= 100)) ; %intLcmp(Exp(1).mutSpotIndx.woRFs,jj);
|
|
intLadjwoRFs100{jj}(2,:)= intLadjwoRFs{jj}(2,(intLadjwoRFs{jj}(1,:)~= 100)) ; % Remove Index where spots are infinite (=100);
|
|
intLadjwoRFs0{jj}(1,:)= intLadjwoRFs100{jj}(1,(intLadjwoRFs100{jj}(1,:)~= 0)); % Remove Index where spots are indeterminely within the range of Ref STD
|
|
intLadjwoRFs0{jj}(2,:)= intLadjwoRFs100{jj}(2,(intLadjwoRFs100{jj}(1,:)~= 0)); % Remove Index where spots are indeterminely within the range of Ref STD
|
|
clear intLadjwoRFs
|
|
intLadjwoRFs{jj}(1,:)= intLadjwoRFs0{jj}(1,:); %Put filtered results back into intLadjwoRFs
|
|
intLadjwoRFs{jj}(2,:)= intLadjwoRFs0{jj}(2,:); %Put filtered results back into intLadjwoRFs
|
|
end
|
|
|
|
intLwoRFsortedAdj{jj}= sortrows(intLadjwoRFs{jj}',1);
|
|
clear intLadjSortGT0 intLadjSortLT0
|
|
tempIntLadj= intLwoRFsortedAdj{jj}(:,1);
|
|
intLadjSortLT0= tempIntLadj((tempIntLadj) <0);
|
|
intLadjSort0s= tempIntLadj(tempIntLadj ==0)
|
|
intLadjSortGT0= tempIntLadj(tempIntLadj >0); %=0);
|
|
|
|
if ~isempty(intLadjSortGT0)&& ~isempty(intLadjSortLT0)
|
|
centPosCntAdj= round(posPercent/100 * length(intLadjSortGT0));
|
|
intLposSelAdj{jj}=intLwoRFsortedAdj{jj}((length(intLadjSortLT0)+ length(intLadjSort0s) + centPosCntAdj): end,:);
|
|
posIntboundryCentralValAdj(jj)= intLadjSortGT0(centPosCntAdj,:);
|
|
else
|
|
posIntboundryCentralValAdj(jj)= 0;
|
|
end
|
|
|
|
if ~isempty(intLadjSortLT0)
|
|
try
|
|
centNegCntAdj= round(negPercent/100 * length(intLadjSortLT0));
|
|
intLnegSelAdj{jj}=intLwoRFsortedAdj{jj}((1:(length(intLadjSortLT0)-centNegCntAdj)),:);
|
|
negIntboundryCentralValAdj(jj)= intLadjSortLT0(((length(intLadjSortLT0))-(centNegCntAdj)),:);
|
|
catch,negIntboundryCentralValAdj(jj)= 1;
|
|
end
|
|
else
|
|
negIntboundryCentralValAdj(jj)= 1;
|
|
end
|
|
|
|
if jj== daysSel(1) %Intc1,
|
|
InterslstPosAdj{1}= intLposSelAdj{daysSel(1)}(:,2) %intLcmpposInd{Intc1}
|
|
InterslstNegAdj{1}= intLnegSelAdj{daysSel(1)}(:,2) %intLcmpnegInd{Intc1}
|
|
elseif sum(ismember(daysSel,jj))==1 % jj>Intc1 && jj<=IntcLst
|
|
InterslstPosAdj{1}=(intersect(InterslstPosAdj{1},intLposSelAdj{jj}(:,2))); %,intLcmpposInd{jj}))
|
|
InterslstNegAdj{1}=(intersect(InterslstNegAdj{1},intLnegSelAdj{jj}(:,2))); %,intLcmpnegInd{jj}))
|
|
end
|
|
|
|
|
|
%Convolute experiment spot index to get scan#, MP# and plateIndx needed
|
|
%later to obtain genename and other descriptors and correlate data
|
|
try
|
|
intLposDIndxAdj{jj}(:,2)= ceil((intLposSelAdj{jj}(:,2))/(384)); %mp plate numb column
|
|
intLposDIndxAdj{jj}(:,4)= jj;
|
|
intLposDIndxAdj{jj}(:,3)=(rem(intLposSelAdj{jj}(:,2),(384)));
|
|
tmp=(intLposDIndxAdj{jj}(:,3)==0);
|
|
intLposDIndx{jj}(tmp,3)= 384;
|
|
intLposDIndxAdj{jj}(:,1)= pertSel + (dmN*((intLposDIndxAdj{jj}(:,2))-1)); %scan numb column
|
|
catch
|
|
end
|
|
try
|
|
intLnegDIndxAdj{jj}(:,2)= m; %ceil((intLnegSelAdj{jj}(:,2))/384); %mp plate numb column
|
|
intLnegDIndxAdj{jj}(:,4)= jj;
|
|
intLnegDIndxAdj{jj}(:,3)=(rem(intLnegSelAdj{jj}(:,2),(384)));
|
|
tmp=(intLnegDIndxAdj{jj}(:,3)==0);
|
|
intLnegDIndxAdj{jj}(tmp,3)= 384;
|
|
intLnegDIndxAdj{jj}(:,1)= pertSel + (dmN*((intLnegDIndxAdj{jj}(:,2))-1)); %scan numb
|
|
catch
|
|
end
|
|
|
|
%end %for Perts2use jj= DMs2use
|
|
end % for j= 1:DexpLen
|
|
%****************************************************************************************
|
|
%******END OF Big Loop*******************************************************************
|
|
%****************************************************************************************
|
|
|
|
|
|
|
|
|
|
%get interaction values for each DM drugmedia agar type
|
|
IntersValsPos= intLcmp(InterslstPos{1},daysSel);
|
|
IntersValsNeg= intLcmp(InterslstNeg{1},daysSel);
|
|
IntersValsPosAdj= intLadjcmp(InterslstPosAdj{1},daysSel);
|
|
IntersValsNegAdj= intLadjcmp(InterslstNegAdj{1},daysSel);
|
|
%*********************************************************
|
|
|
|
%Build 'genelist' data sheet for interactors
|
|
if ~isempty(InterslstPos{1})
|
|
selIntPx{1}(:,6)=InterslstPos{1};
|
|
selIntPx{1}(:,2)=ceil((InterslstPos{1})/(384)); %mp plate numb column
|
|
selIntPx{1}(:,3)= rem(InterslstPos{1},(384));
|
|
tmpMovV1=(selIntPx{1}(:,3)==0);
|
|
selIntPx{1}(tmpMovV1,3)= 384;
|
|
selIntPx{1}(:,4)= ceil(selIntPx{1}(:,3)/24); %row numb
|
|
selIntPx{1}(:,5)= rem(selIntPx{1}(:,3),24);
|
|
tmp2=(selIntPx{1}(:,5)==0);
|
|
selIntPx{1}(tmp2,5)= 24;
|
|
selIntPx{1}(:,1)= pertSel + (dmN*((selIntPx{1}(:,2))-1)); %scan numb column %intLposDIndx(:,2)* intLposDIndx(:,3);
|
|
selIntP= cell2mat(selIntPx);
|
|
end
|
|
if ~isempty(InterslstNeg{1})
|
|
selIntNx{1}(:,6)=InterslstNeg{1};
|
|
selIntNx{1}(:,2)=ceil((InterslstNeg{1})/(384)); %mp plate numb column
|
|
selIntNx{1}(:,3)=(rem(InterslstNeg{1},(384)));
|
|
tmp1=(selIntNx{1}(:,3)==0);
|
|
selIntNx{1}(tmp1,3)= 384;
|
|
selIntNx{1}(:,4)= ceil(selIntNx{1}(:,3)/24); %row numb
|
|
selIntNx{1}(:,5)= rem(selIntNx{1}(:,3),24);
|
|
tmp2=(selIntNx{1}(:,5)==0);
|
|
selIntNx{1}(tmp2,5)= 24;
|
|
|
|
selIntNx{1}(:,1)= pertSel + (dmN*((selIntNx{1}(:,2))-1)); %jj + (maxNperts*((selIntNx{1}(:,2))-1)); %scan numb
|
|
selIntN= cell2mat(selIntNx);
|
|
end
|
|
|
|
if strcmp(Exp(expN).DexpType, 'single') || strcmp(Exp(expN).DexpType,'multi')
|
|
d1= DexpN;
|
|
elseif strcmp(Exp(expN).DexpType, 'chrono')
|
|
d1= daysSel(1); %Dexps2use(1);
|
|
end
|
|
if ~isempty(InterslstPos{1})
|
|
for i=1:size(selIntP,1)
|
|
IPgene(i)=Exp(expN).Dexp(d1).MP(selIntP(i,2)).genename{1}(selIntP(i,3));
|
|
IPorf(i)= Exp(expN).Dexp(d1).MP(selIntP(i,2)).orf{1}(selIntP(i,3));
|
|
IPstrain(i)= Exp(expN).Dexp(d1).MP(selIntP(i,2)).strain{1}(selIntP(i,3));
|
|
IPspecifics(i)=Exp(expN).Dexp(d1).MP(selIntP(i,2)).specifics{1}(selIntP(i,3));
|
|
IPorfRep(i)=Exp(expN).Dexp(d1).MP(selIntP(i,2)).orfRep{1}(selIntP(i,3));
|
|
|
|
%Bad this is the L data for only the last selected DM perturbation
|
|
%Would need to calculate each scan# for each perts2use value
|
|
ipL(i)= Exp(expN).Dexp(d1).scan(selIntP(i,1)).plate(1).CFout(selIntP(i,3),5);
|
|
ipLlower(i)= Exp(expN).Dexp(d1).scan(selIntP(i,1)).plate(1).CFout(selIntP(i,3),11);
|
|
ipLupper(i)= Exp(expN).Dexp(d1).scan(selIntP(i,1)).plate(1).CFout(selIntP(i,3),12);
|
|
%*************************************************************************
|
|
end
|
|
end
|
|
if ~isempty(InterslstNeg{1})
|
|
for i=1:size(selIntN,1)
|
|
i
|
|
INgene(i)=Exp(expN).Dexp(d1).MP(selIntN(i,2)).genename{1}(selIntN(i,3));
|
|
INorf(i)= Exp(expN).Dexp(d1).MP(selIntN(i,2)).orf{1}(selIntN(i,3));
|
|
INstrain(i)= Exp(expN).Dexp(d1).MP(selIntN(i,2)).strain{1}(selIntN(i,3));
|
|
INspecifics(i)=Exp(expN).Dexp(d1).MP(selIntN(i,2)).specifics{1}(selIntN(i,3));
|
|
INorfRep(i)=Exp(expN).Dexp(d1).MP(selIntN(i,2)).orfRep{1}(selIntN(i,3));
|
|
|
|
%Bad this is the L data for only the last selected DM perturbation
|
|
%Would need to calculate each scan# for each perts2use value
|
|
inL(i)= Exp(expN).Dexp(d1).scan(selIntN(i,1)).plate(1).CFout(selIntN(i,3),5);
|
|
inLlower(i)= Exp(expN).Dexp(d1).scan(selIntN(i,1)).plate(1).CFout(selIntN(i,3),11);
|
|
inLupper(i)= Exp(expN).Dexp(d1).scan(selIntN(i,1)).plate(1).CFout(selIntN(i,3),12);
|
|
%*************************************************************************
|
|
end
|
|
end
|
|
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
%**************************************************************************************
|
|
%ADJUSTED with STD and curve fit boundaries to produce more conservative interaction values
|
|
|
|
%Build 'genelist' data sheet for interactors
|
|
selIntPxAdj{1}(:,2)=ceil((InterslstPosAdj{1})/(384)); %mp plate numb column
|
|
selIntPxAdj{1}(:,3)=(rem(InterslstPosAdj{1},(384)));
|
|
tmpMovV1=(selIntPxAdj{1}(:,3)==0);
|
|
selIntPxAdj{1}(tmpMovV1,3)= 384;
|
|
selIntPxAdj{1}(:,4)= ceil(selIntPxAdj{1}(:,3)/24); %row numb
|
|
selIntPxAdj{1}(:,5)= rem(selIntPxAdj{1}(:,3),24);
|
|
tmpMovV2=(selIntPxAdj{1}(:,5)==0);
|
|
selIntPxAdj{1}(tmpMovV2,5)= 24;
|
|
|
|
selIntPxAdj{1}(:,1)= pertSel + (dmN*((selIntPxAdj{1}(:,2))-1)); %scan numb column %intLposDIndx(:,2)* intLposDIndx(:,3);
|
|
selIntPAdj= cell2mat(selIntPxAdj);
|
|
|
|
if ~isempty(InterslstNegAdj{1})
|
|
selIntNxAdj{1}(:,2)=ceil((InterslstNegAdj{1})/(384)); %mp plate numb column
|
|
selIntNxAdj{1}(:,3)= rem(InterslstNegAdj{1},(384));
|
|
tmpMovV1=(selIntNxAdj{1}(:,3)==0);
|
|
selIntNxAdj{1}(tmpMovV1,3)= 384;
|
|
selIntNxAdj{1}(:,4)= ceil(selIntNxAdj{1}(:,3)/24); %row numb
|
|
selIntNxAdj{1}(:,5)= rem(selIntNxAdj{1}(:,3),24);
|
|
tmpMovV2=(selIntNxAdj{1}(:,5)==0);
|
|
selIntNxAdj{1}(tmpMovV2,5)= 24;
|
|
|
|
selIntNxAdj{1}(:,1)= pertSel + (dmN*((selIntNxAdj{1}(:,2))-1)); %scan numb
|
|
selIntNAdj= cell2mat(selIntNxAdj);
|
|
end
|
|
for i=1:size(selIntPAdj,1)
|
|
IPgeneAdj(i)=Exp(expN).Dexp(d1).MP(selIntPAdj(i,2)).genename{1}(selIntPAdj(i,3));
|
|
IPorfAdj(i)= Exp(expN).Dexp(d1).MP(selIntPAdj(i,2)).orf{1}(selIntPAdj(i,3));
|
|
IPstrainAdj(i)= Exp(expN).Dexp(d1).MP(selIntPAdj(i,2)).strain{1}(selIntPAdj(i,3));
|
|
IPspecificsAdj(i)=Exp(expN).Dexp(d1).MP(selIntPAdj(i,2)).specifics{1}(selIntPAdj(i,3));
|
|
IPorfRepAdj(i)=Exp(expN).Dexp(d1).MP(selIntPAdj(i,2)).orfRep{1}(selIntPAdj(i,3));
|
|
|
|
%Bad this is the L data for only the last selected DM perturbation
|
|
%Would need to calculate each scan# for each perts2use value
|
|
ipLAdj(i)= Exp(expN).Dexp(d1).scan(selIntPAdj(i,1)).plate(1).CFout(selIntPAdj(i,3),5);
|
|
ipLlowerAdj(i)= Exp(expN).Dexp(d1).scan(selIntPAdj(i,1)).plate(1).CFout(selIntPAdj(i,3),11);
|
|
ipLupperAdj(i)= Exp(expN).Dexp(d1).scan(selIntPAdj(i,1)).plate(1).CFout(selIntPAdj(i,3),12);
|
|
%************************************************************************************
|
|
end
|
|
if ~isempty(InterslstNegAdj{1})
|
|
for i=1:size(selIntNAdj,1)
|
|
INgeneAdj(i)=Exp(expN).Dexp(d1).MP(selIntNAdj(i,2)).genename{1}(selIntNAdj(i,3));
|
|
INorfAdj(i)= Exp(expN).Dexp(d1).MP(selIntNAdj(i,2)).orf{1}(selIntNAdj(i,3));
|
|
INstrainAdj(i)= Exp(expN).Dexp(d1).MP(selIntNAdj(i,2)).strain{1}(selIntNAdj(i,3));
|
|
INspecificsAdj(i)=Exp(expN).Dexp(d1).MP(selIntNAdj(i,2)).specifics{1}(selIntNAdj(i,3));
|
|
INorfRepAdj(i)=Exp(expN).Dexp(d1).MP(selIntNAdj(i,2)).orfRep{1}(selIntNAdj(i,3));
|
|
|
|
%Bad this is the L data for only the last selected DM perturbation
|
|
%Would need to calculate each scan# for each perts2use value
|
|
inLAdj(i)= Exp(expN).Dexp(d1).scan(selIntNAdj(i,1)).plate(1).CFout(selIntNAdj(i,3),5);
|
|
inLlowerAdj(i)= Exp(expN).Dexp(d1).scan(selIntNAdj(i,1)).plate(1).CFout(selIntNAdj(i,3),11);
|
|
inLupperAdj(i)= Exp(expN).Dexp(d1).scan(selIntNAdj(i,1)).plate(1).CFout(selIntNAdj(i,3),12);
|
|
%*************************************************************************************
|
|
end
|
|
end
|
|
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
|
|
|
%Plot Histogram******************************************************
|
|
|
|
%subplotX=1;
|
|
figure
|
|
RFstds=', ';
|
|
for jj=1:DexpLen,
|
|
RFstds=strcat(RFstds,'Rs',num2str(jj),'_',num2str(Rs(jj)));
|
|
if jj~=DexpLen, strcat(RFstds,', ');end
|
|
end
|
|
histName= strcat('ExpZone ',num2str(expN),'-',Exp(expN).Dexp(DexpN).ExpFoldr,', Interaction Values ', ...
|
|
', LfFilter-',num2str(negPercent),', RtFilter-',num2str(posPercent),', RemoveNoGrowth-',char(removInfinL), ...
|
|
RFstds)
|
|
histAdjName= strcat('ExpZone ',num2str(expN),'-',Exp(expN).Dexp(DexpN).ExpFoldr,', Interaction Compensated by Reference Standard Deviation @',num2str(percentRs),'%', '& Upper/Lower Curvefit Boundaries', ...
|
|
', LfFilter-',num2str(negPercent),', RtFilter-',num2str(posPercent),', RemoveNoGrowth-',char(removInfinL), ...
|
|
RFstds)
|
|
if strcmpi(subplotX,'Y')
|
|
for jj=1:DexpLen
|
|
histLdata= intLwoRFsorted{jj}(:,1); %intLcmp(385:(mpN-1)*384,jj);
|
|
%histLadjData= intLadjcmp(385:(mpN-1)*384,jj);
|
|
hgLdat{jj}=histfitJR(histLdata,numBins,'kernel');
|
|
|
|
x{jj}= get(hgLdat{jj}(2),'xdata');
|
|
y{jj}= get(hgLdat{jj}(2),'ydata');
|
|
xb{jj}=get(hgLdat{jj}(1),'xdata');
|
|
yb{jj}=get(hgLdat{jj}(1),'ydata');
|
|
ybpostot{jj}=sum(yb{jj}(2,(xb{jj}(1,:)>=0)));
|
|
ybnegtot{jj}=sum(yb{jj}(2,(xb{jj}(1,:) <0)));
|
|
xbb(jj,:)=xb{jj}(2,:);
|
|
ybb(jj,:)=yb{jj}(2,:);
|
|
clf
|
|
end
|
|
|
|
% figure
|
|
|
|
|
|
if strcmpi(removInfinL,'N')
|
|
histLadjData= intLwoRFsortedAdj{jj}(:,1); %intLadjcmp(385:(mpN-1)*384,jj);
|
|
else
|
|
intLwoRFsortedAdj4HisW0{jj}= sortrows(intLadjwoRFs100{jj}',1); %Data including with 0's indeterminate within STD
|
|
histLadjData= intLwoRFsortedAdj4HisW0{jj}(:,1)
|
|
end
|
|
for jj=1:DexpLen
|
|
histLdata= intLwoRFsorted{jj}(:,1); %intLcmp(385:(mpN-1)*384,jj);
|
|
hgL{jj}=subplot(2, 4, jj), histfitJR(histLdata,numBins,'kernel') ; hold %hgL{jj}=histfit(intLcmp(:,jj),31,'kernel')
|
|
subplot(2, 4, jj),plot(posIntboundryCentralVal(jj), 1:3000,'--r')
|
|
subplot(2, 4, jj),plot(negIntboundryCentralVal(jj), 1:3000,'--g')
|
|
hold off
|
|
end
|
|
scnsize=get(0,'screensize')
|
|
pos1= [round(scnsize(3)/40), round(scnsize(4)/2 +(scnsize(3)/80)),...
|
|
round(scnsize(3) -round(scnsize(3)/80)),round(scnsize(4)/2 -round(scnsize(4)/80))]
|
|
set(gcf,'outerposition',pos1)
|
|
set(gcf,'Name', histName);
|
|
|
|
figure
|
|
|
|
|
|
for jj=1:DexpLen
|
|
if strcmpi(removInfinL,'N')
|
|
histLadjData= intLwoRFsortedAdj{jj}(:,1); %intLadjcmp(385:(mpN-1)*384,jj);
|
|
else
|
|
intLwoRFsortedAdj4HisW0{jj}= sortrows(intLadjwoRFs100{jj}',1); %Data including with 0's indeterminate within STD
|
|
histLadjData= intLwoRFsortedAdj4HisW0{jj}(:,1)
|
|
end
|
|
hgLadj{jj}=subplot(2, 4, jj),histfitJR(histLadjData,numBins,'kernel') ; hold %hgLadj{jj}=histfit(intLadjcmp(:,jj),31,'kernel')
|
|
subplot(2, 4, jj),plot(posIntboundryCentralValAdj(jj), 1:3000,'--r')
|
|
subplot(2, 4, jj),plot(negIntboundryCentralValAdj(jj), 1:3000,'--g')
|
|
hold off
|
|
end
|
|
pos2= [round(scnsize(3)/40), round(scnsize(4)/30),...
|
|
round(scnsize(3) -scnsize(3)/80),round(scnsize(4)/2 -scnsize(4)/80)]
|
|
set(gcf,'outerposition',pos2)
|
|
set(gcf,'Name', histAdjName)
|
|
%set(gcf,'Name', 'Interaction Compensated by Standard Deviation and Upper/Lower Curvefit boundaries')
|
|
|
|
elseif strcmpi(subplotX,'N')
|
|
for jj=1:DexpLen
|
|
|
|
histLdata= intLwoRFsorted{jj}(:,1); %intLcmp(385:(mpN-1)*384,jj);
|
|
%intLwoRFsortedAdj4HisW0{jj}= sortrows(intLadjwoRFs100{jj}',1); %Data including with 0's indeterminate within STD
|
|
%histLadjData= intLwoRFsortedAdj4HisW0{jj}(:,1);
|
|
%histLadjData= intLwoRFsortedAdj{jj}(:,1); %intLadjcmp(385:(mpN-1)*384,jj);%intLadjcmp(385:(mpN-1)*384,jj); %intLcmp(:,jj); %intLadjcmp(:,jj);
|
|
if strcmpi(removInfinL,'N')
|
|
histLadjData= intLwoRFsortedAdj{jj}(:,1); %intLadjcmp(385:(mpN-1)*384,jj);
|
|
else
|
|
intLwoRFsortedAdj4HisW0{jj}= sortrows(intLadjwoRFs100{jj}',1); %Data including with 0's indeterminate within STD
|
|
histLadjData= intLwoRFsortedAdj4HisW0{jj}(:,1)
|
|
end
|
|
figure
|
|
hgL{jj}=histfitJR(histLdata,numBins,'kernel') ; hold %hgL{jj}=histfit(intLcmp(:,jj),31,'kernel')
|
|
plot(posIntboundryCentralVal(jj), 1:3000,'--r')
|
|
plot(negIntboundryCentralVal(jj), 1:3000,'--g')
|
|
set(gcf,'Name', strcat('DM-',num2str(jj),'-',histName));
|
|
hold off
|
|
|
|
figure
|
|
hgLadj{jj}=histfitJR(histLadjData,numBins,'kernel') ; hold %hgLadj{jj}=histfit(intLadjcmp(:,jj),31,'kernel')
|
|
plot(posIntboundryCentralValAdj(jj), 1:3000,'--r')
|
|
plot(negIntboundryCentralValAdj(jj), 1:3000,'--g')
|
|
set(gcf,'Name', strcat('DM-',num2str(jj),'-',histAdjName));
|
|
hold off
|
|
|
|
x{jj}= get(hgL{jj}(2),'xdata')
|
|
y{jj}= get(hgL{jj}(2),'ydata');
|
|
xb{jj}=get(hgL{jj}(1),'xdata')
|
|
yb{jj}=get(hgL{jj}(1),'ydata')
|
|
ybpostot{jj}=sum(yb{jj}(2,(xb{jj}(1,:)>=0)))
|
|
ybnegtot{jj}=sum(yb{jj}(2,(xb{jj}(1,:) <0)))
|
|
|
|
xbb(jj,:)=xb{jj}(2,:);
|
|
ybb(jj,:)=yb{jj}(2,:);
|
|
end % for jj= when subplotX~=1 standard one plot per figure
|
|
|
|
|
|
|
|
end %if subplotX==1 histograms placed in subplot figure else multiple histogram plots
|
|
|
|
|
|
|
|
if strcmpi(subplotX,'Y')
|
|
%{
|
|
figure
|
|
bar3(ybb);
|
|
set(gcf,'Name', 'Unfiltered Interaction Histogram for all DrugMedias; NoGrowth Interactors set to 100hr (highest bin)')
|
|
%}
|
|
%xxbb=yb{1}(2,:);
|
|
%figure
|
|
end
|
|
|
|
EZintPrint
|
|
a=1
|
|
|
|
%{
|
|
if methCalc==0
|
|
deltaXR{m,j}= zeros(1,384);
|
|
deltaXR{m,j}(Xn{m,j} >=(Rn(j)+Rs(j)))= ( Xln{m,j}(Xn{m,j} >=(Rn(j)+Rs(j))))- (Rn(j)+Rs(j));
|
|
deltaXR{m,j}(Xn{m,j} < (Rn(j)-Rs(j)))= ( Xhn{m,j}(Xn{m,j} < (Rn(j)-Rs(j))))- (Rn(j)-Rs(j));
|
|
Xneg= Xhn{m,j}- (Rn(j)-Rs(j));
|
|
Xpos= Xln{m,j}- (Rn(j)+Rs(j));
|
|
|
|
|
|
for i=1:length(Xpos(:)),
|
|
%deltaXR{m,j}(i)= Xpos(i);
|
|
if deltaXR{m,j}(i)==0
|
|
try
|
|
if abs(Xpos(i))<abs(Xneg(i)), deltaXR{m,j}(i)= Xpos(i);end
|
|
catch, end
|
|
end
|
|
end
|
|
for i=1:length(Xneg(:)),
|
|
if deltaXR{m,j}(i)==0, deltaXR{m,j}(i)= Xneg(i); end
|
|
try
|
|
if abs(Xpos(i))>abs(Xneg(i)), deltaXR{m,j}(i)= Xneg(i); end
|
|
catch
|
|
end
|
|
end
|
|
%else else else else
|
|
else %if methCalc~=0
|
|
%percentRs= 100;
|
|
RsReduced(j)= percentRs/100* Rs(j)
|
|
%{
|
|
Yn{m,j}= Xn{m,j}-Xn{m,1}; %Yn is deltaXn
|
|
Yn{m,j}(Yn{m,j}==0)=-0.5;
|
|
Yln{m,j}= Xln{m,j}-Xln{m,1};
|
|
Yln{m,j}(Yln{m,j}==0)=-0.5;
|
|
Yhn{m,j}= Xhn{m,j}-Xhn{m,1};
|
|
Yhn{m,j}(Yhn{m,j}==0)=-0.5;
|
|
%}
|
|
|
|
%deltaRp(j)= (Rn(j)+RsReduced(j))-Rn(1); %
|
|
deltaRp(j)= (Rn(j)+RsReduced(j))-(Rn(1)+RsReduced(1));
|
|
%deltaRn(j)= (Rn(j)-RsReduced(j))-Rn(1); %
|
|
deltaRn(j)=(Rn(j)-RsReduced(j))-(Rn(1)-RsReduced(1));
|
|
if deltaRp(j)==0, deltaRp(j)=0.2; end
|
|
if deltaRn(j)==0, deltaRn(j)=0.2; end
|
|
|
|
deltaYp= zeros(1,384); deltaYn= zeros(1,384);
|
|
deltaXRp= zeros(1,384); deltaXRn= zeros(1,384);
|
|
deltaXR{m,j}= zeros(1,384);
|
|
for i=1:384
|
|
%Select lower or upper boundary value based on Yn(1)
|
|
if Xn{m,j}(i) >= (Rn(j)+RsReduced(j));
|
|
deltaYp(i)= Xln{m,j}(i)-Xln{m,1}(i);
|
|
elseif Xn{m,j}(i) < (Rn(j)-RsReduced(j));
|
|
deltaYn(i)= Xhn{m,j}(i)-Xhn{m,1}(i);
|
|
% Insert else
|
|
end
|
|
%Calculate deltaXRp and deltaXRn for each plate based on growth relative to deltaRp or deltaRn
|
|
if deltaYp(i)>= deltaRp(j)
|
|
deltaXRp(i)= deltaYp(i)-deltaRp(j);
|
|
deltaXR{m,j}(i)= deltaXRp(i); %Consoludate into deltaXR{m,j}(i) cell array
|
|
elseif deltaYn(i) < deltaRn(j)
|
|
deltaXRn(i)= deltaYn(i)-deltaRn(j);
|
|
deltaXR{m,j}(i)= deltaXRn(i); %Consoludate into deltaXR{m,j}(i) cell array
|
|
if deltaYn(i)==0, deltaXR{m,j}(i)=0; end
|
|
end
|
|
|
|
%Ambiguous results that have delta gene values that are less than the variance of Reference+/-std
|
|
|
|
|
|
end %for i=1:384
|
|
|
|
%**************************************************************************
|
|
end %if methCalc==0
|
|
%}
|
|
|