brittneybrinsfield / pysam

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

Invalid header generation #144

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using pysam 0.7.6 under Python 3.3.2.

I create a Samfile wich a custom header, like this:

refs = ['a','b','c']
s = pysam.Samfile('broken.bam', 'wb', referencenames=refs, 
referencelengths=[100]*3)

The resulting header is malformed.

$ samtools view -H broken.bam

@SQ     SN:b'a' LN:100
@SQ     SN:b'b' LN:100
@SQ     SN:b'c' LN:100

It should be:

@SQ     SN:a    LN:100
@SQ     SN:b    LN:100
@SQ     SN:c    LN:100

Those extra b'xxx' are introduced by the (implicit) conversion between bytes 
and strings.

The attached patch provides a fix for this.

Original issue reported on code.google.com by gbrsa...@gmail.com on 6 Nov 2013 at 9:17

Attachments:

GoogleCodeExporter commented 9 years ago
Thanks, fixed!

Best wishes,
Andreas

Original comment by andreas....@gmail.com on 24 Nov 2013 at 11:30