Files
hartman-server/qhtcp-workflow/apps/matlab/ezview/EZintPrint.m

150 lines
7.7 KiB
Matlab
Executable File

%print Interaction Data Output file
%resDir=Exp(expN).Dexp(DexpN).resDir;
%expN=1; %temp entry
if strcmp(Exp(expN).DexpType, 'single') || strcmp(Exp(expN).DexpType,'multi')
pertTypeLB= '; DMselections:';
Rsmax=max(Rs(1),Rs(1:dmN));
intLfilename1= fullfile(Exp(expN).Dexp(DexpN).resDir,'PrintResults','!AggrevatingL-DM.txt'); %Longer shorter
intLfilename2= fullfile(Exp(expN).Dexp(DexpN).resDir,'PrintResults','!AlleviatingL-DM.txt');
intLfilename3= fullfile(Exp(expN).Dexp(DexpN).resDir,'PrintResults','!AggrevatingLadjusted-DM.txt');
intLfilename4= fullfile(Exp(expN).Dexp(DexpN).resDir,'PrintResults','!AlleviatingLadjusted-DM.txt');
elseif strcmp(Exp(expN).DexpType, 'chrono')
pertTypeLB= '; Dayselections:';
Rsmax=max(Rs(1),Rs(1:dmN));
%MKDIR for ChonologicalStudy results in Exp Group folder
%For chrono studies, put the interaction results in the first Exp of selected group. i.e., DexpN=1;
intLfilename1= fullfile(Exp(expN).Dexp(1).resDir,'PrintResults','!AggrevatingL-Chrono.txt');
intLfilename2= fullfile(Exp(expN).Dexp(1).resDir,'PrintResults','!AlleviatingL-Chrono.txt');
intLfilename3= fullfile(Exp(expN).Dexp(1).resDir,'PrintResults','!AggrevatingLadjusted-Chrono.txt');
intLfilename4= fullfile(Exp(expN).Dexp(1).resDir,'PrintResults','!AlleviatingLadjusted-Chrono.txt');
end
userInputs=cell2mat(strcat( 'ExpZone:',num2str(expN), '; LeftPercent',answer(1),'; RightPercent:',answer(2),...
'; RFstdPercent:',answer(3),pertTypeLB,answer(4),'; RemoveNoGrowthInfLs:',answer(5),...
'; NumberOfHistogramBins:',answer(6),'; Subplots:',answer(7))); %answer(7)
% Interaction Printout for Positive (longer L interaction values) Non-Adjusted for Ref std and curve fit boundaries
fid=fopen(intLfilename1,'w');
ln=1;
fprintf(fid,'%d\t',ln);
fprintf(fid,'%s\userInputs',strcat('AggrevatingInteractionResults for User Input: ',userInputs));
for j=1:dmN, fprintf(fid,'%s',strcat(', Rstd',num2str(j),'_',num2str(Rs(j)))); end
fprintf(fid, '\n');
ln=2;
fprintf(fid,'%d\t',ln);
fprintf(fid, 'Orf\tGene\t');
for j=1:length(DMsel), fprintf(fid,'%s\t',strcat('IntLdm',num2str(DMsel(j)))); end
%fprintf(fid, 'L\tLlower\tLupper\t')
fprintf(fid,'Specifics\tReplicate\tStrain\tMP\tRow\tCol\tIndex');
fprintf(fid, '\n');
if ~isempty(InterslstPos{1})
for i=1:size(selIntP,1)
ln=ln+1;
fprintf(fid,'%d\t',ln);
fprintf(fid,'%s\t%s\t',cell2mat(IPorf(i)),cell2mat(IPgene(i)));
for j=1:length(DMsel) % 'Scan\tPlate\tRow\tCol\t');
fprintf(fid,'%.5f\t',IntersValsPos(i,j))
end
% fprintf(fid,'%.5f\t%.5f\t%.5f\t',ipL(i),ipLlower(i),ipLupper(i))
fprintf(fid,'%s\t%s\t%s\t',cell2mat(IPspecifics(i)),cell2mat(IPorfRep(i)),cell2mat(IPstrain(i)));
fprintf(fid,'%.5f\t%.5f\t%.5f\t',selIntPx{1}(i,2),selIntPx{1}(i,4),selIntPx{1}(i,5),InterslstPos{1}(i))
fprintf(fid, '\n');
end
else
ln=ln+1;
fprintf(fid,'%d\t',ln);
fprintf(fid,'%s\t','Empty Set, No interaction found within set range.');
end
% fprintf(fid, 'Num.\tDiagnostics\tDrug\tConc\tMedia\tModifier1\tConc1\tModifier2\tConc2\tORF\tGene\tAUC\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');
fclose(fid)
% Interaction Printout for Negative (shorter L interaction values) Non-Adjusted for Ref std and curve fit boundaries
fid=fopen(intLfilename2,'w');
ln=1;
fprintf(fid,'%d\t',ln);
fprintf(fid,'%s\userInputs',strcat('AlleviatingInteractionResults for User Input: ',userInputs)); %fprintf(fid,'%s\userInputs',userInputs);
for j=1:dmN, fprintf(fid,'%s',strcat(', Rstd',num2str(j),'_',num2str(Rs(j)))); end
fprintf(fid, '\n');
ln=2;
fprintf(fid,'%d\t',ln);
fprintf(fid, 'Orf\tGene\t');
for j=1:length(DMsel), fprintf(fid,'%s\t',strcat('IntLdm',num2str(DMsel(j)))); end
%fprintf(fid, 'L\tLlower\tLupper\t')
fprintf(fid,'Specifics\tReplicate\tStrain\tMP\tRow\tCol\tIndex');
fprintf(fid, '\n');
if ~isempty(InterslstNeg{1})
for i=1:size(selIntN,1)
ln=ln+1;
fprintf(fid,'%d\t',ln);
fprintf(fid,'%s\t%s\t',cell2mat(INorf(i)),cell2mat(INgene(i)));
for j=1:length(DMsel) % 'Scan\tPlate\tRow\tCol\t');
fprintf(fid,'%.5f\t',IntersValsNeg(i,j))
end
% fprintf(fid,'%.5f\t%.5f\t%.5f\t',ipL(i),ipLlower(i),ipLupper(i))
fprintf(fid,'%s\t%s\t%s\t',cell2mat(INspecifics(i)),cell2mat(INorfRep(i)),cell2mat(INstrain(i)));
fprintf(fid,'%.5f\t%.5f\t%.5f\t%.5f\t',selIntNx{1}(i,2),selIntNx{1}(i,4),selIntNx{1}(i,5),InterslstNeg{1}(i))
fprintf(fid, '\n');
end
end
fclose(fid)
% Interaction Printout for Positive (longer L interaction values) "ADJUSTED" for Ref std and curve fit boundaries
fid=fopen(intLfilename3,'w');
ln=1;
fprintf(fid,'%d\t',ln);
fprintf(fid,'%s\userInputs',strcat('Adjusted AggrevatingInteractionResults for User Input: ',userInputs));
for j=1:dmN, fprintf(fid,'%s',strcat(', Rstd',num2str(j),'_',num2str(Rs(j)))); end
fprintf(fid, '\n');
ln=2;
fprintf(fid,'%d\t',ln);
fprintf(fid, 'Orf\tGene\t');
for j=1:length(DMsel), fprintf(fid,'%s\t',strcat('IntLdm',num2str(DMsel(j)))); end
% fprintf(fid, 'L\tLlower\tLupper\t')
fprintf(fid,'Specifics\tReplicate\tStrain\tMP\tRow\tCol\tIndex');
fprintf(fid, '\n');
for i=1:size(selIntPAdj,1)
ln=ln+1;
fprintf(fid,'%d\t',ln);
fprintf(fid,'%s\t%s\t',cell2mat(IPorfAdj(i)),cell2mat(IPgeneAdj(i)));
for j=1:length(DMsel) %'Scan\tPlate\tRow\tCol\t');
fprintf(fid,'%.5f\t',IntersValsPosAdj(i,j))
end
% fprintf(fid,'%.5f\t%.5f\t%.5f\t',ipL(i),ipLlower(i),ipLupper(i))
fprintf(fid,'%s\t%s\t%s\t',cell2mat(IPspecificsAdj(i)),cell2mat(IPorfRepAdj(i)),cell2mat(IPstrainAdj(i)));
fprintf(fid,'%.5f\t%.5f\t%.5f\t',selIntPxAdj{1}(i,2),selIntPxAdj{1}(i,4),selIntPxAdj{1}(i,5),InterslstPosAdj{1}(i))
fprintf(fid, '\n');
end
% fprintf(fid, 'Num.\tDiagnostics\tDrug\tConc\tMedia\tModifier1\tConc1\tModifier2\tConc2\tORF\tGene\tAUC\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');
fclose(fid)
fid=fopen(intLfilename4,'w');
ln=1;
fprintf(fid,'%d\t',ln);
fprintf(fid,'%s\userInputs',strcat('AlleviatingInteractionResults for User Input: ',userInputs)); %fprintf(fid,'%s\userInputs',userInputs);
for j=1:dmN, fprintf(fid,'%s',strcat(', Rstd',num2str(j),'_',num2str(Rs(j)))); end
fprintf(fid, '\n');
ln=2;
fprintf(fid,'%d\t',ln);
fprintf(fid, 'Orf\tGene\t');
if ~isempty(InterslstNegAdj{1})
for j=1:length(DMsel), fprintf(fid,'%s\t',strcat('IntLdm',num2str(DMsel(j)))); end
%fprintf(fid, 'L\tLlower\tLupper\t')
fprintf(fid,'Specifics\tReplicate\tStrain\tMP\tRow\tCol\tIndex');
fprintf(fid, '\n');
for i=1:size(selIntNAdj,1)
i
ln=ln+1;
fprintf(fid,'%d\t',ln);
fprintf(fid,'%s\t%s\t',cell2mat(INorfAdj(i)),cell2mat(INgeneAdj(i)));
for j=1:length(DMsel) %'Scan\tPlate\tRow\tCol\t');
fprintf(fid,'%.5f\t',IntersValsNegAdj(i,j))
end
% fprintf(fid,'%.5f\t%.5f\t%.5f\t',ipL(i),ipLlower(i),ipLupper(i))
fprintf(fid,'%s\t%s\t%s\t',cell2mat(INspecificsAdj(i)),cell2mat(INorfRepAdj(i)),cell2mat(INstrainAdj(i)));
fprintf(fid,'%.5f\t%.5f\t%.5f\t',selIntNxAdj{1}(i,2),selIntNxAdj{1}(i,4),selIntNxAdj{1}(i,5),InterslstNegAdj{1}(i))
fprintf(fid, '\n');
end
end
fclose(fid)