Closed saulpierotti closed 1 year ago
I wanted also to add that when failing like this in generating the inputs, STITCH does not return an error code but just a warning. I think that this is not desirable because when used in a pipeline (nextflow in my case) it is not possible to catch the error. Then, when running EM from the generated inputs, some of the ./inputs
files are missing and STITCH exits with code 1.
I think I tracked down the error. This line tries to access the vector bxtagInteger_ord
with an index corresponding to the read number.
However bxtagInteger_ord
is of size 0 when use_bx_tag
is FALSE, leading to undefined behaviour.
bxtagInteger_ord
is passed as an argument to to the function cpp_read_reassign
, and it is defined in the R code here:
In my case I was not manually setting use_bx_tag
to FALSE, but it is set to FALSE automatically here in case no bx tags are present in the bam file:
I tested putting the incriminating line inside a if (use_bx_tag)
statement and the error disappears in my test case.
Thanks for the great post! That made for a very simple fix, which I've now pushed.
The fact that R is giving a non-zero exit code with the above behaviour is very weird. When I throw a stop() in R it does give a normal error code. I'm not sure this is something I can easily sort out at this time. This feels more like an Rcpp/mclapply/R problem to me. A simple hack in your script is to check for the desired output and throw an error if it doesn't exist would sort you out here, though I acknowledge it's inelegant.
Thanks for the very quick fix!
I have been experiencing segmentation fault errors in STITCH on an intermittent basis. This always happens when loading the bamfiles, not during EM. I managed to narrow the issue down to a single bam file and a single chromosome (though also other bam files cause the same issue). The issue happens only when nCores > 1. I was able to reproduce the issue in several different machines. I am using the STITCH installation from conda.
Here the code that I run:
This is my output of
sessionInfo()
:This is the segfault error:
I am willing to share the bamfile and posfile if needed.