Cython API to import a column and a view from a DMS to another DMS
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
#cython: language_level=3
|
||||
|
||||
from .obitypes cimport const_char_p
|
||||
from .obitypes cimport const_char_p, \
|
||||
obiversion_t
|
||||
|
||||
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,7 +8,9 @@ __OBIDMS_COLUMN_CLASS__ = {}
|
||||
|
||||
from ..capi.obitypes cimport name_data_type, \
|
||||
obitype_t, \
|
||||
OBI_BOOL
|
||||
obiversion_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]
|
||||
|
||||
|
||||
@staticmethod
|
||||
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
|
||||
|
||||
|
||||
@staticmethod
|
||||
def new_column(View view,
|
||||
object column_name,
|
||||
|
@ -37,6 +37,8 @@ from ..capi.obitypes cimport is_a_DNA_seq, \
|
||||
OBI_SEQ, \
|
||||
OBI_STR
|
||||
|
||||
from ..capi.obidms cimport obi_import_view
|
||||
|
||||
import importlib
|
||||
import inspect
|
||||
import pkgutil
|
||||
@ -54,6 +56,12 @@ cdef class View(OBIWrapper) :
|
||||
return __VIEW_CLASS__.get(view_type, View)
|
||||
|
||||
|
||||
@staticmethod
|
||||
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")
|
||||
|
||||
|
||||
@staticmethod
|
||||
def new(DMS dms,
|
||||
object view_name,
|
||||
|
Reference in New Issue
Block a user