Skip to content

Commit

Permalink
Updated samtools and bcftools to version 1.3.1 #44 #59
Browse files Browse the repository at this point in the history
  • Loading branch information
homonecloco committed May 24, 2016
1 parent 26344df commit a99652d
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 27 deletions.
43 changes: 26 additions & 17 deletions ext/Rakefile
@@ -1,41 +1,50 @@
require 'rbconfig'
require 'open-uri'
require 'open_uri_redirections'
#require 'open_uri_redirections'
require 'fileutils'
include FileUtils::Verbose
require 'rake/clean'

URL = "http://sourceforge.net/projects/samtools/files/samtools/0.1.19/samtools-0.1.19.tar.bz2/download"

URL = "https://github.com/samtools/samtools/releases/download/1.3.1/samtools-1.3.1.tar.bz2"
URL_bcf = "https://github.com/samtools/bcftools/releases/download/1.3.1/bcftools-1.3.1.tar.bz2"
task :download do
open(URL, :allow_redirections => :all) do |uri|
File.open("samtools-0.1.19.tar.bz2",'wb') do |fout|
open(URL) do |uri|
File.open("samtools-1.3.1.tar.bz2",'wb') do |fout|
fout.write(uri.read)
end #fout
end #uri

open(URL_bcf) do |uri|
File.open("bcftools-1.3.1.tar.bz2",'wb') do |fout|
fout.write(uri.read)
end #fout
end #uri

end

task :compile do
sh "tar xvfj samtools-0.1.19.tar.bz2"
cd("samtools-0.1.19") do
sh "patch < ../Makefile-bioruby.patch"
# This patch replace CURSES lib with NCURSES which it is the only one available in OpenSUSE
sh "patch < ../Makefile-suse.patch"
sh "tar xvfj samtools-1.3.1.tar.bz2"
cd("samtools-1.3.1") do
sh "make"
cp('samtools', "/Users/ramirezr/Documents/public_code/git_merge/bioruby-samtools/ext/../lib/bio/db/sam/external")
cp('samtools', "/Users/ramirezr/Documents/public_code/helios/bioruby-samtools/ext/../lib/bio/db/sam/external")
end #cd
cd("samtools-0.1.19/bcftools") do

sh "tar xvfj bcftools-1.3.1.tar.bz2"
cd("bcftools-1.3.1") do
sh "make"
cp('bcftools', "/Users/ramirezr/Documents/public_code/git_merge/bioruby-samtools/ext/../lib/bio/db/sam/external")
end
cp('bcftools', "/Users/ramirezr/Documents/public_code/helios/bioruby-samtools/ext/../lib/bio/db/sam/external")
end #cd
end

task :clean do
cd("samtools-0.1.19") do
cd("samtools-1.3.1") do
sh "make clean"
end
rm("samtools-0.1.19.tar.bz2")
rm_rf("samtools-0.1.19")
rm("samtools-1.3.1.tar.bz2")
rm_rf("samtools-1.3.1")
rm("bcftools-1.3.1.tar.bz2")
rm_rf("bcftools-1.3.1")
end

task :default => [:download, :compile, :clean]

29 changes: 20 additions & 9 deletions ext/mkrf_conf.rb
Expand Up @@ -12,41 +12,50 @@
Version = version.read
version.close

url = "http://sourceforge.net/projects/samtools/files/samtools/#{Version}/samtools-#{Version}.tar.bz2/download"
#url = "http://sourceforge.net/projects/samtools/files/samtools/#{Version}/samtools-#{Version}.tar.bz2/download"
url="https://github.com/samtools/samtools/releases/download/#{Version}/samtools-#{Version}.tar.bz2"
SamToolsFile = "samtools-#{Version}.tar.bz2"
url_bcftools="https://github.com/samtools/bcftools/releases/download/#{Version}/bcftools-#{Version}.tar.bz2"
BcfToolsFile = "bcftools-#{Version}.tar.bz2"

File.open(File.join(path,"Rakefile"),"w") do |rakefile|
rakefile.write <<-RAKE
require 'rbconfig'
require 'open-uri'
require 'open_uri_redirections'
#require 'open_uri_redirections'
require 'fileutils'
include FileUtils::Verbose
require 'rake/clean'
URL = "#{url}"
URL_bcf = "#{url_bcftools}"
task :download do
open(URL, :allow_redirections => :all) do |uri|
open(URL) do |uri|
File.open("#{SamToolsFile}",'wb') do |fout|
fout.write(uri.read)
end #fout
end #uri
open(URL_bcf) do |uri|
File.open("#{BcfToolsFile}",'wb') do |fout|
fout.write(uri.read)
end #fout
end #uri
end
task :compile do
sh "tar xvfj #{SamToolsFile}"
cd("samtools-#{Version}") do
sh "patch < ../Makefile-bioruby.patch"
# This patch replace CURSES lib with NCURSES which it is the only one available in OpenSUSE
sh "patch < ../Makefile-suse.patch"
sh "make"
cp('samtools', "#{path_external}")
end #cd
cd("samtools-#{Version}/bcftools") do
sh "tar xvfj #{BcfToolsFile}"
cd("bcftools-#{Version}") do
sh "make"
cp('bcftools', "#{path_external}")
end
end #cd
end
task :clean do
Expand All @@ -55,6 +64,8 @@
end
rm("#{SamToolsFile}")
rm_rf("samtools-#{Version}")
rm("#{BcfToolsFile}")
rm_rf("bcftools-#{Version}")
end
task :default => [:download, :compile, :clean]
Expand Down
2 changes: 1 addition & 1 deletion lib/bio/db/sam/external/VERSION
@@ -1 +1 @@
0.1.19
1.3.1

0 comments on commit a99652d

Please sign in to comment.