Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #61 (6) Examine result file of dedupe in test #63

Merged
merged 2 commits into from Apr 25, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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 @@ -372,6 +375,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