htslib 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +79 -49
- data/TUTORIAL.md +9 -20
- data/ext/htslib_native/extconf.rb +41 -0
- data/ext/htslib_native/htslib_native.h +11 -0
- data/ext/htslib_native/htslib_native_ext.c +48 -0
- data/ext/htslib_native/native_bam.c +1108 -0
- data/ext/htslib_native/native_bcf.c +369 -0
- data/ext/htslib_native/native_faidx.c +155 -0
- data/ext/htslib_native/native_tabix.c +246 -0
- data/lib/hts/bam/auxi.rb +87 -342
- data/lib/hts/bam/base_mod.rb +37 -73
- data/lib/hts/bam/cigar.rb +9 -55
- data/lib/hts/bam/flag.rb +19 -27
- data/lib/hts/bam/header.rb +29 -56
- data/lib/hts/bam/mpileup.rb +158 -132
- data/lib/hts/bam/pileup.rb +120 -145
- data/lib/hts/bam/record.rb +233 -270
- data/lib/hts/bam.rb +102 -42
- data/lib/hts/bcf/errors.rb +1 -0
- data/lib/hts/bcf/format.rb +278 -379
- data/lib/hts/bcf/header.rb +38 -123
- data/lib/hts/bcf/header_record.rb +9 -35
- data/lib/hts/bcf/info.rb +72 -320
- data/lib/hts/bcf/record.rb +61 -102
- data/lib/hts/bcf.rb +149 -323
- data/lib/hts/faidx.rb +28 -87
- data/lib/hts/hts.rb +6 -94
- data/lib/hts/native.rb +13 -0
- data/lib/hts/tabix.rb +93 -48
- data/lib/hts/version.rb +1 -1
- data/lib/htslib.rb +6 -52
- metadata +13 -64
- data/lib/hts/ffi_ext/README.md +0 -8
- data/lib/hts/ffi_ext/pointer.rb +0 -18
- data/lib/hts/ffi_ext/struct.rb +0 -45
- data/lib/hts/libhts/bgzf.rb +0 -199
- data/lib/hts/libhts/constants.rb +0 -658
- data/lib/hts/libhts/cram.rb +0 -471
- data/lib/hts/libhts/fai.rb +0 -146
- data/lib/hts/libhts/hfile.rb +0 -109
- data/lib/hts/libhts/hts.rb +0 -477
- data/lib/hts/libhts/kfunc.rb +0 -38
- data/lib/hts/libhts/sam.rb +0 -760
- data/lib/hts/libhts/sam_funcs.rb +0 -155
- data/lib/hts/libhts/tbx.rb +0 -79
- data/lib/hts/libhts/tbx_funcs.rb +0 -32
- data/lib/hts/libhts/thread_pool.rb +0 -139
- data/lib/hts/libhts/vcf.rb +0 -557
- data/lib/hts/libhts/vcf_funcs.rb +0 -353
- data/lib/hts/libhts.rb +0 -47
data/lib/hts/libhts/cram.rb
DELETED
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module HTS
|
|
4
|
-
module LibHTS
|
|
5
|
-
typedef :pointer, :cram_fd
|
|
6
|
-
typedef :pointer, :cram_container
|
|
7
|
-
typedef :pointer, :cram_block
|
|
8
|
-
typedef :pointer, :cram_metrics
|
|
9
|
-
|
|
10
|
-
# cram_fd
|
|
11
|
-
|
|
12
|
-
attach_function \
|
|
13
|
-
:cram_fd_get_header,
|
|
14
|
-
[:cram_fd],
|
|
15
|
-
SamHdr.by_ref
|
|
16
|
-
|
|
17
|
-
attach_function \
|
|
18
|
-
:cram_fd_set_header,
|
|
19
|
-
[:cram_fd, SamHdr.by_ref],
|
|
20
|
-
:void
|
|
21
|
-
|
|
22
|
-
attach_function \
|
|
23
|
-
:cram_fd_get_version,
|
|
24
|
-
[:cram_fd],
|
|
25
|
-
:int
|
|
26
|
-
|
|
27
|
-
attach_function \
|
|
28
|
-
:cram_fd_set_version,
|
|
29
|
-
%i[cram_fd int],
|
|
30
|
-
:void
|
|
31
|
-
|
|
32
|
-
attach_function \
|
|
33
|
-
:cram_major_vers,
|
|
34
|
-
[:cram_fd],
|
|
35
|
-
:int
|
|
36
|
-
|
|
37
|
-
attach_function \
|
|
38
|
-
:cram_minor_vers,
|
|
39
|
-
[:cram_fd],
|
|
40
|
-
:int
|
|
41
|
-
|
|
42
|
-
attach_function \
|
|
43
|
-
:cram_fd_get_fp,
|
|
44
|
-
[:cram_fd],
|
|
45
|
-
HFile.by_ref
|
|
46
|
-
|
|
47
|
-
attach_function \
|
|
48
|
-
:cram_fd_set_fp,
|
|
49
|
-
[:cram_fd, HFile],
|
|
50
|
-
:void
|
|
51
|
-
|
|
52
|
-
attach_function \
|
|
53
|
-
:cram_container_get_length,
|
|
54
|
-
[:cram_container],
|
|
55
|
-
:int32
|
|
56
|
-
|
|
57
|
-
attach_function \
|
|
58
|
-
:cram_container_set_length,
|
|
59
|
-
%i[cram_container int32],
|
|
60
|
-
:void
|
|
61
|
-
|
|
62
|
-
attach_function \
|
|
63
|
-
:cram_container_get_num_blocks,
|
|
64
|
-
[:cram_container],
|
|
65
|
-
:int32
|
|
66
|
-
|
|
67
|
-
attach_function \
|
|
68
|
-
:cram_container_set_num_blocks,
|
|
69
|
-
%i[cram_container int32],
|
|
70
|
-
:void
|
|
71
|
-
|
|
72
|
-
attach_function \
|
|
73
|
-
:cram_container_get_landmarks,
|
|
74
|
-
%i[cram_container int32],
|
|
75
|
-
:pointer
|
|
76
|
-
|
|
77
|
-
attach_function \
|
|
78
|
-
:cram_container_set_landmarks,
|
|
79
|
-
%i[cram_container int32 pointer],
|
|
80
|
-
:void
|
|
81
|
-
|
|
82
|
-
attach_function \
|
|
83
|
-
:cram_container_get_num_records,
|
|
84
|
-
[:cram_container],
|
|
85
|
-
:int32
|
|
86
|
-
|
|
87
|
-
attach_function \
|
|
88
|
-
:cram_container_get_num_bases,
|
|
89
|
-
[:cram_container],
|
|
90
|
-
:int32
|
|
91
|
-
|
|
92
|
-
# Returns true if the container is empty (EOF marker)
|
|
93
|
-
attach_function \
|
|
94
|
-
:cram_container_is_empty,
|
|
95
|
-
[:cram_fd],
|
|
96
|
-
:int
|
|
97
|
-
|
|
98
|
-
# Returns chromosome and start/span from container struct
|
|
99
|
-
attach_function \
|
|
100
|
-
:cram_container_get_coords,
|
|
101
|
-
%i[cram_container pointer pointer],
|
|
102
|
-
:void
|
|
103
|
-
|
|
104
|
-
attach_function \
|
|
105
|
-
:cram_block_get_content_id,
|
|
106
|
-
[:cram_block],
|
|
107
|
-
:int32
|
|
108
|
-
|
|
109
|
-
attach_function \
|
|
110
|
-
:cram_block_get_comp_size,
|
|
111
|
-
[:cram_block],
|
|
112
|
-
:int32
|
|
113
|
-
|
|
114
|
-
attach_function \
|
|
115
|
-
:cram_block_get_uncomp_size,
|
|
116
|
-
[:cram_block],
|
|
117
|
-
:int32
|
|
118
|
-
|
|
119
|
-
attach_function \
|
|
120
|
-
:cram_block_get_crc32,
|
|
121
|
-
[:cram_block],
|
|
122
|
-
:int32
|
|
123
|
-
|
|
124
|
-
attach_function \
|
|
125
|
-
:cram_block_get_data,
|
|
126
|
-
[:cram_block],
|
|
127
|
-
:pointer
|
|
128
|
-
|
|
129
|
-
attach_function \
|
|
130
|
-
:cram_block_get_content_type,
|
|
131
|
-
[:cram_block],
|
|
132
|
-
CramContentType
|
|
133
|
-
|
|
134
|
-
attach_function \
|
|
135
|
-
:cram_block_get_method,
|
|
136
|
-
[:cram_block],
|
|
137
|
-
CramBlockMethod
|
|
138
|
-
|
|
139
|
-
attach_function \
|
|
140
|
-
:cram_expand_method,
|
|
141
|
-
[:pointer, :int32, CramBlockMethod],
|
|
142
|
-
:pointer
|
|
143
|
-
|
|
144
|
-
attach_function \
|
|
145
|
-
:cram_block_set_content_id,
|
|
146
|
-
%i[cram_block int32],
|
|
147
|
-
:void
|
|
148
|
-
|
|
149
|
-
attach_function \
|
|
150
|
-
:cram_block_set_comp_size,
|
|
151
|
-
%i[cram_block int32],
|
|
152
|
-
:void
|
|
153
|
-
|
|
154
|
-
attach_function \
|
|
155
|
-
:cram_block_set_uncomp_size,
|
|
156
|
-
%i[cram_block int32],
|
|
157
|
-
:void
|
|
158
|
-
|
|
159
|
-
attach_function \
|
|
160
|
-
:cram_block_set_crc32,
|
|
161
|
-
%i[cram_block int32],
|
|
162
|
-
:void
|
|
163
|
-
|
|
164
|
-
attach_function \
|
|
165
|
-
:cram_block_set_data,
|
|
166
|
-
%i[cram_block pointer],
|
|
167
|
-
:void
|
|
168
|
-
|
|
169
|
-
attach_function \
|
|
170
|
-
:cram_block_append,
|
|
171
|
-
%i[cram_block pointer int],
|
|
172
|
-
:int
|
|
173
|
-
|
|
174
|
-
attach_function \
|
|
175
|
-
:cram_block_update_size,
|
|
176
|
-
[:cram_block],
|
|
177
|
-
:void
|
|
178
|
-
|
|
179
|
-
attach_function \
|
|
180
|
-
:cram_block_get_offset,
|
|
181
|
-
[:cram_block],
|
|
182
|
-
:size_t
|
|
183
|
-
|
|
184
|
-
attach_function \
|
|
185
|
-
:cram_block_set_offset,
|
|
186
|
-
%i[cram_block size_t],
|
|
187
|
-
:void
|
|
188
|
-
|
|
189
|
-
# Computes the size of a cram block, including the block header itself.
|
|
190
|
-
attach_function \
|
|
191
|
-
:cram_block_size,
|
|
192
|
-
[:cram_block],
|
|
193
|
-
:uint32
|
|
194
|
-
|
|
195
|
-
# Returns the Block Content ID values referred to by a cram_codec in ids[2].
|
|
196
|
-
attach_function \
|
|
197
|
-
:cram_codec_get_content_ids,
|
|
198
|
-
%i[pointer pointer],
|
|
199
|
-
:void
|
|
200
|
-
|
|
201
|
-
# Produces a human readable description of the codec parameters.
|
|
202
|
-
attach_function \
|
|
203
|
-
:cram_codec_describe,
|
|
204
|
-
[:pointer, KString.ptr],
|
|
205
|
-
:int
|
|
206
|
-
|
|
207
|
-
# Renumbers RG numbers in a cram compression header.
|
|
208
|
-
attach_function \
|
|
209
|
-
:cram_transcode_rg,
|
|
210
|
-
%i[cram_fd cram_fd cram_container int pointer pointer],
|
|
211
|
-
:int
|
|
212
|
-
|
|
213
|
-
# Copies the blocks representing the next num_slice slices from a
|
|
214
|
-
# container from 'in' to 'out'.
|
|
215
|
-
attach_function \
|
|
216
|
-
:cram_copy_slice,
|
|
217
|
-
%i[cram_fd cram_fd int32],
|
|
218
|
-
:int
|
|
219
|
-
|
|
220
|
-
# Copies a container, but filtering it down to a specific region (as
|
|
221
|
-
# already specified in 'in'
|
|
222
|
-
attach_function \
|
|
223
|
-
:cram_filter_container,
|
|
224
|
-
%i[cram_fd cram_fd cram_container pointer],
|
|
225
|
-
:int
|
|
226
|
-
|
|
227
|
-
# Decodes a CRAM block compression header.
|
|
228
|
-
attach_function \
|
|
229
|
-
:cram_decode_compression_header,
|
|
230
|
-
%i[cram_fd cram_block],
|
|
231
|
-
:pointer # cram_block_compression_hdr
|
|
232
|
-
|
|
233
|
-
# Frees a cram_block_compression_hdr structure.
|
|
234
|
-
attach_function \
|
|
235
|
-
:cram_free_compression_header,
|
|
236
|
-
[:pointer],
|
|
237
|
-
:void
|
|
238
|
-
|
|
239
|
-
# Map cram block numbers to data-series.
|
|
240
|
-
attach_function \
|
|
241
|
-
:cram_update_cid2ds_map,
|
|
242
|
-
%i[pointer pointer],
|
|
243
|
-
:pointer
|
|
244
|
-
|
|
245
|
-
# Return a list of data series observed as belonging to a block with
|
|
246
|
-
# the specified content_id.
|
|
247
|
-
attach_function \
|
|
248
|
-
:cram_cid2ds_query,
|
|
249
|
-
%i[pointer int pointer],
|
|
250
|
-
:int
|
|
251
|
-
|
|
252
|
-
# Frees a cram_cid2ds_t allocated by cram_update_cid2ds_map
|
|
253
|
-
attach_function \
|
|
254
|
-
:cram_cid2ds_free,
|
|
255
|
-
[:pointer],
|
|
256
|
-
:void
|
|
257
|
-
|
|
258
|
-
# Produces a description of the record and tag encodings held within
|
|
259
|
-
# a compression header and appends to 'ks'.
|
|
260
|
-
attach_function \
|
|
261
|
-
:cram_describe_encodings,
|
|
262
|
-
[:pointer, KString.ptr],
|
|
263
|
-
:int
|
|
264
|
-
|
|
265
|
-
# Returns the number of cram blocks within this slice.
|
|
266
|
-
attach_function \
|
|
267
|
-
:cram_slice_hdr_get_num_blocks,
|
|
268
|
-
[:pointer],
|
|
269
|
-
:int32
|
|
270
|
-
|
|
271
|
-
# Returns the block content_id for the block containing an embedded
|
|
272
|
-
# reference sequence.
|
|
273
|
-
attach_function \
|
|
274
|
-
:cram_slice_hdr_get_embed_ref_id,
|
|
275
|
-
[:pointer],
|
|
276
|
-
:int
|
|
277
|
-
|
|
278
|
-
# Returns slice reference ID, start and span (length) coordinates.
|
|
279
|
-
attach_function \
|
|
280
|
-
:cram_slice_hdr_get_coords,
|
|
281
|
-
%i[pointer pointer pointer pointer],
|
|
282
|
-
:void
|
|
283
|
-
|
|
284
|
-
# Decodes a slice header from a cram block.
|
|
285
|
-
attach_function \
|
|
286
|
-
:cram_decode_slice_header,
|
|
287
|
-
%i[pointer pointer],
|
|
288
|
-
:pointer
|
|
289
|
-
|
|
290
|
-
# Frees a cram_block_slice_hdr structure.
|
|
291
|
-
attach_function \
|
|
292
|
-
:cram_free_slice_header,
|
|
293
|
-
[:pointer],
|
|
294
|
-
:void
|
|
295
|
-
|
|
296
|
-
# Allocates a new cram_block structure with a specified content_type
|
|
297
|
-
# and id.
|
|
298
|
-
attach_function \
|
|
299
|
-
:cram_new_block,
|
|
300
|
-
[CramContentType, :int],
|
|
301
|
-
:cram_block
|
|
302
|
-
|
|
303
|
-
# Reads a block from a cram file.
|
|
304
|
-
attach_function \
|
|
305
|
-
:cram_read_block,
|
|
306
|
-
[:cram_fd],
|
|
307
|
-
:cram_block
|
|
308
|
-
|
|
309
|
-
# Writes a CRAM block.
|
|
310
|
-
attach_function \
|
|
311
|
-
:cram_write_block,
|
|
312
|
-
%i[cram_fd cram_block],
|
|
313
|
-
:int
|
|
314
|
-
|
|
315
|
-
# Frees a CRAM block, deallocating internal data too.
|
|
316
|
-
attach_function \
|
|
317
|
-
:cram_free_block,
|
|
318
|
-
[:cram_block],
|
|
319
|
-
:void
|
|
320
|
-
|
|
321
|
-
# Uncompresses a CRAM block, if compressed.
|
|
322
|
-
attach_function \
|
|
323
|
-
:cram_uncompress_block,
|
|
324
|
-
[:cram_block],
|
|
325
|
-
:int
|
|
326
|
-
|
|
327
|
-
# Compresses a block.
|
|
328
|
-
attach_function \
|
|
329
|
-
:cram_compress_block,
|
|
330
|
-
%i[cram_fd cram_block cram_metrics int int],
|
|
331
|
-
:int
|
|
332
|
-
|
|
333
|
-
# Creates a new container, specifying the maximum number of slices
|
|
334
|
-
# and records permitted.
|
|
335
|
-
attach_function \
|
|
336
|
-
:cram_new_container,
|
|
337
|
-
%i[int int],
|
|
338
|
-
:cram_container
|
|
339
|
-
|
|
340
|
-
attach_function \
|
|
341
|
-
:cram_free_container,
|
|
342
|
-
[:cram_container],
|
|
343
|
-
:void
|
|
344
|
-
|
|
345
|
-
# Reads a container header.
|
|
346
|
-
attach_function \
|
|
347
|
-
:cram_read_container,
|
|
348
|
-
[:cram_fd],
|
|
349
|
-
:cram_container
|
|
350
|
-
|
|
351
|
-
# Writes a container structure.
|
|
352
|
-
attach_function \
|
|
353
|
-
:cram_write_container,
|
|
354
|
-
%i[cram_fd cram_container],
|
|
355
|
-
:int
|
|
356
|
-
|
|
357
|
-
# Stores the container structure in dat and returns *size as the
|
|
358
|
-
# number of bytes written to dat[].
|
|
359
|
-
attach_function \
|
|
360
|
-
:cram_store_container,
|
|
361
|
-
%i[cram_fd cram_container string pointer],
|
|
362
|
-
:int
|
|
363
|
-
|
|
364
|
-
attach_function \
|
|
365
|
-
:cram_container_size,
|
|
366
|
-
[:cram_container],
|
|
367
|
-
:int
|
|
368
|
-
|
|
369
|
-
# Opens a CRAM file for read (mode "rb") or write ("wb").
|
|
370
|
-
attach_function \
|
|
371
|
-
:cram_open,
|
|
372
|
-
%i[string string],
|
|
373
|
-
:cram_fd
|
|
374
|
-
|
|
375
|
-
# Opens an existing stream for reading or writing.
|
|
376
|
-
attach_function \
|
|
377
|
-
:cram_dopen,
|
|
378
|
-
%i[pointer string string],
|
|
379
|
-
:cram_fd
|
|
380
|
-
|
|
381
|
-
# Closes a CRAM file.
|
|
382
|
-
attach_function \
|
|
383
|
-
:cram_close,
|
|
384
|
-
[:cram_fd],
|
|
385
|
-
:int
|
|
386
|
-
|
|
387
|
-
# Seek within a CRAM file.
|
|
388
|
-
attach_function \
|
|
389
|
-
:cram_seek,
|
|
390
|
-
%i[pointer off_t int],
|
|
391
|
-
:int # FIXME: pointer should be :cram_fd
|
|
392
|
-
|
|
393
|
-
# Flushes a CRAM file.
|
|
394
|
-
attach_function \
|
|
395
|
-
:cram_flush,
|
|
396
|
-
[:cram_fd],
|
|
397
|
-
:int
|
|
398
|
-
|
|
399
|
-
# Checks for end of file on a cram_fd stream.
|
|
400
|
-
attach_function \
|
|
401
|
-
:cram_eof,
|
|
402
|
-
[:cram_fd],
|
|
403
|
-
:int
|
|
404
|
-
|
|
405
|
-
# Sets options on the cram_fd.
|
|
406
|
-
attach_function \
|
|
407
|
-
:cram_set_option,
|
|
408
|
-
[:cram_fd, HtsFmtOption, :varargs],
|
|
409
|
-
:int
|
|
410
|
-
|
|
411
|
-
# Sets options on the cram_fd.
|
|
412
|
-
attach_function \
|
|
413
|
-
:cram_set_voption,
|
|
414
|
-
[:cram_fd, HtsFmtOption, :pointer], # va_list
|
|
415
|
-
:int
|
|
416
|
-
|
|
417
|
-
# Attaches a header to a cram_fd.
|
|
418
|
-
attach_function \
|
|
419
|
-
:cram_set_header,
|
|
420
|
-
[:cram_fd, SamHdr.by_ref],
|
|
421
|
-
:int
|
|
422
|
-
|
|
423
|
-
# Check if this file has a proper EOF block
|
|
424
|
-
attach_function \
|
|
425
|
-
:cram_check_EOF,
|
|
426
|
-
[:cram_fd],
|
|
427
|
-
:int
|
|
428
|
-
|
|
429
|
-
# As int32_decoded/encode, but from/to blocks instead of cram_fd
|
|
430
|
-
attach_function \
|
|
431
|
-
:int32_put_blk,
|
|
432
|
-
%i[cram_block int32],
|
|
433
|
-
:int
|
|
434
|
-
|
|
435
|
-
# Returns the refs_t structure used by a cram file handle.
|
|
436
|
-
attach_function \
|
|
437
|
-
:cram_get_refs,
|
|
438
|
-
[HtsFile.by_ref],
|
|
439
|
-
:pointer # refs_t
|
|
440
|
-
|
|
441
|
-
# Returns the file offsets of CRAM slices covering a specific region query.
|
|
442
|
-
attach_function \
|
|
443
|
-
:cram_index_extents,
|
|
444
|
-
%i[cram_fd int hts_pos_t hts_pos_t pointer pointer],
|
|
445
|
-
:int
|
|
446
|
-
|
|
447
|
-
# Returns the total number of containers in the CRAM index.
|
|
448
|
-
attach_function \
|
|
449
|
-
:cram_num_containers,
|
|
450
|
-
[:cram_fd],
|
|
451
|
-
:int64
|
|
452
|
-
|
|
453
|
-
# Returns the number of containers in the CRAM index within given offsets.
|
|
454
|
-
attach_function \
|
|
455
|
-
:cram_num_containers_between,
|
|
456
|
-
%i[cram_fd off_t off_t pointer pointer],
|
|
457
|
-
:int64
|
|
458
|
-
|
|
459
|
-
# Returns the byte offset for the start of the n^th container.
|
|
460
|
-
attach_function \
|
|
461
|
-
:cram_container_num2offset,
|
|
462
|
-
%i[cram_fd int64],
|
|
463
|
-
:off_t
|
|
464
|
-
|
|
465
|
-
# Returns the container number for the first container at offset >= pos.
|
|
466
|
-
attach_function \
|
|
467
|
-
:cram_container_offset2num,
|
|
468
|
-
%i[cram_fd off_t],
|
|
469
|
-
:int64
|
|
470
|
-
end
|
|
471
|
-
end
|
data/lib/hts/libhts/fai.rb
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module HTS
|
|
4
|
-
module LibHTS
|
|
5
|
-
# Build index for a FASTA or FASTQ or bgzip-compressed FASTA or FASTQ file.
|
|
6
|
-
attach_function \
|
|
7
|
-
:fai_build3,
|
|
8
|
-
%i[string string string],
|
|
9
|
-
:int
|
|
10
|
-
|
|
11
|
-
# Build index for a FASTA or FASTQ or bgzip-compressed FASTA or FASTQ file.
|
|
12
|
-
attach_function \
|
|
13
|
-
:fai_build,
|
|
14
|
-
[:string],
|
|
15
|
-
:int
|
|
16
|
-
|
|
17
|
-
# Destroy a faidx_t struct
|
|
18
|
-
attach_function \
|
|
19
|
-
:fai_destroy,
|
|
20
|
-
[Faidx],
|
|
21
|
-
:void
|
|
22
|
-
|
|
23
|
-
# Load FASTA indexes.
|
|
24
|
-
attach_function \
|
|
25
|
-
:fai_load3,
|
|
26
|
-
%i[string string string int],
|
|
27
|
-
Faidx.by_ref
|
|
28
|
-
|
|
29
|
-
# Load index from "fn.fai".
|
|
30
|
-
attach_function \
|
|
31
|
-
:fai_load,
|
|
32
|
-
[:string],
|
|
33
|
-
Faidx.by_ref
|
|
34
|
-
|
|
35
|
-
# Load FASTA or FASTQ indexes.
|
|
36
|
-
attach_function \
|
|
37
|
-
:fai_load3_format,
|
|
38
|
-
[:string, :string, :string, :int, FaiFormatOptions],
|
|
39
|
-
Faidx.by_ref
|
|
40
|
-
|
|
41
|
-
# Load index from "fn.fai".
|
|
42
|
-
attach_function \
|
|
43
|
-
:fai_load_format,
|
|
44
|
-
[:string, FaiFormatOptions],
|
|
45
|
-
Faidx.by_ref
|
|
46
|
-
|
|
47
|
-
# Fetch the sequence in a region
|
|
48
|
-
attach_function \
|
|
49
|
-
:fai_fetch,
|
|
50
|
-
[Faidx, :string, :pointer],
|
|
51
|
-
:pointer
|
|
52
|
-
|
|
53
|
-
# Fetch the sequence in a region
|
|
54
|
-
attach_function \
|
|
55
|
-
:fai_fetch64,
|
|
56
|
-
[Faidx, :string, :pointer],
|
|
57
|
-
:pointer
|
|
58
|
-
|
|
59
|
-
# Fetch the quality string for a region for FASTQ files
|
|
60
|
-
attach_function \
|
|
61
|
-
:fai_fetchqual,
|
|
62
|
-
[Faidx, :string, :pointer],
|
|
63
|
-
:pointer
|
|
64
|
-
|
|
65
|
-
attach_function \
|
|
66
|
-
:fai_fetchqual64,
|
|
67
|
-
[Faidx, :string, :pointer],
|
|
68
|
-
:pointer
|
|
69
|
-
|
|
70
|
-
# Fetch the number of sequences
|
|
71
|
-
attach_function \
|
|
72
|
-
:faidx_fetch_nseq,
|
|
73
|
-
[Faidx],
|
|
74
|
-
:int
|
|
75
|
-
|
|
76
|
-
# Fetch the sequence in a region
|
|
77
|
-
attach_function \
|
|
78
|
-
:faidx_fetch_seq,
|
|
79
|
-
[Faidx, :string, :int, :int, :pointer],
|
|
80
|
-
:pointer
|
|
81
|
-
|
|
82
|
-
# Fetch the sequence in a region
|
|
83
|
-
attach_function \
|
|
84
|
-
:faidx_fetch_seq64,
|
|
85
|
-
[Faidx, :string, :int64, :int64, :pointer],
|
|
86
|
-
:pointer
|
|
87
|
-
|
|
88
|
-
# Fetch the quality string in a region for FASTQ files
|
|
89
|
-
attach_function \
|
|
90
|
-
:faidx_fetch_qual,
|
|
91
|
-
[Faidx, :string, :int, :int, :pointer],
|
|
92
|
-
:pointer
|
|
93
|
-
|
|
94
|
-
# Fetch the quality string in a region for FASTQ files
|
|
95
|
-
attach_function \
|
|
96
|
-
:faidx_fetch_qual64,
|
|
97
|
-
[Faidx, :string, :int64, :int64, :pointer],
|
|
98
|
-
:pointer
|
|
99
|
-
|
|
100
|
-
# Query if sequence is present
|
|
101
|
-
attach_function \
|
|
102
|
-
:faidx_has_seq,
|
|
103
|
-
[Faidx, :string],
|
|
104
|
-
:int
|
|
105
|
-
|
|
106
|
-
# Return number of sequences in fai index
|
|
107
|
-
attach_function \
|
|
108
|
-
:faidx_nseq,
|
|
109
|
-
[Faidx],
|
|
110
|
-
:int
|
|
111
|
-
|
|
112
|
-
# Return name of i-th sequence
|
|
113
|
-
attach_function \
|
|
114
|
-
:faidx_iseq,
|
|
115
|
-
[Faidx, :int],
|
|
116
|
-
:string
|
|
117
|
-
|
|
118
|
-
# Return sequence length, -1 if not present
|
|
119
|
-
attach_function \
|
|
120
|
-
:faidx_seq_len,
|
|
121
|
-
[Faidx, :string],
|
|
122
|
-
:int
|
|
123
|
-
|
|
124
|
-
attach_function \
|
|
125
|
-
:faidx_seq_len64,
|
|
126
|
-
[Faidx, :string],
|
|
127
|
-
:int64
|
|
128
|
-
|
|
129
|
-
# Parses a region string.
|
|
130
|
-
attach_function \
|
|
131
|
-
:fai_parse_region,
|
|
132
|
-
[Faidx, :string, :pointer, :pointer, :pointer, :int], :string
|
|
133
|
-
|
|
134
|
-
# Sets the cache size of the underlying BGZF compressed file
|
|
135
|
-
attach_function \
|
|
136
|
-
:fai_set_cache_size,
|
|
137
|
-
[Faidx, :int],
|
|
138
|
-
:void
|
|
139
|
-
|
|
140
|
-
# Determines the path to the reference index file
|
|
141
|
-
attach_function \
|
|
142
|
-
:fai_path,
|
|
143
|
-
[:string],
|
|
144
|
-
:string
|
|
145
|
-
end
|
|
146
|
-
end
|
data/lib/hts/libhts/hfile.rb
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
module HTS
|
|
4
|
-
module LibHTS
|
|
5
|
-
# Open the named file or URL as a stream
|
|
6
|
-
attach_function \
|
|
7
|
-
:hopen,
|
|
8
|
-
%i[string string varargs],
|
|
9
|
-
HFile.by_ref
|
|
10
|
-
|
|
11
|
-
# Associate a stream with an existing open file descriptor
|
|
12
|
-
attach_function \
|
|
13
|
-
:hdopen,
|
|
14
|
-
%i[int string],
|
|
15
|
-
HFile.by_ref
|
|
16
|
-
|
|
17
|
-
# Report whether the file name or URL denotes remote storage
|
|
18
|
-
attach_function \
|
|
19
|
-
:hisremote,
|
|
20
|
-
[:string],
|
|
21
|
-
:int
|
|
22
|
-
|
|
23
|
-
# Append an extension or replace an existing extension
|
|
24
|
-
attach_function \
|
|
25
|
-
:haddextension,
|
|
26
|
-
[KString, :string, :int, :string],
|
|
27
|
-
:string
|
|
28
|
-
|
|
29
|
-
# Flush (for output streams) and close the stream
|
|
30
|
-
attach_function \
|
|
31
|
-
:hclose,
|
|
32
|
-
[HFile],
|
|
33
|
-
:int
|
|
34
|
-
|
|
35
|
-
# Close the stream, without flushing or propagating errors
|
|
36
|
-
attach_function \
|
|
37
|
-
:hclose_abruptly,
|
|
38
|
-
[HFile],
|
|
39
|
-
:void
|
|
40
|
-
|
|
41
|
-
# Reposition the read/write stream offset
|
|
42
|
-
attach_function \
|
|
43
|
-
:hseek,
|
|
44
|
-
[HFile, :off_t, :int],
|
|
45
|
-
:off_t
|
|
46
|
-
|
|
47
|
-
# Report the current stream offset
|
|
48
|
-
def self.htell(fp)
|
|
49
|
-
base_ptr = fp.pointer
|
|
50
|
-
begin_ptr = base_ptr.get_pointer(fp.offset_of(:begin))
|
|
51
|
-
buffer_ptr = base_ptr.get_pointer(fp.offset_of(:buffer))
|
|
52
|
-
fp[:offset] + (begin_ptr.address - buffer_ptr.address)
|
|
53
|
-
end
|
|
54
|
-
|
|
55
|
-
# Read from the stream until the delimiter, up to a maximum length
|
|
56
|
-
attach_function \
|
|
57
|
-
:hgetdelim,
|
|
58
|
-
[:string, :size_t, :int, HFile],
|
|
59
|
-
:ssize_t
|
|
60
|
-
|
|
61
|
-
# Read a line from the stream, up to a maximum length
|
|
62
|
-
attach_function \
|
|
63
|
-
:hgets,
|
|
64
|
-
[:string, :int, HFile],
|
|
65
|
-
:string
|
|
66
|
-
|
|
67
|
-
# Peek at characters to be read without removing them from buffers
|
|
68
|
-
attach_function \
|
|
69
|
-
:hpeek,
|
|
70
|
-
[HFile, :pointer, :size_t],
|
|
71
|
-
:ssize_t
|
|
72
|
-
|
|
73
|
-
# For writing streams, flush buffered output to the underlying stream
|
|
74
|
-
attach_function \
|
|
75
|
-
:hflush,
|
|
76
|
-
[HFile],
|
|
77
|
-
:int
|
|
78
|
-
|
|
79
|
-
# For hfile_mem: get the internal buffer and it's size from a hfile
|
|
80
|
-
attach_function \
|
|
81
|
-
:hfile_mem_get_buffer,
|
|
82
|
-
[HFile, :pointer],
|
|
83
|
-
:string
|
|
84
|
-
|
|
85
|
-
# For hfile_mem: get the internal buffer and it's size from a hfile.
|
|
86
|
-
attach_function \
|
|
87
|
-
:hfile_mem_steal_buffer,
|
|
88
|
-
[HFile, :pointer],
|
|
89
|
-
:string
|
|
90
|
-
|
|
91
|
-
# Fills out sc_list[] with the list of known URL schemes.
|
|
92
|
-
attach_function \
|
|
93
|
-
:hfile_list_schemes,
|
|
94
|
-
%i[string pointer pointer], # mutable string
|
|
95
|
-
:int
|
|
96
|
-
|
|
97
|
-
# Fills out plist[] with the list of known hFILE plugins.
|
|
98
|
-
attach_function \
|
|
99
|
-
:hfile_list_plugins,
|
|
100
|
-
%i[pointer pointer], # mutable string
|
|
101
|
-
:int
|
|
102
|
-
|
|
103
|
-
# Tests for the presence of a specific hFILE plugin.
|
|
104
|
-
attach_function \
|
|
105
|
-
:hfile_has_plugin,
|
|
106
|
-
[:string],
|
|
107
|
-
:int
|
|
108
|
-
end
|
|
109
|
-
end
|