// an example programme that uses slow5lib to read a SLOW5 file sequentially #include #include #include #define FILE_PATH "examples/example.slow5" #define TO_PICOAMPS(RAW_VAL,DIGITISATION,OFFSET,RANGE) (((RAW_VAL)+(OFFSET))*((RANGE)/(DIGITISATION))) 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); } slow5_rec_t *rec = NULL; //slow5 record to be read int ret=0; //for return value //iterate through the file until end while((ret = slow5_get_next(&rec,sp)) >= 0){ printf("%s\t",rec->read_id); uint64_t len_raw_signal = rec->len_raw_signal; for(uint64_t i=0;iraw_signal[i],rec->digitisation,rec->offset,rec->range); printf("%f ",pA); } printf("\n"); } if(ret != SLOW5_ERR_EOF){ //check if proper end of file has been reached fprintf(stderr,"Error in slow5_get_next. Error code %d\n",ret); exit(EXIT_FAILURE); } //free the SLOW5 record slow5_rec_free(rec); //close the SLOW5 file slow5_close(sp); return 0; }