Skip to content

Commit d57a6d3

Browse files
authored
Merge pull request #1804 from opencobra/develop
Develop
2 parents 25dbea4 + 9585fea commit d57a6d3

File tree

82 files changed

+10238
-3150
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+10238
-3150
lines changed

.artenolis/generateTutorials.m

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ function generateTutorials(destinationFolder, varargin)
1515

1616
if strcmp(version('-release'), '2016b')
1717
openAndConvert = @matlab.internal.richeditor.openAndConvert;
18-
end
19-
if strcmp(version('-release'), '2017b')
18+
else
2019
openAndConvert = @matlab.internal.liveeditor.openAndConvert;
2120
end
2221
[~, ~, ~] = mkdir(destinationFolder);

.gitattributes

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,32 @@
22
*.html linguist-vendored=true
33
*.gms linguist-vendored=true
44

5-
*.mat -crlf -diff -merge
6-
*.mlx -crlf -diff -merge
7-
*.xlsx -crlf -diff -merge
5+
## https://nl.mathworks.com/help/matlab/matlab_prog/set-up-git-source-control.html#buhx2d6-1_3
6+
*.fig binary
7+
*.mat binary
8+
*.mdl binary
9+
*.mdlp binary
10+
*.mexa64 binary
11+
*.mexw64 binary
12+
*.mexmaci64 binary
13+
*.mlapp binary
14+
*.mldatx binary
15+
*.mlproj binary
16+
*.mlx binary
17+
*.p binary
18+
*.sfx binary
19+
*.sldd binary
20+
*.slreqx binary
21+
*.slmx binary
22+
*.sltx binary
23+
*.slxc binary
24+
*.slx binary merge=mlAutoMerge
25+
*.slxp binary
26+
27+
## Other common binary file types
28+
*.docx binary
29+
*.exe binary
30+
*.jpg binary
31+
*.pdf binary
32+
*.png binary
33+
*.xlsx binary

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,3 +49,6 @@
4949
[submodule "external/base/utilities/condalab"]
5050
path = external/base/utilities/condalab
5151
url = https://github.com/sg-s/condalab
52+
[submodule "external/analysis/PolytopeSamplerMatlab"]
53+
path = external/analysis/PolytopeSamplerMatlab
54+
url = https://github.com/ConstrainedSampler/PolytopeSamplerMatlab

deprecated/_maps_old/drawCbMap.m

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@
105105
if ~isfield(options,'textSize')
106106
options.textSize = ones(max(nNodes,nEdges),1)*12;
107107
if strcmp(CB_MAP_OUTPUT,'svg')
108-
options.textSize = ones(max(nNodes,nEdges),1)*6;
108+
options.textSize = ones(max(nNodes,nEdges),1)*10;
109109
end
110110
end
111111
%Font Color
@@ -286,7 +286,7 @@
286286
if isfield(options, 'rxnTextSize')
287287
drawText(map.rxnLabelPosition(1,i),map.rxnLabelPosition(2,i),map.connectionAbb{find(map.rxnIndex(i)==map.connection,1)},options.rxnTextSize(i),'italic');
288288
else
289-
drawText(map.rxnLabelPosition(1,i),map.rxnLabelPosition(2,i),map.connectionAbb{find(map.rxnIndex(i)==map.connection,1)},8,'italic');
289+
drawText(map.rxnLabelPosition(1,i),map.rxnLabelPosition(2,i),map.connectionAbb{find(map.rxnIndex(i)==map.connection,1)},10,'italic');
290290
end
291291
end
292292
end

deprecated/_maps_old/drawFlux.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,12 @@
5151
if ~isfield(options,'rxnDirFlag'), rxnDirFlag = false; else rxnDirFlag = options.rxnDirFlag; end
5252
rxnListZero = model.rxns(abs(flux)<=1e-9);
5353
absFlag=false;
54+
origFlux = flux; %need this to set the arrow directions correct if abs is used -mfarshada
5455
switch lower(options.scaleType)
5556
case {1, 'linear'}
5657
options.scaleTypeLabel='Linear;';
5758
case {2 ,'linear absolute'}
58-
flux=abs(flux);
59+
flux=abs(flux);
5960
absFlag=true;
6061
options.scaleTypeLabel='Linear absolute;';
6162
case {3,'log10'}
@@ -109,8 +110,8 @@
109110
if rxnDirFlag
110111
options.rxnDir = zeros(length(map.connectionAbb),1);
111112
for i = 1:length(map.connectionAbb)
112-
options.rxnDir(ismember(map.connectionAbb,model.rxns(flux>0))) = 1;
113-
options.rxnDir(ismember(map.connectionAbb,model.rxns(flux<0))) = -1;
113+
options.rxnDir(ismember(map.connectionAbb,model.rxns(origFlux>0))) = -1; %was 1, inconsistent with drawLine -mfarshada
114+
options.rxnDir(ismember(map.connectionAbb,model.rxns(origFlux<0))) = 1; %was -1
114115
end
115116
end
116117

docs/README.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,35 @@ in /var/tmp/cobratoolbox_doc_timestamp.tar.gz
4747
You can specify an alternative directory by changing the location of
4848
the /output mountpoint in the docker run command.
4949

50+
## Building COBRA.tutorials
5051

