Home > cellorganizer > setup.m

setup

PURPOSE ^

SETUP Helper method that loads CellOrganizer into workspace

SYNOPSIS ^

function setup()

DESCRIPTION ^

SETUP Helper method that loads CellOrganizer into workspace

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function setup()
0002 %SETUP Helper method that loads CellOrganizer into workspace
0003 
0004 % Author: Ivan E. Cao-Berg (icaoberg@cmu.edu)
0005 % Created: November 24, 2008
0006 %
0007 % Copyright (C) 2008-2013 Murphy Lab
0008 % Lane Center for Computational Biology
0009 % School of Computer Science
0010 % Carnegie Mellon University
0011 %
0012 % March 14, 2012 I. Cao-Berg Made it sure that .git folder is not added to
0013 %                path just in case they use the git clone
0014 % March 19, 2012 R.F. Murphy Fix addpaths
0015 % March 27, 2012 I. Cao-Berg Turned script into function
0016 % April 11, 2012 R.F. Murphy Support two digit sub- and sub-subversions
0017 % October 2, 2012 I. Cao-Berg Ignore licenses folder from working path
0018 % May 7, 2013 I. Cao-Berg Updated method to include loading of Bio-formats
0019 %
0020 % This program is free software; you can redistribute it and/or modify
0021 % it under the terms of the GNU General Public License as published
0022 % by the Free Software Foundation; either version 2 of the License,
0023 % or (at your option) any later version.
0024 %
0025 % This program is distributed in the hope that it will be useful, but
0026 % WITHOUT ANY WARRANTY; without even the implied warranty of
0027 % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0028 % General Public License for more details.
0029 %
0030 % You should have received a copy of the GNU General Public License
0031 % along with this program; if not, write to the Free Software
0032 % Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
0033 % 02110-1301, USA.
0034 %
0035 % For additional information visit http://murphylab.web.cmu.edu or
0036 % send email to murphy@cmu.edu
0037 
0038 addpath( pwd );
0039 %icaoberg 10/2/2012
0040 addpath(genpath( [pwd filesep 'utilities']));
0041 addpath(genpath( [pwd filesep 'models']));
0042 addpath(genpath( [pwd filesep 'demos']));
0043 
0044 if ~isCompatible
0045     rmpath( genpath( pwd ) );
0046     rmpath(genpath( 'utilities' ));
0047     error( ['CellOrganizer: The current system is not ' ...
0048         'compatible with the toolbox']);
0049 end
0050 
0051 version = '1.9.3';
0052 versionURL = 'http://murphylab.web.cmu.edu/software/CellOrganizer/version';
0053 
0054 try
0055    fprintf(1,'%s',['Checking for new stable version... ']);
0056    latestVersion = urlread( versionURL );
0057    if latestVersion(end) == 10 
0058       latestVersion = latestVersion(1:end-1);
0059    end
0060 
0061    if upgrade( version, latestVersion )
0062       fprintf(1,'%s\n',['A newer version (' latestVersion ') is available.']);
0063    else
0064       fprintf(1,'%s\n',['Version is up to date.']);
0065    end
0066    
0067    javaaddpath( [ pwd filesep ...
0068        'utilities' filesep 'bioformats' filesep 'loci_tools.jar'] );
0069 catch
0070    fprintf(1,'%s\n',['Unable to connect.']);
0071 end
0072 
0073 end%setup
0074 
0075 
0076 function answer = upgrade( version, latestVersion )
0077 version = sscanf(version, '%d.%d.%d')';
0078 if length(version) < 3
0079    version(3) = 0;
0080 end
0081 
0082 latestVersion = sscanf(latestVersion, '%d.%d.%d')';
0083 if length(latestVersion) < 3
0084    latestVersion(3) = 0;
0085 end
0086 
0087 answer = (sign(version - latestVersion) * [10; .1; .001]) < 0;
0088 
0089 end%upgrade

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