Skip to content

Commit

Permalink
Merge pull request #1804 from opencobra/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
rmtfleming authored Sep 16, 2021
2 parents 25dbea4 + 9585fea commit d57a6d3
Show file tree
Hide file tree
Showing 82 changed files with 10,238 additions and 3,150 deletions.
3 changes: 1 addition & 2 deletions .artenolis/generateTutorials.m
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ function generateTutorials(destinationFolder, varargin)

if strcmp(version('-release'), '2016b')
openAndConvert = @matlab.internal.richeditor.openAndConvert;
end
if strcmp(version('-release'), '2017b')
else
openAndConvert = @matlab.internal.liveeditor.openAndConvert;
end
[~, ~, ~] = mkdir(destinationFolder);
Expand Down
32 changes: 29 additions & 3 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,32 @@
*.html linguist-vendored=true
*.gms linguist-vendored=true

*.mat -crlf -diff -merge
*.mlx -crlf -diff -merge
*.xlsx -crlf -diff -merge
## https://nl.mathworks.com/help/matlab/matlab_prog/set-up-git-source-control.html#buhx2d6-1_3
*.fig binary
*.mat binary
*.mdl binary
*.mdlp binary
*.mexa64 binary
*.mexw64 binary
*.mexmaci64 binary
*.mlapp binary
*.mldatx binary
*.mlproj binary
*.mlx binary
*.p binary
*.sfx binary
*.sldd binary
*.slreqx binary
*.slmx binary
*.sltx binary
*.slxc binary
*.slx binary merge=mlAutoMerge
*.slxp binary

## Other common binary file types
*.docx binary
*.exe binary
*.jpg binary
*.pdf binary
*.png binary
*.xlsx binary
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,6 @@
[submodule "external/base/utilities/condalab"]
path = external/base/utilities/condalab
url = https://github.com/sg-s/condalab
[submodule "external/analysis/PolytopeSamplerMatlab"]
path = external/analysis/PolytopeSamplerMatlab
url = https://github.com/ConstrainedSampler/PolytopeSamplerMatlab
4 changes: 2 additions & 2 deletions deprecated/_maps_old/drawCbMap.m
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
if ~isfield(options,'textSize')
options.textSize = ones(max(nNodes,nEdges),1)*12;
if strcmp(CB_MAP_OUTPUT,'svg')
options.textSize = ones(max(nNodes,nEdges),1)*6;
options.textSize = ones(max(nNodes,nEdges),1)*10;
end
end
%Font Color
Expand Down Expand Up @@ -286,7 +286,7 @@
if isfield(options, 'rxnTextSize')
drawText(map.rxnLabelPosition(1,i),map.rxnLabelPosition(2,i),map.connectionAbb{find(map.rxnIndex(i)==map.connection,1)},options.rxnTextSize(i),'italic');
else
drawText(map.rxnLabelPosition(1,i),map.rxnLabelPosition(2,i),map.connectionAbb{find(map.rxnIndex(i)==map.connection,1)},8,'italic');
drawText(map.rxnLabelPosition(1,i),map.rxnLabelPosition(2,i),map.connectionAbb{find(map.rxnIndex(i)==map.connection,1)},10,'italic');
end
end
end
Expand Down
7 changes: 4 additions & 3 deletions deprecated/_maps_old/drawFlux.m
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@
if ~isfield(options,'rxnDirFlag'), rxnDirFlag = false; else rxnDirFlag = options.rxnDirFlag; end
rxnListZero = model.rxns(abs(flux)<=1e-9);
absFlag=false;
origFlux = flux; %need this to set the arrow directions correct if abs is used -mfarshada
switch lower(options.scaleType)
case {1, 'linear'}
options.scaleTypeLabel='Linear;';
case {2 ,'linear absolute'}
flux=abs(flux);
flux=abs(flux);
absFlag=true;
options.scaleTypeLabel='Linear absolute;';
case {3,'log10'}
Expand Down Expand Up @@ -109,8 +110,8 @@
if rxnDirFlag
options.rxnDir = zeros(length(map.connectionAbb),1);
for i = 1:length(map.connectionAbb)
options.rxnDir(ismember(map.connectionAbb,model.rxns(flux>0))) = 1;
options.rxnDir(ismember(map.connectionAbb,model.rxns(flux<0))) = -1;
options.rxnDir(ismember(map.connectionAbb,model.rxns(origFlux>0))) = -1; %was 1, inconsistent with drawLine -mfarshada
options.rxnDir(ismember(map.connectionAbb,model.rxns(origFlux<0))) = 1; %was -1
end
end

