nilesh-iiita / pysam

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

str(AlignedRead) does not format SAM tags correctly #74

Closed GoogleCodeExporter closed 9 years ago

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

1. Download http://pysam.googlecode.com/hg/tests/ex9_nofail.bam
2. Run the two line python script:

import pysam
for read in pysam.Samfile("ex9_nofail.bam", "rb"): print read

What is the expected output? What do you see instead?

Observed:

$ python
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pysam
>>> for read in pysam.Samfile("ex9_nofail.bam", "rb"): print read
... 
CUESOXRA74  0   1   0   10  [(0, 77), (1, 1), (0, 
222)]   -1  -1  300 GCCTTTTATAATTATTATAAATTTCGGTTGACCCGACCCCATTAGACAGAGTCTATTAAAGCCC
CGTGAAAGCCCGGCAAAACCCAGTAGCGCAGAGATCGGCGAGGGCGAATTTTCGATTGCATTTTCGTTCGTTTCTCTTCT
GAATTTCTGTAATCTGTAACGATGTCTCAGACTACTGTCCTCAAGGTTGCTATGTCATGTCAGGGCTGTGTTGGAGCCGC
CAAAAGGGTCTTGGGGAAACTGGAAGGTGTTGAAACATTTGACATCGACATAGATGCACAAAAGGTGACTGTGAAA    1BB
@@BBHFHHHHHIIHIHFFF@@A@@>9>?999<0////8888>=??@DDDDFFFF???:;;;;AAA???DDDDFFFAAAAF
FD8AAFFFC???CFFFFFFFFFFFFFFFFAAAAFFFFCCCF<<<<F?88FFFFFFFFFFFC:::666DAA:::DDFA@@@
FFFFFFFFFDDDDDFFF?;;;FFFFFFFDDDDFFFFFFFFFFD666DBBBA>=424226622....666=?==4466444
@?4444==?;;;9688<0...:::9<:7988989????984444A@?AABBA=?==;   [('AS', 260), ('XS', 
239), ('XF', 2), ('XE', 3), ('XN', 1), ('RG', 'mu16_454_mu16')]

Expected output as from samtools:

$ samtools view ex9_nofail.bam 
CUESOXRA74  0   CUTC000001  1   10  77M1I222M   *   0   0   GCCTTTTATAATTATTATAAATTTCGGTTGACCCG
ACCCCATTAGACAGAGTCTATTAAAGCCCCGTGAAAGCCCGGCAAAACCCAGTAGCGCAGAGATCGGCGAGGGCGAATTT
TCGATTGCATTTTCGTTCGTTTCTCTTCTGAATTTCTGTAATCTGTAACGATGTCTCAGACTACTGTCCTCAAGGTTGCT
ATGTCATGTCAGGGCTGTGTTGGAGCCGCCAAAAGGGTCTTGGGGAAACTGGAAGGTGTTGAAACATTTGACATCGACAT
AGATGCACAAAAGGTGACTGTGAAA   1BB@@BBHFHHHHHIIHIHFFF@@A@@>9>?999<0////8888>=??@DDDDF
FFF???:;;;;AAA???DDDDFFFAAAAFFD8AAFFFC???CFFFFFFFFFFFFFFFFAAAAFFFFCCCF<<<<F?88FF
FFFFFFFFFC:::666DAA:::DDFA@@@FFFFFFFFFDDDDDFFF?;;;FFFFFFFDDDDFFFFFFFFFFD666DBBBA
>=424226622....666=?==4466444@?4444==?;;;9688<0...:::9<:7988989????984444A@?AABB
A=?==;  AS:i:260    XS:i:239    XF:i:2  XE:i:3  XN:i:1  RG:Z:mu16_454_mu16

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

pysam 0.5, Mac OS X Snow Leopard.

Please provide any additional information below.

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

GoogleCodeExporter commented 9 years ago
str(AlignedRead) is not supposed to return valid SAM format.

Original comment by andreas....@gmail.com on 19 Oct 2011 at 7:54