Merge pull request #210 from oncokb/rc #104
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will install Python dependencies, run annotation against the master annotation | |
name: Compare Annotation | |
on: | |
push: | |
branches: | |
- master | |
- next-minor-release | |
pull_request: | |
branches: | |
- master | |
- next-minor-release | |
jobs: | |
build: | |
if: github.repository == 'oncokb/oncokb-annotator' | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.8 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install flake8 | |
pip install -r requirements/common.txt -r requirements/pip3.txt | |
- name: Lint with flake8 | |
run: | | |
# stop the build if there are Python syntax errors or undefined names | |
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics | |
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide | |
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics | |
- name: Annotate | |
id: annotate | |
env: | |
ONCOKB_API_TOKEN: ${{ secrets.ONCOKB_BOT_API_TOKEN }} | |
ONCOKB_OAUTH_TOKEN: ${{ secrets.ONCOKB_OAUTH_TOKEN }} | |
run: | | |
git checkout -b compare | |
MUTATION_DATA_NAME=data_mutations_mskcc.txt | |
CLINICAL_DATA_NAME=data_clinical_sample.txt | |
FUSION_DATA_NAME=data_fusions.txt | |
INDIVIDUAL_CNA_DATA_NAME=data_individual_CNA.txt | |
cd data || exit | |
curl -s -H "Authorization: token ${ONCOKB_OAUTH_TOKEN}" https://api.github.com/repos/knowledgesystems/oncokb-data/contents/annotation/annotator-test/data | jq -r '.[] | .download_url + " " + .name' | while IFS=' ' read -r downloadurl name; do | |
if [[ "$name" == "$FIEL_NAME_PREFIX"* ]]; then | |
curl -s "$downloadurl" -o $name | |
fi | |
done | |
cd .. | |
# create compare folder to add all annotated files | |
mkdir compare | |
PREFIX=oncokb | |
IMAF=data/"$MUTATION_DATA_NAME" | |
OMAF=compare/"$PREFIX"_"$MUTATION_DATA_NAME" | |
IC=data/"$CLINICAL_DATA_NAME" | |
OC=compare/"$PREFIX"_"$CLINICAL_DATA_NAME" | |
IF=data/"$FUSION_DATA_NAME" | |
OF=compare/"$PREFIX"_"$FUSION_DATA_NAME" | |
IICNA=data/"$INDIVIDUAL_CNA_DATA_NAME" | |
OICNA=compare/"$PREFIX"_"$INDIVIDUAL_CNA_DATA_NAME" | |
python MafAnnotator.py -i "$IMAF" -o "$OMAF" -c "$IC" -b "$ONCOKB_API_TOKEN" | |
python FusionAnnotator.py -i "$IF" -o "$OF" -c "$IC" -b "$ONCOKB_API_TOKEN" | |
python CnaAnnotator.py -i "$IICNA" -o "$OICNA" -c "$IC" -b "$ONCOKB_API_TOKEN" -f "individual" | |
python ClinicalDataAnnotator.py -i "$IC" -o "$OC" -a "$OMAF,$OICNA,$OF" | |
git config user.name oncokb-bot | |
git config user.email [email protected] | |
git add . | |
git commit -m 'add analysis' | |
- name: Compare annotation result with the ones from master | |
id: compare | |
env: | |
ONCOKB_OAUTH_TOKEN: ${{ secrets.ONCOKB_OAUTH_TOKEN }} | |
FIEL_NAME_PREFIX: 'oncokb_data' | |
run: | | |
# remove everything under compare folder and replace wiht the ones from oncokb-data | |
rm -f compare/*.txt | |
cd compare || exit | |
curl -s -H "Authorization: token ${ONCOKB_OAUTH_TOKEN}" https://api.github.com/repos/knowledgesystems/oncokb-data/contents/annotation/annotator-test/annotation | jq -r '.[] | .download_url + " " + .name' | while IFS=' ' read -r downloadurl name; do | |
if [[ "$name" == "$FIEL_NAME_PREFIX"* ]]; then | |
curl -s "$downloadurl" -o $name | |
fi | |
done | |
cd .. | |
# compare | |
CHANGED=$(git diff --name-only HEAD --) | |
if [ -n "$CHANGED" ] | |
then | |
git diff | |
exit 1 | |
fi | |