forked from murphygroup/cellorganizer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.m
103 lines (90 loc) · 3.54 KB
/
setup.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
function setup( force )
%SETUP Helper method that loads CellOrganizer into workspace if toolbox is
%compatible. If force flag is set to true, then it will load CellOrganizer
%even if system is not compatible.
% Ivan E. Cao-Berg ([email protected])
%
% Copyright (C) 2008-2020 Murphy Lab
% Lane Center for Computational Biology
% School of Computer Science
% Carnegie Mellon University
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published
% by the Free Software Foundation; either version 2 of the License,
% or (at your option) any later version.
%
% This program is distributed in the hope that it will be useful, but
% WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
% General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
% 02110-1301, USA.
%
% For additional information visit http://murphylab.web.cmu.edu or
% send email to [email protected]
%icaoberg 2/3/2015
if ~exist( 'force', 'var' )
force = false;
end
addpath( pwd );
global CELLORGANIZER_ROOT_PATH
CELLORGANIZER_ROOT_PATH = pwd;
%icaoberg 10/2/2015
disp('Adding appropriate folders to path.');
addpath(genpath( [pwd filesep 'utilities']));
addpath(genpath( [pwd filesep 'models']));
addpath(genpath( [pwd filesep 'demos']));
addpath( [pwd filesep 'applications']);
addpath([pwd filesep 'images']);
javaaddpath( [ pwd filesep ...
'utilities' filesep 'bfmatlab' filesep 'bioformats_package.jar'] );
%enable logging
loci.common.DebugTools.enableLogging('INFO');
%icaoberg 2/3/2015
disp('Checking if your system and Matlab version is compatible with CellOrganizer.');
if ~is_it_compatible_with_cellorganizer()
if force
warning( ['The current system is not ' ...
'compatible with CellOrganizer. However, CellOrganizer was loaded because force flag was set to true.'] );
else
rmpath(genpath( [pwd filesep 'utilities']));
rmpath(genpath( [pwd filesep 'models']));
rmpath(genpath( [pwd filesep 'demos']));
rmpath( [pwd filesep 'applications']);
error( ['The current system is not ' ...
'compatible with CellOrganizer. Please refer to the official documentation for more information.'] );
end
end
version = '2.9.3';
versionURL = 'http://murphylab.web.cmu.edu/software/CellOrganizer/version';
try
fprintf( 1, '%s', 'Checking for updates. ' );
latestVersion = urlread( versionURL );
if latestVersion(end) == 10
latestVersion = latestVersion(1:end-1);
end
if upgrade( version, latestVersion )
disp(['A newer version (CellOrganizer v' latestVersion ...
') is available online. Please visit www.cellorganizer.org to download the latest stable release.']);
else
disp(['CellOrganizer version ' num2str(version) ' is the latest stable release.']);
end
catch
disp('Unable to connect to server. Please try again later.');
end
end%setup
function answer = upgrade( version, latestVersion )
version = sscanf(version, '%d.%d.%d')';
if length(version) < 3
version(3) = 0;
end
latestVersion = sscanf(latestVersion, '%d.%d.%d')';
if length(latestVersion) < 3
latestVersion(3) = 0;
end
answer = (sign(version - latestVersion) * [10; .1; .001]) < 0;
end%upgrade