Skip to content

Commit

Permalink
Replace lsb protocol invocations with fn counterparts
Browse files Browse the repository at this point in the history
  • Loading branch information
athos committed Nov 14, 2023
1 parent 185af98 commit 3726b73
Show file tree
Hide file tree
Showing 12 changed files with 28 additions and 28 deletions.
22 changes: 11 additions & 11 deletions src/cljam/algo/convert.clj
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
(ns cljam.algo.convert
"Converters between equivalent formats: SAM/BAM and FASTA/TwoBit."
(:require [clojure.tools.logging :as logging]
[clojure.string :as cstr]
[cljam.common :refer [*n-threads* get-exec-n-threads]]
[cljam.io.sam :as sam]
(:require [cljam.common :refer [*n-threads* get-exec-n-threads]]
[cljam.io.bam.encoder :as encoder]
[cljam.io.fastq :as fq]
[cljam.io.sam :as sam]
[cljam.io.sam.util.flag :as flag]
[cljam.io.sam.util.refs :as refs]
[cljam.util.sequence :as util-seq]
[cljam.io.sequence :as cseq]
[cljam.io.fastq :as fq]
[cljam.io.util :as io-util]
[cljam.util.sequence :as util-seq]
[clojure.string :as cstr]
[clojure.tools.logging :as logging]
[com.climate.claypoole :as cp])
(:import [java.nio ByteBuffer]
[cljam.io.fastq FASTQRead]))
(:import [cljam.io.fastq FASTQRead]
[java.io ByteArrayOutputStream]))

;;; SAM <-> BAM

Expand All @@ -30,9 +30,9 @@
n-threads (get-exec-n-threads)]
(doseq [blocks (cp/pmap (if (= n-threads 1) :serial (dec n-threads))
(fn [chunk']
(mapv #(let [bb (ByteBuffer/allocate (encoder/get-block-size %))]
(encoder/encode-alignment bb % refs)
{:data (.array bb)})
(mapv #(let [baos (ByteArrayOutputStream. (encoder/get-block-size %))]
(encoder/encode-alignment baos % refs)
{:data (.toByteArray baos)})
chunk'))
(partition-all num-block (sam/read-alignments rdr {})))]
(sam/write-blocks wtr blocks))))
Expand Down
2 changes: 1 addition & 1 deletion src/cljam/io/bam/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
[writer :as writer]]
[cljam.io.bam-index :as bai]
[cljam.io.util.bgzf :as bgzf]
[cljam.io.util.lsb :as lsb]
[cljam.io.util.lsb.data-io :as lsb]
[cljam.util :as util])
(:import java.util.Arrays
[java.io DataInputStream DataOutputStream IOException FileNotFoundException]
Expand Down
2 changes: 1 addition & 1 deletion src/cljam/io/bam/encoder.clj
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
[cljam.io.sam.util.quality :as qual]
[cljam.io.sam.util.cigar :as cigar]
[cljam.io.sam.util.sequence :as seq]
[cljam.io.util.lsb :as lsb]
[cljam.io.util.lsb.io-stream :as lsb]
[cljam.io.bam.common :as common]))

