generateSUXMatrix

PURPOSE ^

generateSUXMatrix creates the matrices for matlab smiley -- > combines S, U

SYNOPSIS ^

function MatricesSUX =generateSUXMatrix(model,dictionary, KEGGFilename, KEGGBlackList, compartment, addModel)

DESCRIPTION ^

 generateSUXMatrix creates the matrices for matlab smiley -- > combines S, U
  (KEGG), X (transport)

    MatricesSUX =generateSUXMatrix(model,CompAbr, KEGGID,
    KEGGFilename, compartment)

 model          model structure
 CompAbr        List of compounds abreviation (non-compartelized)
 KEGGID         List of KEGGIDs for compounds in CompAbr
 KEGGFilename   File name containing KEGG database
 KEGGBlackList
 compartment   [c] --> transport from cytoplasm [c] to extracellulat space
               [e] (default), [p] creates transport from [c] to [p] and from [p] to [c],
               if '' - no exchange reactions/transport will be added to the matrix.
 addModel      model structure, containing an additional matrix or model
               that should be combined with SUX matrix.% Note that the naming of metabolites in this matrix has to be identical to
               model naming. Also, the list should be unique.

 11-10-07 IT

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function MatricesSUX =generateSUXMatrix(model,dictionary, KEGGFilename, KEGGBlackList, compartment, addModel)
0002 % generateSUXMatrix creates the matrices for matlab smiley -- > combines S, U
0003 %  (KEGG), X (transport)
0004 %
0005 %    MatricesSUX =generateSUXMatrix(model,CompAbr, KEGGID,
0006 %    KEGGFilename, compartment)
0007 %
0008 % model          model structure
0009 % CompAbr        List of compounds abreviation (non-compartelized)
0010 % KEGGID         List of KEGGIDs for compounds in CompAbr
0011 % KEGGFilename   File name containing KEGG database
0012 % KEGGBlackList
0013 % compartment   [c] --> transport from cytoplasm [c] to extracellulat space
0014 %               [e] (default), [p] creates transport from [c] to [p] and from [p] to [c],
0015 %               if '' - no exchange reactions/transport will be added to the matrix.
0016 % addModel      model structure, containing an additional matrix or model
0017 %               that should be combined with SUX matrix.% Note that the naming of metabolites in this matrix has to be identical to
0018 %               model naming. Also, the list should be unique.
0019 %
0020 % 11-10-07 IT
0021 %
0022 
0023 if nargin < 6
0024     addModel = '';
0025 end
0026 
0027 if nargin < 5
0028     compartment = '[c]';
0029 end
0030 if nargin < 4
0031     KEGGBlackList = {};
0032 end
0033 if nargin < 3
0034     KEGGFilename = '11-20-08-KEGG-reaction.lst';
0035 end
0036 
0037 % checks if model.mets has () or [] for compartment, or adds cytosol to
0038 % compounds if no compartment is specified
0039 model = CheckMetName(model);
0040 
0041 
0042 % create KEGG Matrix - U
0043 KEGG = createUniversalReactionModel(KEGGFilename, KEGGBlackList);
0044 KEGG = transformKEGG2Model(KEGG,dictionary);
0045 
0046 
0047 %merge all 3 matrixes
0048 % 1. S with U
0049 
0050 model.RxnSubsystem = model.subSystems;
0051 KEGG.RxnSubsystem = KEGG.subSystems;
0052 [model_SU] = mergeTwoModels(model,KEGG,1);
0053 
0054 % Adds an additional matrix if given as input
0055 % Note that the naming of metabolites in this matrix has to be identical to
0056 % model naming. Also, the list should be unique.
0057 if isstruct(addModel)
0058     addModel = CheckMetName(addModel);
0059     [model_SU] = mergeTwoModels(model_SU,addModel,1);
0060 end
0061 
0062 if ~isempty(compartment)
0063     ExchangeRxnMatrix = createXMatrix(model_SU.mets,1,compartment);
0064     % 2. SU with X
0065     ExchangeRxnMatrix.RxnSubsystem = ExchangeRxnMatrix.subSystems;
0066     %model_SU.RxnSubsystem = model_SU.subSystems;
0067     [MatricesSUX] = mergeTwoModels(model_SU,ExchangeRxnMatrix,1);
0068     % creates a vector assigning the origin of the reactions to the parentfprintf(1,'Converting merged model into an irreversible model...');
0069 else
0070     MatricesSUX=model_SU;
0071 end
0072 
0073 MatricesSUX.rxnGeneMat(length(MatricesSUX.rxns),length(MatricesSUX.genes))=0;
0074 MatricesSUX.rxnGeneMat = sparse(MatricesSUX.rxnGeneMat);
0075 MatricesSUX = convertToIrreversible(MatricesSUX);
0076 
0077 % MatrixPart indicates in which area of MatricesSUX the model reactions,
0078 % kegg reactions, and exchange/transport reactions are located (ie. 1 -
0079 % model, 2 - kegg, 3 - X)
0080 tmp=find(model.rev);
0081 MatricesSUX.MatrixPart(1:length(model.rxns)+length(tmp),1)=1; % model reactions
0082 MatricesSUX.MatrixPart(length(MatricesSUX.MatrixPart)+1:length(MatricesSUX.MatrixPart)+length(KEGG.rxns)+length(find(KEGG.rev)),1)=2;%KEGG DB reactions
0083 MatricesSUX.MatrixPart(length(MatricesSUX.MatrixPart)+1:length(MatricesSUX.rxns),1)=3; %exchange and transport reactions
0084 
0085 function model = CheckMetName(model)
0086 % checks if model.mets has () or [] for compartment
0087 if ~isempty(strfind(model.mets,'(c)')) ||~isempty(strfind(model.mets,'(e)'))
0088     for i = 1 :length(model.mets)
0089         model.mets{i} = regexprep(model.mets{i},'(','[');
0090         model.mets{i} = regexprep(model.mets{i},')',']');
0091     end
0092 end
0093 % fixes metabolites names if no compartment has been added to metabolites.
0094 % It assumes that the metabolites without compartment are in the cytosol
0095     for i = 1 :length(model.mets)
0096         if  isempty(regexp(model.mets{i},'\(\w\)')) && isempty(regexp(model.mets{i},'\[\w\]'))
0097             model.mets{i} = strcat(model.mets{i},'[c]');
0098         end
0099     end

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