Closed bkohrn closed 5 years ago
Hi Brendan,
This is a subtle issue that has to do with how a new BamRecord is constructed. The default constructor is just to construct a placeholder that doesn't allocate any memory. To actually assign memory to this object, you need to call init()
. e.g.
SeqLib::BamRecord temp_bam_entry;
temp_bam_entry.init();
Perhaps the default should be to assign memory with the default constructor. But for now, just do the init()
call.
Thanks for the help; that fixed that problem. My next issue is that one of the next steps in my program requires sorting the file with samtools sort -n, and samtools is telling me I have a truncated BAM file. This happens in the middle of the program; the file I'm writing is supposed to be an unmapped BAM. It looks like it's the correct size, but samtools doesn't like it. Do I need to do something besides temp_bam.Close() to keep the file from being truncated?
Again, thanks for the help, Brendan
Never mind, figured it out. I have a new issue, but I'll open a new ticket for it, as it may be a more serious issue that needs to be addressed.
I am attempting to migrate a program I wrote from using bamtools to using SeqLib. Unfortunately, my C++ isn't that great (I do most of my programing in Python, but would like to use C++ for this purpose). I managed to figure out compiling (I think), but I'm getting a segmentation fault when I call BarRecord::SetQname. The problematic section of code (as determined by getting an output every few lines until the error) is:
and the error I am getting is "Segmentation fault: 11". I am working on a Apple computer running MacOSX 10.12.6.
Any idea why this is happening/what I can do to fix it?
Brendan