Home > cellorganizer > utilities > slml2report.m

slml2report

PURPOSE ^

SLML2REPORT Generate a report comparing various SLML models.

SYNOPSIS ^

function slml2report( varargin )

DESCRIPTION ^

 SLML2REPORT Generate a report comparing various SLML models.

 COMMENT: When the method is not deployed the shape of the input arguments is
 slml2report( models, param )

 List Of Input Arguments  Descriptions
 -----------------------  ------------
 models                   A cell array of filenames
 param                    A structure holding the function options

 The shape of param is described

 List Of Parameters        Descriptions
 ------------------        ------------
 verbose                   (optional) Print the intermediate steps to screen. Default is true.
 resolution.cell           (optional) The resolution of the cell and nucleus that are being passed in
 resolution.objects        (optional) The resolution of the object model being synthesized
 includenuclear            (optional) Include parameters of the nuclear model in the comparison
 includecell               (optional) Include parameters of the cell model in the comparison
 includeprot               (optional) Include parameters of the protein model in the comparison

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function slml2report( varargin )
0002 % SLML2REPORT Generate a report comparing various SLML models.
0003 %
0004 % COMMENT: When the method is not deployed the shape of the input arguments is
0005 % slml2report( models, param )
0006 %
0007 % List Of Input Arguments  Descriptions
0008 % -----------------------  ------------
0009 % models                   A cell array of filenames
0010 % param                    A structure holding the function options
0011 %
0012 % The shape of param is described
0013 %
0014 % List Of Parameters        Descriptions
0015 % ------------------        ------------
0016 % verbose                   (optional) Print the intermediate steps to screen. Default is true.
0017 % resolution.cell           (optional) The resolution of the cell and nucleus that are being passed in
0018 % resolution.objects        (optional) The resolution of the object model being synthesized
0019 % includenuclear            (optional) Include parameters of the nuclear model in the comparison
0020 % includecell               (optional) Include parameters of the cell model in the comparison
0021 % includeprot               (optional) Include parameters of the protein model in the comparison
0022 %
0023 
0024 % Author: Robert F. Murphy
0025 % Created: June 29, 2013
0026 
0027 % Copyright (C) 2013 Murphy Lab
0028 % Carnegie Mellon University
0029 %
0030 % This program is free software; you can redistribute it and/or modify
0031 % it under the terms of the GNU General Public License as published
0032 % by the Free Software Foundation; either version 2 of the License,
0033 % or (at your option) any later version.
0034 %
0035 % This program is distributed in the hope that it will be useful, but
0036 % WITHOUT ANY WARRANTY; without even the implied warranty of
0037 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0038 % General Public License for more details.
0039 %
0040 % You should have received a copy of the GNU General Public License
0041 % along with this program; if not, write to the Free Software
0042 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0043 % 02110-1301, USA.
0044 %
0045 % For additional information visit http://murphylab.web.cmu.edu or
0046 % send email to murphy@cmu.edu
0047 
0048 % if ~isdeployed
0049 %     if nargin ~= 2
0050 %         error( ['CellOrganizer: Wrong number of input arguments. If slml2img ' ...
0051 %             ' is not deployed, then the number of input arguments must be 2.'] );
0052 %     end
0053 %
0054 % end
0055 
0056 %INPUT ARGUMENTS
0057 if nargin < 2
0058     param = [];
0059 else
0060     param = varargin{2};
0061 end    
0062 param = ml_initparam(param,struct('verbose',true,'includenuclear',true,'includecell',true,'includeprot',true));
0063 
0064 if ~(param.includenuclear | param.includecell | param.includeprot) error('At least one set of parameters must be included.'); end
0065 
0066 %check if files exists and are valid SLML instances
0067 %parse SLML instances into Matlab structures
0068 
0069 filenames = varargin{1};
0070 
0071 %if exist('testing.mat', 'file')
0072 %    load testing
0073 %else
0074     
0075 if param.verbose
0076     fprintf( 1, '\n%s%%', 'Parsing SLML instances: 0' );
0077 end
0078 
0079 try
0080     for j=1:1:length(filenames)
0081         %if it is a mat file then load directly into memory
0082         if( isMatFile(filenames{j}) )
0083             load(filenames{j});
0084             models{j} = model;
0085         elseif isstruct(filenames{j})
0086             models{j} = filenames{j};
0087         else
0088             models{j} = slml2model( filenames{j} );
0089         end
0090         
0091         
0092         n=length(filenames);
0093         if param.verbose
0094             %indicate an object has been successfully added
0095             fprintf( 1, [ repmat('\b', 1, length(num2str(100*(j-1)/n))+1) '%s'], ...
0096                 repmat(' ', 1, length(num2str(100*(j-1)/n))+1) );
0097             fprintf( 1, [ repmat('\b', 1, length(num2str(100*(j-1)/n))+1) '%s%%'], num2str(100*j/n) );
0098             pause(0.1)
0099         end
0100     end
0101     fprintf( 1, '\n', 0 );
0102 catch err
0103     warning( 'CellOrganizer: Unable to parse SLML instances. Exiting program.' );
0104         
0105     if ~isdeployed
0106         return
0107     else
0108         exit
0109     end
0110 end
0111 
0112 try
0113     classlabels = varargin{3};
0114 catch
0115 %
0116 % use the class labels for the various models as the independent
0117 % (categorical) variable
0118 %
0119     classlabels = [];
0120     for j=1:n
0121         try
0122             classlabels = strcat(classlabels, [models{j}.proteinShape.class ';']);
0123         catch
0124             classlabels = strcat(classlabels, [models{j}.proteinShape.type ';']);
0125         end
0126     end
0127     classlabels=classlabels(1:end-1);
0128 end
0129 
0130 %
0131 % generate reports
0132 %
0133 
0134 try
0135     indvar = varargin{4};
0136     models2report(models,param,classlabels,indvar)
0137 catch
0138     models2report(models,param,classlabels)
0139 end

Generated on Sun 29-Sep-2013 18:44:06 by m2html © 2005