Debian Codegraph @

src/io/nanopolish_fast5_io.h

raw symbols SCIP
1 //---------------------------------------------------------
2 // Copyright 2018 Ontario Institute for Cancer Research
3 // Written by Jared Simpson ([email protected])
4 //---------------------------------------------------------
5 //
6 // nanopolish_fast5_io -- lightweight functions
7 // to read specific data from fast5 files. Some functions
8 // ported from scrappie's fast5_interface.c
9 //
10 #ifndef NANOPOLISH_FAST5_IO_H
11 #define NANOPOLISH_FAST5_IO_H
12
13 #include <string>
14 #include <vector>
15 #include <hdf5.h>
16
17 extern "C" {
18 #include "event_detection.h"
19 #include "scrappie_common.h"
20 }
21
22 // From scrappie
23 typedef struct {
24
25 int channel_id;
26 // Parameters for scaling raw data from ADC values to pA
27 float digitisation;
28 float offset;
29 float range;
30 float sample_rate;
31 } fast5_raw_scaling;
32
33 //
34 struct fast5_file
35 {
36 hid_t hdf5_file;
37 bool is_multi_fast5;
38 };
39
40 //
41 // External API
42 //
43
44 //
45 // Basic I/O
46 //
47
48 // open the file and return handle
49 fast5_file fast5_open(const std::string& filename);
50
51 // check if file is open
52 bool fast5_is_open(fast5_file& fh);
53
54 // close the file
55 void fast5_close(fast5_file& fh);
56
57 //
58 // Functions to get the names of the read(s) contained in the file
59 //
60
61 // Get the identifier of a read from the hdf5 file (eg 00041f-....)
62 std::string fast5_get_read_id_single_fast5(fast5_file& fh);
63
64 // Get a vector of read groups for a multi-fast5 file (eg [read_00041f-..., read_1243fe-....])
65 std::vector<std::string> fast5_get_multi_read_groups(fast5_file& fh);
66
67 //
68 // Functions to get the samples or metadata
69 //
70
71 // get the raw samples from this file
72 raw_table fast5_get_raw_samples(fast5_file& fh, const std::string& read_id, fast5_raw_scaling scaling);
73
74 // Get the sequencing kit
75 std::string fast5_get_sequencing_kit(fast5_file& fh, const std::string& read_id);
76
77 // Get the experiment type attribute
78 std::string fast5_get_experiment_type(fast5_file& fh, const std::string& read_id);
79
80 // Get sample rate, and ADC-to-pA scalings
81 fast5_raw_scaling fast5_get_channel_params(fast5_file& fh, const std::string& read_id);
82
83 // Get the start time of this read
84 uint64_t fast5_get_start_time(fast5_file& fh, const std::string& read_id);
85
86 //
87 // Internal utility functions
88 //
89
90 // get the name of the raw read in the file (eg Read_1234)
91 std::string fast5_get_raw_read_internal_name(fast5_file& fh);
92
93 // get the name of the raw read group (eg /Raw/Read/Read_1234 or /read_00041f-.../Raw/)
94 std::string fast5_get_raw_read_group(fast5_file& fh, const std::string& read_id);
95
96 //
97 std::string fast5_get_string_attribute(fast5_file& fh, const std::string& group_name, const std::string& attribute_name);
98
99 uint8_t fast5_is_vbz_compressed(fast5_file& fh, const std::string& read_id);
100
101 #endif