summary refs log tree commit diff
path: root/gnu
diff options
context:
space:
mode:
authorRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2015-05-21 15:43:25 +0200
committerRicardo Wurmus <ricardo.wurmus@mdc-berlin.de>2015-05-22 13:14:29 +0200
commit66e3eff1e31c4483aeb7a96ada8ea378fdc49e51 (patch)
tree7d0e2423fd89742829703f327e38394a1786c43e /gnu
parent21461f27e7f2deef243ab4a4b6f04653e2d21e62 (diff)
downloadguix-66e3eff1e31c4483aeb7a96ada8ea378fdc49e51.tar.gz
gnu: Add rsem.
* gnu/packages/bioinformatics.scm (rsem): New variable.
* gnu/packages/patches/rsem-makefile.patch: New file.
Diffstat (limited to 'gnu')
-rw-r--r--gnu/packages/bioinformatics.scm78
-rw-r--r--gnu/packages/patches/rsem-makefile.patch682
2 files changed, 760 insertions, 0 deletions
diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 1c5a5c2eeb..b29ca67dbd 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -1013,6 +1013,84 @@ files and writing bioinformatics applications.")
 generated using the PacBio Iso-Seq protocol.")
       (license license:bsd-3))))
 
+(define-public rsem
+  (package
+    (name "rsem")
+    (version "1.2.20")
+    (source
+     (origin
+       (method url-fetch)
+       (uri
+        (string-append "http://deweylab.biostat.wisc.edu/rsem/src/rsem-"
+                       version ".tar.gz"))
+       (sha256
+        (base32 "0nzdc0j0hjllhsd5f2xli95dafm3nawskigs140xzvjk67xh0r9q"))
+       (patches (list (search-patch "rsem-makefile.patch")))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; remove bundled copy of boost
+           (delete-file-recursively "boost")
+           #t))))
+    (build-system gnu-build-system)
+    (arguments
+     `(#:tests? #f ;no "check" target
+       #:phases
+       (modify-phases %standard-phases
+         ;; No "configure" script.
+         ;; Do not build bundled samtools library.
+         (replace 'configure
+                  (lambda _
+                    (substitute* "Makefile"
+                      (("^all : sam/libbam.a") "all : "))
+                    #t))
+         (replace 'install
+                  (lambda* (#:key outputs #:allow-other-keys)
+                    (let* ((out (string-append (assoc-ref outputs "out")))
+                           (bin (string-append out "/bin/"))
+                           (perl (string-append out "/lib/perl5/site_perl")))
+                      (mkdir-p bin)
+                      (mkdir-p perl)
+                      (for-each (lambda (file)
+                                  (copy-file file
+                                             (string-append bin (basename file))))
+                                (find-files "." "rsem-.*"))
+                      (copy-file "rsem_perl_utils.pm"
+                                 (string-append perl "/rsem_perl_utils.pm")))
+                    #t))
+         (add-after
+          'install 'wrap-program
+          (lambda* (#:key outputs #:allow-other-keys)
+            (let ((out (assoc-ref outputs "out")))
+              (for-each (lambda (prog)
+                          (wrap-program (string-append out "/bin/" prog)
+                            `("PERL5LIB" ":" prefix
+                              (,(string-append out "/lib/perl5/site_perl")))))
+                        '("rsem-plot-transcript-wiggles"
+                          "rsem-calculate-expression"
+                          "rsem-generate-ngvector"
+                          "rsem-run-ebseq"
+                          "rsem-prepare-reference")))
+            #t)))))
+    (inputs
+     `(("boost" ,boost)
+       ("ncurses" ,ncurses)
+       ("r" ,r)
+       ("perl" ,perl)
+       ("samtools" ,samtools-0.1)
+       ("zlib" ,zlib)))
+    (home-page "http://deweylab.biostat.wisc.edu/rsem/")
+    (synopsis "Estimate gene expression levels from RNA-Seq data")
+    (description
+     "RSEM is a software package for estimating gene and isoform expression
+levels from RNA-Seq data.  The RSEM package provides a user-friendly
+interface, supports threads for parallel computation of the EM algorithm,
+single-end and paired-end read data, quality scores, variable-length reads and
+RSPD estimation.  In addition, it provides posterior mean and 95% credibility
+interval estimates for expression levels.  For visualization, it can generate
+BAM and Wiggle files in both transcript-coordinate and genomic-coordinate.")
+    (license license:gpl3+)))
+
 (define-public rseqc
   (package
     (name "rseqc")
diff --git a/gnu/packages/patches/rsem-makefile.patch b/gnu/packages/patches/rsem-makefile.patch
new file mode 100644
index 0000000000..5481dc685f
--- /dev/null
+++ b/gnu/packages/patches/rsem-makefile.patch
@@ -0,0 +1,682 @@
+This patch simplifies the Makefile, making it much easier to build rsem
+without the bundled version of samtools.  It has already been submitted
+upstream: https://github.com/bli25wisc/RSEM/pull/11
+
+From 161894e91a16c7e15af57e4fcfe8cb613711c7fa Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 14:51:07 +0200
+Subject: [PATCH 1/7] remove all headers from Makefile
+
+---
+ Makefile | 95 +++++++++++-----------------------------------------------------
+ 1 file changed, 16 insertions(+), 79 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 54e2603..3a55ed8 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,133 +10,70 @@ all : $(PROGRAMS)
+ sam/libbam.a :
+ 	cd sam ; ${MAKE} all
+ 
+-Transcript.h : utils.h
+-
+-Transcripts.h : utils.h my_assert.h Transcript.h
+-
+-rsem-extract-reference-transcripts : utils.h my_assert.h GTFItem.h Transcript.h Transcripts.h extractRef.cpp
++rsem-extract-reference-transcripts : extractRef.cpp
+ 	$(CC) -Wall -O3 extractRef.cpp -o rsem-extract-reference-transcripts
+ 
+-rsem-synthesis-reference-transcripts : utils.h my_assert.h Transcript.h Transcripts.h synthesisRef.cpp
++rsem-synthesis-reference-transcripts : synthesisRef.cpp
+ 	$(CC) -Wall -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
+ 
+-BowtieRefSeqPolicy.h : RefSeqPolicy.h
+-
+-RefSeq.h : utils.h
+-
+-Refs.h : utils.h RefSeq.h RefSeqPolicy.h PolyARules.h
+-
+-
+ rsem-preref : preRef.o
+ 	$(CC) preRef.o -o rsem-preref
+ 
+-preRef.o : utils.h RefSeq.h Refs.h PolyARules.h RefSeqPolicy.h AlignerRefSeqPolicy.h preRef.cpp
++preRef.o : preRef.cpp
+ 	$(CC) $(COFLAGS) preRef.cpp
+ 
+-
+-SingleRead.h : Read.h
+-
+-SingleReadQ.h : Read.h
+-
+-PairedEndRead.h : Read.h SingleRead.h
+-
+-PairedEndReadQ.h : Read.h SingleReadQ.h
+-
+-
+-PairedEndHit.h : SingleHit.h
+-
+-HitContainer.h : GroupInfo.h
+-
+-
+-SamParser.h : sam/sam.h sam/bam.h utils.h my_assert.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h SingleHit.h PairedEndHit.h Transcripts.h
+-
+-
+ rsem-parse-alignments : parseIt.o sam/libbam.a
+ 	$(CC) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread 
+ 
+-parseIt.o : utils.h GroupInfo.h Read.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h SingleHit.h PairedEndHit.h HitContainer.h SamParser.h Transcripts.h sam/sam.h sam/bam.h parseIt.cpp
++parseIt.o : parseIt.cpp
+ 	$(CC) -Wall -O2 -c -I. parseIt.cpp
+ 
+-
+-rsem-build-read-index : utils.h buildReadIndex.cpp
++rsem-build-read-index : buildReadIndex.cpp
+ 	$(CC) -O3 buildReadIndex.cpp -o rsem-build-read-index
+ 
+-
+-simul.h : boost/random.hpp
+-
+-ReadReader.h : SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h ReadIndex.h
+-
+-SingleModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h Profile.h NoiseProfile.h ModelParams.h RefSeq.h Refs.h SingleRead.h SingleHit.h ReadReader.h simul.h
+-
+-SingleQModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h ModelParams.h RefSeq.h Refs.h SingleReadQ.h SingleHit.h ReadReader.h simul.h
+-
+-PairedEndModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h Profile.h NoiseProfile.h ModelParams.h RefSeq.h Refs.h SingleRead.h PairedEndRead.h PairedEndHit.h ReadReader.h simul.h 
+-
+-PairedEndQModel.h : utils.h my_assert.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h ModelParams.h RefSeq.h Refs.h SingleReadQ.h PairedEndReadQ.h PairedEndHit.h ReadReader.h simul.h
+-
+-HitWrapper.h : HitContainer.h
+-
+-sam_rsem_aux.h : sam/bam.h
+-
+-sam_rsem_cvt.h : sam/bam.h Transcript.h Transcripts.h
+-
+-BamWriter.h : sam/sam.h sam/bam.h sam_rsem_aux.h sam_rsem_cvt.h SingleHit.h PairedEndHit.h HitWrapper.h Transcript.h Transcripts.h
+-
+-sampling.h : boost/random.hpp
+-
+-WriteResults.h : utils.h my_assert.h GroupInfo.h Transcript.h Transcripts.h RefSeq.h Refs.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h
+-
+ rsem-run-em : EM.o sam/libbam.a
+ 	$(CC) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
+ 
+-EM.o : utils.h my_assert.h Read.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h SingleHit.h PairedEndHit.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h Refs.h GroupInfo.h HitContainer.h ReadIndex.h ReadReader.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h ModelParams.h RefSeq.h RefSeqPolicy.h PolyARules.h Profile.h NoiseProfile.h Transcript.h Transcripts.h HitWrapper.h BamWriter.h sam/bam.h sam/sam.h simul.h sam_rsem_aux.h sampling.h boost/random.hpp WriteResults.h EM.cpp
++EM.o : EM.cpp
+ 	$(CC) $(COFLAGS) EM.cpp
+ 
+-bc_aux.h : sam/bam.h
+-
+-BamConverter.h : utils.h my_assert.h sam/sam.h sam/bam.h sam_rsem_aux.h sam_rsem_cvt.h bc_aux.h Transcript.h Transcripts.h
+-
+-rsem-tbam2gbam : utils.h Transcripts.h Transcript.h bc_aux.h BamConverter.h sam/sam.h sam/bam.h sam/libbam.a sam_rsem_aux.h sam_rsem_cvt.h tbam2gbam.cpp sam/libbam.a
++rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
+ 	$(CC) -O3 -Wall tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+-rsem-bam2wig : utils.h my_assert.h wiggle.h wiggle.o sam/libbam.a bam2wig.cpp
++rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
+ 	$(CC) -O3 -Wall bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
+ 
+-rsem-bam2readdepth : utils.h my_assert.h wiggle.h wiggle.o sam/libbam.a bam2readdepth.cpp
++rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
+ 	$(CC) -O3 -Wall bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
+ 
+-wiggle.o: sam/bam.h sam/sam.h wiggle.cpp wiggle.h
++wiggle.o: wiggle.cpp
+ 	$(CC) $(COFLAGS) wiggle.cpp
+ 
+ rsem-simulate-reads : simulation.o
+ 	$(CC) -o rsem-simulate-reads simulation.o
+ 
+-simulation.o : utils.h Read.h SingleRead.h SingleReadQ.h PairedEndRead.h PairedEndReadQ.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h Refs.h RefSeq.h GroupInfo.h Transcript.h Transcripts.h Orientation.h LenDist.h RSPD.h QualDist.h QProfile.h NoiseQProfile.h Profile.h NoiseProfile.h simul.h boost/random.hpp WriteResults.h simulation.cpp
++simulation.o : simulation.cpp
+ 	$(CC) $(COFLAGS) simulation.cpp
+ 
+ rsem-run-gibbs : Gibbs.o
+ 	$(CC) -o rsem-run-gibbs Gibbs.o -lpthread
+ 
+-#some header files are omitted
+-Gibbs.o : utils.h my_assert.h boost/random.hpp sampling.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h RefSeq.h RefSeqPolicy.h PolyARules.h Refs.h GroupInfo.h WriteResults.h Gibbs.cpp 
++Gibbs.o : Gibbs.cpp
+ 	$(CC) $(COFLAGS) Gibbs.cpp
+ 
+-Buffer.h : my_assert.h
+-
+ rsem-calculate-credibility-intervals : calcCI.o
+ 	$(CC) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
+ 
+-#some header files are omitted
+-calcCI.o : utils.h my_assert.h boost/random.hpp sampling.h Model.h SingleModel.h SingleQModel.h PairedEndModel.h PairedEndQModel.h RefSeq.h RefSeqPolicy.h PolyARules.h Refs.h GroupInfo.h WriteResults.h Buffer.h calcCI.cpp
++calcCI.o : calcCI.cpp
+ 	$(CC) $(COFLAGS) calcCI.cpp
+ 
+-rsem-get-unique : sam/bam.h sam/sam.h getUnique.cpp sam/libbam.a
++rsem-get-unique : getUnique.cpp sam/libbam.a
+ 	$(CC) -O3 -Wall getUnique.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+-rsem-sam-validator : sam/bam.h sam/sam.h my_assert.h samValidator.cpp sam/libbam.a
++rsem-sam-validator : samValidator.cpp sam/libbam.a
+ 	$(CC) -O3 -Wall samValidator.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+-rsem-scan-for-paired-end-reads : sam/bam.h sam/sam.h my_assert.h scanForPairedEndReads.cpp sam/libbam.a
++rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
+ 	$(CC) -O3 -Wall scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+ ebseq :
+
+From ec136638a727632e20abfaeb65c22c46d15ca8c4 Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:06:41 +0200
+Subject: [PATCH 2/7] include current dir, ./sam and ./boost by default
+
+---
+ Makefile | 48 ++++++++++++++++++++++++------------------------
+ 1 file changed, 24 insertions(+), 24 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 3a55ed8..1dd97ca 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,6 +1,6 @@
+ CC = g++
+-CFLAGS = -Wall -c -I.
+-COFLAGS = -Wall -O3 -ffast-math -c -I.
++CFLAGS = -Wall -I. -I./sam -I./boost
++COFLAGS = -O3 -ffast-math -c
+ PROGRAMS = rsem-extract-reference-transcripts rsem-synthesis-reference-transcripts rsem-preref rsem-parse-alignments rsem-build-read-index rsem-run-em rsem-tbam2gbam rsem-run-gibbs rsem-calculate-credibility-intervals rsem-simulate-reads rsem-bam2wig rsem-get-unique rsem-bam2readdepth rsem-sam-validator rsem-scan-for-paired-end-reads
+ 
+ .PHONY : all ebseq clean
+@@ -11,70 +11,70 @@ sam/libbam.a :
+ 	cd sam ; ${MAKE} all
+ 
+ rsem-extract-reference-transcripts : extractRef.cpp
+-	$(CC) -Wall -O3 extractRef.cpp -o rsem-extract-reference-transcripts
++	$(CC) $(CFLAGS) -O3 extractRef.cpp -o rsem-extract-reference-transcripts
+ 
+ rsem-synthesis-reference-transcripts : synthesisRef.cpp
+-	$(CC) -Wall -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
++	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
+ 
+ rsem-preref : preRef.o
+-	$(CC) preRef.o -o rsem-preref
++	$(CC) $(CFLAGS) preRef.o -o rsem-preref
+ 
+ preRef.o : preRef.cpp
+-	$(CC) $(COFLAGS) preRef.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
+ 
+ rsem-parse-alignments : parseIt.o sam/libbam.a
+-	$(CC) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread 
++	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread
+ 
+ parseIt.o : parseIt.cpp
+-	$(CC) -Wall -O2 -c -I. parseIt.cpp
++	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
+ 
+ rsem-build-read-index : buildReadIndex.cpp
+-	$(CC) -O3 buildReadIndex.cpp -o rsem-build-read-index
++	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
+ 
+ rsem-run-em : EM.o sam/libbam.a
+-	$(CC) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
++	$(CC) $(CFLAGS) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
+ 
+ EM.o : EM.cpp
+-	$(CC) $(COFLAGS) EM.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
+ 
+ rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
+-	$(CC) -O3 -Wall tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+ rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
+-	$(CC) -O3 -Wall bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
+ 
+ rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
+-	$(CC) -O3 -Wall bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
+ 
+ wiggle.o: wiggle.cpp
+-	$(CC) $(COFLAGS) wiggle.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
+ 
+ rsem-simulate-reads : simulation.o
+-	$(CC) -o rsem-simulate-reads simulation.o
++	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
+ 
+ simulation.o : simulation.cpp
+-	$(CC) $(COFLAGS) simulation.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
+ 
+ rsem-run-gibbs : Gibbs.o
+-	$(CC) -o rsem-run-gibbs Gibbs.o -lpthread
++	$(CC) $(CFLAGS) -o rsem-run-gibbs Gibbs.o -lpthread
+ 
+ Gibbs.o : Gibbs.cpp
+-	$(CC) $(COFLAGS) Gibbs.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
+ 
+ rsem-calculate-credibility-intervals : calcCI.o
+-	$(CC) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
++	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
+ 
+ calcCI.o : calcCI.cpp
+-	$(CC) $(COFLAGS) calcCI.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
+ 
+ rsem-get-unique : getUnique.cpp sam/libbam.a
+-	$(CC) -O3 -Wall getUnique.cpp sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 getUnique.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+ rsem-sam-validator : samValidator.cpp sam/libbam.a
+-	$(CC) -O3 -Wall samValidator.cpp sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 samValidator.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+ rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
+-	$(CC) -O3 -Wall scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+ ebseq :
+ 	cd EBSeq ; ${MAKE} all
+
+From d366614ea50f79fdd93e3c76383ccb6fcdeaa8e0 Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:10:49 +0200
+Subject: [PATCH 3/7] separate object rules from rules for executables
+
+---
+ Makefile | 50 ++++++++++++++++++++++++++------------------------
+ 1 file changed, 26 insertions(+), 24 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 1dd97ca..ae4de3b 100644
+--- a/Makefile
++++ b/Makefile
+@@ -10,6 +10,32 @@ all : $(PROGRAMS)
+ sam/libbam.a :
+ 	cd sam ; ${MAKE} all
+ 
++ebseq :
++	cd EBSeq ; ${MAKE} all
++
++
++calcCI.o : calcCI.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
++
++EM.o : EM.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
++
++Gibbs.o : Gibbs.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
++
++preRef.o : preRef.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
++
++parseIt.o : parseIt.cpp
++	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
++
++simulation.o : simulation.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
++
++wiggle.o: wiggle.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
++
++
+ rsem-extract-reference-transcripts : extractRef.cpp
+ 	$(CC) $(CFLAGS) -O3 extractRef.cpp -o rsem-extract-reference-transcripts
+ 
+@@ -19,24 +45,15 @@ rsem-synthesis-reference-transcripts : synthesisRef.cpp
+ rsem-preref : preRef.o
+ 	$(CC) $(CFLAGS) preRef.o -o rsem-preref
+ 
+-preRef.o : preRef.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
+-
+ rsem-parse-alignments : parseIt.o sam/libbam.a
+ 	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread
+ 
+-parseIt.o : parseIt.cpp
+-	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
+-
+ rsem-build-read-index : buildReadIndex.cpp
+ 	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
+ 
+ rsem-run-em : EM.o sam/libbam.a
+ 	$(CC) $(CFLAGS) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
+ 
+-EM.o : EM.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
+-
+ rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
+ 	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+@@ -46,27 +63,15 @@ rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
+ rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
+ 	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
+ 
+-wiggle.o: wiggle.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
+-
+ rsem-simulate-reads : simulation.o
+ 	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
+ 
+-simulation.o : simulation.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
+-
+ rsem-run-gibbs : Gibbs.o
+ 	$(CC) $(CFLAGS) -o rsem-run-gibbs Gibbs.o -lpthread
+ 
+-Gibbs.o : Gibbs.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
+-
+ rsem-calculate-credibility-intervals : calcCI.o
+ 	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
+ 
+-calcCI.o : calcCI.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
+-
+ rsem-get-unique : getUnique.cpp sam/libbam.a
+ 	$(CC) $(CFLAGS) -O3 getUnique.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+@@ -76,9 +81,6 @@ rsem-sam-validator : samValidator.cpp sam/libbam.a
+ rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
+ 	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
+ 
+-ebseq :
+-	cd EBSeq ; ${MAKE} all
+-
+ clean :
+ 	rm -f *.o *~ $(PROGRAMS)
+ 	cd sam ; ${MAKE} clean
+
+From 6ba1c33cccdf7c8e7df7a3189e7db204be3b1e8d Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:28:30 +0200
+Subject: [PATCH 4/7] add ./sam to library directories, link with -lbam
+
+---
+ Makefile | 36 ++++++++++++++++++------------------
+ 1 file changed, 18 insertions(+), 18 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index ae4de3b..a87cc4d 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,11 +1,11 @@
+ CC = g++
+-CFLAGS = -Wall -I. -I./sam -I./boost
++CFLAGS = -Wall -I. -I./sam -I./boost -L./sam
+ COFLAGS = -O3 -ffast-math -c
+ PROGRAMS = rsem-extract-reference-transcripts rsem-synthesis-reference-transcripts rsem-preref rsem-parse-alignments rsem-build-read-index rsem-run-em rsem-tbam2gbam rsem-run-gibbs rsem-calculate-credibility-intervals rsem-simulate-reads rsem-bam2wig rsem-get-unique rsem-bam2readdepth rsem-sam-validator rsem-scan-for-paired-end-reads
+ 
+ .PHONY : all ebseq clean
+ 
+-all : $(PROGRAMS)
++all : sam/libbam.a $(PROGRAMS)
+ 
+ sam/libbam.a :
+ 	cd sam ; ${MAKE} all
+@@ -45,23 +45,23 @@ rsem-synthesis-reference-transcripts : synthesisRef.cpp
+ rsem-preref : preRef.o
+ 	$(CC) $(CFLAGS) preRef.o -o rsem-preref
+ 
+-rsem-parse-alignments : parseIt.o sam/libbam.a
+-	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o sam/libbam.a -lz -lpthread
++rsem-parse-alignments : parseIt.o
++	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o -lbam -lz -lpthread
+ 
+ rsem-build-read-index : buildReadIndex.cpp
+ 	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
+ 
+-rsem-run-em : EM.o sam/libbam.a
+-	$(CC) $(CFLAGS) -o rsem-run-em EM.o sam/libbam.a -lz -lpthread
++rsem-run-em : EM.o
++	$(CC) $(CFLAGS) -o rsem-run-em EM.o -lbam -lz -lpthread
+ 
+-rsem-tbam2gbam : tbam2gbam.cpp sam/libbam.a
+-	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp sam/libbam.a -lz -lpthread -o $@
++rsem-tbam2gbam : tbam2gbam.cpp
++	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp -lbam -lz -lpthread -o $@
+ 
+-rsem-bam2wig : wiggle.o sam/libbam.a bam2wig.cpp
+-	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
++rsem-bam2wig : wiggle.o bam2wig.cpp
++	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o -lbam -lz -lpthread -o $@
+ 
+-rsem-bam2readdepth : wiggle.o sam/libbam.a bam2readdepth.cpp
+-	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o sam/libbam.a -lz -lpthread -o $@
++rsem-bam2readdepth : wiggle.o bam2readdepth.cpp
++	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o -lbam -lz -lpthread -o $@
+ 
+ rsem-simulate-reads : simulation.o
+ 	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
+@@ -72,14 +72,14 @@ rsem-run-gibbs : Gibbs.o
+ rsem-calculate-credibility-intervals : calcCI.o
+ 	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
+ 
+-rsem-get-unique : getUnique.cpp sam/libbam.a
+-	$(CC) $(CFLAGS) -O3 getUnique.cpp sam/libbam.a -lz -lpthread -o $@
++rsem-get-unique : getUnique.cpp
++	$(CC) $(CFLAGS) -O3 getUnique.cpp -lbam -lz -lpthread -o $@
+ 
+-rsem-sam-validator : samValidator.cpp sam/libbam.a
+-	$(CC) $(CFLAGS) -O3 samValidator.cpp sam/libbam.a -lz -lpthread -o $@
++rsem-sam-validator : samValidator.cpp
++	$(CC) $(CFLAGS) -O3 samValidator.cpp -lbam -lz -lpthread -o $@
+ 
+-rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp sam/libbam.a
+-	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp sam/libbam.a -lz -lpthread -o $@
++rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp
++	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp -lbam -lz -lpthread -o $@
+ 
+ clean :
+ 	rm -f *.o *~ $(PROGRAMS)
+
+From 5402b88c269df79ee245c1c59e15f3c8282a0220 Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:33:02 +0200
+Subject: [PATCH 5/7] do not repeat target name, use $@ instead
+
+---
+ Makefile | 18 +++++++++---------
+ 1 file changed, 9 insertions(+), 9 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index a87cc4d..7ec90a3 100644
+--- a/Makefile
++++ b/Makefile
+@@ -37,22 +37,22 @@ wiggle.o: wiggle.cpp
+ 
+ 
+ rsem-extract-reference-transcripts : extractRef.cpp
+-	$(CC) $(CFLAGS) -O3 extractRef.cpp -o rsem-extract-reference-transcripts
++	$(CC) $(CFLAGS) -O3 extractRef.cpp -o $@
+ 
+ rsem-synthesis-reference-transcripts : synthesisRef.cpp
+-	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o rsem-synthesis-reference-transcripts
++	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o $@
+ 
+ rsem-preref : preRef.o
+-	$(CC) $(CFLAGS) preRef.o -o rsem-preref
++	$(CC) $(CFLAGS) preRef.o -o $@
+ 
+ rsem-parse-alignments : parseIt.o
+-	$(CC) $(CFLAGS) -o rsem-parse-alignments parseIt.o -lbam -lz -lpthread
++	$(CC) $(CFLAGS) -o $@ parseIt.o -lbam -lz -lpthread
+ 
+ rsem-build-read-index : buildReadIndex.cpp
+-	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o rsem-build-read-index
++	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o $@
+ 
+ rsem-run-em : EM.o
+-	$(CC) $(CFLAGS) -o rsem-run-em EM.o -lbam -lz -lpthread
++	$(CC) $(CFLAGS) -o $@ EM.o -lbam -lz -lpthread
+ 
+ rsem-tbam2gbam : tbam2gbam.cpp
+ 	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp -lbam -lz -lpthread -o $@
+@@ -64,13 +64,13 @@ rsem-bam2readdepth : wiggle.o bam2readdepth.cpp
+ 	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o -lbam -lz -lpthread -o $@
+ 
+ rsem-simulate-reads : simulation.o
+-	$(CC) $(CFLAGS) -o rsem-simulate-reads simulation.o
++	$(CC) $(CFLAGS) -o $@ simulation.o
+ 
+ rsem-run-gibbs : Gibbs.o
+-	$(CC) $(CFLAGS) -o rsem-run-gibbs Gibbs.o -lpthread
++	$(CC) $(CFLAGS) -o $@ Gibbs.o -lpthread
+ 
+ rsem-calculate-credibility-intervals : calcCI.o
+-	$(CC) $(CFLAGS) -o rsem-calculate-credibility-intervals calcCI.o -lpthread
++	$(CC) $(CFLAGS) -o $@ calcCI.o -lpthread
+ 
+ rsem-get-unique : getUnique.cpp
+ 	$(CC) $(CFLAGS) -O3 getUnique.cpp -lbam -lz -lpthread -o $@
+
+From f60784bc7aa303cc825bd87dd3f5d7d26c51bded Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:44:53 +0200
+Subject: [PATCH 6/7] use automatic variables to refer to prerequisites
+
+---
+ Makefile | 44 ++++++++++++++++++++++----------------------
+ 1 file changed, 22 insertions(+), 22 deletions(-)
+
+diff --git a/Makefile b/Makefile
+index 7ec90a3..6540d81 100644
+--- a/Makefile
++++ b/Makefile
+@@ -15,71 +15,71 @@ ebseq :
+ 
+ 
+ calcCI.o : calcCI.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) calcCI.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ EM.o : EM.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) EM.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ Gibbs.o : Gibbs.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) Gibbs.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ preRef.o : preRef.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) preRef.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ parseIt.o : parseIt.cpp
+-	$(CC) $(CFLAGS) -O2 -c parseIt.cpp
++	$(CC) $(CFLAGS) -O2 -c $<
+ 
+ simulation.o : simulation.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) simulation.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ wiggle.o: wiggle.cpp
+-	$(CC) $(CFLAGS) $(COFLAGS) wiggle.cpp
++	$(CC) $(CFLAGS) $(COFLAGS) $<
+ 
+ 
+ rsem-extract-reference-transcripts : extractRef.cpp
+-	$(CC) $(CFLAGS) -O3 extractRef.cpp -o $@
++	$(CC) $(CFLAGS) -O3 $< -o $@
+ 
+ rsem-synthesis-reference-transcripts : synthesisRef.cpp
+-	$(CC) $(CFLAGS) -O3 synthesisRef.cpp -o $@
++	$(CC) $(CFLAGS) -O3 $< -o $@
+ 
+ rsem-preref : preRef.o
+-	$(CC) $(CFLAGS) preRef.o -o $@
++	$(CC) $(CFLAGS) $< -o $@
+ 
+ rsem-parse-alignments : parseIt.o
+-	$(CC) $(CFLAGS) -o $@ parseIt.o -lbam -lz -lpthread
++	$(CC) $(CFLAGS) -o $@ $< -lbam -lz -lpthread
+ 
+ rsem-build-read-index : buildReadIndex.cpp
+-	$(CC) $(CFLAGS) -O3 buildReadIndex.cpp -o $@
++	$(CC) $(CFLAGS) -O3 $< -o $@
+ 
+ rsem-run-em : EM.o
+-	$(CC) $(CFLAGS) -o $@ EM.o -lbam -lz -lpthread
++	$(CC) $(CFLAGS) -o $@ $< -lbam -lz -lpthread
+ 
+ rsem-tbam2gbam : tbam2gbam.cpp
+-	$(CC) $(CFLAGS) -O3 tbam2gbam.cpp -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
+ 
+ rsem-bam2wig : wiggle.o bam2wig.cpp
+-	$(CC) $(CFLAGS) -O3 bam2wig.cpp wiggle.o -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $^ -lbam -lz -lpthread -o $@
+ 
+ rsem-bam2readdepth : wiggle.o bam2readdepth.cpp
+-	$(CC) $(CFLAGS) -O3 bam2readdepth.cpp wiggle.o -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $^ -lbam -lz -lpthread -o $@
+ 
+ rsem-simulate-reads : simulation.o
+-	$(CC) $(CFLAGS) -o $@ simulation.o
++	$(CC) $(CFLAGS) -o $@ $<
+ 
+ rsem-run-gibbs : Gibbs.o
+-	$(CC) $(CFLAGS) -o $@ Gibbs.o -lpthread
++	$(CC) $(CFLAGS) -o $@ $< -lpthread
+ 
+ rsem-calculate-credibility-intervals : calcCI.o
+-	$(CC) $(CFLAGS) -o $@ calcCI.o -lpthread
++	$(CC) $(CFLAGS) -o $@ $< -lpthread
+ 
+ rsem-get-unique : getUnique.cpp
+-	$(CC) $(CFLAGS) -O3 getUnique.cpp -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
+ 
+ rsem-sam-validator : samValidator.cpp
+-	$(CC) $(CFLAGS) -O3 samValidator.cpp -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
+ 
+ rsem-scan-for-paired-end-reads : scanForPairedEndReads.cpp
+-	$(CC) $(CFLAGS) -O3 scanForPairedEndReads.cpp -lbam -lz -lpthread -o $@
++	$(CC) $(CFLAGS) -O3 $< -lbam -lz -lpthread -o $@
+ 
+ clean :
+ 	rm -f *.o *~ $(PROGRAMS)
+
+From 0cf9721077f67fb4ca15fdc59cbfbf24a944debd Mon Sep 17 00:00:00 2001
+From: Ricardo Wurmus <ricardo.wurmus@mdc-berlin.de>
+Date: Wed, 22 Apr 2015 15:49:19 +0200
+Subject: [PATCH 7/7] split long line
+
+---
+ Makefile | 17 ++++++++++++++++-
+ 1 file changed, 16 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index 6540d81..0ab04a5 100644
+--- a/Makefile
++++ b/Makefile
+@@ -1,7 +1,22 @@
+ CC = g++
+ CFLAGS = -Wall -I. -I./sam -I./boost -L./sam
+ COFLAGS = -O3 -ffast-math -c
+-PROGRAMS = rsem-extract-reference-transcripts rsem-synthesis-reference-transcripts rsem-preref rsem-parse-alignments rsem-build-read-index rsem-run-em rsem-tbam2gbam rsem-run-gibbs rsem-calculate-credibility-intervals rsem-simulate-reads rsem-bam2wig rsem-get-unique rsem-bam2readdepth rsem-sam-validator rsem-scan-for-paired-end-reads
++PROGRAMS = \
++  rsem-extract-reference-transcripts \
++  rsem-synthesis-reference-transcripts \
++  rsem-preref \
++  rsem-parse-alignments \
++  rsem-build-read-index \
++  rsem-run-em \
++  rsem-tbam2gbam \
++  rsem-run-gibbs \
++  rsem-calculate-credibility-intervals \
++  rsem-simulate-reads \
++  rsem-bam2wig \
++  rsem-get-unique \
++  rsem-bam2readdepth \
++  rsem-sam-validator \
++  rsem-scan-for-paired-end-reads
+ 
+ .PHONY : all ebseq clean
+