module D4
Overview
D4 format library for Crystal
D4 is a format designed to store quantitative data associated with genomic intervals. It provides efficient compression and fast random access for depth data and similar genomic quantitative information.
Usage
Reading D4 files
D4.open("data.d4") do |file|
puts file.chromosomes.map(&.name)
puts file.mean("chr1", 1000, 2000)
file.each_interval("chr1", 1000, 2000) do |interval|
puts "#{interval.left}-#{interval.right}: #{interval.value}"
end
end
Writing D4 files
D4.create("output.d4", chromosomes: [D4::Chromosome.new("chr1", 1000_i64)],
dictionary: D4::Dictionary.new(0_i32, 8_i32)) do |writer|
writer.write_values("chr1", 0, [1_i32, 2_i32, 3_i32])
end
Defined in:
d4.crd4/bins.cr
d4/errors.cr
d4/file.cr
d4/format.cr
d4/http.cr
d4/index.cr
d4/index_builder.cr
d4/matrix.cr
d4/reducers.cr
d4/scaled.cr
d4/source.cr
d4/stats.cr
d4/track.cr
d4/types.cr
d4/version.cr
d4/write_control.cr
d4/writer.cr
Constant Summary
-
D4Error =
Error -
Compatibility name for callers of the former d4binding wrapper.
-
VERSION =
{{ (`shards version /home/runner/work/d4.cr/d4.cr/src/d4`).chomp.stringify }}
Class Method Summary
- .build_indexes(path : String | Path, *, track : String | Nil = nil, kinds : Array(IndexKind) = [IndexKind::SecondaryFrames, IndexKind::Sum], control : WriteControl = WriteControl.new) : Nil
- .create(path : String | Path, *, chromosomes : Array(Chromosome), dictionary : Dictionary = Dictionary.new(0, 64), denominator : Float64 = 1.0, default_value : Int32 = 0, options : WriteOptions = WriteOptions.new, control : WriteControl = WriteControl.new) : Writer
- .create(path : String | Path, *, chromosomes : Array(Chromosome), dictionary : Dictionary = Dictionary.new(0, 64), denominator : Float64 = 1.0, default_value : Int32 = 0, options : WriteOptions = WriteOptions.new, control : WriteControl = WriteControl.new, & : Writer -> T) : T forall T
-
.open(path : String | Path, *, track : String | Nil = nil, options : ReadOptions = ReadOptions.new)
Convenience method to open a D4 file for reading
-
.open(path : String | Path, *, track : String | Nil = nil, options : ReadOptions = ReadOptions.new, & : File -> T) forall T
Convenience method to open a D4 file with a block
- .open(source : Source, *, sync_close : Bool = false, track : String | Nil = nil, options : ReadOptions = ReadOptions.new)
- .open(source : Source, *, sync_close : Bool = false, track : String | Nil = nil, options : ReadOptions = ReadOptions.new, & : File -> T) forall T
- .open(io : IO, *, sync_close : Bool = false, track : String | Nil = nil, options : ReadOptions = ReadOptions.new)
- .open(io : IO, *, sync_close : Bool = false, track : String | Nil = nil, options : ReadOptions = ReadOptions.new, & : File -> T) : T forall T
Class Method Detail
def self.build_indexes(path : String | Path, *, track : String | Nil = nil, kinds : Array(IndexKind) = [IndexKind::SecondaryFrames, IndexKind::Sum], control : WriteControl = WriteControl.new) : Nil
#
def self.create(path : String | Path, *, chromosomes : Array(Chromosome), dictionary : Dictionary = Dictionary.new(0, 64), denominator : Float64 = 1.0, default_value : Int32 = 0, options : WriteOptions = WriteOptions.new, control : WriteControl = WriteControl.new) : Writer
#
def self.create(path : String | Path, *, chromosomes : Array(Chromosome), dictionary : Dictionary = Dictionary.new(0, 64), denominator : Float64 = 1.0, default_value : Int32 = 0, options : WriteOptions = WriteOptions.new, control : WriteControl = WriteControl.new, & : Writer -> T) : T forall T
#
def self.open(path : String | Path, *, track : String | Nil = nil, options : ReadOptions = ReadOptions.new)
#
Convenience method to open a D4 file for reading
def self.open(path : String | Path, *, track : String | Nil = nil, options : ReadOptions = ReadOptions.new, & : File -> T) forall T
#
Convenience method to open a D4 file with a block
def self.open(source : Source, *, sync_close : Bool = false, track : String | Nil = nil, options : ReadOptions = ReadOptions.new)
#
def self.open(source : Source, *, sync_close : Bool = false, track : String | Nil = nil, options : ReadOptions = ReadOptions.new, & : File -> T) forall T
#
def self.open(io : IO, *, sync_close : Bool = false, track : String | Nil = nil, options : ReadOptions = ReadOptions.new)
#
def self.open(io : IO, *, sync_close : Bool = false, track : String | Nil = nil, options : ReadOptions = ReadOptions.new, & : File -> T) : T forall T
#