GetOptGeneSol

PURPOSE ^

GetOptGeneSol save the solution from optGene and optGeneR in same format as OptKnock

SYNOPSIS ^

function [optGeneSol] = GetOptGeneSol(model, targetRxn, substrateRxn, generxnList, population, x, scores, isGeneList)

DESCRIPTION ^

GetOptGeneSol save the solution from optGene and optGeneR in same format as OptKnock

 [optGeneSol] = GetOptGeneSol(model, targetRxn, substrateRxn, generxnList, population, x, scores, isGeneList)

INPUTS
 model
 targetRxn
 substrateRxn
 generxnList
 population
 x                 the best solution
 scores
 isGeneList

OUTPUT
 optGeneSol

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [optGeneSol] = GetOptGeneSol(model, targetRxn, substrateRxn, generxnList, population, x, scores, isGeneList)
0002 %GetOptGeneSol save the solution from optGene and optGeneR in same format as OptKnock
0003 %
0004 % [optGeneSol] = GetOptGeneSol(model, targetRxn, substrateRxn, generxnList, population, x, scores, isGeneList)
0005 %
0006 %INPUTS
0007 % model
0008 % targetRxn
0009 % substrateRxn
0010 % generxnList
0011 % population
0012 % x                 the best solution
0013 % scores
0014 % isGeneList
0015 %
0016 %OUTPUT
0017 % optGeneSol
0018 
0019 
0020 % writeDirect where the files should be saved
0021 writeDirect = 'C:\';
0022 
0023 optGeneSol = struct();
0024 % from user input
0025 optGeneSol.substrateRxn = substrateRxn;
0026 optGeneSol.targetRxn = targetRxn;
0027 
0028 % for no genes or reactions found
0029 if sum(x) == 0
0030     save (strcat(writeDirect, 'optGeneSol--target-', char(targetRxn),...
0031         '--sub-',char(substrateRxn),'--KOs-0-no_solution_better_than_WT'...
0032         ), 'optGeneSol')
0033     return;
0034 end
0035 
0036 % from OptGene
0037 if isGeneList
0038     optGeneSol.geneList = generxnList(logical(x));
0039     optGeneSol.numDel = length(optGeneSol.geneList);
0040     [tmp,tmp2,optGeneSol.rxnList] = deleteModelGenes(model,optGeneSol.geneList); %finds just the reactions that are KOed b/c of gene removal
0041 else
0042     optGeneSol.rxnList = generxnList(logical(x));
0043     optGeneSol.numDel = length(optGeneSol.rxnList);
0044 end
0045 optGeneSol.obj = min(scores);
0046 optGeneSol.population = population;
0047 optGeneSol.scores = scores;
0048 
0049 %check the result from Opt...
0050 [growthRate,minProd,maxProd] = testOptKnockSol(model,optGeneSol.targetRxn,optGeneSol.rxnList);
0051 if (optGeneSol.obj - maxProd) / maxProd < .001 % acculacy must be within .1%
0052     slnCheck = 'valid_sln';
0053 else slnCheck = 'unsound_sln';
0054 end
0055 if (maxProd - minProd) / maxProd < .001 % acculacy must be within .1%
0056     slnType = 'unique_point';
0057 else slnType = 'non_unique';
0058 end
0059 
0060 % storage
0061 if isGeneList    
0062     save (strcat(writeDirect, 'optGeneSol--genes--target-', optGeneSol.targetRxn,...
0063         '--sub-',optGeneSol.substrateRxn,'--KOs-',num2str(optGeneSol.numDel),...
0064         '--yield-',num2str(optGeneSol.obj),...
0065         '--',slnCheck,'--',slnType,'--GR-',num2str(growthRate),...
0066         '--10CC.mat'...
0067         ), 'optGeneSol')
0068 else
0069     save (strcat(writeDirect, 'optGeneSol--rxns--target-', char(optGeneSol.targetRxn),...
0070         '--sub-',char(optGeneSol.substrateRxn),'--KOs-',num2str(optGeneSol.numDel),...
0071         '--yield-',num2str(optGeneSol.obj),...
0072         '--',slnCheck,'--',slnType,'--GR-',num2str(growthRate),...
0073         '--10CC.mat'...
0074         ), 'optGeneSol')
0075 end

Generated on Thu 21-Jun-2012 15:39:23 by m2html © 2003