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 mosdepth recipe #48070

Open
wants to merge 19 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions recipes/mosdepth/build.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
#!/bin/sh
#!/bin/bash

if [[ ${target_platform} == osx-64 ]] ; then
curl -SL https://github.com/nim-lang/nightlies/releases/download/latest-version-1-6/macosx_x64.tar.xz -o macosx_x64.tar.xz
if [[ ${target_platform} == "osx-64" ]] ; then
curl -SL https://github.com/nim-lang/nightlies/releases/download/latest-version-2-2/macosx_x64.tar.xz -o macosx_x64.tar.xz
tar -xzf macosx_x64.tar.xz
cd nim-1.6.*
cd nim-2.2.*
export PATH="$PWD/bin:$PATH"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add error handling for directory changes

Directory changes should handle potential failures.

-    cd nim-2.2.*
+    cd nim-2.2.* || exit 1
     export PATH="$PWD/bin:$PATH"
-    cd ..
+    cd .. || exit 1
     ...
-    cd mosdepth-0.3.9
+    cd mosdepth-0.3.9 || exit 1

Also applies to: 8-8, 16-16

🧰 Tools
🪛 Shellcheck

[warning] 6-6: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

cd ..
curl -SL https://github.com/brentp/mosdepth/archive/refs/tags/v${PKG_VERSION}.tar.gz -o mosdepth-latest.tar.gz
tar -xzf mosdepth-latest.tar.gz
cd mosdepth-${PKG_VERSION}
nimble install -y "docopt@0.7.0"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add error handling for directory changes.

The cd commands should handle potential failures:

-    cd nim-2.2.*
+    cd nim-2.2.* || exit 1
     export PATH="$PWD/bin:$PATH"
-    cd ..
+    cd .. || exit 1
     curl -SL https://github.com/brentp/mosdepth/archive/refs/tags/v${PKG_VERSION}.tar.gz -o mosdepth-latest.tar.gz
     tar -xzf mosdepth-latest.tar.gz
-    cd mosdepth-${PKG_VERSION}
+    cd mosdepth-${PKG_VERSION} || exit 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
cd nim-2.2.*
export PATH="$PWD/bin:$PATH"
cd ..
curl -SL https://github.com/brentp/mosdepth/archive/refs/tags/v${PKG_VERSION}.tar.gz -o mosdepth-latest.tar.gz
tar -xzf mosdepth-latest.tar.gz
cd mosdepth-${PKG_VERSION}
cd nim-2.2.* || exit 1
export PATH="$PWD/bin:$PATH"
cd .. || exit 1
curl -SL https://github.com/brentp/mosdepth/archive/refs/tags/v${PKG_VERSION}.tar.gz -o mosdepth-latest.tar.gz
tar -xzf mosdepth-latest.tar.gz
cd mosdepth-${PKG_VERSION} || exit 1
🧰 Tools
🪛 Shellcheck

[warning] 6-6: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)


[warning] 11-11: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

nimble build -y --verbose -d:release
export CFLAGS="$CFLAGS -I$PREFIX/include"
export LDFLAGS="$LDFLAGS -L$PREFIX/lib"
nimble install -y "docopt@0.7.1" --passC:"-I$PREFIX/include" --passL:"-L$PREFIX/lib"
nimble build -y --verbose -d:release -d:d4 --passC:"-I$PREFIX/include" --passL:"-L$PREFIX/lib"
else
curl -SL https://github.com/brentp/mosdepth/releases/download/v$PKG_VERSION/mosdepth -o mosdepth
#Link to mosdepth_d4 is specified below because of https://github.com/brentp/mosdepth/issues/232
curl -SL https://github.com/brentp/mosdepth/releases/download/v$PKG_VERSION/mosdepth_d4 -o mosdepth
chmod +x mosdepth
fi

mkdir -p "${PREFIX}/bin"
cp mosdepth "${PREFIX}/bin/"
chmod 0755 mosdepth
mv mosdepth "${PREFIX}/bin/"
24 changes: 17 additions & 7 deletions recipes/mosdepth/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
{% set version = "0.3.8" %}
{% set name = "mosdepth" %}
{% set version = "0.3.9" %}

package:
name: mosdepth
name: {{ name }}
version: {{ version }}

source:
url: https://github.com/brentp/{{ name }}/archive/refs/tags/v{{ version }}.tar.gz
sha256: 9171ea9a6ddaccd0091db5b85fa9e6cb79516bbe005c47ffc8dcfe49c978eb69

build:
number: 0
run_exports:
Expand All @@ -12,23 +17,28 @@ build:
requirements:
build:
- {{ compiler('c') }}
- curl
host:
- htslib >=1.19.1
- htslib >=1.21
- d4binding
- curl
run:
- d4binding

test:
commands:
- mosdepth -h

about:
home: https://github.com/brentp/mosdepth
dev_url: https://github.com/brentp/mosdepth
doc_url: https://github.com/brentp/mosdepth
home: "https://github.com/brentp/mosdepth"
dev_url: "https://github.com/brentp/mosdepth"
doc_url: "https://github.com/brentp/mosdepth/blob/v{{ version }}/README.md"
license: MIT
license_family: MIT
license_file: LICENSE
summary: 'Fast BAM/CRAM depth calculation for WGS, exome, or targeted sequencing.'

extra:
identifiers:
- doi:10.1093/bioinformatics/btx699
- biotools:mosdepth
- usegalaxy-eu:mosdepth
Loading