homebrew-core/Formula/sratoolkit.rb
2018-06-28 04:33:53 -07:00

74 lines
2.5 KiB
Ruby

class Sratoolkit < Formula
desc "Data tools for INSDC Sequence Read Archive"
homepage "https://github.com/ncbi/sra-tools"
url "https://github.com/ncbi/sra-tools/archive/2.9.1-1.tar.gz"
version "2.9.1-1"
sha256 "561dea9bb00f76a6f9a65cb20d6794379353d02a9e33b0db4f10eb38a42465db"
head "https://github.com/ncbi/sra-tools.git"
bottle do
cellar :any
sha256 "341b131b3985cd604bca8fe4cda0f09184b6e6c744be37b7d36a7ef4708d2a70" => :high_sierra
sha256 "0a06b37706ab390130cba0e529ff9ba666b74bd747068b32771fd9484f4080c7" => :sierra
sha256 "6e25f614ce455865635ed1a477212a097c7d9d1ccd95aa18a4aa850cdde5c5b8" => :el_capitan
end
depends_on "hdf5"
depends_on "libmagic"
resource "ngs-sdk" do
url "https://github.com/ncbi/ngs/archive/2.9.1.tar.gz"
sha256 "c24c93bd70ed198a44c6b9dba0d6704edc90f228f832f2fef21fa5342303fc50"
end
resource "ncbi-vdb" do
url "https://github.com/ncbi/ncbi-vdb/archive/2.9.1-1.tar.gz"
version "2.9.1-1"
sha256 "c1ee7443599d2cedab13eb44af0a2d29a4c3e8bf0130c2a6b34a9aa7016287e4"
end
def install
ngs_sdk_prefix = buildpath/"ngs-sdk-prefix"
resource("ngs-sdk").stage do
cd "ngs-sdk" do
system "./configure",
"--prefix=#{ngs_sdk_prefix}",
"--build=#{buildpath}/ngs-sdk-build"
system "make"
system "make", "install"
end
end
ncbi_vdb_source = buildpath/"ncbi-vdb-source"
ncbi_vdb_build = buildpath/"ncbi-vdb-build"
ncbi_vdb_source.install resource("ncbi-vdb")
cd ncbi_vdb_source do
system "./configure",
"--prefix=#{buildpath/"ncbi-vdb-prefix"}",
"--with-ngs-sdk-prefix=#{ngs_sdk_prefix}",
"--build=#{ncbi_vdb_build}"
ENV.deparallelize { system "make" }
end
# Fix the error: ld: library not found for -lmagic-static
# Upstream PR: https://github.com/ncbi/sra-tools/pull/105
inreplace "tools/copycat/Makefile", "-smagic-static", "-smagic"
system "./configure",
"--prefix=#{prefix}",
"--with-ngs-sdk-prefix=#{ngs_sdk_prefix}",
"--with-ncbi-vdb-sources=#{ncbi_vdb_source}",
"--with-ncbi-vdb-build=#{ncbi_vdb_build}",
"--build=#{buildpath}/sra-tools-build"
system "make", "install"
# Remove non-executable files.
rm_r [bin/"magic", bin/"ncbi"]
end
test do
assert_match "Read 1 spots for SRR000001", shell_output("#{bin}/fastq-dump -N 1 -X 1 SRR000001")
assert_match "@SRR000001.1 EM7LVYS02FOYNU length=284", File.read("SRR000001.fastq")
end
end