Skip to content

Commit

Permalink
Issue chrovis#61 (6) Examine result file of dedupe in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ayamada committed Apr 21, 2017
1 parent 4a65d3c commit 2a7cebd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
Binary file added test-resources/small.deduped.bam
Binary file not shown.
10 changes: 10 additions & 0 deletions test/cljam/t_common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
(def test-bam-file "test-resources/test.bam")
(def test-sorted-bam-file "test-resources/test.sorted.bam")
(def small-bam-file "test-resources/small.bam")
(def small-deduped-bam-file "test-resources/small.deduped.bam")
(def medium-bam-file "test-resources/medium.bam")
(def large-bam-file (cavia/resource mycavia "large.bam"))

Expand Down Expand Up @@ -372,6 +373,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: 4 additions & 5 deletions test/cljam/t_dedupe.clj
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@
(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")]
(let [in-file small-bam-file
out-file (str temp-dir "/deduped.bam")
controlled-result-file small-deduped-bam-file]
(is (not-throw? (dedupe/dedupe in-file out-file)))
;; TODO: check alignments of out-file
)))
(is (same-bam-file? out-file controlled-result-file)))))

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

0 comments on commit 2a7cebd

Please sign in to comment.