BioHDF version 0.3 alpha
Scalable NGS Data Storage Based on HDF5
|
00001 /***************************************************************************** 00002 * Copyright by The HDF Group * 00003 * All rights reserved. * 00004 * * 00005 * This file is part of BioHDF. The full BioHDF copyright notice, including * 00006 * terms governing use, modification, and redistribution, is contained in * 00007 * the file COPYING. COPYING can be found at the root of the source code * 00008 * distribution tree. If you do not have access to this file, you may * 00009 * request a copy from help@hdfgroup.org. * 00010 *****************************************************************************/ 00011 00019 #ifndef _BIOH5G_READS_H 00020 #define _BIOH5G_READS_H 00021 00022 #include <stdio.h> 00023 00024 #include "biohdf_api.h" 00025 #include "biohdf_error.h" 00026 00027 00028 00029 00030 /***************************************************************************** 00031 * Type definitions * 00032 *****************************************************************************/ 00033 00034 00035 00037 typedef struct _bioh5g_reads *bioh5g_reads; 00038 00039 00040 00042 typedef struct _bioh5g_reads_iterator *bioh5g_reads_iterator; 00043 00044 00045 00047 typedef struct _bioh5g_reads_properties *bioh5g_reads_properties; 00048 00049 00050 00051 /***************************************************************************** 00052 * Common structs and enums * 00053 *****************************************************************************/ 00054 00055 00056 00061 typedef enum 00062 { 00063 BASE_SPACE, 00064 COLOR_SPACE 00065 } bioh5g_reads_type; 00066 00067 00068 00075 typedef enum 00076 { 00077 FASTQ_FORMAT, 00078 FASTA_FORMAT 00079 } bioh5g_reads_format; 00080 00081 00082 00083 /***************************************************************************** 00084 * Data container * 00085 *****************************************************************************/ 00086 00087 00088 00095 typedef struct 00096 { 00097 char *sequence; 00098 char *quality_values; 00099 char *identifier; 00100 } bioh5g_read_data; 00101 00102 00103 00104 /***************************************************************************** 00105 * Create, open, close * 00106 *****************************************************************************/ 00107 00108 00109 00125 BIOHDF_API biohdf_error 00126 BIOH5Gcheck_reads_presence(biohdf_file file, 00127 const char *path, 00128 /*OUT*/ int *presence); 00129 00130 00131 00144 BIOHDF_API biohdf_error 00145 BIOH5Gcreate_reads_collection(biohdf_file file, 00146 bioh5g_reads_properties properties, 00147 const char *path, 00148 /*OUT*/ bioh5g_reads *reads); 00149 00150 00151 00161 BIOHDF_API biohdf_error 00162 BIOH5Gopen_reads_collection(biohdf_file file, 00163 const char *path, 00164 biohdf_open_mode mode, 00165 /*OUT*/ bioh5g_reads *reads); 00166 00167 00168 00177 BIOHDF_API biohdf_error 00178 BIOH5Gclose_reads_collection(/*IN-OUT*/ bioh5g_reads *reads); 00179 00180 00181 00182 /***************************************************************************** 00183 * Append and read data * 00184 *****************************************************************************/ 00185 00186 00187 00195 BIOHDF_API biohdf_error 00196 BIOH5Gget_reads_count(const bioh5g_reads reads, 00197 /*OUT*/ int64_t *count); 00198 00199 00200 00208 BIOHDF_API biohdf_error 00209 BIOH5Gcreate_reads_iterator(const bioh5g_reads reads, 00210 /*OUT*/ bioh5g_reads_iterator *iter); 00211 00212 00213 00222 BIOHDF_API biohdf_error 00223 BIOH5Gdestroy_reads_iterator(/*OUT*/ bioh5g_reads_iterator *iter); 00224 00225 00226 00234 BIOHDF_API biohdf_error 00235 BIOH5Gadd_read(const bioh5g_reads reads, 00236 const bioh5g_read_data *data); 00237 00238 00239 00250 BIOHDF_API biohdf_error 00251 BIOH5Gget_index_of_last_added_read(const bioh5g_reads reads, 00252 /*OUT*/ int64_t *index); 00253 00254 00255 00267 BIOHDF_API biohdf_error 00268 BIOH5Gget_next_read(bioh5g_reads_iterator iter, 00269 /*OUT*/ int64_t *index, 00270 /*OUT*/ bioh5g_read_data **data); 00271 00272 00273 00282 BIOHDF_API biohdf_error 00283 BIOH5Gget_read(const bioh5g_reads reads, 00284 int64_t index, 00285 /*OUT*/ bioh5g_read_data **data); 00286 00287 00288 00297 BIOHDF_API biohdf_error 00298 BIOH5Gfree_read(/*OUT*/ bioh5g_read_data **data); 00299 00300 00301 00302 /***************************************************************************** 00303 * Data formats * 00304 *****************************************************************************/ 00305 00306 00319 BIOHDF_API biohdf_error 00320 BIOH5Gcreate_read_string(const bioh5g_read_data *read, 00321 bioh5g_reads_format format, 00322 /*OUT*/ char **read_string); 00323 00324 00340 BIOHDF_API biohdf_error 00341 BIOH5Gwrite_read_to_stream(const bioh5g_read_data *read, 00342 bioh5g_reads_format format, 00343 FILE *stream); 00344 00345 00346 00347 /***************************************************************************** 00348 * Accessor functions (needed for higher-language interoperation) * 00349 *****************************************************************************/ 00350 00355 BIOHDF_API biohdf_error 00356 BIOH5Gcreate_read_data(/*OUT*/ bioh5g_read_data **data); 00357 00358 00359 00361 BIOHDF_API biohdf_error 00362 BIOH5Gget_read_identifier(bioh5g_read_data *data, /*OUT*/ char **identifier); 00363 00364 00365 00367 BIOHDF_API biohdf_error 00368 BIOH5Gset_read_identifier(bioh5g_read_data *data, char *identifier); 00369 00370 00371 00373 BIOHDF_API biohdf_error 00374 BIOH5Gget_read_sequence(bioh5g_read_data *data, /*OUT*/ char **sequence); 00375 00376 00377 00379 BIOHDF_API biohdf_error 00380 BIOH5Gset_read_sequence(bioh5g_read_data *data, char *sequence); 00381 00382 00383 00385 BIOHDF_API biohdf_error 00386 BIOH5Gget_read_quality_values(bioh5g_read_data *data, /*OUT*/ char **quality_values); 00387 00388 00389 00391 BIOHDF_API biohdf_error 00392 BIOH5Gset_read_quality_values(bioh5g_read_data *data, char *quality_values); 00393 00398 /***************************************************************************** 00399 * Reads properties - create, destroy, access * 00400 *****************************************************************************/ 00401 00408 BIOHDF_API biohdf_error 00409 BIOH5Gcreate_reads_properties(/*OUT*/ bioh5g_reads_properties *props); 00410 00411 00412 00414 BIOHDF_API biohdf_error 00415 BIOH5Gdestroy_reads_properties(/*OUT*/ bioh5g_reads_properties *props); 00416 00417 00418 00420 BIOHDF_API biohdf_error 00421 BIOH5Gset_reads_properties_reads_type(bioh5g_reads_properties props, 00422 bioh5g_reads_type reads_type); 00423 00424 00425 00427 BIOHDF_API biohdf_error 00428 BIOH5Gset_reads_properties_chunk_size(bioh5g_reads_properties props, 00429 int64_t chunk_size); 00430 00431 00432 00434 BIOHDF_API biohdf_error 00435 BIOH5Gset_reads_properties_compression_level(bioh5g_reads_properties props, 00436 compression_level level); 00437 00438 00439 00441 BIOHDF_API biohdf_error 00442 BIOH5Gset_reads_properties_sequences_scheme(bioh5g_reads_properties props, 00443 biohdf_string_storage_scheme scheme); 00444 00445 00446 00448 BIOHDF_API biohdf_error 00449 BIOH5Gset_reads_properties_identifiers_scheme(bioh5g_reads_properties props, 00450 biohdf_string_storage_scheme scheme); 00451 00452 00453 00455 BIOHDF_API biohdf_error 00456 BIOH5Gset_reads_properties_sequences_length(bioh5g_reads_properties props, 00457 size_t length); 00458 00459 00460 00462 BIOHDF_API biohdf_error 00463 BIOH5Gset_reads_properties_identifiers_length(bioh5g_reads_properties props, 00464 size_t length); 00465 00469 #endif