Skip to content

Commit

Permalink
fix the spamming warning due to the missing reads from split read bas…
Browse files Browse the repository at this point in the history
…ecalling
  • Loading branch information
hasindu2008 committed Aug 9, 2024
1 parent 3c03d2d commit 1935adb
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 5 deletions.
1 change: 1 addition & 0 deletions src/f5c.c
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ core_t* init_core(const char* bamfilename, const char* fastafile,
STDERR("Error in loading SLOW5 index for %s\n",slow5file);
exit(EXIT_FAILURE);
}
slow5_set_skip_rid();

if(drna_detect(core->sf)) {
opt.flag |= F5C_RNA;
Expand Down
5 changes: 3 additions & 2 deletions src/f5cio.c
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,10 @@ void read_slow5_single(core_t* core, db_t* db, int i){


if(record==NULL || len <0){ //todo : should we free if len<0
db->bad_fast5_file++;
//db->bad_fast5_file++;
__sync_fetch_and_add(&db->bad_fast5_file,1);
if (core->opt.flag & F5C_SKIP_UNREADABLE) {
WARNING("Slow5 record for read [%s] is unavailable/unreadable and will be skipped", qname.c_str());
//WARNING("Slow5 record for read [%s] is unavailable/unreadable and will be skipped", qname.c_str());
db->sig[i]->nsample = 0;
db->sig[i]->rawptr = NULL;
} else {
Expand Down
12 changes: 11 additions & 1 deletion src/meth_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,17 @@ int meth_main(int argc, char* argv[], int8_t mode) {
if(core->qc_fail_reads + core->failed_calibration_reads + core->failed_alignment_reads > core->total_reads/2){
WARNING("%ld out of %ld reads failed. Double check --pore and --rna options.",(long)core->qc_fail_reads + core->failed_calibration_reads + core->failed_alignment_reads,(long)core->total_reads);
}

if(core->bad_fast5_file > core->total_reads/10.0){
WARNING("%ld out of %ld reads missing in FAST5/SLOW5.",(long)core->bad_fast5_file,(long)core->total_reads);
}
if(core->qc_fail_reads + core->failed_calibration_reads + core->failed_alignment_reads + core->bad_fast5_file >= core->total_reads){
ERROR("all %ld out of %ld reads failed. Check the input files.",(long)core->total_reads,(long)core->total_reads);
exit(EXIT_FAILURE);
}
if(core->total_reads==0){
ERROR("%s","0 reads processed. Check the input files.");
exit(EXIT_FAILURE);
}
//free the core data structure
free_core(core,opt);

Expand Down
18 changes: 16 additions & 2 deletions src/resquiggle.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ core_t* init_core_rsq(opt_t opt, const char *slow5file, double realtime0) {
STDERR("Error in loading SLOW5 index for %s\n",slow5file);
exit(EXIT_FAILURE);
}
slow5_set_skip_rid();
if(drna_detect(core->sf)) {
core->opt.flag |= F5C_RNA;
opt.flag |= F5C_RNA;
Expand Down Expand Up @@ -483,9 +484,10 @@ static void read_slow5_single(core_t* core, db_t* db, int i){
MALLOC_CHK(db->sig[i]);

if(record==NULL || len <0){ //todo : should we free if len<0
db->bad_fast5_file++;
__sync_fetch_and_add(&db->bad_fast5_file,1);
//db->bad_fast5_file++;
if (core->opt.flag & F5C_SKIP_UNREADABLE) {
WARNING("Slow5 record for read [%s] is unavailable/unreadable and will be skipped", db->read_id[i]);
//WARNING("Slow5 record for read [%s] is unavailable/unreadable and will be skipped", db->read_id[i]);
db->sig[i]->nsample = 0;
db->sig[i]->rawptr = NULL;
} else {
Expand Down Expand Up @@ -785,9 +787,21 @@ int resquiggle_main(int argc, char **argv) {

fprintf(stderr,"\n");

//todo duplicate code from meth_main.c - can be modularised
if(core->qc_fail_reads + core->failed_calibration_reads + core->failed_alignment_reads > core->total_reads/2){
WARNING("%ld out of %ld reads failed. Double check --pore and --rna options.",(long)core->qc_fail_reads + core->failed_calibration_reads + core->failed_alignment_reads,(long)core->total_reads);
}
if(core->bad_fast5_file > core->total_reads/10.0){
WARNING("%ld out of %ld reads missing in SLOW5.",(long)core->bad_fast5_file,(long)core->total_reads);
}
if(core->qc_fail_reads + core->failed_calibration_reads + core->failed_alignment_reads + core->bad_fast5_file >= core->total_reads){
ERROR("all %ld out of %ld reads failed. Check the input files.",(long)core->total_reads,(long)core->total_reads);
exit(EXIT_FAILURE);
}
if(core->total_reads==0){
ERROR("%s","0 reads processed. Check the input files.");
exit(EXIT_FAILURE);
}

kseq_destroy(seq);
gzclose(fp);
Expand Down

0 comments on commit 1935adb

Please sign in to comment.