MaciekAber / pysam

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

samfile.fetch() retrieves chromosome id based on 0 indexing #34

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. samfile.fetch('chr2') retrieves coordinates from chromosome 1 in the bam 
file.

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

It should retrieve coordinates from chromsome 2. It's ok to use 0 based 
numbering for coordinates, but retrieving a different chromosome number is 
not correct behaviour

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

pysam-0.1.2, CentOS 5

Please provide any additional information below.

Original issue reported on code.google.com by vasishtr...@gmail.com on 7 Jun 2010 at 2:56

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago
I can't reproduce this on rev 81ec15fe64a3

samfile.fetch('chr2') correctly fetche reads aligned against chr2 in my 
(sorted, indexed) bam file.

I wouldn't suppose this has anything to do with '0 based indexing', chromosomes 
within a bam are basically in arbitrary order, and you need to use 
bamfile.references
to see which one they are actually aligned to.

What does bamfile.references[list(samfile.fetch('chr2'))[0].rname] say, 
vasishtreeddy?

Plesae also controst with issue:25

Original comment by finkerna...@mathematik.uni-marburg.de on 14 Jun 2010 at 1:42

GoogleCodeExporter commented 8 years ago
I think I messed up there, it's the same as issue:25. Sorry about the 
confusion. samfile.fetch behaves as expected, but the rname is decremented by 1.

Original comment by vasishtr...@gmail.com on 14 Jun 2010 at 2:40

GoogleCodeExporter commented 8 years ago
thanks. I admit, the chromosome access can be improved.

Original comment by andreas....@gmail.com on 18 Jul 2010 at 6:17