Skip to content

Commit

Permalink
Add tests for BAM random read with multiple spans.
Browse files Browse the repository at this point in the history
  • Loading branch information
alumi committed Jan 19, 2017
1 parent 09456cd commit f14f070
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 0 deletions.
Binary file added test-resources/small.bam
Binary file not shown.
Binary file added test-resources/small.bam.bai
Binary file not shown.
14 changes: 14 additions & 0 deletions test/cljam/t_bam_indexer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,20 @@
;; (it will use https://gitlab.xcoo.jp/chrovis/cljam/issues/8 later)
)))

(with-state-changes [(before :facts (do (prepare-cache!)
(fs/copy small-bam-file temp-file-sorted)))
(after :facts (clean-cache!))]
(fact "about BAM indexer (small file)"
(bai/create-index
temp-file-sorted (str temp-file-sorted ".bai")) => anything
(fs/exists? (str temp-file-sorted ".bai")) => truthy
(with-open [r (bam/reader temp-file-sorted)]
;; Random read with different number of spans.
(count (io/read-alignments r {:chr "chr1" :start 23000000 :end 25000000 :depth :deep})) => 14858
(count (io/read-alignments r {:chr "chr1" :start 23000000 :end 24500000 :depth :deep})) => 11424
(count (io/read-alignments r {:chr "chr1" :start 23000000 :end 24000000 :depth :deep})) => 10010
(count (io/read-alignments r {:chr "chr1" :start 23000000 :end 23500000 :depth :deep})) => 3806)))

(with-state-changes [(before :facts (do (prepare-cache!)
(fs/copy medium-bam-file
temp-file-sorted)))
Expand Down
1 change: 1 addition & 0 deletions test/cljam/t_common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,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 medium-bam-file "test-resources/medium.bam")
(def large-bam-file (cavia/resource mycavia "large.bam"))

Expand Down

0 comments on commit f14f070

Please sign in to comment.