Skip to content

Commit

Permalink
Ensemble calling: correctly handle inputs with same base filename in …
Browse files Browse the repository at this point in the history
…different directories. Fixes #23
  • Loading branch information
chapmanb committed Jan 9, 2015
1 parent bdf24c6 commit bd7af84
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
5 changes: 5 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.2.2 (9 January 2015)

- Ensemble calling: correctly handle inputs with same base filename in different
directories. Thanks to Nancy Hansen.

## 0.2.1 (3 January 2015)

- Do not normalize by default as part of ensemble combining. Prefer that to be
Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject bcbio.variation "0.2.1"
(defproject bcbio.variation "0.2.2"
:description "Toolkit to analyze genomic variation data, built on the GATK with Clojure"
:license {:name "MIT" :url "http://www.opensource.org/licenses/mit-license.html"}
:dependencies [[org.clojure/clojure "1.5.1"]
Expand Down
16 changes: 11 additions & 5 deletions src/bcbio/variation/combine.clj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@
get-vcf-retriever variants-in-region]])
(:require [me.raynes.fs :as fs]
[clojure.string :as string]
[clojure.java.io :as io]
[clojure.java.shell :as shell]
[bcbio.run.fsp :as fsp]
[bcbio.run.itx :as itx]
[bcbio.run.broad :as broad]))
Expand Down Expand Up @@ -174,7 +176,7 @@
:check-ploidy? false
:unsafe true)))]
(let [in-files (if (coll? (:file call)) (:file call) [(:file call)])
out-fname (str (get-out-basename exp call in-files) ".vcf")
out-fname (str (io/file out-dir (get-out-basename exp call in-files))".vcf")
_ (transition :clean (str "Cleaning input VCF: " (:name call)))
clean-files (vec (map #(if-not (:preclean call) %
(clean-problem-vcf % (:ref exp) (:sample exp) call exp :out-dir out-dir))
Expand All @@ -186,10 +188,14 @@
_ (transition :prep (str "Prepare VCF, resorting to genome build: " (:name call)))
prep-file (dirty-prep-work merge-file call exp intervals out-dir out-fname)]
(transition :normalize (str "Normalize MNP and indel variants: " (:name call)))
(assoc call :file (if (true? (get call :normalize true))
(normalize-variants prep-file (:ref exp) out-dir
:out-fname out-fname)
prep-file)))))
(assoc call :file (cond (true? (get call :normalize true))
(normalize-variants prep-file (:ref exp) out-dir
:out-fname out-fname)
(.endsWith prep-file ".vcf.gz")
(do (shell/sh "sh" "-c" (str "gunzip -c " prep-file " > " out-fname))
out-fname)
:else
(fs/copy prep-file out-fname))))))

;; ## Top-level entry points

Expand Down

0 comments on commit bd7af84

Please sign in to comment.