Skip to content

Commit

Permalink
Merge pull request #4 from jonalm/dev/use_ncbi_artifacts_instead_of_b…
Browse files Browse the repository at this point in the history
…ioconda

use artifacts from NCBI directly
  • Loading branch information
kescobo authored Oct 15, 2024
2 parents 90a65f8 + 3f7ba3c commit 5695b95
Show file tree
Hide file tree
Showing 7 changed files with 90 additions and 31 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
- 'nightly'
os:
- ubuntu-latest
- windows-latest
- macOS-latest
arch:
- x64
steps:
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
/docs/build/
.CondaPkg
test/example_files/dna2.fasta.*
.DS_Store
Manifest*
42 changes: 42 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[[ncbi-blast]]
arch = "aarch64"
git-tree-sha1 = "0406b91031ce302fa9117606d007d04635279fef"
os = "macos"

[[ncbi-blast.download]]
sha256 = "e8da4f34b0421da051b1c2d9e5f8e1e43bf76e38cf9361a1dbe2fbc44b6224db"
url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.16.0/ncbi-blast-2.16.0+-aarch64-macosx.tar.gz"
[[ncbi-blast]]
arch = "x86_64"
git-tree-sha1 = "690abc170201bc029d0e7386da0791d7a76d98ff"
os = "macos"

[[ncbi-blast.download]]
sha256 = "7eee1e7720f5daaf06e39d9c92b125d9072de7eb81f499c005dedb08b932324c"
url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.16.0/ncbi-blast-2.16.0+-x64-macosx.tar.gz"
[[ncbi-blast]]
arch = "aarch64"
git-tree-sha1 = "39394a0d1959ae677fde91f3148e1a6bc94f11eb"
libc = "glibc"
os = "linux"

[[ncbi-blast.download]]
sha256 = "d447a232ed3c47d1a5abca91932e0e4d3e6540f2c970cee26aa52b994392e0c2"
url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.16.0/ncbi-blast-2.16.0+-aarch64-linux.tar.gz"
[[ncbi-blast]]
arch = "x86_64"
git-tree-sha1 = "401cfe44557a4063e16671896f0834e2648b67af"
libc = "glibc"
os = "linux"

[[ncbi-blast.download]]
sha256 = "b0b13098c901d23b324ad1700e7471bb7408a7f7f517d74d5faad711be76e8f4"
url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.16.0/ncbi-blast-2.16.0+-x64-linux.tar.gz"
[[ncbi-blast]]
arch = "x86_64"
git-tree-sha1 = "f8f04f978f874b0a2a50ba3ebcfe97f29eaa740d"
os = "windows"

[[ncbi-blast.download]]
sha256 = "3b6f27a72e9a875f1c02119704775a8e04ae97b5e4a148b560f9be9acd39e943"
url = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/2.16.0/ncbi-blast-2.16.0+-x64-win64.tar.gz"
3 changes: 0 additions & 3 deletions CondaPkg.toml

This file was deleted.

6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name = "NCBIBlast"
uuid = "dcaf3faf-48b5-45a7-abb1-fcfd75344536"
authors = ["Kevin Bonham <[email protected]> and contributors"]
version = "0.1.0"
version = "0.2.0"

[deps]
CondaPkg = "992eb4ea-22a4-4c89-a5bb-47a3300528ab"
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"

[compat]
CondaPkg = "0.2.23"
Pkg = "1.10.0"
julia = "1.10"
18 changes: 18 additions & 0 deletions dev/generate_artifact_toml.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
using Pkg: BinaryPlatforms
using ArtifactUtils: add_artifact!

blast_version = "2.16.0"
url_common = "https://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/$(blast_version)/ncbi-blast-$(blast_version)+-"
platform_url_pairs = [
BinaryPlatforms.MacOS(:aarch64) => "$(url_common)aarch64-macosx.tar.gz",
BinaryPlatforms.MacOS(:x86_64) => "$(url_common)x64-macosx.tar.gz",
BinaryPlatforms.Linux(:aarch64) => "$(url_common)aarch64-linux.tar.gz",
BinaryPlatforms.Linux(:x86_64) => "$(url_common)x64-linux.tar.gz",
BinaryPlatforms.Windows(:x86_64) => "$(url_common)x64-win64.tar.gz"
]

foreach(platform_url_pairs) do (platform, url)
add_artifact!("Artifacts.toml", "ncbi-blast", url; platform, force=true)
end

##
48 changes: 23 additions & 25 deletions src/NCBIBlast.jl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,17 @@ export blastn,
tblastx,
makeblastdb

using CondaPkg
using Pkg.Artifacts: @artifact_str

const BLAST_VERSION = "2.16.0"
const BIN_PATH = joinpath(artifact"ncbi-blast", "ncbi-blast-$(BLAST_VERSION)+", "bin")

_blastn_exe() = joinpath(BIN_PATH, "blastn")
_blastx_exe() = joinpath(BIN_PATH, "blastx")
_blastp_exe() = joinpath(BIN_PATH, "blastp")
_tblastn_exe() = joinpath(BIN_PATH, "tblastn")
_tblastx_exe() = joinpath(BIN_PATH, "tblastx")
_makeblastdb_exe() = joinpath(BIN_PATH, "makeblastdb")

function add_cli_kwargs!(cmd::Vector{String}, kwargs)
for (key,val) in pairs(kwargs)
Expand Down Expand Up @@ -85,11 +95,9 @@ Use '-help' to print detailed descriptions of command line arguments
```
"""
function blastn(stdin = nothing; stdout=stdout, kwargs...)
cmd = ["blastn"]
cmd = [_blastn_exe()]
add_cli_kwargs!(cmd, kwargs)
CondaPkg.withenv() do
run(pipeline(Cmd(cmd); stdout, stdin))
end
run(pipeline(Cmd(cmd); stdout, stdin))
end


Expand Down Expand Up @@ -141,11 +149,9 @@ DESCRIPTION
```
"""
function blastp(stdin = nothing; stdout=stdout, kwargs...)
cmd = ["blastp"]
cmd = [_blastp_exe()]
add_cli_kwargs!(cmd, kwargs)
CondaPkg.withenv() do
run(pipeline(Cmd(cmd); stdout, stdin))
end
run(pipeline(Cmd(cmd); stdout, stdin))
end

"""
Expand Down Expand Up @@ -199,11 +205,9 @@ Use '-help' to print detailed descriptions of command line arguments
```
"""
function blastx(stdin = nothing; stdout=stdout, kwargs...)
cmd = ["blastx"]
cmd = [_blastx_exe()]
add_cli_kwargs!(cmd, kwargs)
CondaPkg.withenv() do
run(pipeline(Cmd(cmd); stdin, stdout))
end
run(pipeline(Cmd(cmd); stdin, stdout))
end


Expand Down Expand Up @@ -258,11 +262,9 @@ Use '-help' to print detailed descriptions of command line arguments
```
"""
function tblastn(stdin = nothing; stdout=stdout, kwargs...)
cmd = ["tblastn"]
cmd = [_tblastn_exe()]
add_cli_kwargs!(cmd, kwargs)
CondaPkg.withenv() do
run(pipeline(Cmd(cmd); stdout, stdin))
end
run(pipeline(Cmd(cmd); stdout, stdin))
end

"""
Expand Down Expand Up @@ -311,11 +313,9 @@ Use '-help' to print detailed descriptions of command line arguments
```
"""
function tblastx(stdin = nothing; stdout=stdout, kwargs...)
cmd = ["tblastx"]
cmd = [_tblastx_exe()]
add_cli_kwargs!(cmd, kwargs)
CondaPkg.withenv() do
run(pipeline(Cmd(cmd); stdout, stdin))
end
run(pipeline(Cmd(cmd); stdout, stdin))
end


Expand Down Expand Up @@ -345,11 +345,9 @@ Use '-help' to print detailed descriptions of command line arguments
```
"""
function makeblastdb(; kwargs...)
cmd = ["makeblastdb"]
cmd = [_makeblastdb_exe()]
add_cli_kwargs!(cmd, kwargs)
CondaPkg.withenv() do
run(Cmd(cmd))
end
run(Cmd(cmd))
end

end

2 comments on commit 5695b95

@kescobo
Copy link
Member Author

@kescobo kescobo commented on 5695b95 Feb 5, 2025

Choose a reason for hiding this comment

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

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

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

Registration pull request created: JuliaRegistries/General/124381

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.2.0 -m "<description of version>" 5695b9585aaf10e80ba09d8083ba8abbae523241
git push origin v0.2.0

Please sign in to comment.