From ce12fe7ab81aa860a6c1131b2d417e4de627a9f0 Mon Sep 17 00:00:00 2001 From: kojix2 <2xijok@gmail.com> Date: Fri, 13 Sep 2024 12:55:03 +0900 Subject: [PATCH] Add methods in cram [wip] --- lib/hts/libhts/cram.rb | 43 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/lib/hts/libhts/cram.rb b/lib/hts/libhts/cram.rb index 10a61e97..af6bb43b 100644 --- a/lib/hts/libhts/cram.rb +++ b/lib/hts/libhts/cram.rb @@ -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, @@ -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], @@ -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, @@ -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,