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

Uncompressed BAM output from pysam v0.8 is not readable by SAMTools v0.1.19 #43

Closed
MikkelSchubert opened this issue Sep 30, 2014 · 4 comments

Comments

@MikkelSchubert
Copy link
Contributor

When using the following script:

#!/usr/bin/env python
import sys
import pysam
with pysam.Samfile(sys.argv[1]) as input_handle:
    with pysam.Samfile(sys.argv[2], "wbu", template=input_handle) as output_handle:
        for record in input_handle:
            output_handle.write(record)

and Pysam v0.7.8, both SAMTools 0.1.19 and 1.x is able to read the files. However, when using Pysam 0.8.0, only SAMTools v1.x is able to read the file, while SAMTools v0.1.19 produces the follow output:

$ python example.py input.bam output.bam
$ samtools0.1.19 view output.bam
[bam_header_read] EOF marker is absent. The input is probably truncated.
[bam_header_read] invalid BAM binary header (this is not a BAM file).
[main_samview] fail to read the header from "out.bam".

This is in contrast with uncompressed output from SAMTools v1.x, which is readable by SAMTools v0.1.19.

$ samtools1.1 view -bu input.bam > output.bam
$ samtools0.1.19 view output.bam
[OK]

Similarly, the uncompressed output from Pysam 0.8.0 is not readable by Pysam 0.7.x either.

@AndreasHeger
Copy link
Contributor

Thanks, I will check if that can be fixed.

Best wishes,
Andreas

@AndreasHeger
Copy link
Contributor

Thanks, I have fixed this, in htslib, mode 'bw0' seems to work (rather than 'bwu').

Best wishes,
Andreas

@AndreasHeger
Copy link
Contributor

need to redo, changes lost in bricked laptop.

@AndreasHeger AndreasHeger reopened this Oct 9, 2014
@AndreasHeger
Copy link
Contributor

fixed, see d88d3f4

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

2 participants