lixin6135 / pysam

Automatically exported from code.google.com/p/pysam
0 stars 0 forks source link

pysam.Samfile(sam_filename) won't work without SAM headers #73

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?

1. Make a SAM file with no header (they are optional), e.g. decompress this 
from the unit tests:

http://code.google.com/p/pysam/source/browse/tests/ex1.sam.gz

2. Try and open it with:

>>> import pysam
>>> sam = pysam.Samfile("ex1.sam", "r")

What is the expected output?

Since mode was explicitly text (not binary), pysam should assume SAM not BAM, 
and load it.

What do you see instead?

Traceback (most recent call last):
...
  File "csamtools.pyx", line 459, in csamtools.Samfile.__cinit__ (pysam/csamtools.c:4992)
  File "csamtools.pyx", line 591, in csamtools.Samfile._open (pysam/csamtools.c:6438)
ValueError: file header is empty (mode='r') - is it SAM/BAM format?

What version of the product are you using? On what operating system?

pysam 0.5, Mac OS X Snow Leopard.

Original issue reported on code.google.com by p.j.a.c...@googlemail.com on 13 Oct 2011 at 3:10

GoogleCodeExporter commented 8 years ago
Thanks,

opening a samfile without header now should work.

Note though, that not much else is possible such as calling fetch() or pileup().

Best wishes,
Andreas

Original comment by andreas....@gmail.com on 17 Oct 2011 at 9:45

GoogleCodeExporter commented 8 years ago
Thanks, but I don't see it on the trunk yet:
http://code.google.com/p/pysam/source/list

Original comment by p.j.a.c...@googlemail.com on 17 Oct 2011 at 10:01

GoogleCodeExporter commented 8 years ago
This issue was closed by revision 6480d5c5976c.

Original comment by andreas....@gmail.com on 19 Oct 2011 at 9:37