forked from ahmadia/homebrew-science
-
Notifications
You must be signed in to change notification settings - Fork 0
/
trinity.rb
91 lines (76 loc) · 3.67 KB
/
trinity.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
class Trinity < Formula
desc "RNA-Seq de novo assembler"
homepage "https://trinityrnaseq.github.io"
url "https://github.com/trinityrnaseq/trinityrnaseq/archive/Trinity-v2.4.0.tar.gz"
sha256 "9f816fdc7870fb85af9a44249be05bf06f2a3f0b780275513eec9b0124fa9bda"
revision 2
head "https://github.com/trinityrnaseq/trinityrnaseq.git"
# doi "10.1038/nbt.1883"
# tag "bioinformatics"
bottle do
cellar :any
sha256 "d36e26c44dd73954f18a29ff6ab5d6f8c70633641dbb35e46b47f243b88399db" => :sierra
sha256 "9a051d1c4e150ceed1a0b4e342741b24161f4121c6ea8adc3847a0f88c01e34c" => :el_capitan
sha256 "244391e3a8f08d9d8b9d5b275271248012b717cdfa98e9f3ef0385914963e7d7" => :yosemite
sha256 "a9505c779a7c9f01846847bdddb413816e82fa4975dfb5ccf9bdd341b9537c0f" => :x86_64_linux
end
depends_on "express" => :recommended
depends_on "bowtie2"
depends_on "jellyfish"
depends_on "trimmomatic"
depends_on "samtools"
depends_on "htslib"
depends_on "gcc"
depends_on :java => "1.8+"
needs :openmp
def install
# Fix IRKE.cpp:89:62: error: 'omp_set_num_threads' was not declared in this scope
ENV.append_to_cflags "-fopenmp" if OS.linux?
ENV.append "CPPFLAGS", "-I#{buildpath}/Chrysalis"
inreplace "Makefile",
"cd Chrysalis && $(MAKE)", "cd Chrysalis && $(MAKE) CC=#{ENV.cc} CXX=#{ENV.cxx}"
inreplace "trinity-plugins/Makefile" do |s|
s.gsub! "CC=gcc CXX=g++", "CC=#{ENV.cc} CXX=#{ENV.cxx}"
s.gsub! /(trinity_essentials.*) jellyfish/, "\\1"
s.gsub! /(trinity_essentials.*) trimmomatic_target/, "\\1"
s.gsub! /(trinity_essentials.*) samtools_target/, "\\1"
end
inreplace "Trinity" do |s|
s.gsub! "$ROOTDIR/trinity-plugins/jellyfish", Formula["jellyfish"].opt_prefix
s.gsub! "$ROOTDIR/trinity-plugins/Trimmomatic/trimmomatic.jar", Formula["trimmomatic"].opt_share/"java/trimmomatic-#{Formula["trimmomatic"].version}.jar"
s.gsub! "$ROOTDIR/trinity-plugins/Trimmomatic", Formula["trimmomatic"].opt_prefix
end
inreplace "util/support_scripts/trinity_install_tests.sh" do |s|
s.gsub! "trinity-plugins/jellyfish/jellyfish", Formula["jellyfish"].opt_prefix
s.gsub! "trinity-plugins/BIN/samtools", Formula["samtools"].opt_prefix
end
inreplace "galaxy-plugin/old/GauravGalaxy/Trinity", "$ROOTDIR/trinity-plugins/jellyfish", Formula["jellyfish"].opt_prefix
inreplace "galaxy-plugin/old/Trinity", "$ROOTDIR/trinity-plugins/jellyfish", Formula["jellyfish"].opt_prefix
inreplace "util/insilico_read_normalization.pl", "$ROOTDIR/trinity-plugins/jellyfish", Formula["jellyfish"].opt_prefix
inreplace "util/misc/run_jellyfish.pl", '$JELLYFISH_DIR = $FindBin::RealBin . "/../../trinity-plugins/jellyfish-1.1.3";',
"$JELLYFISH_DIR = \"#{Formula["jellyfish"].opt_prefix}\";"
system "make", "all"
system "make", "plugins"
system "make", "test"
prefix.install Dir["*"]
(bin/"Trinity").write <<-EOS.undent
#!/bin/bash
PERL5LIB="#{prefix}/PerlLib" exec "#{prefix}/Trinity" "$@"
EOS
end
def caveats; <<-EOS.undent
Trinity only officially supports Java 1.8. To skip this check pass the
option --bypass_java_version_check to Trinity. A specific Java version may
also be set via environment variable:
JAVA_HOME=`/usr/libexec/java_home -v 1.8`
EOS
end
test do
cp_r Dir["#{prefix}/sample_data/test_Trinity_Assembly/*.fq.gz"], "."
system "#{bin}/Trinity",
"--no_distributed_trinity_exec", "--bypass_java_version_check",
"--seqType", "fq", "--max_memory", "1G", "--SS_lib_type", "RF",
"--left", "reads.left.fq.gz,reads2.left.fq.gz",
"--right", "reads.right.fq.gz,reads2.right.fq.gz"
end
end