Skip to content

Commit 388f1d0

Browse files
Merge branch 'main' into stable
2 parents dcf36c2 + 801f27f commit 388f1d0

34 files changed

+1059
-468
lines changed

.github/workflows/build.yml

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -138,12 +138,11 @@ jobs:
138138
github_token: ${{ secrets.GITHUB_TOKEN }}
139139
branch: main
140140

141-
BuildPip:
142-
needs: Commit
141+
BuildConda:
142+
needs: [Commit, Tag]
143143
runs-on: ubuntu-latest
144144
env:
145-
bld_path: /tmp/build
146-
asset: pip.zip
145+
asset: straindesign-${{ needs.Tag.outputs.tag }}-py_0.tar.bz2
147146
outputs:
148147
asset: ${{ env.asset }}
149148
defaults:
@@ -158,74 +157,30 @@ jobs:
158157
uses: conda-incubator/setup-miniconda@v2
159158
with:
160159
miniconda-version: "latest"
161-
environment-file: conda.recipes/conda_build_env.yaml
160+
environment-file: recipes/workflow.yaml
162161
python-version: '3.9'
163-
- name: 'Build pip package'
162+
- name: 'Build conda package'
164163
run: |
165-
python3 -m build --outdir ${bld_path}
166-
- name: 'Create asset'
167-
run: |
168-
zip -r -j ${asset} ${bld_path}
164+
conda-build recipes --output-folder . --output "${{ env.asset }}"
169165
- name: 'Upload Artifact Package'
170166
uses: actions/upload-artifact@v2
171167
with:
172-
name: package-pip-artifact
168+
name: package-conda-artifact
173169
path: ${{ env.asset }}
174170
retention-days: 1
175171
if-no-files-found: error
176172

177173
Release:
178-
needs: [Tag, BuildPip]
174+
needs: [Tag, BuildConda]
179175
runs-on: ubuntu-latest
180176
steps:
181177
- name: 'Download Artifact Package - Pip'
182178
uses: actions/download-artifact@v2
183179
with:
184-
name: package-pip-artifact
180+
name: package-conda-artifact
185181
- name: 'Create Release'
186182
uses: softprops/action-gh-release@v1
187183
with:
188184
tag_name: ${{ needs.Tag.outputs.tag }}
189185
body: ${{ needs.Tag.outputs.changelog }}
190-
files: ${{ needs.BuildPip.outputs.asset }}
191-
192-
Docker:
193-
needs: [Tag, BuildPip]
194-
runs-on: ubuntu-latest
195-
permissions:
196-
packages: write
197-
contents: read
198-
steps:
199-
- name: 'Checkout'
200-
uses: actions/checkout@v2
201-
with:
202-
ref: stable
203-
- name: 'Download Artifact Package - Pip'
204-
uses: actions/download-artifact@v2
205-
with:
206-
name: package-pip-artifact
207-
- name: 'Unzip pip artifact'
208-
run: |
209-
echo "list directory"
210-
ls
211-
unzip pip.zip
212-
echo "list directory"
213-
ls
214-
- name: 'Define Image name'
215-
run: |
216-
image_name=${{ github.repository }}
217-
image_name=$(echo "$image_name" | cut -f2 -d"/" | tr '[:upper:]' '[:lower:]')
218-
echo "image_name=$image_name" >> "$GITHUB_ENV"
219-
- name: 'Build image'
220-
run: |
221-
docker build . --file Dockerfile --tag ${{ env.image_name }} --label "runnumber=${GITHUB_RUN_ID}"
222-
- name: 'Log in to registry'
223-
run: |
224-
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
225-
- name: 'Push image'
226-
run: |
227-
IMAGE_ID=$(echo ghcr.io/${{ github.repository_owner }}/${{ env.image_name }} | tr '[:upper:]' '[:lower:]')
228-
VERSION=${{ needs.Tag.outputs.tag }}
229-
echo "IMAGE_ID=$IMAGE_ID | VERSION=$VERSION"
230-
docker tag ${{ env.image_name }} "${IMAGE_ID}:${VERSION}"
231-
docker push "${IMAGE_ID}:${VERSION}"
186+
files: ${{ needs.BuildConda.outputs.asset }}

