Home > RAVEN > markPathwayWithExpression.m

markPathwayWithExpression

PURPOSE ^

markPathwayWithExpression

SYNOPSIS ^

function pathway=markPathwayWithExpression(pathway,model,experiment,experimentOrder)

DESCRIPTION ^

 markPathwayWithExpression
   Adds gene expression data to a pathway object

   pathway           map structure as generated by constructPathwayFromCelldesigner
   model             a model structure
   experiment        experiment structure as generated by getExpressionStructure
   experimentOrder   cell array with two experiment names as defined in
                     'experiment'

   pathway           updated pathway object

   Usage: pathway=markPathwayWithExpression(pathway,model,experiment,experimentOrder)

   Rasmus Agren, 2010-12-16

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function pathway=markPathwayWithExpression(pathway,model,experiment,experimentOrder)
0002 % markPathwayWithExpression
0003 %   Adds gene expression data to a pathway object
0004 %
0005 %   pathway           map structure as generated by constructPathwayFromCelldesigner
0006 %   model             a model structure
0007 %   experiment        experiment structure as generated by getExpressionStructure
0008 %   experimentOrder   cell array with two experiment names as defined in
0009 %                     'experiment'
0010 %
0011 %   pathway           updated pathway object
0012 %
0013 %   Usage: pathway=markPathwayWithExpression(pathway,model,experiment,experimentOrder)
0014 %
0015 %   Rasmus Agren, 2010-12-16
0016 %
0017 
0018 if numel(experimentOrder)~=2
0019     throw(MException('','This can only be done for two cases at the moment (experimentOrder must be two elements)'));
0020 end
0021 
0022 %Check that experiment fit with experimentOrder
0023 [present expIds]=ismember(experimentOrder,experiment.experiments);
0024 
0025 if ~all(present)
0026    throw(MException('','Not all experiments could be found in the experiment structure'));
0027 end
0028 
0029 experiment.data=experiment.data(:,expIds);
0030 experiment.experiments=experiment.experiments(:,expIds);
0031 
0032 %Go through each species in pathway and if it's a reaction, get it's genes
0033 %and log2-fold change in expression from model and experiment
0034 for i=1:numel(pathway.listOfSpecies)
0035     if strcmp('PROTEIN', pathway.listOfSpecies(i).type)
0036         if isfield(pathway.listOfSpecies(i),'note')
0037             if ~isempty(pathway.listOfSpecies(i).note)
0038                 %Get the reaction if present in model
0039                 [present index]=ismember(pathway.listOfSpecies(i).note,model.rxns);
0040 
0041                 %If present, then get the genes
0042                 if any(present)
0043                     [crap genes]=find(model.rxnGeneMat(index,:));
0044 
0045                     %If it was associated with genes match them to the ORFs
0046                     if any(genes)
0047                         [present experimentIndexes]=ismember(model.genes(genes),experiment.orfs);
0048 
0049                         %Add annotation to pathway structure
0050                         if any(present)
0051                             pathway.listOfSpecies(i).orfs=experiment.orfs(experimentIndexes(present));
0052                             pathway.listOfSpecies(i).expA=experiment.data(experimentIndexes(present),1);
0053                             pathway.listOfSpecies(i).expB=experiment.data(experimentIndexes(present),2);
0054                         end
0055                     end
0056                 end
0057             end
0058         end
0059     end
0060 end

Generated on Tue 16-Jul-2013 21:50:02 by m2html © 2005