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
6bd42132
Commit
6bd42132
authored
Mar 23, 2016
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixes to silence warnings and replaced two asprintf uses
parent
40859043
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
44 deletions
+36
-44
src/bloom.c
src/bloom.c
+1
-1
src/encode.c
src/encode.c
+2
-2
src/encode.h
src/encode.h
+1
-1
src/obiavl.c
src/obiavl.c
+32
-39
src/obiview.c
src/obiview.c
+0
-1
No files found.
src/bloom.c
View file @
6bd42132
...
...
@@ -61,7 +61,7 @@ static int bloom_check_add(struct bloom * bloom,
register
unsigned
int
a
=
murmurhash2
(
buffer
,
len
,
0x9747b28c
);
register
unsigned
int
b
=
murmurhash2
(
buffer
,
len
,
a
);
register
unsigned
int
x
;
register
unsigned
int
i
;
register
int
i
;
// TODO why was it unsigned?
unsigned
bucket_index
=
(
a
%
bloom
->
buckets
);
...
...
src/encode.c
View file @
6bd42132
...
...
@@ -28,9 +28,9 @@
bool
only_ATGC
(
char
*
seq
)
bool
only_ATGC
(
c
onst
c
har
*
seq
)
{
char
*
c
=
seq
;
c
onst
c
har
*
c
=
seq
;
while
(
*
c
)
{
...
...
src/encode.h
View file @
6bd42132
...
...
@@ -69,7 +69,7 @@ enum
* @since November 2015
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
bool
only_ATGC
(
char
*
seq
);
bool
only_ATGC
(
c
onst
c
har
*
seq
);
/**
...
...
src/obiavl.c
View file @
6bd42132
...
...
@@ -483,26 +483,9 @@ int grow_avl(OBIDMS_avl_p avl) // TODO Lock when needed
size_t
new_data_size
;
size_t
header_size
;
int
avl_file_descriptor
;
char
*
avl_file_name
;
avl_file_descriptor
=
avl
->
avl_fd
;
// // Get the avl file name
// avl_file_name = build_avl_file_name((avl->header)->avl_name);
// if (avl_file_name == NULL)
// return -1;
//
// // Open the avl file
// avl_file_descriptor = openat(avl->dir_fd, avl_file_name, O_RDWR);
// if (avl_file_descriptor < 0)
// {
// obi_set_errno(OBI_AVL_ERROR);
// obidebug(1, "\nError opening an AVL tree file");
// free(avl_file_name);
// return -1;
// }
// free(avl_file_name);
// Calculate the new file size
old_data_size
=
(
avl
->
header
)
->
avl_size
;
new_data_size
=
old_data_size
*
AVL_GROWTH_FACTOR
;
...
...
@@ -563,26 +546,9 @@ int grow_avl_data(OBIDMS_avl_p avl) // TODO Lock when needed
index_t
new_data_size
;
size_t
header_size
;
int
avl_data_file_descriptor
;
char
*
avl_data_file_name
;
avl_data_file_descriptor
=
avl
->
data_fd
;
// // Get the avl data file name
// avl_data_file_name = build_avl_data_file_name((avl->header)->avl_name);
// if (avl_data_file_name == NULL)
// return -1;
//
// // Open the avl data file
// avl_data_file_descriptor = openat(avl->dir_fd, avl_data_file_name, O_RDWR);
// if (avl_data_file_descriptor < 0)
// {
// obi_set_errno(OBI_AVL_ERROR);
// obidebug(1, "\nError opening an AVL tree data file");
// free(avl_data_file_name);
// return -1;
// }
// free(avl_data_file_name);
// Calculate the new file size
old_data_size
=
((
avl
->
data
)
->
header
)
->
data_size_max
;
new_data_size
=
old_data_size
*
AVL_GROWTH_FACTOR
;
...
...
@@ -1014,8 +980,20 @@ OBIDMS_avl_group_p obi_create_avl_group(OBIDMS_p dms, const char* avl_name)
avl_group
=
(
OBIDMS_avl_group_p
)
malloc
(
sizeof
(
OBIDMS_avl_group_t
));
// Create 1st avl
asprintf
(
&
avl_name_with_idx
,
"%s_%u"
,
avl_name
,
0
);
avl_name_with_idx
=
malloc
((
strlen
(
avl_name
)
+
3
)
*
sizeof
(
char
));
if
(
sprintf
(
avl_name_with_idx
,
"%s_%u"
,
avl_name
,
0
)
<
0
)
{
obi_set_errno
(
OBI_AVL_ERROR
);
obidebug
(
1
,
"
\n
Error building an AVL tree file name"
);
return
NULL
;
}
(
avl_group
->
sub_avls
)[
0
]
=
obi_create_avl
(
dms
,
avl_name_with_idx
);
if
((
avl_group
->
sub_avls
)[
0
]
==
NULL
)
{
obidebug
(
1
,
"
\n
Error creating the first AVL of an AVL group"
);
return
NULL
;
}
avl_group
->
current_avl_idx
=
0
;
strcpy
(
avl_group
->
avl_name
,
avl_name
);
...
...
@@ -1039,7 +1017,7 @@ int remap_an_avl(OBIDMS_avl_p avl)
{
(
avl
->
data
)
->
data
=
mmap
(
NULL
,
((
avl
->
data
)
->
header
)
->
data_size_max
,
PROT_READ
|
PROT_WRITE
,
PROT_READ
,
MAP_SHARED
,
avl
->
data_fd
,
((
avl
->
data
)
->
header
)
->
header_size
);
...
...
@@ -1048,7 +1026,7 @@ int remap_an_avl(OBIDMS_avl_p avl)
avl
->
tree
=
mmap
(
NULL
,
((
avl
->
header
)
->
nb_items_max
)
*
sizeof
(
AVL_node_t
),
PROT_READ
|
PROT_WRITE
,
PROT_READ
,
MAP_SHARED
,
avl
->
avl_fd
,
(
avl
->
header
)
->
header_size
);
...
...
@@ -1062,13 +1040,28 @@ int remap_an_avl(OBIDMS_avl_p avl)
int
obi_add_new_avl_in_group
(
OBIDMS_avl_group_p
avl_group
)
// TODO check for errors
{
char
*
avl_name_with_idx
;
int
avl_idx_length
;
// unmap older
unmap_an_avl
((
avl_group
->
sub_avls
)[
avl_group
->
current_avl_idx
]);
(
avl_group
->
current_avl_idx
)
++
;
asprintf
(
&
avl_name_with_idx
,
"%s_%u"
,
avl_group
->
avl_name
,
avl_group
->
current_avl_idx
);
avl_idx_length
=
((
avl_group
->
current_avl_idx
)
==
0
?
1
:
(
int
)(
log10
(
avl_group
->
current_avl_idx
)
+
1
));
avl_name_with_idx
=
malloc
((
strlen
(
avl_group
->
avl_name
)
+
avl_idx_length
+
2
)
*
sizeof
(
char
));
if
(
sprintf
(
avl_name_with_idx
,
"%s_%u"
,
avl_group
->
avl_name
,
avl_group
->
current_avl_idx
)
<
0
)
{
obi_set_errno
(
OBI_AVL_ERROR
);
obidebug
(
1
,
"
\n
Error building an AVL tree file name"
);
return
-
1
;
}
//fprintf(stderr, "\nindex length = %d, file name = %s\n", avl_idx_length, avl_name_with_idx);
(
avl_group
->
sub_avls
)[
avl_group
->
current_avl_idx
]
=
obi_create_avl
(
avl_group
->
dms
,
avl_name_with_idx
);
if
((
avl_group
->
sub_avls
)[
avl_group
->
current_avl_idx
]
==
NULL
)
{
obidebug
(
1
,
"
\n
Error creating a new AVL tree in a group"
);
return
-
1
;
}
return
0
;
}
...
...
src/obiview.c
View file @
6bd42132
...
...
@@ -228,7 +228,6 @@ Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p v
if
(
view
==
NULL
)
return
NULL
;
fprintf
(
stderr
,
"
\n
mmmm
\n
"
);
strcpy
(
view
->
view_type
,
VIEW_TYPE_NUC_SEQS
);
if
(
view_to_clone
==
NULL
)
...
...
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