Error in pysam: trying to read BAM file using CYTHON
1
0
Entering edit mode
6.5 years ago
ammarsabir15 ▴ 70

I am trying to read BAM file using CYTHON via pysam but was not successful in doing so because of errors that are pasted below with code,

>>> pyximport.install()
(None, <pyximport.pyximport.PyxImporter object at 0x7fc5c0c12ba8>)
>>> import _pysam_flagstat
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named '_pysam_flagstat'
>>> from pysam.calignmentfile cimport AlignmentFile,AlignedSegment 
File "<stdin>", line 1
from pysam.calignmentfile cimport AlignmentFile,AlignedSegment 
                                ^
SyntaxError: invalid syntax
>>> import cython
>>> from pysam.calignmentfile cimport AlignmentFile,AlignedSegment 
 File "<stdin>", line 1
 from pysam.calignmentfile cimport AlignmentFile,AlignedSegment 
                                ^
SyntaxError: invalid syntax

I have installed pysam and cython correctly but don't now I am seeing this error. Is there any solution?

next-gen alignment pysam • 1.8k views
ADD COMMENT
0
Entering edit mode
6.5 years ago

The cython stuff, such as cimport isn't really intended for use in interactive sessions, to me knowledge. That's all for writing modules, which it doesn't appear you're doing. Just use pysam in the normal python manner.

ADD COMMENT
0
Entering edit mode

So you mean to say that cimport is not used for reading BAM files?

ADD REPLY
0
Entering edit mode

It's not directly used in python interactive sessions to do so. One instead does import pysam.

ADD REPLY

Login before adding your answer.

Traffic: 2132 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6