EZintPrint.m 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. %print Interaction Data Output file
  2. %resDir=Exp(expN).Dexp(DexpN).resDir;
  3. %expN=1; %temp entry
  4. if strcmp(Exp(expN).DexpType, 'single') || strcmp(Exp(expN).DexpType,'multi')
  5. pertTypeLB= '; DMselections:';
  6. Rsmax=max(Rs(1),Rs(1:dmN));
  7. intLfilename1= fullfile(Exp(expN).Dexp(DexpN).resDir,'PrintResults','!AggrevatingL-DM.txt'); %Longer shorter
  8. intLfilename2= fullfile(Exp(expN).Dexp(DexpN).resDir,'PrintResults','!AlleviatingL-DM.txt');
  9. intLfilename3= fullfile(Exp(expN).Dexp(DexpN).resDir,'PrintResults','!AggrevatingLadjusted-DM.txt');
  10. intLfilename4= fullfile(Exp(expN).Dexp(DexpN).resDir,'PrintResults','!AlleviatingLadjusted-DM.txt');
  11. elseif strcmp(Exp(expN).DexpType, 'chrono')
  12. pertTypeLB= '; Dayselections:';
  13. Rsmax=max(Rs(1),Rs(1:dmN));
  14. %MKDIR for ChonologicalStudy results in Exp Group folder
  15. %For chrono studies, put the interaction results in the first Exp of selected group. i.e., DexpN=1;
  16. intLfilename1= fullfile(Exp(expN).Dexp(1).resDir,'PrintResults','!AggrevatingL-Chrono.txt');
  17. intLfilename2= fullfile(Exp(expN).Dexp(1).resDir,'PrintResults','!AlleviatingL-Chrono.txt');
  18. intLfilename3= fullfile(Exp(expN).Dexp(1).resDir,'PrintResults','!AggrevatingLadjusted-Chrono.txt');
  19. intLfilename4= fullfile(Exp(expN).Dexp(1).resDir,'PrintResults','!AlleviatingLadjusted-Chrono.txt');
  20. end
  21. userInputs=cell2mat(strcat( 'ExpZone:',num2str(expN), '; LeftPercent',answer(1),'; RightPercent:',answer(2),...
  22. '; RFstdPercent:',answer(3),pertTypeLB,answer(4),'; RemoveNoGrowthInfLs:',answer(5),...
  23. '; NumberOfHistogramBins:',answer(6),'; Subplots:',answer(7))); %answer(7)
  24. % Interaction Printout for Positive (longer L interaction values) Non-Adjusted for Ref std and curve fit boundaries
  25. fid=fopen(intLfilename1,'w');
  26. ln=1;
  27. fprintf(fid,'%d\t',ln);
  28. fprintf(fid,'%s\userInputs',strcat('AggrevatingInteractionResults for User Input: ',userInputs));
  29. for j=1:dmN, fprintf(fid,'%s',strcat(', Rstd',num2str(j),'_',num2str(Rs(j)))); end
  30. fprintf(fid, '\n');
  31. ln=2;
  32. fprintf(fid,'%d\t',ln);
  33. fprintf(fid, 'Orf\tGene\t');
  34. for j=1:length(DMsel), fprintf(fid,'%s\t',strcat('IntLdm',num2str(DMsel(j)))); end
  35. %fprintf(fid, 'L\tLlower\tLupper\t')
  36. fprintf(fid,'Specifics\tReplicate\tStrain\tMP\tRow\tCol\tIndex');
  37. fprintf(fid, '\n');
  38. if ~isempty(InterslstPos{1})
  39. for i=1:size(selIntP,1)
  40. ln=ln+1;
  41. fprintf(fid,'%d\t',ln);
  42. fprintf(fid,'%s\t%s\t',cell2mat(IPorf(i)),cell2mat(IPgene(i)));
  43. for j=1:length(DMsel) % 'Scan\tPlate\tRow\tCol\t');
  44. fprintf(fid,'%.5f\t',IntersValsPos(i,j))
  45. end
  46. % fprintf(fid,'%.5f\t%.5f\t%.5f\t',ipL(i),ipLlower(i),ipLupper(i))
  47. fprintf(fid,'%s\t%s\t%s\t',cell2mat(IPspecifics(i)),cell2mat(IPorfRep(i)),cell2mat(IPstrain(i)));
  48. fprintf(fid,'%.5f\t%.5f\t%.5f\t',selIntPx{1}(i,2),selIntPx{1}(i,4),selIntPx{1}(i,5),InterslstPos{1}(i))
  49. fprintf(fid, '\n');
  50. end
  51. else
  52. ln=ln+1;
  53. fprintf(fid,'%d\t',ln);
  54. fprintf(fid,'%s\t','Empty Set, No interaction found within set range.');
  55. end
  56. % 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');
  57. fclose(fid)
  58. % Interaction Printout for Negative (shorter L interaction values) Non-Adjusted for Ref std and curve fit boundaries
  59. fid=fopen(intLfilename2,'w');
  60. ln=1;
  61. fprintf(fid,'%d\t',ln);
  62. fprintf(fid,'%s\userInputs',strcat('AlleviatingInteractionResults for User Input: ',userInputs)); %fprintf(fid,'%s\userInputs',userInputs);
  63. for j=1:dmN, fprintf(fid,'%s',strcat(', Rstd',num2str(j),'_',num2str(Rs(j)))); end
  64. fprintf(fid, '\n');
  65. ln=2;
  66. fprintf(fid,'%d\t',ln);
  67. fprintf(fid, 'Orf\tGene\t');
  68. for j=1:length(DMsel), fprintf(fid,'%s\t',strcat('IntLdm',num2str(DMsel(j)))); end
  69. %fprintf(fid, 'L\tLlower\tLupper\t')
  70. fprintf(fid,'Specifics\tReplicate\tStrain\tMP\tRow\tCol\tIndex');
  71. fprintf(fid, '\n');
  72. if ~isempty(InterslstNeg{1})
  73. for i=1:size(selIntN,1)
  74. ln=ln+1;
  75. fprintf(fid,'%d\t',ln);
  76. fprintf(fid,'%s\t%s\t',cell2mat(INorf(i)),cell2mat(INgene(i)));
  77. for j=1:length(DMsel) % 'Scan\tPlate\tRow\tCol\t');
  78. fprintf(fid,'%.5f\t',IntersValsNeg(i,j))
  79. end
  80. % fprintf(fid,'%.5f\t%.5f\t%.5f\t',ipL(i),ipLlower(i),ipLupper(i))
  81. fprintf(fid,'%s\t%s\t%s\t',cell2mat(INspecifics(i)),cell2mat(INorfRep(i)),cell2mat(INstrain(i)));
  82. 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))
  83. fprintf(fid, '\n');
  84. end
  85. end
  86. fclose(fid)
  87. % Interaction Printout for Positive (longer L interaction values) "ADJUSTED" for Ref std and curve fit boundaries
  88. fid=fopen(intLfilename3,'w');
  89. ln=1;
  90. fprintf(fid,'%d\t',ln);
  91. fprintf(fid,'%s\userInputs',strcat('Adjusted AggrevatingInteractionResults for User Input: ',userInputs));
  92. for j=1:dmN, fprintf(fid,'%s',strcat(', Rstd',num2str(j),'_',num2str(Rs(j)))); end
  93. fprintf(fid, '\n');
  94. ln=2;
  95. fprintf(fid,'%d\t',ln);
  96. fprintf(fid, 'Orf\tGene\t');
  97. for j=1:length(DMsel), fprintf(fid,'%s\t',strcat('IntLdm',num2str(DMsel(j)))); end
  98. % fprintf(fid, 'L\tLlower\tLupper\t')
  99. fprintf(fid,'Specifics\tReplicate\tStrain\tMP\tRow\tCol\tIndex');
  100. fprintf(fid, '\n');
  101. for i=1:size(selIntPAdj,1)
  102. ln=ln+1;
  103. fprintf(fid,'%d\t',ln);
  104. fprintf(fid,'%s\t%s\t',cell2mat(IPorfAdj(i)),cell2mat(IPgeneAdj(i)));
  105. for j=1:length(DMsel) %'Scan\tPlate\tRow\tCol\t');
  106. fprintf(fid,'%.5f\t',IntersValsPosAdj(i,j))
  107. end
  108. % fprintf(fid,'%.5f\t%.5f\t%.5f\t',ipL(i),ipLlower(i),ipLupper(i))
  109. fprintf(fid,'%s\t%s\t%s\t',cell2mat(IPspecificsAdj(i)),cell2mat(IPorfRepAdj(i)),cell2mat(IPstrainAdj(i)));
  110. fprintf(fid,'%.5f\t%.5f\t%.5f\t',selIntPxAdj{1}(i,2),selIntPxAdj{1}(i,4),selIntPxAdj{1}(i,5),InterslstPosAdj{1}(i))
  111. fprintf(fid, '\n');
  112. end
  113. % 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');
  114. fclose(fid)
  115. fid=fopen(intLfilename4,'w');
  116. ln=1;
  117. fprintf(fid,'%d\t',ln);
  118. fprintf(fid,'%s\userInputs',strcat('AlleviatingInteractionResults for User Input: ',userInputs)); %fprintf(fid,'%s\userInputs',userInputs);
  119. for j=1:dmN, fprintf(fid,'%s',strcat(', Rstd',num2str(j),'_',num2str(Rs(j)))); end
  120. fprintf(fid, '\n');
  121. ln=2;
  122. fprintf(fid,'%d\t',ln);
  123. fprintf(fid, 'Orf\tGene\t');
  124. if ~isempty(InterslstNegAdj{1})
  125. for j=1:length(DMsel), fprintf(fid,'%s\t',strcat('IntLdm',num2str(DMsel(j)))); end
  126. %fprintf(fid, 'L\tLlower\tLupper\t')
  127. fprintf(fid,'Specifics\tReplicate\tStrain\tMP\tRow\tCol\tIndex');
  128. fprintf(fid, '\n');
  129. for i=1:size(selIntNAdj,1)
  130. i
  131. ln=ln+1;
  132. fprintf(fid,'%d\t',ln);
  133. fprintf(fid,'%s\t%s\t',cell2mat(INorfAdj(i)),cell2mat(INgeneAdj(i)));
  134. for j=1:length(DMsel) %'Scan\tPlate\tRow\tCol\t');
  135. fprintf(fid,'%.5f\t',IntersValsNegAdj(i,j))
  136. end
  137. % fprintf(fid,'%.5f\t%.5f\t%.5f\t',ipL(i),ipLlower(i),ipLupper(i))
  138. fprintf(fid,'%s\t%s\t%s\t',cell2mat(INspecificsAdj(i)),cell2mat(INorfRepAdj(i)),cell2mat(INstrainAdj(i)));
  139. fprintf(fid,'%.5f\t%.5f\t%.5f\t',selIntNxAdj{1}(i,2),selIntNxAdj{1}(i,4),selIntNxAdj{1}(i,5),InterslstNegAdj{1}(i))
  140. fprintf(fid, '\n');
  141. end
  142. end
  143. fclose(fid)