.github/workflows/coverage.yml

Lines changed: 0 additions & 33 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Lint
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
7+
Lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- name: 'Checkout'
11+
uses: actions/checkout@v2
12+
with:
13+
ref: ${{ github.ref }}
14+
fetch-depth: 0
15+
- name: Lint Code Base
16+
uses: github/super-linter@v4
17+
env:
18+
VALIDATE_ALL_CODEBASE: false
19+
VALIDATE_YAML: false
20+
VALIDATE_XML: false
21+
VALIDATE_DOCKERFILE_HADOLINT: false
22+
DEFAULT_BRANCH: main
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yml

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,41 @@
11
name: Tests
22

3-
on: [push, pull_request]
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
410

511
jobs:
612

7-
Lint:
13+
Build:
814
runs-on: ubuntu-latest
15+
defaults:
16+
run:
17+
shell: bash -l {0}
918
steps:
1019
- name: 'Checkout'
1120
uses: actions/checkout@v2
1221
with:
1322
ref: ${{ github.ref }}
14-
fetch-depth: 0
15-
- name: Lint Code Base
16-
uses: github/super-linter@v4
17-
env:
18-
VALIDATE_ALL_CODEBASE: false
19-
VALIDATE_YAML: false
20-
VALIDATE_XML: false
21-
VALIDATE_DOCKERFILE_HADOLINT: false
22-
DEFAULT_BRANCH: main
23-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
23+
- name: 'Deploying miniconda'
24+
uses: conda-incubator/setup-miniconda@v2
25+
with:
26+
miniconda-version: "latest"
27+
environment-file: recipes/workflow.yaml
28+
python-version: '3.9'
29+
- name: 'Build conda package'
30+
run: |
31+
conda-build recipes/
2432
25-
Build:
26-
runs-on: ${{ matrix.os }}-latest
33+
Pytest:
34+
needs: [Build]
35+
runs-on: ubuntu-latest
2736
strategy:
2837
matrix:
29-
os: ["ubuntu"]
30-
python-version: ['3.8', '3.9']
31-
env:
32-
bld_path: /tmp/build
38+
python-version: [3.8, 3.9]
3339
defaults:
3440
run:
3541
shell: bash -l {0}
@@ -41,38 +47,38 @@ jobs:
4147
- name: 'Deploying miniconda'
4248
uses: conda-incubator/setup-miniconda@v2
4349
with:
44-
miniconda-version: 'latest'
45-
environment-file: conda.recipes/conda_build_env.yaml
50+
miniconda-version: "latest"
51+
environment-file: recipes/workflow.yaml
4652
python-version: ${{ matrix.python-version }}
47-
- name: 'Set up output folder'
48-
run: |
49-
mkdir -p "${bld_path}"
50-
- name: 'Build pip package'
53+
- name: 'Run tests'
5154
run: |
52-
python3 -m build --outdir "${bld_path}"
55+
pip install --no-deps .
56+
python -m pytest tests/unit
5357
54-
Pytest:
58+
Coverage:
5559
needs: [Build]
56-
runs-on: ${{ matrix.os }}-latest
57-
strategy:
58-
matrix:
59-
python-version: ['3.8', '3.9']
60-
os: [ubuntu, macos]
61-
env:
62-
bld_path: /tmp/build
60+
runs-on: ubuntu-latest
61+
defaults:
62+
run:
63+
shell: bash -l {0}
6364
steps:
6465
- name: 'Checkout'
6566
uses: actions/checkout@v2
6667
with:
6768
ref: ${{ github.ref }}
68-
- name: 'Set up Python'
69-
uses: actions/setup-python@v2
69+
- name: 'Deploying miniconda'
70+
uses: conda-incubator/setup-miniconda@v2
7071
with:
71-
python-version: ${{ matrix.python-version }}
72-
- name: 'Install'
73-
run: |
74-
pip install .
75-
- name: 'Run pytest'
72+
miniconda-version: "latest"
73+
environment-file: recipes/workflow.yaml
74+
python-version: '3.9'
75+
- name: 'Run tests'
7676
run: |
77-
pip install pytest
78-
python -m pytest
77+
pip install --no-deps .
78+
coverage run -m pytest
79+
coverage lcov
80+
- name: 'Coveralls'
81+
uses: coverallsapp/github-action@master
82+
with:
83+
github-token: ${{ secrets.GITHUB_TOKEN }}
84+
path-to-lcov: ./coverage.lcov

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,4 @@ super-linter.log
2020
.eggs
2121
build
2222
debug
23+
.tox

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
include environment.yml
1+
graft recipes

