Major update: New column type to store sequence qualities. Closes #41

This commit is contained in:
Celine Mercier
2016-05-20 16:45:22 +02:00
parent ffff91e76c
commit 3b59043ea8
33 changed files with 962 additions and 267 deletions

View File

@ -17,6 +17,7 @@
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <stdint.h>
#include <stdbool.h>
#include <time.h>
#include <math.h>
@ -50,6 +51,9 @@
#define DEFINITION_COLUMN "DEFINITION" /**< The name of the column containing the sequence definitions
* in NUC_SEQS_VIEW views.
*/
#define QUALITY_COLUMN "QUALITY" /**< The name of the column containing the sequence qualities
* in NUC_SEQS_VIEW views.
*/
/**
@ -215,6 +219,7 @@ Obiview_p obi_new_view_cloned_from_name(OBIDMS_p dms, const char* view_name, con
* - NUC_SEQUENCE_COLUMN where nucleotide sequences are stored
* - ID_COLUMN where sequence identifiers are stored
* - DEFINITION_COLUMN where sequence definitions are stored
* - QUALITY_COLUMN where sequence qualities are stored
*
* @param dms A pointer on the OBIDMS.
* @param view_name The unique name of the view.
@ -246,6 +251,7 @@ Obiview_p obi_new_view_nuc_seqs(OBIDMS_p dms, const char* view_name, Obiview_p v
* - NUC_SEQUENCE_COLUMN where nucleotide sequences are stored
* - ID_COLUMN where sequence identifiers are stored
* - DEFINITION_COLUMN where sequence definitions are stored
* - QUALITY_COLUMN where sequence qualities are stored
*
* @param dms A pointer on the OBIDMS.
* @param view_name The unique name of the new view.
@ -803,6 +809,194 @@ int obi_column_set_obiint_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p
obiint_t obi_column_get_obiint_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name);
/**
* @brief Sets a value in an OBIDMS column containing data in the form of indices referring
* to sequence qualities handled by an indexer, and using the index of the element in the column's line,
* in the context of a view.
*
* This function is for qualities in the character string format.
*
* @warning Pointers returned by obi_open_column() don't allow writing.
*
* @param view A pointer on the opened view.
* @param column A pointer as returned by obi_create_column() or obi_clone_column().
* @param line_nb The number of the line where the value should be set.
* @param element_idx The index of the element that should be set in the line.
* @param value The value that should be set, in the character string format.
*
* @returns An integer value indicating the success of the operation.
* @retval 0 on success.
* @retval -1 if an error occurred.
*
* @since May 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_column_set_obiqual_char_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, const char* value);
/**
* @brief Sets a value in an OBIDMS column containing data in the form of indices referring
* to sequence qualities handled by an indexer, and using the index of the element in the column's line,
* in the context of a view.
*
* This function is for qualities in the integer format.
*
* @warning Pointers returned by obi_open_column() don't allow writing.
*
* @param view A pointer on the opened view.
* @param column A pointer as returned by obi_create_column() or obi_clone_column().
* @param line_nb The number of the line where the value should be set.
* @param element_idx The index of the element that should be set in the line.
* @param value The value that should be set, in the integer array format.
* @param value_length The length of the integer array.
*
* @returns An integer value indicating the success of the operation.
* @retval 0 on success.
* @retval -1 if an error occurred.
*
* @since May 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_column_set_obiqual_int_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, const uint8_t* value, int value_length);
/**
* @brief Recovers a value in an OBIDMS column containing data in the form of indices referring
* to sequence qualities handled by an indexer, and using the index of the element in the column's line,
* in the context of a view.
*
* This function returns quality scores in the character string format.
*
* @param view A pointer on the opened view.
* @param column A pointer as returned by obi_create_column().
* @param line_nb The number of the line where the value should be recovered.
* @param element_idx The index of the element that should be recovered in the line.
*
* @returns The recovered value, in the character string format.
* @retval OBIQual_str_NA the NA value of the type if an error occurred and obi_errno is set.
*
* @since May 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
char* obi_column_get_obiqual_char_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx);
/**
* @brief Recovers a value in an OBIDMS column containing data in the form of indices referring
* to sequence qualities handled by an indexer, and using the index of the element in the column's line,
* in the context of a view.
*
* This function returns quality scores in the integer format.
*
* @param view A pointer on the opened view.
* @param column A pointer as returned by obi_create_column().
* @param line_nb The number of the line where the value should be recovered.
* @param element_idx The index of the element that should be recovered in the line.
* @param value_length A pointer on an integer to store the length of the integer array recovered.
*
* @returns The recovered value, in the integer array format.
* @retval OBIQual_int_NA the NA value of the type if an error occurred and obi_errno is set.
*
* @since May 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
const uint8_t* obi_column_get_obiqual_int_with_elt_idx_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, index_t element_idx, int* value_length);
/**
* @brief Sets a value in an OBIDMS column containing data in the form of indices referring
* to sequence qualities handled by an indexer, and using the index of the element in the column's line,
* in the context of a view.
*
* This function is for quality scores in the character string format.
*
* @warning Pointers returned by obi_open_column() don't allow writing.
*
* @param view A pointer on the opened view.
* @param column A pointer as returned by obi_create_column() or obi_clone_column().
* @param line_nb The number of the line where the value should be set.
* @param element_name The name of the element that should be set in the line.
* @param value The value that should be set, in the character string format.
*
* @returns An integer value indicating the success of the operation.
* @retval 0 on success.
* @retval -1 if an error occurred.
*
* @since May 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_column_set_obiqual_char_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, const char* value);
/**
* @brief Sets a value in an OBIDMS column containing data in the form of indices referring
* to sequence qualities handled by an indexer, and using the index of the element in the column's line,
* in the context of a view.
*
* This function is for quality scores in the integer array format.
*
* @warning Pointers returned by obi_open_column() don't allow writing.
*
* @param view A pointer on the opened view.
* @param column A pointer as returned by obi_create_column() or obi_clone_column().
* @param line_nb The number of the line where the value should be set.
* @param element_name The name of the element that should be set in the line.
* @param value The value that should be set, in the integer format.
* @param value_length The length of the integer array.
*
* @returns An integer value indicating the success of the operation.
* @retval 0 on success.
* @retval -1 if an error occurred.
*
* @since May 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_column_set_obiqual_int_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, const uint8_t* value, int value_length);
/**
* @brief Recovers a value in an OBIDMS column containing data in the form of indices referring
* to sequence qualities handled by an indexer, and using the index of the element in the column's line,
* in the context of a view.
*
* This function returns quality scores in the character string format.
*
* @param view A pointer on the opened view.
* @param column A pointer as returned by obi_create_column() or obi_clone_column().
* @param line_nb The number of the line where the value should be recovered.
* @param element_name The name of the element that should be recovered in the line.
*
* @returns The recovered value, in the character string format.
* @retval OBIQual_str_NA the NA value of the type if an error occurred and obi_errno is set.
*
* @since May 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
char* obi_column_get_obiqual_char_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name);
/**
* @brief Recovers a value in an OBIDMS column containing data in the form of indices referring
* to sequence qualities handled by an indexer, and using the index of the element in the column's line,
* in the context of a view.
*
* This function returns quality scores in the integer array format.
*
* @param view A pointer on the opened view.
* @param column A pointer as returned by obi_create_column() or obi_clone_column().
* @param line_nb The number of the line where the value should be recovered.
* @param element_name The name of the element that should be recovered in the line.
* @param value_length A pointer on an integer to store the length of the integer array recovered.
*
* @returns The recovered value, in the integer format.
* @retval OBIQual_int_NA the NA value of the type if an error occurred and obi_errno is set.
*
* @since May 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
const uint8_t* obi_column_get_obiqual_int_with_elt_name_in_view(Obiview_p view, OBIDMS_column_p column, index_t line_nb, const char* element_name, int* value_length);
/**
* @brief Sets a value in an OBIDMS column containing data with the type OBI_SEQ, using the index of the element in the line,
* in the context of a view.