Commit e5240410 by Celine Mercier

Views: Files for unfinished views now have the extension

'.obiview_unfinished', renamed to '.obiview' when the view is finished.
parent a9102620
......@@ -690,7 +690,7 @@ cdef class OBIDMS :
cdef int i, j
cdef str column_name
view_infos_p = obi_view_map_file(self._pointer, str2bytes(view_name))
view_infos_p = obi_view_map_file(self._pointer, str2bytes(view_name), True)
view_infos_d = {}
view_infos_d["name"] = bytes2str(view_infos_p.name)
view_infos_d["comments"] = bytes2str(view_infos_p.comments)
......
......@@ -68,7 +68,7 @@ cdef extern from "obiview.h" nogil:
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, bint quality_column)
Obiview_infos_p obi_view_map_file(OBIDMS_p dms, const char* view_name)
Obiview_infos_p obi_view_map_file(OBIDMS_p dms, const char* view_name, bint finished)
int obi_view_unmap_file(OBIDMS_p dms, Obiview_infos_p view_infos)
......@@ -94,11 +94,7 @@ cdef extern from "obiview.h" nogil:
OBIDMS_column_p* obi_view_get_pointer_on_column_in_view(Obiview_p view, const_char_p column_name)
int obi_view_create_column_alias(Obiview_p view, const_char_p current_name, const_char_p alias)
int obi_save_view(Obiview_p view)
int obi_close_view(Obiview_p view)
int obi_view_create_column_alias(Obiview_p view, const_char_p current_name, const_char_p alias)
int obi_save_and_close_view(Obiview_p view)
......
......@@ -4,7 +4,7 @@
/**
* @file obi_align.c
* @author Celine Mercier
* @author Celine Mercier (celine.mercier@metabarcoding.org)
* @date May 4th 2016
* @brief Functions handling LCS sequence alignments.
*/
......@@ -31,10 +31,6 @@
#define DEBUG_LEVEL 0 // TODO has to be defined somewhere else (cython compil flag?)
// TODO
// use openMP pragmas
/**************************************************************************
*
* D E C L A R A T I O N O F T H E P R I V A T E F U N C T I O N S
......@@ -618,12 +614,12 @@ int obi_lcs_align_one_column(OBIDMS_p dms, const char* seq_view_name, const char
}
// Close views
if (obi_close_view(seq_view) < 0)
if (obi_save_and_close_view(seq_view) < 0)
{
obidebug(1, "\nError closing the input view after aligning");
return -1;
}
if (obi_close_view(output_view) < 0)
if (obi_save_and_close_view(output_view) < 0)
{
obidebug(1, "\nError closing the output view after aligning");
return -1;
......@@ -963,19 +959,19 @@ int obi_lcs_align_two_columns(OBIDMS_p dms,
// Close views
if (seq2_view != seq1_view)
{
if (obi_close_view(seq2_view) < 0)
if (obi_save_and_close_view(seq2_view) < 0)
{
obidebug(1, "\nError closing the second input view after aligning");
return -1;
}
}
if (obi_close_view(seq1_view) < 0)
if (obi_save_and_close_view(seq1_view) < 0)
{
obidebug(1, "\nError closing the first input view after aligning");
return -1;
}
if (obi_close_view(output_view) < 0)
if (obi_save_and_close_view(output_view) < 0)
{
obidebug(1, "\nError closing the output view after aligning");
return -1;
......
......@@ -242,6 +242,7 @@ Obiview_p obi_new_view_nuc_seqs_cloned_from_name(OBIDMS_p dms, const char* view_
*
* @param dms A pointer on the OBIDMS.
* @param view_name The unique name identifying the view.
* @param finished Whether the view is finished or not.
*
* @returns A pointer on the mapped view infos structure.
* @retval NULL if an error occurred.
......@@ -249,7 +250,7 @@ Obiview_p obi_new_view_nuc_seqs_cloned_from_name(OBIDMS_p dms, const char* view_
* @since June 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
Obiview_infos_p obi_view_map_file(OBIDMS_p dms, const char* view_name);
Obiview_infos_p obi_view_map_file(OBIDMS_p dms, const char* view_name, bool finished);
/**
......@@ -445,42 +446,6 @@ int obi_select_lines(Obiview_p view, index_t* line_nbs);
/**
* @brief Saves a view, writing it in the view file.
*
* The view is written at the end of the view file, following the latest written view.
*
* @warning The view must be writable.
*
* @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 February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_save_view(Obiview_p view);
/**
* @brief Closes an opened view.
*
* @warning Uses obi_save_and_close_view() to automatically save the view if it's not already saved in the view file.
*
* @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 February 2016
* @author Celine Mercier (celine.mercier@metabarcoding.org)
*/
int obi_close_view(Obiview_p view);
/**
* @brief Closes an opened view, and saves it if it is not read-only (meaning it is not already saved in the view file).
*
* The predicates associated with the view are checked before saving it, and -1 is returned if at
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment