aboutsummaryrefslogtreecommitdiff
path: root/kmer.py
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2014-02-02 14:56:00 -0500
committerCalvin Morrison <mutantturkey@gmail.com>2014-02-02 14:56:00 -0500
commit79af85ef9a4983527b6498c858b30525bbe502f1 (patch)
treef0510330f404fab9631e7af44e9e22f72d5082bb /kmer.py
parent1e12e8802e1a2ad5f02c2d47ebea6226d4f871d2 (diff)
somewhat working python module
Diffstat (limited to 'kmer.py')
-rw-r--r--kmer.py26
1 files changed, 16 insertions, 10 deletions
diff --git a/kmer.py b/kmer.py
index 9326aab..c22ec1e 100644
--- a/kmer.py
+++ b/kmer.py
@@ -1,7 +1,7 @@
'''
- The kmer module provides an interface between the C-library
- for quikr kmer counting in Python
+The kmer module provides an interface between the C-library
+for quikr kmer counting in Python
'''
__author__ = "Calvin Morrison"
@@ -16,17 +16,23 @@ __status__ = "development"
import numpy as np
import ctypes as c
try:
- libkmer = c.CDLL("libkmer.so");
+ libkmer = c.CDLL("libkmer.so");
except:
- raise Exception("Error: could not load libkmer.so")
+ raise Exception("Error: could not load libkmer.so")
def load_kmer_counts_from_file(fh, kmer):
- '''
- '''
- width = (kmer ** 4) + 1
- libkmer.get_kmer_counts_from_file.restype = c.POINTER(c.c_ulonglong * width )
+ '''
+ '''
+ ret = []
+ width = (kmer ** 4) + 1
+ libkmer.get_kmer_counts_from_filename.restype = c.POINTER(c.c_ulonglong * width )
+ counts = libkmer.get_kmer_counts_from_filename(fh, kmer);
- counts = libkmer.get_kmer_counts_from_filename(fh, kmer);
+ if counts.contents:
+ for i in counts.contents:
+ ret.append(i)
+ else:
+ ret = 'error'
- return counts
+ return ret