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

For reduce worktime of lein cloverage #69

Merged
merged 5 commits into from
Apr 28, 2017
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion test/cljam/t_bam.clj
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
(is (thrown? IOException (bam/reader invalid-file-2 :ignore-index true)))
(is (thrown? IOException (bam/reader not-found-file :ignore-index true)))))

(deftest bamreader-medium-file
(deftest-slow bamreader-medium-file
(with-before-after {:before (prepare-cache!)
:after (clean-cache!)}
(with-open [rdr (bam/reader medium-bam-file :ignore-index true)]
Expand Down
24 changes: 15 additions & 9 deletions test/cljam/t_bam_indexer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
[cljam.bam-indexer :as bai]))

(def temp-file-sorted (str temp-dir "/test.sorted.bam"))
(def temp-file-sorted-2 (str temp-dir "/test.sorted2.bam"))

(deftest about-bam-indexer
(with-before-after {:before (do (prepare-cache!)
Expand Down Expand Up @@ -52,19 +53,24 @@
)))

(deftest about-bam-indexer-small-file
(doseq [n-threads [1 4]]
(with-before-after {:before (do (prepare-cache!)
(fs/copy small-bam-file temp-file-sorted))
:after (clean-cache!)}
(with-before-after {:before (do (prepare-cache!)
(fs/copy small-bam-file temp-file-sorted)
(fs/copy small-bam-file temp-file-sorted-2))
:after (clean-cache!)}
(let [temp-file-sorted-bai (str temp-file-sorted ".bai")
temp-file-sorted-bai-2 (str temp-file-sorted-2 ".bai")]
(is (not-throw? (bai/create-index temp-file-sorted
(str temp-file-sorted ".bai")
:n-threads n-threads)))
(is (fs/exists? (str temp-file-sorted ".bai")))
temp-file-sorted-bai
:n-threads 1)))
(is (fs/exists? temp-file-sorted-bai))
(is (not-throw? (bai/create-index temp-file-sorted-2
temp-file-sorted-bai-2
:n-threads 4)))
(is (fs/exists? temp-file-sorted-bai-2))
(is (same-file? temp-file-sorted-bai temp-file-sorted-bai-2))
(with-open [r (bam/reader temp-file-sorted)]
;; Random read with different number of spans.
(are [?param ?counts] (= (count (io/read-alignments r ?param)) ?counts)
{:chr "chr1" :start 23000000 :end 25000000 :depth :shallow} 14858
{:chr "chr1" :start 23000000 :end 25000000 :depth :pointer} 14858
{:chr "chr1" :start 23000000 :end 25000000 :depth :deep} 14858
{:chr "chr1" :start 23000000 :end 24500000 :depth :deep} 11424
{:chr "chr1" :start 23000000 :end 24000000 :depth :deep} 10010
Expand Down
4 changes: 2 additions & 2 deletions test/cljam/t_pileup.clj
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@
(mplp/pileup-seq 101 120 (map #(hash-map :pos (inc %) :cigar "10M") (range))))
[10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10]))
(is (= (map :pos
(last (mplp/pileup-seq 1 1000000 (map #(hash-map :pos (inc %) :cigar "10M") (range)))))
[999991 999992 999993 999994 999995 999996 999997 999998 999999 1000000]))
(last (mplp/pileup-seq 1 100000 (map #(hash-map :pos (inc %) :cigar "10M") (range)))))
[99991 99992 99993 99994 99995 99996 99997 99998 99999 100000]))

;; -----
;; ----
Expand Down