DependencyMappingScript.m 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. % Get the files used by each script to export minimal repository for
  2. % publication
  3. files = mfilename('fullpath')
  4. mainDir = 'W:\lramos\Documents\MATLAB\shako-copy\Luis\Papers\Tm9RFs\';
  5. files = dir([mainDir '*.m'])
  6. for iFile = 1: numel(files)
  7. fList{iFile} = matlab.codetools.requiredFilesAndProducts(...
  8. fullfile(files(iFile).folder, ...
  9. files(iFile).name));
  10. end
  11. %%
  12. minimalCodeBase = unique([fList{:}])';
  13. %%
  14. minimalCodeDir = [mainDir 'minimalCodeBase'];
  15. if ~exist(minimalCodeDir, 'dir'); mkdir(minimalCodeDir); end
  16. plottingSubDir = [minimalCodeDir filesep 'plotting'];
  17. if ~exist(plottingSubDir, 'dir'); mkdir(plottingSubDir); end
  18. paperSubDir = [minimalCodeDir filesep 'figures'];
  19. if ~exist(paperSubDir, 'dir'); mkdir(paperSubDir); end
  20. rfSubDir = [minimalCodeDir filesep 'receptiveFields'];
  21. if ~exist(rfSubDir, 'dir'); mkdir(rfSubDir); end
  22. ffSubDir = [minimalCodeDir filesep 'fullfield'];
  23. if ~exist(ffSubDir, 'dir'); mkdir(ffSubDir); end
  24. utilsSubDir = [minimalCodeDir filesep 'utils'];
  25. if ~exist(utilsSubDir, 'dir'); mkdir(utilsSubDir); end
  26. statsSubDir = [minimalCodeDir filesep 'stats'];
  27. if ~exist(statsSubDir, 'dir'); mkdir(statsSubDir); end
  28. %%
  29. orphanFiles = {};
  30. for iFile = 1: numel(minimalCodeBase)
  31. [~, fileName, fileExt] = fileparts(minimalCodeBase{iFile});
  32. if contains(minimalCodeBase{iFile}, ...
  33. ["Plotting", "plotErrorPatch", "suptitle"])
  34. copyfile(minimalCodeBase{iFile}, ...
  35. fullfile(plottingSubDir, [fileName fileExt]));
  36. elseif contains(minimalCodeBase{iFile}, 'OnOffAnalysis')
  37. copyfile(minimalCodeBase{iFile}, ...
  38. fullfile(ffSubDir, [fileName fileExt]));
  39. elseif contains(minimalCodeBase{iFile}, ...
  40. ["BarsReceptiveFields", "GluCla", "IndependentRFs", ...
  41. "Noise", "T4T5_Tm9"])
  42. copyfile(minimalCodeBase{iFile}, ...
  43. fullfile(rfSubDir, [fileName fileExt]));
  44. elseif contains(minimalCodeBase{iFile}, ...
  45. ["TableAnalysis", "Stimulus_Analysis", ...
  46. "createRFsTable", "parseDatasetVars"])
  47. copyfile(minimalCodeBase{iFile}, ...
  48. fullfile(utilsSubDir, [fileName fileExt]));
  49. elseif contains(minimalCodeBase{iFile}, ["Make"])
  50. copyfile(minimalCodeBase{iFile}, ...
  51. fullfile(paperSubDir, [fileName fileExt]));
  52. elseif contains(minimalCodeBase{iFile}, ["permutation"], 'IgnoreCase', true)
  53. copyfile(minimalCodeBase{iFile}, ...
  54. fullfile(statsSubDir, [fileName fileExt]));
  55. elseif contains(minimalCodeBase{iFile}, ["dependencymapping"], 'IgnoreCase', true)
  56. copyfile(minimalCodeBase{iFile}, ...
  57. fullfile(statsSubDir, [fileName fileExt]));
  58. else
  59. copyfile(minimalCodeBase{iFile}, ...
  60. fullfile(utilsSubDir, [fileName fileExt]));
  61. end
  62. end