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.3.tar.gz" sha256 "531c8ce774c9807df091005a23cdf88a63d6efb2be2e38342406af90e4db15c9" head "https://github.com/ncbi/sra-tools.git" bottle do cellar :any sha256 "3f096fe6b0e114fa80664808855571f1f4b5a90791d0ff27344045541fabcc1f" => :mojave sha256 "eae0fff7e32f0c681c804686b5dc7dacbd8d051cc2538a3344b43c3e3c7c7b8d" => :high_sierra sha256 "0f6ea3b9f3138766a401fa0c892c888eeaeabc95409d26669985ce72aca3f123" => :sierra end depends_on "hdf5" depends_on "libmagic" resource "ngs-sdk" do url "https://github.com/ncbi/ngs/archive/2.9.2.tar.gz" sha256 "ac559009b2021f56bbfaea680c8207f1608637435136277dad9796516be0385a" end resource "ncbi-vdb" do url "https://github.com/ncbi/ncbi-vdb/archive/2.9.2.tar.gz" sha256 "7db26cc71f7742e693ba8cff8b06fefd2244f42bda4dba4ab315aaea9b9194f0" 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