// an example programme that uses slow5lib to sequentially read raw SLOW5 records using one thread // and decode records in prallel using multiple threads (openMP) #include #include #include #include #define FILE_PATH "examples/example.slow5" #define READ_BUFFER_SIZE 1024 //number of reads to be loaded in one go int main(){ //open the SLOW5 file slow5_file_t *sp = slow5_open(FILE_PATH,"r"); if(sp==NULL){ fprintf(stderr,"Error in opening file\n"); exit(EXIT_FAILURE); } //for simplicity assume file has less than READ_BUFFER_SIZE reads char *mem[READ_BUFFER_SIZE] = {NULL}; //memory to store raw records size_t bytes[READ_BUFFER_SIZE] = {0}; //memory to store raw record sizes int n_rec = 0; //number of records read //read a batch of raw records for(n_rec=0;n_recread_id, rec->len_raw_signal); } slow5_rec_free(rec); //free the SLOW5 record free(mem[i]); //free the raw record } fprintf(stderr, "Decoded %d raw records\n", n_rec); //close the SLOW5 file slow5_close(sp); return 0; }