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

wrong reference length reported on big endian archs #147

Open
satta opened this issue Aug 8, 2017 · 0 comments
Open

wrong reference length reported on big endian archs #147

satta opened this issue Aug 8, 2017 · 0 comments

Comments

@satta
Copy link

satta commented Aug 8, 2017

On big-endian platforms, an apparent problem seems to make bamtools' bamReader.GetReferenceData() return a negative int32_t value as a reference sequence length.

I've attached a small example program bamtools_example.tar.gz to test on both platforms with the BAM file generated by the problematic test case in REAPR, and I can confirm that the problem occurs consistently.

amd64:

[satta:/tmp/tmp.Z5tPunaEOw/result] $ g++ -o bamtools_test  ~/bamtools_test.cpp -I /usr/include/bamtools -lbamtools
[satta:/tmp/tmp.Z5tPunaEOw/result] $ samtools view -H 00.in.bam | grep SQ
@SQ	SN:foo	LN:1000111
[satta:/tmp/tmp.Z5tPunaEOw/result] $ ./bamtools_test 00.in.bam
ref: foo, length: 1000111

mips:

(sid_mips-dchroot)satta@minkus:/tmp/tmp.cWdSvSEoaT/result$ g++ -o bamtools_test ~/bamtools_test.cpp -I /usr/include/bamtools -lbamtools
(sid_mips-dchroot)satta@minkus:/tmp/tmp.cWdSvSEoaT/result$ samtools view -H 00.in.bam | grep SQ
@SQ	SN:foo	LN:1000111
(sid_mips-dchroot)satta@minkus:/tmp/tmp.cWdSvSEoaT/result$ ./bamtools_test 00.in.bam
ref: foo, length: -81

Notice how samtools view shows the same length for both archs but the bamtools test program does not.

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

1 participant