File: slow5_mt_api.md

package info (click to toggle)
libslow5lib 1.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 25,280 kB
  • sloc: ansic: 13,123; python: 1,353; sh: 600; makefile: 98; cpp: 40
file content (55 lines) | stat: -rwxr-xr-x 2,580 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# slow5lib easy multi-thread API

**NOTE: This API documentation is sparse. If something is not clear do not hesitate to open an [issue](https://github.com/hasindu2008/slow5lib/issues).**

The easy multi-thread (called *mt* API) API allows the user to access SLOW5 files using multiple threads, simply by specifying the number of threads, rather than needing to write their own multi-threading code. This API is for programmer's convenience, rather than for efficiency. This API is not meant to be used by a programmer who has the expertise to write multi-threaded code and use the slow5 low-level API directly. While fetching using this API would be faster than using a single thread, it would not be as efficient as using low-level API functions directly from the programmer's own multi-threaded code.

To use this API, include <slow5/slow5_mt.h> in your programme. Make sure to explicitly enable easy multi-thread API as `make slow5_mt=1`, during compile time of slow5lib.

## Data structures

The *slow5_mt_t* structure stores internal multi-threading related data. This structure has the following form:

```
typedef struct {
    // private members that are not to be directly accessed*/
} slow5_mt_t;
```

The *slow5_batch_t* structure stores a batch of SLOW5 records. This structure has the following form:

```
typedef struct {
    // private members that are not to be directly accessed*/
    slow5_rec_t **slow5_rec;
} slow5_batch_t;
```

## API functions

### Common

* [slow5_init_mt](mt_api/slow5_init_mt.md)<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;initialises a slow5 multi-thread structure
* [slow5_free_mt](mt_api/slow5_free_mt.md)<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;frees up a slow5 multi-thread structure
* [slow5_init_batch](mt_api/slow5_init_batch.md)<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;initialises a slow5 record batch
* [slow5_free_batch](mt_api/slow5_free_batch.md)<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;frees up a slow5 record batch

### Reading and access

* [slow5_get_next_batch](mt_api/slow5_get_next_batch.md)<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;fetches the next batch of records at the current file pointer of a SLOW5 file
* [slow5_get_batch](mt_api/slow5_get_batch.md)<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;fetches a batch of SLOW5 records corresponding to a given batch of read IDs


### Writing and editing

* [slow5_write_batch](mt_api/slow5_write_batch.md)<br/>
  &nbsp;&nbsp;&nbsp;&nbsp;writes a batch of SLOW5 records to a SLOW5 file


You may also refer to the examples [here](https://github.com/hasindu2008/slow5lib/tree/master/examples/mt) on how these functions can be used.