Skip to content

Commit

Permalink
Merge pull request #63 from ayamada/feature/test-check-deduped-file
Browse files Browse the repository at this point in the history
Issue #61 (6) Examine result file of `dedupe` in test
  • Loading branch information
totakke committed Apr 25, 2017
2 parents 9391e40 + d819a5e commit 912842c
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 6 deletions.
Binary file added test-resources/dedupe_after.bam
Binary file not shown.
Binary file added test-resources/dedupe_before.bam
Binary file not shown.
Binary file added test-resources/dedupe_before.bam.bai
Binary file not shown.
12 changes: 12 additions & 0 deletions test/cljam/t_common.clj
Expand Up @@ -107,6 +107,9 @@
(def medium-bam-file "test-resources/medium.bam")
(def large-bam-file (cavia/resource mycavia "large.bam"))

(def dedupe-before-bam-file "test-resources/dedupe_before.bam")
(def dedupe-after-bam-file "test-resources/dedupe_after.bam")

;; ### BAM index files

(def test-bai-file "test-resources/test.sorted.bam.bai")
Expand Down Expand Up @@ -377,6 +380,15 @@
[f1 f2]
(= (digest/sha1 (file f1)) (digest/sha1 (file f2))))

(defn same-bam-file?
[f1 f2]
(with-open [r1 (bam/reader f1)
r2 (bam/reader f2)]
(and (= (io/read-header r1)
(io/read-header r2))
(= (io/read-alignments r1 {})
(io/read-alignments r2 {})))))

;;;; FASTA

(def test-fa-header [{:desc "", :name "ref", :offset 5} {:desc "", :name "ref2", :offset 57}])
Expand Down
9 changes: 3 additions & 6 deletions test/cljam/t_dedupe.clj
Expand Up @@ -8,12 +8,9 @@
(deftest simple-pe-dedupe
(with-before-after {:before (prepare-cache!)
:after (clean-cache!)}
;; TODO: need bam-file include PCR duplications
(let [in-file test-sorted-bam-file
out-file (str temp-dir "/deduped.bam")]
(is (not-throw? (dedupe/dedupe in-file out-file)))
;; TODO: check alignments of out-file
)))
(let [out-file (str temp-dir "/deduped.bam")]
(is (not-throw? (dedupe/dedupe dedupe-before-bam-file out-file)))
(is (same-bam-file? out-file dedupe-after-bam-file)))))

(deftest simple-pe-dedupe-xform
(is (= (into #{}
Expand Down

0 comments on commit 912842c

Please sign in to comment.