Skip to content

Commit bd7af84

Browse files
committed
Ensemble calling: correctly handle inputs with same base filename in different directories. Fixes #23
1 parent bdf24c6 commit bd7af84

File tree

3 files changed

+17
-6
lines changed

3 files changed

+17
-6
lines changed

HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
## 0.2.2 (9 January 2015)
2+
3+
- Ensemble calling: correctly handle inputs with same base filename in different
4+
directories. Thanks to Nancy Hansen.
5+
16
## 0.2.1 (3 January 2015)
27

38
- Do not normalize by default as part of ensemble combining. Prefer that to be

project.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
(defproject bcbio.variation "0.2.1"
1+
(defproject bcbio.variation "0.2.2"
22
:description "Toolkit to analyze genomic variation data, built on the GATK with Clojure"
33
:license {:name "MIT" :url "http://www.opensource.org/licenses/mit-license.html"}
44
:dependencies [[org.clojure/clojure "1.5.1"]

src/bcbio/variation/combine.clj

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@
2121
get-vcf-retriever variants-in-region]])
2222
(:require [me.raynes.fs :as fs]
2323
[clojure.string :as string]
24+
[clojure.java.io :as io]
25+
[clojure.java.shell :as shell]
2426
[bcbio.run.fsp :as fsp]
2527
[bcbio.run.itx :as itx]
2628
[bcbio.run.broad :as broad]))
@@ -174,7 +176,7 @@
174176
:check-ploidy? false
175177
:unsafe true)))]
176178
(let [in-files (if (coll? (:file call)) (:file call) [(:file call)])
177-
out-fname (str (get-out-basename exp call in-files) ".vcf")
179+
out-fname (str (io/file out-dir (get-out-basename exp call in-files))".vcf")
178180
_ (transition :clean (str "Cleaning input VCF: " (:name call)))
179181
clean-files (vec (map #(if-not (:preclean call) %
180182
(clean-problem-vcf % (:ref exp) (:sample exp) call exp :out-dir out-dir))
@@ -186,10 +188,14 @@
186188
_ (transition :prep (str "Prepare VCF, resorting to genome build: " (:name call)))
187189
prep-file (dirty-prep-work merge-file call exp intervals out-dir out-fname)]
188190
(transition :normalize (str "Normalize MNP and indel variants: " (:name call)))
189-
(assoc call :file (if (true? (get call :normalize true))
190-
(normalize-variants prep-file (:ref exp) out-dir
191-
:out-fname out-fname)
192-
prep-file)))))
191+
(assoc call :file (cond (true? (get call :normalize true))
192+
(normalize-variants prep-file (:ref exp) out-dir
193+
:out-fname out-fname)
194+
(.endsWith prep-file ".vcf.gz")
195+
(do (shell/sh "sh" "-c" (str "gunzip -c " prep-file " > " out-fname))
196+
out-fname)
197+
:else
198+
(fs/copy prep-file out-fname))))))
193199

194200
;; ## Top-level entry points
195201

0 commit comments

Comments
 (0)