-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
275 additions
and
46 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: deploy release | ||
# This builds the docker image and pushes it to DockerHub | ||
on: | ||
release: | ||
types: [published] | ||
jobs: | ||
push_dockerhub: | ||
name: Push new Docker image to Docker Hub (release) | ||
runs-on: ubuntu-latest | ||
# Only run for the official repo, for releases and merged PRs | ||
if: ${{ github.repository == 'BU-ISCIII/taranis' }} | ||
env: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
steps: | ||
- name: Check out pipeline code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build new docker image | ||
run: docker build --no-cache . -t buisciii/taranis:${{ github.event.release.tag_name }} | ||
|
||
- name: Push Docker image to DockerHub (develop) | ||
run: | | ||
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | ||
docker push buisciii/taranis:${{ github.event.release.tag_name }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: tests ci | ||
# This workflow runs the pipeline with the minimal test dataset to check that it completes any errors | ||
on: | ||
push: | ||
branches: [develop] | ||
pull_request_target: | ||
branches: [develop] | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
push_dockerhub: | ||
name: Push new Docker image to Docker Hub (dev) | ||
runs-on: ubuntu-latest | ||
# Only run for the official repo, for releases and merged PRs | ||
if: ${{ github.repository == 'BU-ISCIII/taranis' }} | ||
env: | ||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} | ||
DOCKERHUB_PASS: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
steps: | ||
- name: Check out pipeline code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build new docker image | ||
run: docker build --no-cache . -t buisciii/taranis:dev | ||
|
||
- name: Push Docker image to DockerHub (develop) | ||
run: | | ||
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin | ||
docker push buisciii/taranis:dev | ||
run-tests: | ||
name: Run tests | ||
needs: push_dockerhub | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Run pipeline with test data | ||
run: | | ||
docker run buisciii/taranis:dev bash -c /opt/taranis/test/test.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
FROM continuumio/miniconda3:latest | ||
|
||
RUN mkdir /opt/taranis/ | ||
ADD utils /opt/taranis/utils | ||
ADD test /opt/taranis/test | ||
ADD *.py /opt/taranis/ | ||
ADD environment.yml /opt/taranis/ | ||
ADD logging_config.ini /opt/taranis/ | ||
ADD README.md /opt/taranis/ | ||
ADD LICENSE /opt/taranis/ | ||
|
||
SHELL ["/bin/bash", "-c"] | ||
RUN cd /opt/taranis | ||
RUN /opt/conda/bin/conda env create -f /opt/taranis/environment.yml && /opt/conda/bin/conda clean -a | ||
RUN /opt/conda/bin/conda env export --name taranis > taranis.yml | ||
RUN echo "conda activate taranis" > ~/.bashrc | ||
ENV PATH /opt/conda/envs/taranis:/opt/conda/envs/taranis/utils:$PATH |
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 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 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
Empty file.
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 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
Empty file.
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
#!/bin/bash --login | ||
|
||
# Exit immediately if a pipeline, which may consist of a single simple command, a list, | ||
#or a compound command returns a non-zero status: If errors are not handled by user | ||
set -e | ||
# Treat unset variables and parameters other than the special parameters ‘@’ or ‘*’ as an error when performing parameter expansion. | ||
|
||
#Print everything as if it were executed, after substitution and expansion is applied: Debug|log option | ||
#set -x | ||
|
||
#============================================================= | ||
# HEADER | ||
#============================================================= | ||
|
||
#INSTITUTION:ISCIII | ||
#CENTRE:BU-ISCIII | ||
# | ||
#ACKNOLEDGE: longops2getops.sh: https://gist.github.com/adamhotep/895cebf290e95e613c006afbffef09d7 | ||
# | ||
#DESCRIPTION: test.sh uses test data for testing taranis installation. | ||
# | ||
# | ||
#================================================================ | ||
# END_OF_HEADER | ||
#================================================================ | ||
|
||
#SHORT USAGE RULES | ||
#LONG USAGE FUNCTION | ||
usage() { | ||
cat << EOF | ||
plasmidID is a computational pipeline tha reconstruct and annotate the most likely plasmids present in one sample | ||
usage : $0 | ||
-v | --version version | ||
-h | --help display usage message | ||
example: ./test.sh | ||
EOF | ||
} | ||
|
||
#================================================================ | ||
# OPTION_PROCESSING | ||
#================================================================ | ||
# Error handling | ||
error(){ | ||
local parent_lineno="$1" | ||
local script="$2" | ||
local message="$3" | ||
local code="${4:-1}" | ||
|
||
RED='\033[0;31m' | ||
NC='\033[0m' | ||
|
||
if [[ -n "$message" ]] ; then | ||
echo -e "\n---------------------------------------\n" | ||
echo -e "${RED}ERROR${NC} in Script $script on or near line ${parent_lineno}; exiting with status ${code}" | ||
echo -e "MESSAGE:\n" | ||
echo -e "$message" | ||
echo -e "\n---------------------------------------\n" | ||
else | ||
echo -e "\n---------------------------------------\n" | ||
echo -e "${RED}ERROR${NC} in Script $script on or near line ${parent_lineno}; exiting with status ${code}" | ||
echo -e "\n---------------------------------------\n" | ||
fi | ||
|
||
exit "${code}" | ||
} | ||
|
||
# translate long options to short | ||
reset=true | ||
for arg in "$@" | ||
do | ||
if [ -n "$reset" ]; then | ||
unset reset | ||
set -- # this resets the "$@" array so we can rebuild it | ||
fi | ||
case "$arg" in | ||
--help) set -- "$@" -h ;; | ||
--version) set -- "$@" -v ;; | ||
# pass through anything else | ||
*) set -- "$@" "$arg" ;; | ||
esac | ||
done | ||
|
||
#DECLARE FLAGS AND VARIABLES | ||
script_dir=$(dirname $(readlink -f $0)) | ||
assemblies="./samples_listeria/" | ||
schema="./MLST_listeria/" | ||
profile="./profile_MLST_listeria/profiles_csv.csv" | ||
refgenome="./reference_listeria/GCF_002213505.1_ASM221350v1_genomic.fna" | ||
|
||
#PARSE VARIABLE ARGUMENTS WITH getops | ||
#common example with letters, for long options check longopts2getopts.sh | ||
options=":1:2:d:s:g:c:a:i:o:C:S:f:l:L:T:M:X:y:Y:RVtvh" | ||
while getopts $options opt; do | ||
case $opt in | ||
h ) | ||
usage | ||
exit 1 | ||
;; | ||
v ) | ||
echo $VERSION | ||
exit 1 | ||
;; | ||
\?) | ||
echo "Invalid Option: -$OPTARG" 1>&2 | ||
usage | ||
exit 1 | ||
;; | ||
: ) | ||
echo "Option -$OPTARG requires an argument." >&2 | ||
exit 1 | ||
;; | ||
* ) | ||
echo "Unimplemented option: -$OPTARG" >&2; | ||
exit 1 | ||
;; | ||
|
||
esac | ||
done | ||
shift $((OPTIND-1)) | ||
|
||
## Execute plasmidID with test data. | ||
echo "Executing:../taranis.py allele_calling -coregenedir $schema -inputdir $assemblies -refgenome $refgenome -outputdir allele_calling_test -percentlength 20 -refalleles $refallele -profile $profile" | ||
echo "Assemblies: $assemblies" | ||
echo "Schema: $schema" | ||
echo "$PWD" | ||
cd | ||
$script_dir/../taranis.py analyze_schema -inputdir $script_dir/MLST_listeria -outputdir analyze_schema_test | ||
|
||
$script_dir/../taranis.py reference_alleles -coregenedir $script_dir/MLST_listeria -outputdir reference_alleles_test | ||
|
||
$script_dir/../taranis.py allele_calling -coregenedir $script_dir/$schema -inputdir $script_dir/$assemblies -refgenome $script_dir/$refgenome -outputdir allele_calling_test -percentlength 20 -refalleles reference_alleles_test -profile $script_dir/$profile | ||
|
||
$script_dir/../taranis.py distance_matrix -alleles_matrix allele_calling_test/result.tsv -outputdir distance_matrix_test | ||
|
||
echo "ALL DONE. TEST COMPLETED SUCCESSFULLY YOUR INSTALLATION SHOULD BE CORRECT." |
Oops, something went wrong.