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
ff6c27ac
Commit
ff6c27ac
authored
Mar 25, 2016
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented the retrieval of values with groups of AVLs
parent
69856f18
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
22 deletions
+53
-22
python/obitools3/obiimport.py
python/obitools3/obiimport.py
+2
-1
src/obiavl.c
src/obiavl.c
+42
-18
src/obiavl.h
src/obiavl.h
+5
-1
src/obidmscolumn_seq.c
src/obidmscolumn_seq.c
+2
-1
src/obidmscolumn_str.c
src/obidmscolumn_str.c
+2
-1
No files found.
python/obitools3/obiimport.py
View file @
ff6c27ac
...
...
@@ -134,9 +134,10 @@ if __name__ == '__main__':
# # #print("header", line)
# #
id
=
line
.
split
(
" "
,
1
)[
0
][
1
:]
# # #
print(id)
print
(
id
)
# # #rest = (line[:-1].split(" ", 1)[1]).split(";")
view
[
i
].
set_id
(
id
)
#print(view[i]["ID"])
#
i
+=
1
...
...
src/obiavl.c
View file @
ff6c27ac
...
...
@@ -1528,6 +1528,18 @@ int obi_close_avl(OBIDMS_avl_p avl)
}
byte_t
*
obi_avl_group_get
(
OBIDMS_avl_group_p
avl_group
,
index_t
idx
)
{
int32_t
avl_idx
;
index_t
idx_in_avl
;
avl_idx
=
(
int32_t
)
(
idx
>>
32
);
idx_in_avl
=
idx
&
0x00000000FFFFFFFF
;
return
obi_avl_get
((
avl_group
->
sub_avls
)[
avl_idx
],
idx_in_avl
);
}
byte_t
*
obi_avl_get
(
OBIDMS_avl_p
avl
,
index_t
idx
)
{
return
(((
avl
->
data
)
->
data
)
+
idx
);
...
...
@@ -1540,45 +1552,57 @@ int maybe_in_avl(OBIDMS_avl_p avl, byte_t* value)
}
in
dex
_t
insert_in_avl_group
(
OBIDMS_avl_group_p
avl_group
,
byte_t
*
value
)
// TODO won't be index_t
in
t64
_t
insert_in_avl_group
(
OBIDMS_avl_group_p
avl_group
,
byte_t
*
value
)
// TODO won't be index_t
{
index_t
index_if_already_in
;
int
i
;
int32_t
index_in_avl
;
int64_t
index_with_avl
;
int
i
;
if
(
maybe_in_avl
((
avl_group
->
sub_avls
)[
avl_group
->
current_avl_idx
],
value
))
{
//fprintf(stderr, "\nyah maybe");
index_if_already_in
=
obi_avl_find
((
avl_group
->
sub_avls
)[
avl_group
->
current_avl_idx
],
value
);
if
(
index_if_already_in
>=
0
)
return
index_if_already_in
;
index_in_avl
=
(
int32_t
)
obi_avl_find
((
avl_group
->
sub_avls
)[
avl_group
->
current_avl_idx
],
value
);
if
(
index_in_avl
>=
0
)
{
index_with_avl
=
avl_group
->
current_avl_idx
;
index_with_avl
=
index_with_avl
<<
32
;
index_with_avl
=
index_with_avl
+
index_in_avl
;
return
index_with_avl
;
}
}
// else
// fprintf(stderr, "\nnah");
for
(
i
=
0
;
i
<
(
avl_group
->
current_avl_idx
);
i
++
)
{
if
(
maybe_in_avl
((
avl_group
->
sub_avls
)[
i
],
value
))
{
//fprintf(stderr, "\nyah maybe");
if
(
remap_an_avl
((
avl_group
->
sub_avls
)[
i
])
<
0
)
return
-
1
;
index_i
f_already_in
=
obi_avl_find
((
avl_group
->
sub_avls
)[
i
],
value
);
index_i
n_avl
=
(
int32_t
)
obi_avl_find
((
avl_group
->
sub_avls
)[
i
],
value
);
if
(
unmap_an_avl
((
avl_group
->
sub_avls
)[
i
])
<
0
)
return
-
1
;
if
(
index_if_already_in
>=
0
)
return
index_if_already_in
;
if
(
index_in_avl
>=
0
)
{
index_with_avl
=
i
;
index_with_avl
=
index_with_avl
<<
32
;
index_with_avl
=
index_with_avl
+
index_in_avl
;
return
index_with_avl
;
}
}
// else
// fprintf(stderr, "\nnah");
}
//
not found in any avl
: add in current
//
first, check if make new one
//
Not found in any AVL
: add in current
//
First, check if make new AVL
if
((((
avl_group
->
sub_avls
)[
avl_group
->
current_avl_idx
])
->
header
)
->
nb_items
==
NODE_COUNT_PER_AVL
)
// TODO add condition with data size
obi_add_new_avl_in_group
(
avl_group
);
// Add in the current AVL
bloom_add
(
&
((((
avl_group
->
sub_avls
)[
avl_group
->
current_avl_idx
])
->
header
)
->
bloom_filter
),
value
,
BYTE_ARRAY_HEADER_SIZE
+
*
((
int32_t
*
)(
value
+
1
)));
return
obi_avl_add
((
avl_group
->
sub_avls
)[
avl_group
->
current_avl_idx
],
value
);
// Build the index containing the AVL index
index_in_avl
=
(
int32_t
)
obi_avl_add
((
avl_group
->
sub_avls
)[
avl_group
->
current_avl_idx
],
value
);
index_with_avl
=
avl_group
->
current_avl_idx
;
index_with_avl
=
index_with_avl
<<
32
;
index_with_avl
=
index_with_avl
+
index_in_avl
;
return
index_with_avl
;
}
...
...
src/obiavl.h
View file @
ff6c27ac
...
...
@@ -365,7 +365,11 @@ byte_t* obi_seq_to_obibytes(char* seq);
* @since November 2015
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
const
char
*
obi_obibytes_to_seq
(
byte_t
*
value_b
);
const
char
*
obi_obibytes_to_seq
(
byte_t
*
value_b
);
// TODO move to encode source files
// TODO
byte_t
*
obi_avl_group_get
(
OBIDMS_avl_group_p
avl_group
,
index_t
idx
);
#endif
/* OBIAVL_H_ */
...
...
src/obidmscolumn_seq.c
View file @
ff6c27ac
...
...
@@ -135,7 +135,8 @@ const char* obi_column_get_obiseq_with_elt_idx(OBIDMS_column_p column, index_t l
if
(
idx
==
OBIIdx_NA
)
return
OBISeq_NA
;
//value_b = obi_avl_get((column->avl)[crc(value)], idx);
value_b
=
obi_avl_group_get
(
column
->
avl
,
idx
);
return
obi_obibytes_to_seq
(
value_b
);
}
...
...
src/obidmscolumn_str.c
View file @
ff6c27ac
...
...
@@ -129,7 +129,8 @@ const char* obi_column_get_obistr_with_elt_idx(OBIDMS_column_p column, index_t l
if
(
idx
==
OBIIdx_NA
)
return
OBIStr_NA
;
//value_b = obi_avl_get(column->avl, idx);
value_b
=
obi_avl_group_get
(
column
->
avl
,
idx
);
return
obi_obibytes_to_str
(
value_b
);
}
...
...
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