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

use artifacts from NCBI directly #4

Merged
Merged
Show file tree
Hide file tree
Changes from all 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
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"
Comment on lines +9 to +12
Copy link
Member

Choose a reason for hiding this comment

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

Is this valid TOML? looks like it would overwrite the entries above...

Though I assume this was auto-generated by Artifacts.jl, so maybe I'm misunderstanding

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, it is not obvious, but the double brackets is toml syntax for "array of tables" https://toml.io/en/v1.0.0#array-of-tables


[[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
jonalm marked this conversation as resolved.
Show resolved Hide resolved
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
Loading