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
3e6aecc6
Commit
3e6aecc6
authored
Jul 11, 2017
by
Celine Mercier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a C function to add a COUNT column to a view with all lines set to
1
parent
ced9a268
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
2 deletions
+62
-2
src/obiview.c
src/obiview.c
+42
-2
src/obiview.h
src/obiview.h
+20
-0
No files found.
src/obiview.c
View file @
3e6aecc6
...
...
@@ -1188,8 +1188,6 @@ static int prepare_to_set_value_in_column(Obiview_p view, OBIDMS_column_p* colum
}
}
// TODO add line_max
if
(((
*
line_nb_p
)
+
1
)
>
(
view
->
infos
)
->
line_count
)
{
if
(
update_lines
(
view
,
((
*
line_nb_p
)
+
1
))
<
0
)
...
...
@@ -2160,6 +2158,7 @@ Obiview_p obi_open_view(OBIDMS_p dms, const char* view_name)
}
// TODO return a pointer on the column?
int
obi_view_add_column
(
Obiview_p
view
,
const
char
*
column_name
,
obiversion_t
version_number
,
...
...
@@ -2458,6 +2457,47 @@ int obi_save_and_close_view(Obiview_p view)
}
int
obi_create_auto_count_column
(
Obiview_p
view
)
{
index_t
i
;
OBIDMS_p
column
;
// Check that the view is not read-only
if
(
view
->
read_only
)
{
obi_set_errno
(
OBIVIEW_ERROR
);
obidebug
(
1
,
"
\n
Error trying to create an automatic count column in a read-only view"
);
return
-
1
;
}
if
(
obi_view_add_column
(
view
,
COUNT_COLUMN
,
-
1
,
NULL
,
OBI_INT
,
0
,
1
,
NULL
,
NULL
,
NULL
,
NULL
,
"Sequence counts"
,
true
)
<
0
)
{
obidebug
(
1
,
"Error adding an automatic count column in a view"
);
return
-
1
;
}
column
=
obi_view_get_column
(
view
,
COUNT_COLUMN
);
if
(
column
==
NULL
)
{
obidebug
(
1
,
"Error adding an automatic count column in a view"
);
return
-
1
;
}
// Fill the column with 1s
for
(
i
=
0
;
i
<
(
view
->
infos
)
->
line_count
;
i
++
)
{
if
(
obi_column_set_obiint_with_elt_idx
(
column
,
i
,
0
,
1
)
<
0
)
{
obidebug
(
1
,
"Error adding an automatic count column in a view"
);
return
-
1
;
}
}
return
0
;
}
// TODO Move to another file?
/*********** FOR BLOB COLUMNS ***********/
Obi_blob_p
obi_get_blob_with_elt_idx_and_col_p_in_view
(
Obiview_p
view
,
OBIDMS_column_p
column_p
,
index_t
line_nb
,
index_t
element_idx
)
...
...
src/obiview.h
View file @
3e6aecc6
...
...
@@ -51,6 +51,9 @@
*/
#define QUALITY_COLUMN "QUALITY"
/**< The name of the column containing the sequence qualities
* in NUC_SEQS_VIEW views.
*/
#define COUNT_COLUMN "COUNT"
/**< The name of the column containing the sequence counts
* in NUC_SEQS_VIEW views.
*/
...
...
@@ -507,6 +510,23 @@ int obi_select_lines(Obiview_p view, index_t* line_nbs);
int
obi_save_and_close_view
(
Obiview_p
view
);
/**
* @brief Creates an OBI_INT column with the line count of the view it belongs to, and sets all lines to 1.
*
* @warning The number of lines set corresponds to the line count of the view.
*
* @param view A pointer on the view.
*
* @returns A value indicating the success of the operation.
* @retval 0 if the operation was successfully completed.
* @retval -1 if an error occurred.
*
* @since July 2017
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int
obi_create_auto_count_column
(
Obiview_p
view
);
/**
* @brief Recovers an obiblob from an OBIDMS column containing indices referring to obiblobs,
* using the index of the element in the line, and the column pointer, in the context of a view.
...
...
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