diff --git a/test/cljam/t_bam.clj b/test/cljam/t_bam.clj index 3be208d0..9d4267e4 100644 --- a/test/cljam/t_bam.clj +++ b/test/cljam/t_bam.clj @@ -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)] diff --git a/test/cljam/t_bam_indexer.clj b/test/cljam/t_bam_indexer.clj index 136dfc71..5e5b4fc8 100644 --- a/test/cljam/t_bam_indexer.clj +++ b/test/cljam/t_bam_indexer.clj @@ -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!) @@ -52,23 +53,29 @@ ))) (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 - {:chr "chr1" :start 23000000 :end 23500000 :depth :deep} 3806 + {:chr "chr1" :start 23000000 :end 23001000 :depth :deep} 46 ;; 1 span + {:chr "chr1" :start 24900000 :end 24902000 :depth :deep} 3 ;; 2 spans + {:chr "chr1" :start 24000000 :end 24001000 :depth :deep} 6 ;; 3 spans + {:chr "chr1" :start 23260000 :end 23268650 :depth :deep} 58 ;; 4 spans + {:chr "chr1" :start 23430000 :end 23470000 :depth :deep} 55 ;; 5 spans {:chr "*"} 0))))) (deftest-slow about-bam-indexer-medium-file diff --git a/test/cljam/t_pileup.clj b/test/cljam/t_pileup.clj index 0198122f..ff9f72e8 100644 --- a/test/cljam/t_pileup.clj +++ b/test/cljam/t_pileup.clj @@ -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])) ;; ----- ;; ----