|
From: Jake C. <jc...@st...> - 2011-06-23 20:05:55
|
When attempting to run tabix from a python program in eclipse ide, my
program throws errors. Python version is 2.6, tabix version is 0.2.5,
running on Windows 7. The errors thrown are as follows:
File "C:\Users\jcc7\workspace\GeneZoom\src\genezoom.py", line 113, in main
vcf = vcfReader( options.vcf_file )
File "C:\Users\jcc7\workspace\GeneZoom\src\vcfutils.py", line 75, in
__init__
self._vcf = tabix.Tabix(filename)
File "C:\Python26\lib\tabix.py", line 50, in __init__
self.tabix = tabix_init();
File "C:\Python26\lib\tabix.py", line 32, in tabix_init
tabix = load_shared_library('tabix')
File "C:\Python26\lib\tabix.py", line 22, in load_shared_library
candidates = glob.glob(_path+'/lib'+lib+suf);
UnboundLocalError: local variable 'suf' referenced before assignment
Exception AttributeError: "Tabix instance has no attribute 'tabix'" in
<bound method Tabix.__del__ of <tabix.Tabix instance at 0x034A91C0>> ignored
genezoom.py is my own program, which attempts to define a vcfReader through
vcfutils, by using tabix. But the error is within tabix itself, in the
following code:
def load_shared_library(lib, _path='.', ver='*'):
"""Search for and load the tabix library. The
expectation is that the library is located in
the current directory (ie. "./")
"""
# find from the system path
path = find_library(lib)
if (path == None): # if fail, search in the custom directory
s = platform.system()
if (s == 'Darwin'): suf = ver+'.dylib'
elif (s == 'Linux'): suf = '.so'+ver
candidates = glob.glob(_path+'/lib'+lib+suf);
if (len(candidates) == 1): path = candidates[0]
else: return None
cdll.LoadLibrary(path)
return CDLL(path)
The error thrown is due to the fact that I am running Windows 7, and not
using a Darwin or Linux operating system, thus "suf" is never initialized.
Is there a way to get this to work, or is there a link to a Windows-viable
version (did I just accidentally download the Mac/Linux version instead of
the Windows version)?
|