Alpha - subject to change. Provides functions for reading from a CRAM file.

(ns cljam.io.cram
  (:refer-clojure :exclude [indexed?])
  (:require [cljam.io.cram.core :as cram]
            [cljam.io.protocols :as protocols]
            [cljam.io.util :as io-util])
  (:import [cljam.io.cram.reader CRAMReader]))

Creates a CRAM reader depending on the argument f: If f is a file or a string that representing the path to a CRAM file, returns a new reader that reads that CRAM file. If f is a CRAM reader, creates and returns a cloned CRAM reader from it.

The function also takes an optional argument option, which is a map that consists of: - reference: A string representing the path to the reference file, or a sequence reader that reads sequences from the reference file. This may be omitted only when the CRAM file to be read does not require a reference file.

(defn reader
  (^CRAMReader [f] (reader f {}))
  (^CRAMReader [f option]
   (if (io-util/cram-reader? f)
     (cram/clone-reader f)
     (cram/reader f option))))

Returns the header of the CRAM file.

(defn read-header
  [rdr]
  (protocols/read-header rdr))

Returns the references of the CRAM file.

(defn read-refs
  [rdr]
  (protocols/read-refs rdr))

Reads all the alignments from the CRAM file and returns them as a lazy sequence of record maps.

(defn read-alignments
  ([rdr]
   (protocols/read-alignments rdr))
  ([rdr region]
   (protocols/read-alignments rdr region)))

Returns true if the reader can be randomly accessed, false if not. Note this function immediately realizes a delayed index.

(defn indexed?
  [rdr]
  (protocols/indexed? rdr))