(def ^:private ^:const fixed-tag-size 3)
Expand Down
2 changes: 1 addition & 1 deletion src/cljam/io/bam/reader.clj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[cljam.io.sam.util.header :as header]
[cljam.io.bam-index.core :as bai]
[cljam.io.bam.decoder :as decoder]
[cljam.io.util.lsb :as lsb])
[cljam.io.util.lsb.data-io :as lsb])
(:import [java.io Closeable FileNotFoundException]
[cljam.io.bam.decoder BAMRawBlock]
[bgzf4j BGZFInputStream]))
Expand Down
2 changes: 1 addition & 1 deletion src/cljam/io/bam/writer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[cljam.io.protocols :as protocols]
[cljam.io.sam.util.refs :as refs]
[cljam.io.sam.util.header :as header]
[cljam.io.util.lsb :as lsb]
[cljam.io.util.lsb.io-stream :as lsb]
[cljam.io.bam.common :as common]
[cljam.io.bam.encoder :as encoder]
[cljam.io.bam.decoder :as bam-decoder]
Expand Down
2 changes: 1 addition & 1 deletion src/cljam/io/bam_index/reader.clj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
(ns cljam.io.bam-index.reader
(:require [clojure.java.io :as cio]
[cljam.io.util.lsb :as lsb]
[cljam.io.util.lsb.io-stream :as lsb]
[cljam.io.bam-index.common :refer [bai-magic]]
[cljam.io.util.chunk :as chunk]
[cljam.util :as util])
Expand Down
2 changes: 1 addition & 1 deletion src/cljam/io/bam_index/writer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(:require [com.climate.claypoole :as cp]
[cljam.common :refer [get-exec-n-threads]]
[cljam.io.util.bgzf :as bgzf]
[cljam.io.util.lsb :as lsb]
[cljam.io.util.lsb.io-stream :as lsb]
[cljam.io.util.bin :as util-bin]
[cljam.io.bam-index.common :refer [linear-index-shift
linear-index-depth
Expand Down
2 changes: 1 addition & 1 deletion src/cljam/io/bcf/reader.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[cljam.io.protocols :as protocols]
[cljam.io.util.bgzf :as bgzf]
[cljam.io.util.byte-buffer :as bb]
[cljam.io.util.lsb :as lsb]
[cljam.io.util.lsb.io-stream :as lsb]
[cljam.io.vcf.reader :as vcf-reader]
[cljam.io.vcf.util :as vcf-util]
[cljam.util :as util]
Expand Down
2 changes: 1 addition & 1 deletion src/cljam/io/bcf/writer.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
(:require [clojure.string :as cstr]
[cljam.io.protocols :as protocols]
[cljam.io.util.bgzf :as bgzf]
[cljam.io.util.lsb :as lsb]
[cljam.io.util.lsb.io-stream :as lsb]
[cljam.io.vcf.writer :as vw]
[cljam.io.vcf.util :as vcf-util]
[cljam.util :as util])
Expand Down
2 changes: 1 addition & 1 deletion src/cljam/io/bigwig.clj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
specifications."
(:require [clojure.java.io :as cio]
[cljam.io.protocols :as protocols]
[cljam.io.util.lsb :as lsb]
[cljam.io.util.lsb.data-io :as lsb]
[cljam.util :as util])
(:import [java.net URL]
[java.io Closeable IOException RandomAccessFile]
Expand Down
14 changes: 7 additions & 7 deletions src/cljam/io/csi.clj
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
(ns cljam.io.csi
"Basic I/O of CSI:Coordinate Sorted Index files."
(:require [clojure.string :as cstr]
[cljam.io.util.bgzf :as bgzf]
[cljam.io.util.lsb :as lsb]
(:require [cljam.io.util.bgzf :as bgzf]
[cljam.io.util.bin :as util-bin]
[cljam.io.util.chunk :as chunk]
[cljam.io.util.bin :as util-bin])
(:import java.util.Arrays
[java.io DataInputStream DataOutputStream IOException]
[java.nio ByteBuffer ByteOrder]))
[cljam.io.util.lsb.io-stream :as lsb]
[clojure.string :as cstr])
(:import [java.io DataInputStream DataOutputStream IOException]
[java.nio ByteBuffer ByteOrder]
java.util.Arrays))

(def ^:const ^:private csi-magic "CSI\1")

Expand Down
2 changes: 1 addition & 1 deletion src/cljam/io/tabix.clj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"Alpha - subject to change.
Reader of a TABIX format file."
(:require [cljam.io.util.bgzf :as bgzf]
[cljam.io.util.lsb :as lsb]
[cljam.io.util.lsb.io-stream :as lsb]
[cljam.io.util.bin :as util-bin]
[clojure.string :as cstr])
(:import java.util.Arrays
Expand Down

0 comments on commit 3726b73

Please sign in to comment.