Commit 7f1ff49a authored by Celine Mercier's avatar Celine Mercier

Cython API to import a column and a view from a DMS to another DMS

parent 4b86aa67
#cython: language_level=3
from .obitypes cimport const_char_p
from .obitypes cimport const_char_p, \
cdef extern from "obidms.h" nogil:
struct OBIDMS_t:
......@@ -17,4 +18,5 @@ cdef extern from "obidms.h" nogil:
char* obi_dms_get_dms_path(OBIDMS_p dms)
char* obi_dms_get_full_path(OBIDMS_p dms, const_char_p path_name)
obiversion_t obi_import_column(const char* dms_path_1, const char* dms_path_2, const char* column_name, obiversion_t version_number)
int obi_import_view(const char* dms_path_1, const char* dms_path_2, const char* view_name_1, const char* view_name_2)
......@@ -8,8 +8,10 @@ __OBIDMS_COLUMN_CLASS__ = {}
from ..capi.obitypes cimport name_data_type, \
obitype_t, \
from ..capi.obidms cimport obi_import_column
from ..capi.obidmscolumn cimport OBIDMS_column_header_p, \
obi_close_column, \
......@@ -59,6 +61,15 @@ cdef class Column(OBIWrapper) :
return __OBIDMS_COLUMN_CLASS__[(obitype, multi_elts)][1]
def import_column(object dms_1, object dms_2, object column_name, obiversion_t version_number):
cdef obiversion_t new_version
new_version = obi_import_column(tobytes(dms_1), tobytes(dms_2), tobytes(column_name), version_number)
if new_version < 0 :
raise Exception("Error importing a column")
return new_version
def new_column(View view,
object column_name,
......@@ -37,6 +37,8 @@ from ..capi.obitypes cimport is_a_DNA_seq, \
from ..capi.obidms cimport obi_import_view
import importlib
import inspect
import pkgutil
......@@ -52,7 +54,13 @@ cdef class View(OBIWrapper) :
def get_view_class(bytes view_type):
global __VIEW_CLASS__
return __VIEW_CLASS__.get(view_type, View)
def import_view(object dms_1, object dms_2, object view_name_1, object view_name_2):
if obi_import_view(tobytes(dms_1), tobytes(dms_2), tobytes(view_name_1), tobytes(view_name_2)) < 0 :
raise Exception("Error importing a view")
def new(DMS dms,
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment