compareSampleTraj

PURPOSE ^

compareSampleHist Compare flux histogramns for two or more samples

SYNOPSIS ^

function compareSampleTraj(rxnNames,samples,models,nBins)

DESCRIPTION ^

compareSampleHist Compare flux histogramns for two or more samples
for one or more reactions

 compareSampleTraj(rxnNames,samples,models,nBins)

INPUTS
 rxnNames      List of reaction names to compare
 samples       Samples to compare
 models        Cell array containing COBRA model structures

OPTIONAL INPUTS
 nBins         Number of bins (Default = nSamples/25)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function compareSampleTraj(rxnNames,samples,models,nBins)
0002 %compareSampleHist Compare flux histogramns for two or more samples
0003 %for one or more reactions
0004 %
0005 % compareSampleTraj(rxnNames,samples,models,nBins)
0006 %
0007 %INPUTS
0008 % rxnNames      List of reaction names to compare
0009 % samples       Samples to compare
0010 % models        Cell array containing COBRA model structures
0011 %
0012 %OPTIONAL INPUTS
0013 % nBins         Number of bins (Default = nSamples/25)
0014 %
0015 
0016 if (nargin < 4)
0017   [tmp,nSamples] = size(samples{1});
0018   bins = round(nSamples/25);
0019 end
0020 
0021 if (~iscell(rxnNames))
0022   rxnNameList{1} = rxnNames;
0023 else
0024   rxnNameList = rxnNames;
0025 end
0026 
0027 nRxns = length(rxnNameList);
0028 nX = ceil(sqrt(nRxns));
0029 
0030 nY = ceil(nRxns/nX);
0031 
0032 for j = 1:nRxns
0033 
0034   clear counts;
0035   currLB = 1e6;
0036   currUB = -1e6;
0037   for i = 1:length(models)
0038     id = findRxnIDs(models{i},rxnNameList{j});
0039     if (isempty(id))
0040       id = findRxnIDs(models{i},[rxnNameList{j} '_r']);
0041       if (isempty(id))
0042         error('Reaction does not exist');
0043       end
0044     end
0045     currLB = min(currLB,min(samples{i}(id,:)'));
0046     currUB = max(currUB,max(samples{i}(id,:)'));
0047   end
0048 
0049   bins = linspace(currLB,currUB,nBins);
0050     
0051   for i = 1:length(models)
0052     sampleSign = 1;
0053     id = findRxnIDs(models{i},rxnNameList{j});
0054     if (isempty(id))
0055       id = findRxnIDs(models{i},[rxnNameList{j} '_r']);
0056       sampleSign = -1;
0057     end
0058     traj(:,i) = sampleSign*samples{i}(id,:)';
0059   end
0060 
0061   subplot(nY,nX,j);
0062   plot(traj,'-');
0063   axis([0 length(traj) currLB currUB]);
0064   %text((currUB+currLB)/2,max(max(counts))+20,rxnNameList{j});
0065 end

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