diff --git a/recipes/mykrobe/build.sh b/recipes/mykrobe/build.sh index 3786386a73c83..e39bb78ebf5b9 100644 --- a/recipes/mykrobe/build.sh +++ b/recipes/mykrobe/build.sh @@ -1,3 +1,35 @@ #!/bin/bash +set -x -$PYTHON setup.py install --single-version-externally-managed --record=record.txt +# specify zlib location https://bioconda.github.io/troubleshooting.html#zlib-errors +export CFLAGS="-I$PREFIX/include" +export LDFLAGS="-L$PREFIX/lib" +export CPATH="$PREFIX/include" + +# download phelim's fork of mccortex +MCCORTEX_DIR=mccortex +MCCORTEX_GIT="https://github.com/phelimb/mccortex" +mkdir "$MCCORTEX_DIR" +git clone --recursive -b geno_kmer_count "$MCCORTEX_GIT" "$MCCORTEX_DIR" +cd "$MCCORTEX_DIR" + +# comment this out as it overrides my LDFLAGS variable +sed -i.bak 's/LDFLAGS =/#LDFLAGS =/' libs/htslib/Makefile +# gcc is hard-coded into Makefile. Comment out to use the conda gcc +sed -i.bak 's/^CC/#CC/' libs/htslib/Makefile + +# point some -lz calls to zlib location +for make_file in libs/string_buffer/Makefile $(find libs/seq_file -name Makefile) $(find libs/seq-align -name Makefile) Makefile; do + sed -i.bak 's/-lz/-lz $(LDFLAGS)/' $make_file +done + +make MAXK=31 + +mkdir -p $PREFIX/bin +install -p bin/mccortex31 $PREFIX/bin/ + +cd ../ + +"$PYTHON" -m pip install . --no-deps -vv + +rm -rf "$MCCORTEX_DIR" diff --git a/recipes/mykrobe/meta.yaml b/recipes/mykrobe/meta.yaml index 95fab664cd592..16f6b1c6f0bea 100644 --- a/recipes/mykrobe/meta.yaml +++ b/recipes/mykrobe/meta.yaml @@ -1,40 +1,45 @@ +{% set version = "0.6.1" %} + package: - name: mykrobe - version: "0.5.6" + name : mykrobe + version: {{ version }} source: - url: https://github.com/iqbal-lab/Mykrobe-predictor/archive/933301d9f1e673a2a282255426a885ef72e67c07.tar.gz - sha256: adcf75a8e873192047921947ef6c367fadee9dff09637f0acad7a4c9c4bcf53e + url : https://github.com/Mykrobe-tools/mykrobe/archive/{{ version }}.tar.gz + sha256 : 5452abf82cb5d3930afc2bc20eaa07b0463403218a1534f036b256dc22aea802 + md5 : 2650bfab3caa6ac9e142fb19d55f5604 build: - # dependency mykatlas currently not built for osx - skip: True # [osx] - number: 1 - entry_points: - - mykrobe = mykrobe.mykrobe_predictor:main + number: 0 + skip: True # [py27] + entry_points: + - mykrobe = mykrobe.cli:main requirements: - host: - - python - - setuptools - + build: + - {{ compiler('cxx') }} + host: + - python + - pip + - zlib + - wget + run: + - python + - mongodb >3.0 + - wget + - zlib - run: - - python - - mykatlas - - ga4ghmongo - - mongoengine - - future test: - # Python imports - imports: - - mykrobe - commands: - - mykrobe --help - + commands: + - mykrobe --version + - mykrobe --help + - mykrobe predict --help + - mykrobe variants --help + - mykrobe genotype --help + - 'mccortex31 2>&1 | head -n2 | grep "^usage: "' about: - home: https://github.com/iqbal-lab/Mykrobe-predictor - license: Custom non-commercial license - license_file: LICENSE - summary: 'Rapid antibiotic-resistance predictions from genome sequence data for Staphylococcus aureus and Mycobacterium tuberculosis.' + home: https://github.com/Mykrobe-tools/mykrobe + license: MIT + license_file: LICENSE + summary: 'Rapid antibiotic-resistance predictions from genome sequence data for Staphylococcus aureus and Mycobacterium tuberculosis.' diff --git a/recipes/mykrobe/post-link.sh b/recipes/mykrobe/post-link.sh new file mode 100644 index 0000000000000..6c5c51645a9bc --- /dev/null +++ b/recipes/mykrobe/post-link.sh @@ -0,0 +1,32 @@ +#!/bin/bash +# This script downloads the panel data that mykrobe uses for its predictions + +cd "$PREFIX" || exit 1 +TARBALL="mykrobe-data.tar.gz" +URLS=( + "https://bit.ly/2H9HKTU" +) +SHA256="14b4e111d8b17a43dd30e3a55416bab79794ed56c44acc6238e1fd10addd0a03" +SUCCESS=0 + +for URL in "${URLS[@]}"; do + wget -O - "${URL}" > "$TARBALL" + [[ $? == 0 ]] || continue + + if [[ $(shasum -a 256 $TARBALL | cut -f1 -d " ") == "$SHA256" ]]; then + SUCCESS=1 + break + fi + +done + +if [[ $SUCCESS != 1 ]]; then + echo "ERROR: post-link.sh was unable to download any of the following URLs with the shasum $SHA256:" >> "${PREFIX}/.messages.txt" 2>&1 + printf '%s\n' "${URLS[@]}" >> "${PREFIX}/.messages.txt" 2>&1 + exit 1 +fi + +tar -vxzf "$TARBALL" +rm -fr "$PREFIX"/src/mykrobe/data +mv mykrobe-data "$PREFIX"/src/mykrobe/data +rm "$TARBALL"