README.md

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -10,68 +10,65 @@
1010

1111
## Installation
1212

13-
### Conda
14-
1513
```sh
1614
conda install -c bioconda straindesign
1715
```
1816

19-
### Docker
20-
21-
```sh
22-
docker pull ghcr.io/brsynth/straindesign:<release version>
23-
```
24-
25-
### Pip
26-
27-
Download asset from the last *Releases*.
28-
29-
* Unzip asset
30-
31-
```sh
32-
unzip <folder>
33-
```
34-
35-
* Install *wheel* with *pip*
36-
37-
```sh
38-
pip install <unzipped file>.whl
39-
```
40-
4117
## Usage
4218

43-
Example: Define the best combination of genes deletion to optimize a target.
19+
### Define the best combination of genes deletion to optimize a target.
4420

4521
```sh
46-
python -m straindesign \
22+
python -m straindesign simulate-deletion \
4723
[input files]
4824
--input-model-file <SBML file>
4925
--input-pathway-file <SBML file>
50-
--input-medium-file <CSV file>
51-
[input parameters]
26+
--input-medium-file <CSV/TSV file>
27+
[parameters]
5228
--biomass-rxn-id <id reaction, str>
5329
--target-rxn-id <id reaction, str>
5430
--substrate-rxn-id <id reaction, str>
5531
[output file]
56-
--output-file <CSV file>
32+
--output-file <CSV/TSV file>
5733
```
5834

59-
Or with docker:
35+
### Delete genes in a model
6036

6137
```sh
62-
docker run \
63-
-it \
64-
--rm \
65-
-v $PWD:/data \
66-
straindesign:latest \
67-
--input-model /data/<SBML file> \
68-
--input-pathway-file /data/<SBML file> \
69-
--input-medium-file /data/<CSV file> \
70-
--biomass-rxn-id <id reaction, str> \
71-
--target-rxn-id <id reaction, str> \
38+
python -m straindesign reduce-model \
39+
[input files]
40+
--input-model-file <SBML file>
41+
--input-straindesign-file <CSV file>
42+
and/or
43+
--input-gene-str <id gene, str>
44+
[parameters]
45+
--parameter-strategy-str <yield-max, gene-max, gene-min>
46+
[output file]
47+
--output-file-sbml <SBML file>
48+
```
49+
You can provide a list of genes to delete in the model or the file produced by the command `simulate-deletion`.
50+
If this file is provided, the combination of genes is choosen among three strategies:
51+
* yield-max: genes are sorted by the best yield
52+
* gene-max: the combination of the maximum number of genes
53+
* gene-min: the combination of the minimum number of genes
54+
55+
### Produce a pareto plot
56+
57+
````sh
58+
python -m straindesign analyzing-model \
59+
[input files]
60+
--input-model-file <SBML file>
61+
--input-medium-file <CSV/TSV file>
62+
--input-pathway-file <SBML file>
63+
[parameters]
64+
--biomass-rxn-id <id reaction, str>
65+
--target-rxn-id <id reaction, str>
7266
--substrate-rxn-id <id reaction, str>
73-
--output-file /data/<CSV file>
67+
[output file]
68+
--output-pareto-png <PNG file>
7469
```
70+
You can provide an heterologous pathway to implement the metabolic pathway producing the targeted compound represented by the `target-rxn-id`, the reaction which produces this compound.
71+
The `substrate-rxn-id` argument lets you to choose the main carbon source.
7572

7673
## Tests
7774

0 commit comments

Comments
 (0)