Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Floating point exception if fastq is empty #56

Open
nick-youngblut opened this issue Nov 6, 2023 · 10 comments
Open

Floating point exception if fastq is empty #56

nick-youngblut opened this issue Nov 6, 2023 · 10 comments

Comments

@nick-youngblut
Copy link

When running falco in a sequencing processing pipeline, some fastq files can be empty. In such cases, falco (v.1.2.1) throws an error:

Floating point exception

It would be helpful if falco just provided a warning if the fastq is empty. This could be an option (e.g., falco --just-warn).

@tamuanand
Copy link

I am facing the same issues. It would be great if the program does not die and instead it should exit gracefully with exit code 0 - currently it exits with exit code 136

It would be great if this feature is implemented

@andrewdavidsmith
Copy link
Collaborator

@tamuanand Can you confirm the version of Falco you are using? The most recent is 1.2.2.

@tamuanand
Copy link

Yes - I am using 1.2.2 - installed via conda

falco --version
falco 1.2.2

@andrewdavidsmith
Copy link
Collaborator

Seems fixable, but I need to know how to reproduce the problem. Can you provide any additional info?

@tamuanand
Copy link

tamuanand commented May 7, 2024

I need to know how to reproduce the problem

Something like this

touch 123_R1.fastq.gz 123_R2.fastq.gz

falco 123_R1.fastq.gz 123_R2.fastq.gz

[limits]        using file <path_to>/falco/Configuration/limits.txt
[adapters]      using file <path_to>/falco/Configuration/adapter_list.txt
[contaminants]  using file <path_to>/falco/Configuration/contaminant_list.txt
[Tue May  7 11:09:44 2024] Started reading file 123_R1.fastq.gz
[Tue May  7 11:09:44 2024] reading file as gzipped FASTQ format
[running falco|===================================================|9223372036854775808%]
[Tue May  7 11:09:45 2024] Finished reading file
[Tue May  7 11:09:45 2024] Writing summary to ./123_R1.fastq.gz_summary.txt
[Tue May  7 11:09:45 2024] Writing text report to ./123_R1.fastq.gz_fastqc_data.txt
[Tue May  7 11:09:45 2024] Writing HTML report to ./123_R1.fastq.gz_fastqc_report.html
Floating point exception

@andrewdavidsmith
Copy link
Collaborator

@tamuanand Thanks -- this helps. I'll see what I can do.

@tamuanand
Copy link

Thanks @andrewdavidsmith

  • FWIW if you run fastp on the same set of files, it will run and give you an output file (yes it is meaningless) - but it does not exit with a non-zero exit code

@andrewdavidsmith
Copy link
Collaborator

@tamuanand @nick-youngblut This particular error is masking some others that probably need to be resolved at the same time. If it were just the floating point issue, I could fix it right away, but once it gets past that point, others emerge. Thanks for your patience.

@tamuanand
Copy link

@andrewdavidsmith - a suggestion

  • check if file is size 0 or do a head -n 100 of the fastq after zcat and if no fastq related headers found, then exit with exit code 0

@andrewdavidsmith
Copy link
Collaborator

@tamuanand I will probably do something like that, because clearly empty input files can't be allowed. Some related issues have emerged. I think the best thing is for me to try and close this issue using your suggestion as soon as possible, and open another for the problems that emerged while looking into this.

If you want to do the check yourself and make a PR, that's fine. Let me know asap because I might fix this later today. This is roughly what I would do:

static size_t
falco_filesize(const string &filename) {
  struct stat sb;
  stat(filename.c_str(), &sb);
  return sb.st_size;
}

and then where the check happens:

if (falco_filesize(some_input_filename) == 0)
  throw runtime_error("empty input file: " + input_filename);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants