Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Adding readConfigFile function was pending
  • Loading branch information
snikumbh committed Jul 31, 2017
1 parent 624d6e4 commit 94241d6
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions readConfigFile.m
@@ -0,0 +1,76 @@
function configParams = readConfigFile(configFilename)

% READCONFIGFILE
% Reads all the parameter values given in the config file and returns
% a structure of all the params
%
% INPUT PARAMS
% Param 'configFilename' (string)
% Config filename to read the parameter values from.
%
% OUTPUT PARAMS
% configParams
% A struct with all variables
%
% ADDITIONAL NOTES
%
% Author: snikumbh@mpi-inf.mpg.de


fid = fopen(configFilename, 'r');

while feof(fid) == 0
l = fgetl(fid);
if findstr(l, '##') > 0
% skip the comment lines
elseif findstr(l, '=') > 0
l2 = strsplit(l,'=');
switch(l2{1})
case 'POSITIVE_FASTA_FILE'
configParams.givenPosFastaFilename = l2{2};
case 'NEGATIVE_FASTA_FILE'
configParams.givenNegFastaFilename = l2{2};
case 'NUMBER_OF_POSITIVES'
configParams.nPosSequences = str2num(l2{2});
case 'NUMBER_OF_NEGATIVES'
configParams.nNegSequences = str2num(l2{2});
case 'TEST_INDICES'
configParams.testIndices = eval(l2{2});
case 'OUTPUT_FOLDER'
configParams.outputFolder = l2{2};
case 'OLIGO_LEN'
configParams.oligoLen = eval(l2{2});
case 'MAX_DIST'
configParams.maxDist = str2num(l2{2});
case 'SEGMENT_SIZE_IN_BPS'
configParams.segmentSizeInBps = str2num(l2{2});
case 'NUMBER_OF_CLUSTERS'
configParams.nClusterVals = eval(l2{2});
case 'SIGMA_VALUES'
configParams.sigmaVals = eval(l2{2});
case 'COST_VALUES'
configParams.Cs = eval(l2{2});
case 'MKL_NORM'
configParams.mklNorm = str2num(l2{2});
case 'NUMBER_OF_INNER_FOLDS'
configParams.nFolds = str2num(l2{2});
case 'NUMBER_OF_OUTER_FOLDS'
configParams.nOuterFolds = str2num(l2{2});
case 'WHETHER_TO_PLOT_HEATMAP'
configParams.whetherToPlotHeatmap = l2{2};
case 'WHETHER_TO_VISUALIZE_WEIGHT_VECTOR'
configParams.whetherToVisualizeWVector = l2{2};
case 'DEBUG_LEVEL'
configParams.debugLevel = str2num(l2{2});
case 'DEBUG_MSG_LOCATION'
configParams.debugMsgLocation = l2{2};
case 'COMPUTATION_VERSION'
configParams.computationVersion = l2{2};
end % switch ends
else

end % if-else ends
end % while ends
fclose(fid);

end

0 comments on commit 94241d6

Please sign in to comment.