Skip to content

Commit

Permalink
Merge branch 'main' into stable
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-gricourt committed Sep 27, 2022
2 parents dcf36c2 + 801f27f commit 388f1d0
Show file tree
Hide file tree
Showing 34 changed files with 1,059 additions and 468 deletions.
65 changes: 10 additions & 55 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,11 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main

BuildPip:
needs: Commit
BuildConda:
needs: [Commit, Tag]
runs-on: ubuntu-latest
env:
bld_path: /tmp/build
asset: pip.zip
asset: straindesign-${{ needs.Tag.outputs.tag }}-py_0.tar.bz2
outputs:
asset: ${{ env.asset }}
defaults:
Expand All @@ -158,74 +157,30 @@ jobs:
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
environment-file: conda.recipes/conda_build_env.yaml
environment-file: recipes/workflow.yaml
python-version: '3.9'
- name: 'Build pip package'
- name: 'Build conda package'
run: |
python3 -m build --outdir ${bld_path}
- name: 'Create asset'
run: |
zip -r -j ${asset} ${bld_path}
conda-build recipes --output-folder . --output "${{ env.asset }}"
- name: 'Upload Artifact Package'
uses: actions/upload-artifact@v2
with:
name: package-pip-artifact
name: package-conda-artifact
path: ${{ env.asset }}
retention-days: 1
if-no-files-found: error

Release:
needs: [Tag, BuildPip]
needs: [Tag, BuildConda]
runs-on: ubuntu-latest
steps:
- name: 'Download Artifact Package - Pip'
uses: actions/download-artifact@v2
with:
name: package-pip-artifact
name: package-conda-artifact
- name: 'Create Release'
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ needs.Tag.outputs.tag }}
body: ${{ needs.Tag.outputs.changelog }}
files: ${{ needs.BuildPip.outputs.asset }}

Docker:
needs: [Tag, BuildPip]
runs-on: ubuntu-latest
permissions:
packages: write
contents: read
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
ref: stable
- name: 'Download Artifact Package - Pip'
uses: actions/download-artifact@v2
with:
name: package-pip-artifact
- name: 'Unzip pip artifact'
run: |
echo "list directory"
ls
unzip pip.zip
echo "list directory"
ls
- name: 'Define Image name'
run: |
image_name=${{ github.repository }}
image_name=$(echo "$image_name" | cut -f2 -d"/" | tr '[:upper:]' '[:lower:]')
echo "image_name=$image_name" >> "$GITHUB_ENV"
- name: 'Build image'
run: |
docker build . --file Dockerfile --tag ${{ env.image_name }} --label "runnumber=${GITHUB_RUN_ID}"
- name: 'Log in to registry'
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin
- name: 'Push image'
run: |
IMAGE_ID=$(echo ghcr.io/${{ github.repository_owner }}/${{ env.image_name }} | tr '[:upper:]' '[:lower:]')
VERSION=${{ needs.Tag.outputs.tag }}
echo "IMAGE_ID=$IMAGE_ID | VERSION=$VERSION"
docker tag ${{ env.image_name }} "${IMAGE_ID}:${VERSION}"
docker push "${IMAGE_ID}:${VERSION}"
files: ${{ needs.BuildConda.outputs.asset }}
33 changes: 0 additions & 33 deletions .github/workflows/coverage.yml

This file was deleted.

23 changes: 23 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lint

on: [push, pull_request]

jobs:

Lint:
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_YAML: false
VALIDATE_XML: false
VALIDATE_DOCKERFILE_HADOLINT: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90 changes: 48 additions & 42 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,41 @@
name: Tests

on: [push, pull_request]
on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:

