brittneybrinsfield / pysam

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

Negative integer-valued tag #79

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
diff = -2
tags = []   
tags.append(("XD", int(diff)))
aligned_read.tags = tags
output_bam.write(aligned_read)

What is the expected output? What do you see instead?
I expect to see: XD:i:-2 in the output bam file
Instead, I see XD:i:254

What version of the product are you using? On what operating system?
pysam 0.5, python 2.6, Linux OS

Please provide any additional information below.
I am trying to add an integer valued tag to my bam output using pysam. When I 
give this tag a negative value, I get strange results in the output file. 

Portion of my code for adding the tag to an AlignedRead:

tags = []   
tags.append(("XD", int(diff)))
aligned_read.tags = tags
output_bam.write(aligned_read)

If diff is positive, the output is as I expect. However, if diff is negative, I 
get strange output. For example, if diff is "-2", I get:

XD:i:254

When I do something similar in bamtools from C++ the output is fine.

Original issue reported on code.google.com by boots1...@gmail.com on 9 Nov 2011 at 12:34

GoogleCodeExporter commented 9 years ago
Thank you for reporting this.

Could you provide a complete example, please?

I have trouble reproducing it.

Bw,
Andreas 

Original comment by andreas....@gmail.com on 6 Dec 2011 at 7:49

GoogleCodeExporter commented 9 years ago
Hello,
Sorry for the delayed response. I have since upgraded my version of samtools 
(I'm not sure if this matters) and am no longer getting this error. I am now 
using version 0.1.18. Before we were using a pre-mpileup version, I believe 
0.1.8.
Best,
~Melissa

Original comment by boots1...@gmail.com on 7 Dec 2011 at 4:46

GoogleCodeExporter commented 9 years ago
Thanks, I am closing this issue.

Best wishes,
Andreas

Original comment by andreas....@gmail.com on 16 Aug 2012 at 9:12