Skip to content

Commit

Permalink
Add methods in cram [wip]
Browse files Browse the repository at this point in the history
  • Loading branch information
kojix2 committed Sep 13, 2024
1 parent 1c9a72c commit ce12fe7
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion lib/hts/libhts/cram.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,12 +89,17 @@ module LibHTS
[:cram_container],
:int32

# Returns true if the container is empty (EOF marker)
attach_function \
:cram_container_is_empty,
[:cram_fd],
:int

# cram_block
# Returns chromosome and start/span from container struct
attach_function \
:cram_container_get_coords,
%i[cram_container pointer pointer],
:void

attach_function \
:cram_block_get_content_id,
Expand Down Expand Up @@ -131,6 +136,11 @@ module LibHTS
[:cram_block],
CramBlockMethod

attach_function \
:cram_expand_method,
[:pointer, :int32, CramBlockMethod],
:pointer

attach_function \
:cram_block_set_content_id,
%i[cram_block int32],
Expand Down Expand Up @@ -182,6 +192,18 @@ module LibHTS
[:cram_block],
:uint32

# Returns the Block Content ID values referred to by a cram_codec in ids[2].
attach_function \
:cram_codec_get_content_ids,
[:pointer, :pointer],
:void

# Produces a human readable description of the codec parameters.
attach_function \
:cram_codec_describe,
[:pointer, KString.ptr],
:int

# Renumbers RG numbers in a cram compression header.
attach_function \
:cram_transcode_rg,
Expand All @@ -195,6 +217,25 @@ module LibHTS
%i[cram_fd cram_fd int32],
:int

# Copies a container, but filtering it down to a specific region (as
# already specified in 'in'
attach_function \
:cram_filter_container,
%i[cram_fd cram_fd cram_container pointer],
:int

# Decodes a CRAM block compression header.
attach_function \
:cram_decode_compression_header,
%i[cram_fd cram_block],
:pointer # cram_block_compression_hdr

# Frees a cram_block_compression_hdr structure.
attach_function \
:cram_free_compression_header,
[:pointer],
:void

# Returns the number of cram blocks within this slice.
attach_function \
:cram_slice_hdr_get_num_blocks,
Expand Down

0 comments on commit ce12fe7

Please sign in to comment.