Home > core > getAllRxnsFromGenes.m

getAllRxnsFromGenes

PURPOSE ^

getAllRxnsFromGenes

SYNOPSIS ^

function allRxns=getAllRxnsFromGenes(model,rxns)

DESCRIPTION ^

 getAllRxnsFromGenes
   Given a list of reactions, this function finds the associated genes in
   the template model and gives all reactions that are annotated by these
   genes.

   model       a model structure
   rxns        either a cell array of IDs, a logical vector with the
               same number of elements as reactions in the model, or a
               vector of indexes

   allRxns     either a cell array of IDs, a logical vector with the
               same number of elements as reactions in the model, or a
               vector of indexes, dependent on the format of rxns

   Usage: allRxns=getAllRxnsFromGenes(model,rxns)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function allRxns=getAllRxnsFromGenes(model,rxns)
0002 % getAllRxnsFromGenes
0003 %   Given a list of reactions, this function finds the associated genes in
0004 %   the template model and gives all reactions that are annotated by these
0005 %   genes.
0006 %
0007 %   model       a model structure
0008 %   rxns        either a cell array of IDs, a logical vector with the
0009 %               same number of elements as reactions in the model, or a
0010 %               vector of indexes
0011 %
0012 %   allRxns     either a cell array of IDs, a logical vector with the
0013 %               same number of elements as reactions in the model, or a
0014 %               vector of indexes, dependent on the format of rxns
0015 %
0016 %   Usage: allRxns=getAllRxnsFromGenes(model,rxns)
0017 
0018 if ~islogical(rxns) && ~isnumeric(rxns)
0019     rxns=convertCharArray(rxns);
0020 end
0021 
0022 rxnIdx=getIndexes(model,rxns,'rxns');
0023 [~, geneIdx]=find(model.rxnGeneMat(rxnIdx,:));
0024 [allRxns, ~]=find(model.rxnGeneMat(:,geneIdx));
0025 if iscell(rxns)
0026     allRxns=unique([model.rxns(allRxns);model.rxns(rxnIdx)]);
0027 elseif isnumeric(rxns) || islogical(rxns)
0028     allRxns=unique([allRxns;rxnIdx]);
0029     if islogical(rxns)
0030         temp=false(numel(model.rxns),1);
0031         temp(allRxns)=true;
0032         allRxns=temp;
0033     end
0034 end
0035 end

Generated by m2html © 2005