Expand Down
46 changes: 46 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,35 @@ in /var/tmp/cobratoolbox_doc_timestamp.tar.gz
You can specify an alternative directory by changing the location of
the /output mountpoint in the docker run command.

## Building COBRA.tutorials

Clone the cobratoolbox and COBRA.tutorials repository in an empty directory. Then cd to
./cobratoolbox/docs directory and create and run the following script:

```
MATLAB_ROOT=/usr/local/MATLAB
MATLAB_VERSION=R2020b
OUTPUT=/var/tmp/COBRA.tutorials_output
./prepareTutorials.sh \
-p=${OUTPUT} \
-t=../../COBRA.tutorials \
-c=../../cobratoolbox \
-e=${MATLAB_ROOT}/${MATLAB_VERSION}/bin/matlab \
-m=html
```

Replace MATLAB_ROOT with the location of the matlab if different to
/usr/local, and OUTPUT with the location to which the tutorial HTML files
are to be written.

Remark: This procedure has been tested with head of cobratoolbox develop branch
(e8c40f3e74de9f2d671b58dd918305697ffd64b9) and
head of COBRA.tutorials master branch (0761e66374b0eff81db0f9adde87e118a12e967e)
on 2021-06-16 running on Ubuntu 18.04 with MATLAB R2020b

Remark: the dependency on matlab for this step makes it difficult to dockerize
due to the need for matlab licence files.

## Publishing the HTML to live site

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

The tracking code is located near the end of the page.

```
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-TRCMZL1FKK"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-TRCMZL1FKK');
</script>
```

## Remarks about sphinx_cobra_theme

The project logo (top-left) is hardcoded in layout.html at approx line 127. A comment in the code indicates this was done
to expedite configuration issues earlier in the project. Ideally the template should be reuseable (without modification)
for all the opencobra sub-projects: so need to find a way to externally configure the project logo.

## Checking for broken links

Expand Down
6 changes: 3 additions & 3 deletions docs/prepareTutorials.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/local/bin/bash
#!/bin/bash
usage="$(basename $0) -p=pdfPath -t=COBRATutorialsPath -c=COBRAToolBoxPath [-f=folderNameOfATutorial] [-h] [-l] [-m=mode] -- script to create tutorial documentation for the COBRA Toolbox.
where:
Expand Down Expand Up @@ -118,7 +118,7 @@ buildHTMLTutorials(){
do
createLocalVariables $tutorial
# create PDF file
/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
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
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"
sed -i.bak 's/white-space:\ pre-wrap/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
sed -i.bak 's/white-space:\ pre/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
Expand All @@ -131,7 +131,7 @@ buildHTMLSpecificTutorial(){
$matlab -nodesktop -nosplash -r "restoredefaultpath;initCobraToolbox;addpath('.artenolis');generateTutorials('$pdfPath', '$specificTutorial');restoredefaultpath;savepath;exit;"
createLocalVariables $specificTutorial
# create PDF file
/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
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
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"
sed -i.bak 's/white-space:\ pre-wrap/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
sed -i.bak 's/white-space:\ pre/white-space:\ normal/g' "$pdfPath/tutorials/$tutorialFolder/iframe_$tutorialName.html"
Expand Down
Loading

0 comments on commit d57a6d3

Please sign in to comment.