-
Notifications
You must be signed in to change notification settings - Fork 290
Closed
Description
I was looking to fix the incorrect documentation here:
https://pysam.readthedocs.io/en/latest/usage.html#working-with-tabix-indexed-files
(Just a couple of minor issues).
I thought I'd better run the latest version of the code from git, and I found that my 'simple test' turned up a segfault...
import pysam
tbx = pysam.TabixFile("tests/tabix_data/example_0v26.bed.gz")
for row in tbx.fetch("chr1", 1000, 2000):
# OK
print(str(row))
for row in tbx.fetch("chr1", 1000, 2000):
# Gives "chromosome is c"
print("chromosome is", row[0])
for row in tbx.fetch("chr1", 1000, 2000, parser=pysam.asTuple()):
# Gives AttributeError: 'pysam.libctabixproxies.TupleProxy' object has no attribute 'contig'
print("chromosome is", row.contig)
# OK
print("first field (chrom)=", row[0])
print("OK, I'm going to run this")
for row in tbx.fetch("chr1", 1000, 2000, parser=pysam.asBed()):
print("here we go...")
# Segmentation fault (core dumped) 😂
print("name is", row.name)
print("Done!")
The output is:
$ python tests/test_simple_tabix.py
chr1 1737 2090
chr1 1737 4275
chr1 1873 1920
chr1 1873 3533
chromosome is c
chromosome is c
chromosome is c
chromosome is c
first field (chrom)= chr1
first field (chrom)= chr1
first field (chrom)= chr1
first field (chrom)= chr1
OK, I'm going to run this
here we go...
Segmentation fault (core dumped)
Metadata
Metadata
Assignees
Labels
No labels