52+
Clone the cobratoolbox and COBRA.tutorials repository in an empty directory. Then cd to
53+
./cobratoolbox/docs directory and create and run the following script:
54+
55+
```
56+
MATLAB_ROOT=/usr/local/MATLAB
57+
MATLAB_VERSION=R2020b
58+
OUTPUT=/var/tmp/COBRA.tutorials_output
59+
./prepareTutorials.sh \
60+
-p=${OUTPUT} \
61+
-t=../../COBRA.tutorials \
62+
-c=../../cobratoolbox \
63+
-e=${MATLAB_ROOT}/${MATLAB_VERSION}/bin/matlab \
64+
-m=html
65+
66+
```
67+
68+
Replace MATLAB_ROOT with the location of the matlab if different to
69+
/usr/local, and OUTPUT with the location to which the tutorial HTML files
70+
are to be written.
71+
72+
Remark: This procedure has been tested with head of cobratoolbox develop branch
73+
(e8c40f3e74de9f2d671b58dd918305697ffd64b9) and
74+
head of COBRA.tutorials master branch (0761e66374b0eff81db0f9adde87e118a12e967e)
75+
on 2021-06-16 running on Ubuntu 18.04 with MATLAB R2020b
76+
77+
Remark: the dependency on matlab for this step makes it difficult to dockerize
78+
due to the need for matlab licence files.
5179

5280
## Publishing the HTML to live site
5381

@@ -61,6 +89,24 @@ and replace the ./stable or ./latest directory with the build output.
6189
Tracking code can be added to the template by editing layout.html or footer.html
6290
in https://github.com/opencobra/sphinx_cobra_theme/tree/develop/sphinx_cobra_theme/
6391

92+
The tracking code is located near the end of the page.
93+
94+
```
95+
<!-- Global site tag (gtag.js) - Google Analytics -->
96+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-TRCMZL1FKK"></script>
97+
<script>
98+
window.dataLayer = window.dataLayer || [];
99+
function gtag(){dataLayer.push(arguments);}
100+
gtag('js', new Date());
101+
gtag('config', 'G-TRCMZL1FKK');
102+
</script>
103+
```
104+
105+
## Remarks about sphinx_cobra_theme
106+
107+
The project logo (top-left) is hardcoded in layout.html at approx line 127. A comment in the code indicates this was done
108+
to expedite configuration issues earlier in the project. Ideally the template should be reuseable (without modification)
109+
for all the opencobra sub-projects: so need to find a way to externally configure the project logo.
64110

65111
## Checking for broken links
66112

docs/prepareTutorials.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/local/bin/bash
1+
#!/bin/bash
22
usage="$(basename $0) -p=pdfPath -t=COBRATutorialsPath -c=COBRAToolBoxPath [-f=folderNameOfATutorial] [-h] [-l] [-m=mode] -- script to create tutorial documentation for the COBRA Toolbox.
33
44
where:
@@ -118,7 +118,7 @@ buildHTMLTutorials(){
118118
do
119119
createLocalVariables $tutorial
120120
# create PDF file
121-
/usr/local/bin/wkhtmltopdf --page-size A8 --margin-right 2 --margin-bottom 3 --margin-top 3 --margin-left 2 $pdfPath/tutorials/$tutorialFolder/$tutorialName.html $pdfPath/tutorials/$tutorialFolder/$tutorialName.pdf
121+
wkhtmltopdf --page-size A8 --margin-right 2 --margin-bottom 3 --margin-top 3 --margin-left 2 $pdfPath/tutorials/$tutorialFolder/$tutorialName.html $pdfPath/tutorials/$tutorialFolder/$tutorialName.pdf
122122
sed 's#<html><head>#&<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/opencobra/cobratoolbox@ffa0229fc0c01c9236bb7e961f65712443277719/latest/_static/js/iframeResizer.contentWindow.min.js"></script>#g' "$pdfPath/tutorials/$tutorialFolder/$tutorialName.html" > "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
123123
sed -i.bak 's/white-space:\ pre-wrap/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
124124
sed -i.bak 's/white-space:\ pre/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
@@ -131,7 +131,7 @@ buildHTMLSpecificTutorial(){
131131
$matlab -nodesktop -nosplash -r "restoredefaultpath;initCobraToolbox;addpath('.artenolis');generateTutorials('$pdfPath', '$specificTutorial');restoredefaultpath;savepath;exit;"
132132
createLocalVariables $specificTutorial
133133
# create PDF file
134-
/usr/local/bin/wkhtmltopdf --page-size A8 --margin-right 2 --margin-bottom 3 --margin-top 3 --margin-left 2 $pdfPath/tutorials/$tutorialFolder/$tutorialName.html $pdfPath/tutorials/$tutorialFolder/$tutorialName.pdf
134+
wkhtmltopdf --page-size A8 --margin-right 2 --margin-bottom 3 --margin-top 3 --margin-left 2 $pdfPath/tutorials/$tutorialFolder/$tutorialName.html $pdfPath/tutorials/$tutorialFolder/$tutorialName.pdf
135135
sed 's#<html><head>#&<script type="text/javascript" src="https://cdn.jsdelivr.net/gh/opencobra/cobratoolbox@ffa0229fc0c01c9236bb7e961f65712443277719/latest/_static/js/iframeResizer.contentWindow.min.js"></script>#g' "$pdfPath/tutorials/$tutorialFolder/$tutorialName.html" > "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
136136
sed -i.bak 's/white-space:\ pre-wrap/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
137137
sed -i.bak 's/white-space:\ pre/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"

0 commit comments

Comments
 (0)