brittneybrinsfield / pysam

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

CIGAR String Does not accept tuples of length 1 #97

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
When trying to create a new read and a perfect cigar string an error will be 
thrown instead of a proper read.  

repo steps:

import pysam
a = pysam.AlignedRead()
a.cigar ( (0, 5) )

I would expect this to work, however it throws an error: 

TypeError                                 Traceback (most recent call last)
<ipython-input-4-d6e54a9ef547> in <module>()
----> 1 a.cigar = ( (0, 5) )

/usr/local/lib/python2.7/dist-packages/pysam-0.6-py2.7-linux-i686.egg/csamtools.
so in csamtools.AlignedRead.cigar.__set__ (pysam/csamtools.c:18674)()

TypeError: 'int' object is not iterable

I am using version .6 of pysam

Original issue reported on code.google.com by gabriel....@gmail.com on 6 Aug 2012 at 10:00

GoogleCodeExporter commented 9 years ago
That's not a tuple of length 1. It's a tuple of length 2, both entries being 
ints.

You need to explicitly create a tuple of tuples.
a.cigar( ( (0,5), ) )

Original comment by finkerna...@mathematik.uni-marburg.de on 8 Oct 2012 at 3:13

GoogleCodeExporter commented 9 years ago
Thanks to you both! 

I close the issue.

Best wishes,
Andreas

Original comment by andreas....@gmail.com on 8 Oct 2012 at 3:23