From 07329bc2c6891fd582ebdb72b04075eb91883479 Mon Sep 17 00:00:00 2001 From: Mihail Anton Date: Fri, 7 Jul 2023 16:20:45 +0800 Subject: [PATCH 1/3] feat: gene essentiality workflow with pr comment --- .github/workflows/commentsFromTests.md | 7 ++++++ .github/workflows/gene-essentiality.yml | 32 +++++++++++++++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 .github/workflows/commentsFromTests.md create mode 100644 .github/workflows/gene-essentiality.yml diff --git a/.github/workflows/commentsFromTests.md b/.github/workflows/commentsFromTests.md new file mode 100644 index 00000000..dd2ba900 --- /dev/null +++ b/.github/workflows/commentsFromTests.md @@ -0,0 +1,7 @@ +This PR has been [automatically tested with GH Actions](https://github.com/SysBioChalmers/Human-GEM/actions/runs/{GH_ACTION_RUN}). Here is the output of the gene essentiality test: + +
+{TEST_RESULTS}
+
+ +> _Note: In the case of multiple test runs, this post will be edited._ diff --git a/.github/workflows/gene-essentiality.yml b/.github/workflows/gene-essentiality.yml new file mode 100644 index 00000000..687954c3 --- /dev/null +++ b/.github/workflows/gene-essentiality.yml @@ -0,0 +1,32 @@ +name: Check gene essentiality with Hart 2015 + +on: + pull_request: + branches: + - "main" + +jobs: + check-metabolictasks: + runs-on: self-hosted + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Run gene essentiality + id: essentiality + run: | + TEST_RESULTS=$(/usr/local/bin/matlab -nodisplay -nosplash -nodesktop -r "ihuman = importYaml('Human-GEM.yml'); taskStruct = parseTaskList('data/metabolicTasks/metabolicTasks_Essential.txt'); eGenes = estimateEssentialGenes(ihuman, 'Hart2015_RNAseq.txt', taskStruct); disp(evaluateHart2015Essentiality(eGenes));" | awk 'NR>9 && !/^\.+/') + PARSED_RESULTS="${TEST_RESULTS//'%'/'%25'}" + PARSED_RESULTS="${PARSED_RESULTS//$'\n'/'
'}" + PARSED_RESULTS="${PARSED_RESULTS//$'\r'/'
'}" + echo "results=$PARSED_RESULTS" >> $GITHUB_OUTPUT + + - name: Post comment + uses: NejcZdovc/comment-pr@v2 + with: + file: "commentsFromTests.md" + env: + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} + TEST_RESULTS: ${{steps.essentiality.outputs.results}} + GH_ACTION_RUN: ${{github.run_id}} From 1bba24db9adab892ba89153a35322cd127456319 Mon Sep 17 00:00:00 2001 From: Mihail Anton Date: Fri, 6 Oct 2023 10:04:17 +0300 Subject: [PATCH 2/3] chore: expand workflow targets --- .github/workflows/gene-essentiality.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/gene-essentiality.yml b/.github/workflows/gene-essentiality.yml index 687954c3..371743a3 100644 --- a/.github/workflows/gene-essentiality.yml +++ b/.github/workflows/gene-essentiality.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - "main" + - "develop" jobs: check-metabolictasks: From aff8211e1ec5ce2006397675445c07d2109f3083 Mon Sep 17 00:00:00 2001 From: Mihail Anton Date: Fri, 6 Oct 2023 12:37:24 +0300 Subject: [PATCH 3/3] fix: add to matlab path --- .github/workflows/gene-essentiality.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/gene-essentiality.yml b/.github/workflows/gene-essentiality.yml index 371743a3..169efc71 100644 --- a/.github/workflows/gene-essentiality.yml +++ b/.github/workflows/gene-essentiality.yml @@ -17,7 +17,7 @@ jobs: - name: Run gene essentiality id: essentiality run: | - TEST_RESULTS=$(/usr/local/bin/matlab -nodisplay -nosplash -nodesktop -r "ihuman = importYaml('Human-GEM.yml'); taskStruct = parseTaskList('data/metabolicTasks/metabolicTasks_Essential.txt'); eGenes = estimateEssentialGenes(ihuman, 'Hart2015_RNAseq.txt', taskStruct); disp(evaluateHart2015Essentiality(eGenes));" | awk 'NR>9 && !/^\.+/') + TEST_RESULTS=$(/usr/local/bin/matlab -nodisplay -nosplash -nodesktop -r "addpath(genpath('.')); ihuman = importYaml('Human-GEM.yml'); taskStruct = parseTaskList('data/metabolicTasks/metabolicTasks_Essential.txt'); eGenes = estimateEssentialGenes(ihuman, 'Hart2015_RNAseq.txt', taskStruct); disp(evaluateHart2015Essentiality(eGenes));" | awk 'NR>9 && !/^\.+/') PARSED_RESULTS="${TEST_RESULTS//'%'/'%25'}" PARSED_RESULTS="${PARSED_RESULTS//$'\n'/'
'}" PARSED_RESULTS="${PARSED_RESULTS//$'\r'/'
'}"