Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update README and tests for binary distribution #5

Merged
merged 13 commits into from
Aug 9, 2024
29 changes: 29 additions & 0 deletions .github/workflows/binary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: binary tarball

on:
workflow_dispatch:
release:
branches: [ master ]
repository_dispatch:
types: [linux-binary-test, install-test]
schedule:
- cron: '15 15 * * *' # 3:15pm every day
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: prerequisites
run: |
sudo apt-get update
sudo apt-get install -y ncbi-blast+
echo "TERM=-$TERM-"
- name: download
run: bash -x .github/workflows/get_binary_release.sh | tee | tail -1 > dirname
- name:
run: stxtyper_v*/stxtyper -v
- name: run tests included with distribution
run: |
directory=$(cat dirname)
cd $directory
./test_stxtyper.sh
28 changes: 28 additions & 0 deletions .github/workflows/get_binary_release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
# found and lightly modified these functions
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" |
grep '"tag_name":' |
cut -d '"' -f 4
}

get_tarball_url() {
curl --silent "https://api.github.com/repos/$1/releases/latest" |
fgrep '"browser_download_url":' |
cut -d '"' -f 4
}


release=$(get_latest_release ncbi/stxtyper)
URL=$(get_tarball_url ncbi/stxtyper)

>&2 echo "Downloading StxTyper version $release"
>&2 echo "Binaries from $URL"

# download and unpack AMRFinder binaries
curl --silent -L -O $URL
tarball_name=$(echo $URL | perl -pe 's#^.*/(.*)#\1#')
tar xfz $tarball_name
rm $tarball_name
directory=$(echo $tarball_name | sed 's/.tar.gz//')
echo $directory
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ install:
then \
mkdir -p $(DESTDIR)$(bindir); \
fi
$(INSTALL) $(BINARIES) $(DATABASE) $(DESTDIR)$(bindir)
$(INSTALL) $(BINARIES) $(DATABASE) test_stxtyper.sh $(DESTDIR)$(bindir)

# stxtyper binaries for github binary release
GITHUB_FILE=stxtyper_v$(VERSION_STRING)_$(ARCH)_$(OS)
Expand Down
61 changes: 44 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,66 @@ StxTyper is used to determine stx type from nucleotide sequence. Stx (Shiga-toxi

# Installation

## Prerequisites
## Installing with Bioconda

### C compiler and make
You'll need Mamba ([Installation instructions](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html)) first.

These generally come standard for unix systems, if not the user will need to intall make
and GCC. MacOS users will need to go to the [App store and install
Xcode](https://apps.apple.com/in/app/xcode/id497799835?mt=12).
micromamba create -n stxtyper ncbi-stxtyper \
--channel conda-forge \
--channel bioconda \
--channel defaults \
--strict-channel-priority

## Installing from binary

### NCBI BLAST
### Prerequisites

StxTyper needs NCBI BLAST binaries in your path (specifically tblastn). If you don't
already have BLAST installed see https://www.ncbi.nlm.nih.gov/books/NBK569861/
for instructions to install BLAST binaries.
#### NCBI BLAST+

Blast can also be installed using bioconda by first installing bioconda, then making sure to activate the environment in which it's installed.
- See the [official install miniconda instructions for Linux](https://docs.anaconda.com/free/miniconda/#quick-command-line-install)
- See the [official install miniconda instructions for MacOS](https://docs.conda.io/en/latest/miniconda.html)
See below under "Compiling" for instructions to install NCBI BLAST+.

Then run:
### Download and install Binary

source ~/miniconda3/bin/activate
conda create -y -c conda-forge -c bioconda -n blast blast
conda activate blast
Download the latest binary tarball from https://github.com/ncbi/stxtyper/releases. Untar it and run the tests e.g.:

If you install BLAST via conda in this way you will need to run `conda activate blast` before you can run StxTyper.
tar xvfz stxtyper_v*.tar.gz
cd stxtyper_v*/
./test_stxtyper.sh

Note that we are currently only publishing binary tarballs for x86 linux.

## Compiling

### Prerequisites

#### NCBI BLAST+

StxTyper needs NCBI BLAST binaries in your path (specifically tblastn). If you
don't already have BLAST installed see
https://www.ncbi.nlm.nih.gov/books/NBK569861/ for the official instructions to
install BLAST binaries. It's also available in many package repositories, for
example on Ubuntu:

sudo apt-get install ncbi-blast+

#### C compiler and make

These are necessary if compiling from source. If using the binary distribution,
or Bioconda you won't need to worry about these. They generally come standard
for unix systems, if not the user will need to intall make and GCC. MacOS users
will need to go to the [App store and install
Xcode](https://apps.apple.com/in/app/xcode/id497799835?mt=12).

### Compiling

StxTyper should compile cleanly for Mac and Linux x86 and ARM, though our official policy is we only support x86 Linux.

git clone https://github.com/evolarjun/stxtyper.git
cd stxtyper
make
make test


# Usage

stxtyper -n <assembled_nucleotide.fa> [<options>]
Expand Down
12 changes: 7 additions & 5 deletions test_stxtyper.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,18 @@ FAILURES=0
TESTS=0
TEST_TEXT=''

echo "TERM=$TERM"

# some color macros
if [ "$TERM" != "" ]
if [ "$TERM" == "" || "$TERM" == "dumb" ]
then
green=`tput setaf 2` # Set green foreground color (code 2)
red=`tput setaf 1` # Set red foreground color (code 1)
reset=`tput sgr0` # Reset color to default
else
green='' # no colors
red=''
reset=''
else
green=`tput setaf 2` # Set green foreground color (code 2)
red=`tput setaf 1` # Set red foreground color (code 1)
reset=`tput sgr0` # Reset color to default
fi

function test_input_file {
Expand Down