nodrogluap / OpenDBA

GPU-accelerated Dynamic Time Warp (DTW) Barycenter Averaging
Other
64 stars 13 forks source link

Feature request: support SLOW5 as input #16

Closed hasindu2008 closed 2 years ago

hasindu2008 commented 2 years ago

Will it be possible to get support for BLOW5 files as input alongside FAST5? Using slow5tools it is very convenient to do signal manipulation compared to FAST5 files and therefore extracts reads that meet certain criteria (e.g., #15) can be done prior to launching openDBA by the user.

Compared to supporting FAST5, supporting BLOW5 should be relatively very easy:

For a given BLOW5 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;
    int ret=0;

    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;i<len_raw_signal;i++){
            double pA = TO_PICOAMPS(rec->raw_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);
    }

    slow5_rec_free(rec);

    slow5_close(sp);

I would like to know your thoughts on this.

nodrogluap commented 2 years ago

Hi,

Would be happy to have BLOW5 support. If you could make a PR it would happen a lot faster :-) Such a PR should ideally include a test case, like there is for HDF5 right now.

Cheers,

Paul

nodrogluap commented 2 years ago

Addressed by PR #17