Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OBITools3
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
23
Issues
23
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
OBITools
OBITools3
Commits
fc5a12ba
Commit
fc5a12ba
authored
Feb 29, 2016
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Closes
#34
parent
e323d8e7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
48 additions
and
30 deletions
+48
-30
python/obitools3/obidms/_obidms.pxd
python/obitools3/obidms/_obidms.pxd
+2
-1
python/obitools3/obidms/_obidms.pyx
python/obitools3/obidms/_obidms.pyx
+13
-11
python/obitools3/obidms/_obiseq.cfiles
python/obitools3/obidms/_obiseq.cfiles
+4
-0
python/obitools3/obidms/capi/obiview.pxd
python/obitools3/obidms/capi/obiview.pxd
+6
-4
src/obiview.c
src/obiview.c
+11
-8
src/obiview.h
src/obiview.h
+12
-6
No files found.
python/obitools3/obidms/_obidms.pxd
View file @
fc5a12ba
...
...
@@ -43,6 +43,7 @@ cdef class OBIView:
cdef
Obiview_p
pointer
cdef
str
name
cdef
str
comments
cdef
dict
columns
cdef
dict
columns_pp
# TODO this dict might be unnecessary
cdef
OBIDMS
dms
...
...
@@ -86,7 +87,7 @@ cdef class OBIDMS:
cpdef
close
(
self
)
cpdef
OBIView
open_view
(
self
,
str
view_name
)
cpdef
OBIView
new_view
(
self
,
str
view_name
,
object
view_to_clone
=*
,
list
line_selection
=*
,
str
view_type
=*
)
cpdef
OBIView
new_view
(
self
,
str
view_name
,
object
view_to_clone
=*
,
list
line_selection
=*
,
str
view_type
=*
,
str
comments
=*
)
cpdef
dict
read_view_infos
(
self
,
str
view_name
)
cpdef
dict
read_views
(
self
)
python/obitools3/obidms/_obidms.pyx
View file @
fc5a12ba
...
...
@@ -231,7 +231,7 @@ cdef class OBIDMS_column_line :
cdef
class
OBIView
:
def
__init__
(
self
,
OBIDMS
dms
,
str
view_name
,
bint
new
=
False
,
object
view_to_clone
=
None
,
list
line_selection
=
None
):
def
__init__
(
self
,
OBIDMS
dms
,
str
view_name
,
bint
new
=
False
,
object
view_to_clone
=
None
,
list
line_selection
=
None
,
str
comments
=
""
):
cdef
Obiview_p
view
=
NULL
cdef
int
i
...
...
@@ -256,11 +256,11 @@ cdef class OBIView :
if
new
:
if
view_to_clone
is
not
None
:
if
type
(
view_to_clone
)
==
str
:
view
=
obi_new_view_cloned_from_name
(
dms
.
pointer
,
str2bytes
(
view_name
),
str2bytes
(
view_to_clone
),
line_selection_p
)
view
=
obi_new_view_cloned_from_name
(
dms
.
pointer
,
str2bytes
(
view_name
),
str2bytes
(
view_to_clone
),
line_selection_p
,
str2bytes
(
comments
)
)
else
:
view
=
obi_new_view
(
dms
.
pointer
,
str2bytes
(
view_name
),
(
<
OBIView
>
view_to_clone
).
pointer
,
line_selection_p
)
view
=
obi_new_view
(
dms
.
pointer
,
str2bytes
(
view_name
),
(
<
OBIView
>
view_to_clone
).
pointer
,
line_selection_p
,
str2bytes
(
comments
)
)
elif
view_to_clone
is
None
:
view
=
obi_new_view
(
dms
.
pointer
,
str2bytes
(
view_name
),
NULL
,
line_selection_p
)
view
=
obi_new_view
(
dms
.
pointer
,
str2bytes
(
view_name
),
NULL
,
line_selection_p
,
str2bytes
(
comments
)
)
elif
not
new
:
if
view_name
is
not
None
:
view
=
obi_open_view
(
dms
.
pointer
,
str2bytes
(
view_name
))
...
...
@@ -300,7 +300,7 @@ cdef class OBIView :
cdef
OBIDMS_column_p
column_p
s
=
self
.
name
s
=
s
+
", "
+
str
(
self
.
pointer
.
line_count
)
+
" lines"
s
=
s
+
", "
+
s
elf
.
comments
+
", "
+
s
tr
(
self
.
pointer
.
line_count
)
+
" lines"
for
column_name
in
self
.
columns
:
# TODO make function in OBIDMS_column class
column
=
self
.
columns
[
column_name
]
column_p
=
(
column
.
pointer
)[
0
]
...
...
@@ -461,7 +461,7 @@ cdef class OBIView :
cdef
class
OBIView_NUC_SEQS
(
OBIView
):
def
__init__
(
self
,
OBIDMS
dms
,
str
view_name
,
bint
new
=
False
,
object
view_to_clone
=
None
,
list
line_selection
=
None
):
def
__init__
(
self
,
OBIDMS
dms
,
str
view_name
,
bint
new
=
False
,
object
view_to_clone
=
None
,
list
line_selection
=
None
,
str
comments
=
""
):
cdef
Obiview_p
view
=
NULL
cdef
int
i
...
...
@@ -486,11 +486,11 @@ cdef class OBIView_NUC_SEQS(OBIView):
if
new
:
if
view_to_clone
is
not
None
:
if
type
(
view_to_clone
)
==
str
:
view
=
obi_new_view_nuc_seqs_cloned_from_name
(
dms
.
pointer
,
str2bytes
(
view_name
),
str2bytes
(
view_to_clone
),
line_selection_p
)
view
=
obi_new_view_nuc_seqs_cloned_from_name
(
dms
.
pointer
,
str2bytes
(
view_name
),
str2bytes
(
view_to_clone
),
line_selection_p
,
str2bytes
(
comments
)
)
else
:
view
=
obi_new_view_nuc_seqs
(
dms
.
pointer
,
str2bytes
(
view_name
),
(
<
OBIView
>
view_to_clone
).
pointer
,
line_selection_p
)
view
=
obi_new_view_nuc_seqs
(
dms
.
pointer
,
str2bytes
(
view_name
),
(
<
OBIView
>
view_to_clone
).
pointer
,
line_selection_p
,
str2bytes
(
comments
)
)
elif
view_to_clone
is
None
:
view
=
obi_new_view_nuc_seqs
(
dms
.
pointer
,
str2bytes
(
view_name
),
NULL
,
line_selection_p
)
view
=
obi_new_view_nuc_seqs
(
dms
.
pointer
,
str2bytes
(
view_name
),
NULL
,
line_selection_p
,
str2bytes
(
comments
)
)
elif
not
new
:
if
view_name
is
not
None
:
view
=
obi_open_view
(
dms
.
pointer
,
str2bytes
(
view_name
))
...
...
@@ -502,6 +502,7 @@ cdef class OBIView_NUC_SEQS(OBIView):
self
.
pointer
=
view
self
.
name
=
bytes2str
(
view
.
name
)
self
.
comments
=
bytes2str
(
view
.
comments
)
# go through columns to build list and open python object (TODO make separate function?)
self
.
columns
=
{}
...
...
@@ -663,7 +664,7 @@ cdef class OBIDMS :
return
view_class
(
self
,
view_name
)
cpdef
OBIView
new_view
(
self
,
str
view_name
,
object
view_to_clone
=
None
,
list
line_selection
=
None
,
str
view_type
=
None
)
:
cpdef
OBIView
new_view
(
self
,
str
view_name
,
object
view_to_clone
=
None
,
list
line_selection
=
None
,
str
view_type
=
None
,
str
comments
=
""
)
:
cdef
object
view_class
...
...
@@ -673,7 +674,7 @@ cdef class OBIDMS :
else
:
view_class
=
OBIView
return
view_class
(
self
,
view_name
,
new
=
True
,
view_to_clone
=
view_to_clone
,
line_selection
=
line_selection
)
return
view_class
(
self
,
view_name
,
new
=
True
,
view_to_clone
=
view_to_clone
,
line_selection
=
line_selection
,
comments
=
comments
)
cpdef
dict
read_view_infos
(
self
,
str
view_name
)
:
...
...
@@ -700,6 +701,7 @@ cdef class OBIDMS :
view_p
=
(
<
Obiview_infos_p
>
(
all_views_p
.
view_infos
))
+
i
view_name
=
bytes2str
(
view_p
.
name
)
views
[
view_name
]
=
{}
views
[
view_name
][
"comments"
]
=
bytes2str
(
view_p
.
comments
)
views
[
view_name
][
"view_type"
]
=
bytes2str
(
view_p
.
view_type
)
views
[
view_name
][
"column_count"
]
=
<
int
>
view_p
.
column_count
views
[
view_name
][
"line_count"
]
=
<
int
>
view_p
.
line_count
...
...
python/obitools3/obidms/_obiseq.cfiles
View file @
fc5a12ba
...
...
@@ -16,3 +16,7 @@
../../../src/private_at_functions.c
../../../src/obiavl.h
../../../src/obiavl.c
../../../src/encode.h
../../../src/encode.c
../../../src/obidmscolumn_idx.h
../../../src/obidmscolumn_idx.c
python/obitools3/obidms/capi/obiview.pxd
View file @
fc5a12ba
...
...
@@ -33,6 +33,7 @@ cdef extern from "obiview.h" nogil:
Column_reference_t
line_selection_reference
index_t
line_count
int
column_count
const_char_p
comments
ctypedef
Obiview_t
*
Obiview_p
...
...
@@ -48,6 +49,7 @@ cdef extern from "obiview.h" nogil:
Column_reference_t
line_selection
Column_reference_p
column_references
const_char_p
view_type
const_char_p
comments
ctypedef
Obiview_infos_t
*
Obiview_infos_p
...
...
@@ -67,13 +69,13 @@ cdef extern from "obiview.h" nogil:
ctypedef
Obiviews_infos_all_t
*
Obiviews_infos_all_p
Obiview_p
obi_new_view_nuc_seqs
(
OBIDMS_p
dms
,
const_char_p
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
)
Obiview_p
obi_new_view_nuc_seqs
(
OBIDMS_p
dms
,
const_char_p
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
,
const_char_p
comments
)
Obiview_p
obi_new_view
(
OBIDMS_p
dms
,
const_char_p
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
)
Obiview_p
obi_new_view
(
OBIDMS_p
dms
,
const_char_p
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
,
const_char_p
comments
)
Obiview_p
obi_new_view_cloned_from_name
(
OBIDMS_p
dms
,
const_char_p
view_name
,
const_char_p
view_to_clone_name
,
index_t
*
line_selection
)
Obiview_p
obi_new_view_cloned_from_name
(
OBIDMS_p
dms
,
const_char_p
view_name
,
const_char_p
view_to_clone_name
,
index_t
*
line_selection
,
const_char_p
comments
)
Obiview_p
obi_new_view_nuc_seqs_cloned_from_name
(
OBIDMS_p
dms
,
const_char_p
view_name
,
const_char_p
view_to_clone_name
,
index_t
*
line_selection
)
Obiview_p
obi_new_view_nuc_seqs_cloned_from_name
(
OBIDMS_p
dms
,
const_char_p
view_name
,
const_char_p
view_to_clone_name
,
index_t
*
line_selection
,
const_char_p
comments
)
Obiview_p
obi_open_view
(
OBIDMS_p
dms
,
const_char_p
view_name
)
...
...
src/obiview.c
View file @
fc5a12ba
...
...
@@ -209,7 +209,7 @@ int create_obiview_file(int dms_file_descriptor)
**********************************************************************/
Obiview_p
obi_new_view_nuc_seqs
(
OBIDMS_p
dms
,
const
char
*
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
)
Obiview_p
obi_new_view_nuc_seqs
(
OBIDMS_p
dms
,
const
char
*
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
,
const
char
*
comments
)
{
Obiview_p
view
;
...
...
@@ -223,7 +223,7 @@ Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p v
}
}
view
=
obi_new_view
(
dms
,
view_name
,
view_to_clone
,
line_selection
);
view
=
obi_new_view
(
dms
,
view_name
,
view_to_clone
,
line_selection
,
comments
);
strcpy
(
view
->
view_type
,
VIEW_TYPE_NUC_SEQS
);
...
...
@@ -253,7 +253,7 @@ Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p v
}
Obiview_p
obi_new_view
(
OBIDMS_p
dms
,
const
char
*
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
)
Obiview_p
obi_new_view
(
OBIDMS_p
dms
,
const
char
*
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
,
const
char
*
comments
)
{
Obiview_p
view
;
int
i
;
...
...
@@ -278,7 +278,7 @@ Obiview_p obi_new_view(OBIDMS_p dms, const char* view_name, Obiview_p view_to_cl
return
NULL
;
}
view
->
dms
=
dms
;
view
->
dms
=
dms
;
view
->
column_count
=
view_to_clone
->
column_count
;
if
((
view_to_clone
->
line_selection
!=
NULL
)
&&
(
line_selection
==
NULL
))
// reorder conditions
{
...
...
@@ -359,13 +359,14 @@ Obiview_p obi_new_view(OBIDMS_p dms, const char* view_name, Obiview_p view_to_cl
}
strcpy
(
view
->
name
,
view_name
);
strcpy
(
view
->
comments
,
comments
);
view
->
read_only
=
0
;
return
view
;
}
Obiview_p
obi_new_view_cloned_from_name
(
OBIDMS_p
dms
,
const
char
*
view_name
,
const
char
*
view_to_clone_name
,
index_t
*
line_selection
)
Obiview_p
obi_new_view_cloned_from_name
(
OBIDMS_p
dms
,
const
char
*
view_name
,
const
char
*
view_to_clone_name
,
index_t
*
line_selection
,
const
char
*
comments
)
{
Obiview_p
view
;
Obiview_p
view_to_clone
;
...
...
@@ -373,7 +374,7 @@ Obiview_p obi_new_view_cloned_from_name(OBIDMS_p dms, const char* view_name, con
view_to_clone
=
obi_open_view
(
dms
,
view_to_clone_name
);
if
(
view_to_clone
==
NULL
)
return
NULL
;
view
=
obi_new_view
(
dms
,
view_name
,
view_to_clone
,
line_selection
);
view
=
obi_new_view
(
dms
,
view_name
,
view_to_clone
,
line_selection
,
comments
);
obi_close_view
(
view_to_clone
);
...
...
@@ -381,7 +382,7 @@ Obiview_p obi_new_view_cloned_from_name(OBIDMS_p dms, const char* view_name, con
}
Obiview_p
obi_new_view_nuc_seqs_cloned_from_name
(
OBIDMS_p
dms
,
const
char
*
view_name
,
const
char
*
view_to_clone_name
,
index_t
*
line_selection
)
Obiview_p
obi_new_view_nuc_seqs_cloned_from_name
(
OBIDMS_p
dms
,
const
char
*
view_name
,
const
char
*
view_to_clone_name
,
index_t
*
line_selection
,
const
char
*
comments
)
{
Obiview_p
view
;
Obiview_p
view_to_clone
;
...
...
@@ -389,7 +390,7 @@ Obiview_p obi_new_view_nuc_seqs_cloned_from_name(OBIDMS_p dms, const char* view_
view_to_clone
=
obi_open_view
(
dms
,
view_to_clone_name
);
if
(
view_to_clone
==
NULL
)
return
NULL
;
view
=
obi_new_view_nuc_seqs
(
dms
,
view_name
,
view_to_clone
,
line_selection
);
view
=
obi_new_view_nuc_seqs
(
dms
,
view_name
,
view_to_clone
,
line_selection
,
comments
);
obi_close_view
(
view_to_clone
);
...
...
@@ -532,6 +533,7 @@ Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name)
strcpy
(
view
->
created_from
,
view_infos
->
created_from
);
strcpy
(
view
->
name
,
view_infos
->
name
);
strcpy
(
view
->
view_type
,
view_infos
->
view_type
);
strcpy
(
view
->
comments
,
view_infos
->
comments
);
// Open the columns to read
for
(
i
=
0
;
i
<
(
view_infos
->
column_count
);
i
++
)
...
...
@@ -1033,6 +1035,7 @@ int obi_save_view(Obiview_p view)
strcpy
(
view_infos
->
created_from
,
view
->
created_from
);
strcpy
(
view_infos
->
name
,
view
->
name
);
strcpy
(
view_infos
->
view_type
,
view
->
view_type
);
strcpy
(
view_infos
->
comments
,
view
->
comments
);
// Store reference for the line selection associated with that view
if
(
view
->
new_line_selection
!=
NULL
)
...
...
src/obiview.h
View file @
fc5a12ba
...
...
@@ -26,8 +26,10 @@
#include "obierrno.h"
#define OBIVIEW_NAME_MAX_LENGTH (10239)
/**< The maximum length of an OBIDMS view name.
*/
#define OBIVIEW_NAME_MAX_LENGTH (1000)
/**< The maximum length of an OBIDMS view name.
*/
#define OBIVIEW_COMMENTS_MAX_LENGTH (10000)
#define OBIVIEW_FILE_NAME "obiviews"
#define VIEW_TYPE_MAX_NAME (1024)
...
...
@@ -84,6 +86,8 @@ typedef struct Obiview {
char
view_type
[
VIEW_TYPE_MAX_NAME
+
1
];
char
comments
[
OBIVIEW_COMMENTS_MAX_LENGTH
+
1
];
}
Obiview_t
,
*
Obiview_p
;
...
...
@@ -111,6 +115,8 @@ typedef struct Obiview_infos {
char
view_type
[
VIEW_TYPE_MAX_NAME
+
1
];
char
comments
[
OBIVIEW_COMMENTS_MAX_LENGTH
+
1
];
}
Obiview_infos_t
,
*
Obiview_infos_p
;
...
...
@@ -135,13 +141,13 @@ typedef struct Obiviews_infos_all {
}
Obiviews_infos_all_t
,
*
Obiviews_infos_all_p
;
Obiview_p
obi_new_view_nuc_seqs
(
OBIDMS_p
dms
,
const
char
*
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
);
Obiview_p
obi_new_view_nuc_seqs
(
OBIDMS_p
dms
,
const
char
*
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
,
const
char
*
comments
);
Obiview_p
obi_new_view
(
OBIDMS_p
dms
,
const
char
*
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
);
Obiview_p
obi_new_view
(
OBIDMS_p
dms
,
const
char
*
view_name
,
Obiview_p
view_to_clone
,
index_t
*
line_selection
,
const
char
*
comments
);
Obiview_p
obi_new_view_cloned_from_name
(
OBIDMS_p
dms
,
const
char
*
view_name
,
const
char
*
view_to_clone_name
,
index_t
*
line_selection
);
Obiview_p
obi_new_view_cloned_from_name
(
OBIDMS_p
dms
,
const
char
*
view_name
,
const
char
*
view_to_clone_name
,
index_t
*
line_selection
,
const
char
*
comments
);
Obiview_p
obi_new_view_nuc_seqs_cloned_from_name
(
OBIDMS_p
dms
,
const
char
*
view_name
,
const
char
*
view_to_clone_name
,
index_t
*
line_selection
);
Obiview_p
obi_new_view_nuc_seqs_cloned_from_name
(
OBIDMS_p
dms
,
const
char
*
view_name
,
const
char
*
view_to_clone_name
,
index_t
*
line_selection
,
const
char
*
comments
);
Obiview_p
obi_open_view
(
OBIDMS_p
dms
,
const
char
*
view_name
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment