Skip to content

Commit

Permalink
Merge pull request #63 from gitter-lab/github_issues
Browse files Browse the repository at this point in the history
Support v7 data and file separators in outdir
  • Loading branch information
agitter authored Feb 25, 2021
2 parents 1b9d091 + 8e58d79 commit 25a786e
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 14 deletions.
30 changes: 19 additions & 11 deletions code/parseParams.m
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@
def_outdir = 'Output';
def_prob_remove_samples = 0.2;
def_date = date;
%

% Remove filesep from string check list
strchecklist = setdiff(['[\/?*''."<>|]'],filesep);
expected_family = {'gaussian','poisson'};
% Changed the conditions to accommodate command line calls to GLG_Instance.
validScalar = @(x) (isnumeric(x) && isscalar(x) && (x >= 0))||(isnumeric(str2num(x)) && isscalar(str2num(x)) && (str2num(x) >= 0));
validPos = @(x) all(isnumeric(x) & (x >= 0))||all(isnumeric(str2num(x)) & (str2num(x) >= 0));
validFile = @(x) isfilecomp(x);
validString = @(x) ischar(x) && isempty(regexp(x,'[\/?*''."<>|]','once'));
validString = @(x) ischar(x) && isempty(regexp(x,strchecklist,'once'));
validInteger = @(x) (~ischar(x)&&((x - floor(x)==0) && (x >= 0)))||((str2num(x) - floor(str2num(x))==0) && (str2num(x) >= 0));
validLags = @(x) (~ischar(x)&&((x - floor(x)==0) && (p.Results.dT*x)<100))||((str2num(x) - floor(str2num(x))==0) && (str2num(p.Results.dT)*str2num(x))<100);
validProb = @(x) (~ischar(x)&&(isnumeric(x) && isscalar(x) && (x >= 0) &&(x<1)))||((isnumeric(str2num(x)) && isscalar(str2num(x)) && (str2num(x) >= 0) &&(str2num(x)<1)));
Expand Down Expand Up @@ -67,28 +69,34 @@
% between parallel jobs (separated valid file and temp file creation for
% this purpose)
if (exist([Data '.mat'], 'file') == 2)
copyfile([Data '.mat'],['TempMat' '_' num2str(params.ID) '.mat']);
load([Data '.mat']);
elseif (exist(Data, 'file') == 2)
copyfile(Data,['TempMat' '_' num2str(params.ID) '.mat']);
load(Data);
end
X = sparse(X);
% Changed the creation of TempMat to load and save Data file in v7.3 to
% avoid lower version mat files causing error.
if exist('branches')
save(['TempMat' '_' num2str(params.ID) '.mat'],'X','ptime','branches','-v7.3');
else
save(['TempMat' '_' num2str(params.ID) '.mat'],'X','ptime','-v7.3');
end
end

function y = isfilecomp(x)
if (exist([x '.mat'], 'file') == 2)
y = 1;
copyfile([x '.mat'],'TempMat.mat');
elseif (exist(x, 'file') == 2)
y = 1;
copyfile(x,'TempMat.mat');
else
y = 0;
end
end

function y = stringcheck(x)
if isstr(x)
y = str2num(x);
else
y = x;
end
if isstr(x)
y = str2num(x);
else
y = x;
end
end
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ ENV SINGE_RUNNING_IN_DOCKER 1

# Download an intermediate version of the compiled SINGE executables for testing
# Download the md5sums of the source .m files and binaries
RUN md5=0f3f9ec6d6aabf7c99e8c2e141dfa8c0 && \
RUN md5=1cd2e9d6d18ffcd85bf2330f29265766 && \
wget --quiet --no-check-certificate https://www.biostat.wisc.edu/~gitter/tmp/$md5/SINGE_Test && \
wget --quiet --no-check-certificate https://www.biostat.wisc.edu/~gitter/tmp/$md5/SINGE_GLG_Test && \
wget --quiet --no-check-certificate https://www.biostat.wisc.edu/~gitter/tmp/$md5/SINGE_Aggregate && \
Expand Down
3 changes: 1 addition & 2 deletions tests/docker_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ cat current_code.md5
# 'code.md5 current_code.md5 differ: char 174, line 4'
# indicates the md5sums of the current source and binary files do not match
# the expected versions
############### RESTORE THIS ###############
#cmp $SINGE_ROOT/code.md5 current_code.md5
cmp $SINGE_ROOT/code.md5 current_code.md5

# Confirm the contents of the conda environment
conda list
Expand Down

0 comments on commit 25a786e

Please sign in to comment.