-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding readConfigFile function was pending
- Loading branch information
Showing
1 changed file
with
76 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |