Skip to content

Commit

Permalink
feat: misc changes to increaseVersion
Browse files Browse the repository at this point in the history
already present in yeast-GEM 8.6.1 README.md
  • Loading branch information
edkerk committed Sep 5, 2022
1 parent 454f3bf commit 3f34b45
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions code/increaseVersion.m
Original file line number Diff line number Diff line change
Expand Up @@ -52,27 +52,29 @@ function increaseVersion(bumpType)
%Run tests
cd modelTests
disp('Running gene essentiality analysis')
[new.accuracy,new.tp,new.tn,new.fn,new.fp] = essentialGenes(newModel);
[new.accuracy,new.tp,new.tn,new.fn,new.fp] = essentialGenes(model);
disp('Run growth analysis')
new.R2=growth(newModel);
new.R2=growth(model);

saveas(gcf,'../../growth.png');

cd ..
copyfile('../README.md','backup.md')
fin = fopen('backup.md','r');
fout = fopen('../README.md','w');
searchStats1 = '^(- Accuracy\: )0\.\d+';
searchStats2 = '^(- True positive genes\: )\d+';
searchStats3 = '^(- True negative genes\: )\d+';
searchStats4 = '^(- False positive genes\: )\d+';
searchStats5 = '^(- False negative genes\: )\d+';
newStats1 = ['$1' num2str(new.accuracy)];
searchStats2 = '^(- True non-essential genes\: )\d+';
searchStats3 = '^(- True essential genes\: )\d+';
searchStats4 = '^(- False non-essential genes\: )\d+';
searchStats5 = '^(- False essential genes\: )\d+';
newStats1 = ['$1' num2str(new.accuracy,'%.3f')];
newStats2 = ['$1' num2str(numel(new.tp))];
newStats3 = ['$1' num2str(numel(new.tn))];
newStats4 = ['$1' num2str(numel(new.fp))];
newStats5 = ['$1' num2str(numel(new.fn))];

searchStats6 = '^(- R<sup>2<\/sup>\: )0\.\d+';
newStats6 = ['$1' num2str(new.R2)];
searchStats6 = '^(- Correlation coefficient R<sup>2<\/sup>\: )0\.\d+';
newStats6 = ['$1' num2str(new.R2,'%.3f')];

while ~feof(fin)
str = fgets(fin);
Expand Down Expand Up @@ -105,10 +107,11 @@ function increaseVersion(bumpType)
delete('backup');

%Include tag and save model:
disp('Write model files')
model.id = ['yeastGEM_v' newVersion];
saveYeastModel(model,true,true,true) %only save if model can grow

%Check if any file changed (except for history.md and 1 line in yeast-GEM.xml):
%Check for any unexpected file changes
[~,diff] = system('git diff --numstat');
diff = strsplit(diff,'\n');
change = false;
Expand All @@ -117,18 +120,20 @@ function increaseVersion(bumpType)
if length(diff_i) == 3
switch diff_i{3}
case 'model/yeast-GEM.xml'
%.xml file: 2 lines should be added & 2 lines should be deleted
if eval([diff_i{1} ' > 2']) || eval([diff_i{2} ' > 2'])
%.xml file: 4 lines should be added & 4 lines should be
%deleted (2 with version information, 2 with current date)
if eval([diff_i{1} ' > 4']) || eval([diff_i{2} ' > 4'])
disp(['NOTE: File ' diff_i{3} ' is changing more than expected'])
change = true;
end
case 'model/yeast-GEM.yml'
%.yml file: 2 lines should be added & 2 lines should be deleted
%(1 with version information, 1 with current date)
if eval([diff_i{1} ' > 2']) || eval([diff_i{2} ' > 2'])
disp(['NOTE: File ' diff_i{3} ' is changing more than expected'])
change = true;
end
case 'history.md'
case {'history.md','README.md','growth.png','model/yeast-GEM.mat'}
otherwise
disp(['NOTE: File ' diff_i{3} ' is changing'])
change = true;
Expand Down

0 comments on commit 3f34b45

Please sign in to comment.