Skip to content

Commit

Permalink
Add test for cljam level
Browse files Browse the repository at this point in the history
  • Loading branch information
ayamada committed Apr 27, 2017
1 parent 11a0fef commit a134664
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/cljam/t_cli.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
(:require [clojure.test :refer :all]
[cljam.t-common :refer :all]
[clojure.java.io :as io]
[cljam.cli :as cli])
[cljam.cli :as cli]
[cljam.io :as cio]
[cljam.bam :as bam])
(:import [java.io PrintStream]))

(defmacro with-out-file
Expand Down Expand Up @@ -132,8 +134,10 @@
(with-out-file temp-out (cli/level [test-bam-file temp-bam]))))
(is (not-throw? (with-out-file temp-out (cli/level [test-sorted-bam-file
temp-bam]))))
;; TODO: examine contents of temp-bam
))
(with-open [rdr (bam/reader temp-bam :ignore-index true)]
(is (= (map #(first (keep :LV (:options %)))
(cio/read-alignments rdr))
test-sorted-bam-levels)))))

(deftest about-run
(with-before-after {:before (prepare-cache!)
Expand Down
14 changes: 14 additions & 0 deletions test/cljam/t_common.clj
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,20 @@
{:data [1 0 0 0 11 0 0 0 3 30 73 18 1 0 0 0 24 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 120 53 0 -128 1 0 0 17 -127 24 -127 20 -126 -127 33 65 66 17 40 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30], :size 75}
{:data [1 0 0 0 13 0 0 0 3 30 73 18 1 0 0 0 23 0 0 0 -1 -1 -1 -1 -1 -1 -1 -1 0 0 0 0 120 54 0 112 1 0 0 -127 24 -127 20 -126 -127 33 65 66 17 40 16 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30], :size 74}])

(def test-sorted-bam-levels
[{:type "i", :value 0}
{:type "i", :value 1}
{:type "i", :value 2}
{:type "i", :value 2}
{:type "i", :value 0}
{:type "i", :value 0}
{:type "i", :value 0}
{:type "i", :value 1}
{:type "i", :value 2}
{:type "i", :value 3}
{:type "i", :value 4}
{:type "i", :value 5}])

(def test-fa
[{:rname "ref", :offset 5, :seq "AGCATGTTAGATAAGATAGCTGTGCTAGTAGGCAGTCAGCGCCAT", :blen 45}
{:rname "ref2", :offset 57, :seq "aggttttataaaacaattaagtctacagagcaactacgcg", :blen 40}])
Expand Down

0 comments on commit a134664

Please sign in to comment.