Skip to content

Commit

Permalink
Fix bad expressions.
Browse files Browse the repository at this point in the history
  • Loading branch information
niyarin committed Nov 12, 2019
1 parent cdba04a commit a6d6692
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/cljam/io/util/bin.clj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
(bit-shift-right (if (<= pos 0) 0 (dec pos)) linear-index-shift))

(defn get-spans
"Calculate span information for random access from ndex data such as tabix."
"Calculate span information for random access from index data such as tabix."
[index-data ^long ref-idx ^long beg ^long end]
(let [bins (reg->bins beg end)
chunks (get-chunks index-data ref-idx bins)
Expand Down
10 changes: 2 additions & 8 deletions src/cljam/io/vcf/reader.clj
Original file line number Diff line number Diff line change
Expand Up @@ -181,14 +181,8 @@
:vcf identity)]
(map parse-fn (read-data-lines (.reader rdr) (.header rdr) kws)))))

(defn- make-lazy-variants [f s]
(when-first [fs s]
(lazy-cat
(f fs)
(make-lazy-variants f (rest s)))))

(defn read-variants-randomly
"Read variants of the bgzip compressed VCF file randomly using tabix file.
"Reads variants of the bgzip compressed VCF file randomly using tabix file.
Returning them as a lazy sequence."
[^VCFReader rdr
{:keys [chr start end] :or {start 1 end 4294967296}}
Expand All @@ -202,7 +196,7 @@
parse-fn (case depth
:deep (vcf-util/variant-parser (.meta-info rdr) (.header rdr))
:vcf identity)]
(make-lazy-variants
(mapcat
(fn [[chunk-beg ^long chunk-end]]
(.seek input-stream chunk-beg)
(->> #(when (< (.getFilePointer input-stream) chunk-end)
Expand Down
4 changes: 2 additions & 2 deletions test/cljam/io/tabix_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
(is (number? (.meta tabix-data)))
(is (number? (.skip tabix-data)))
(is (vector? (.seq tabix-data)))
(is (instance? Chunk (get (get (get (.bidx tabix-data) 0) 4687) 0)))
(is (vector? (get (.lidx tabix-data) 0)))))
(is (instance? Chunk (get (get (get (.bidx tabix-data) 0) 4687) 0)))
(is (vector? (get (.lidx tabix-data) 0)))))

(deftest-remote large-file
(with-before-after {:before (prepare-cavia!)}
Expand Down

0 comments on commit a6d6692

Please sign in to comment.