Lint:
Build:
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
fetch-depth: 0
- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
VALIDATE_YAML: false
VALIDATE_XML: false
VALIDATE_DOCKERFILE_HADOLINT: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: 'Deploying miniconda'
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
environment-file: recipes/workflow.yaml
python-version: '3.9'
- name: 'Build conda package'
run: |
conda-build recipes/
Build:
runs-on: ${{ matrix.os }}-latest
Pytest:
needs: [Build]
runs-on: ubuntu-latest
strategy:
matrix:
os: ["ubuntu"]
python-version: ['3.8', '3.9']
env:
bld_path: /tmp/build
python-version: [3.8, 3.9]
defaults:
run:
shell: bash -l {0}
Expand All @@ -41,38 +47,38 @@ jobs:
- name: 'Deploying miniconda'
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: 'latest'
environment-file: conda.recipes/conda_build_env.yaml
miniconda-version: "latest"
environment-file: recipes/workflow.yaml
python-version: ${{ matrix.python-version }}
- name: 'Set up output folder'
run: |
mkdir -p "${bld_path}"
- name: 'Build pip package'
- name: 'Run tests'
run: |
python3 -m build --outdir "${bld_path}"
pip install --no-deps .
python -m pytest tests/unit
Pytest:
Coverage:
needs: [Build]
runs-on: ${{ matrix.os }}-latest
strategy:
matrix:
python-version: ['3.8', '3.9']
os: [ubuntu, macos]
env:
bld_path: /tmp/build
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: 'Checkout'
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: 'Set up Python'
uses: actions/setup-python@v2
- name: 'Deploying miniconda'
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
- name: 'Install'
run: |
pip install .
- name: 'Run pytest'
miniconda-version: "latest"
environment-file: recipes/workflow.yaml
python-version: '3.9'
- name: 'Run tests'
run: |
pip install pytest
python -m pytest
pip install --no-deps .
coverage run -m pytest
coverage lcov
- name: 'Coveralls'
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: ./coverage.lcov
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ super-linter.log
.eggs
build
debug
.tox
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include environment.yml
graft recipes
79 changes: 38 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,68 +10,65 @@

## Installation

### Conda

```sh
conda install -c bioconda straindesign
```

### Docker

```sh
docker pull ghcr.io/brsynth/straindesign:<release version>
```

### Pip

Download asset from the last *Releases*.

* Unzip asset

```sh
unzip <folder>
```

* Install *wheel* with *pip*

```sh
pip install <unzipped file>.whl
```

## Usage

Example: Define the best combination of genes deletion to optimize a target.
### Define the best combination of genes deletion to optimize a target.

```sh
python -m straindesign \
python -m straindesign simulate-deletion \
[input files]
--input-model-file <SBML file>
--input-pathway-file <SBML file>
--input-medium-file <CSV file>
[input parameters]
--input-medium-file <CSV/TSV file>
[parameters]
--biomass-rxn-id <id reaction, str>
--target-rxn-id <id reaction, str>
--substrate-rxn-id <id reaction, str>
[output file]
--output-file <CSV file>
--output-file <CSV/TSV file>
```

Or with docker:
### Delete genes in a model

```sh
docker run \
-it \
--rm \
-v $PWD:/data \
straindesign:latest \
--input-model /data/<SBML file> \
--input-pathway-file /data/<SBML file> \
--input-medium-file /data/<CSV file> \
--biomass-rxn-id <id reaction, str> \
--target-rxn-id <id reaction, str> \
python -m straindesign reduce-model \
[input files]
--input-model-file <SBML file>
--input-straindesign-file <CSV file>
and/or
--input-gene-str <id gene, str>
[parameters]
--parameter-strategy-str <yield-max, gene-max, gene-min>
[output file]
--output-file-sbml <SBML file>
```
You can provide a list of genes to delete in the model or the file produced by the command `simulate-deletion`.
If this file is provided, the combination of genes is choosen among three strategies:
* yield-max: genes are sorted by the best yield
* gene-max: the combination of the maximum number of genes
* gene-min: the combination of the minimum number of genes

### Produce a pareto plot

````sh
python -m straindesign analyzing-model \
[input files]
--input-model-file <SBML file>
--input-medium-file <CSV/TSV file>
--input-pathway-file <SBML file>
[parameters]
--biomass-rxn-id <id reaction, str>
--target-rxn-id <id reaction, str>
--substrate-rxn-id <id reaction, str>
--output-file /data/<CSV file>
[output file]
--output-pareto-png <PNG file>
```
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.
The `substrate-rxn-id` argument lets you to choose the main carbon source.

## Tests

Expand Down
Loading

0 comments on commit 388f1d0

Please sign in to comment.