Commit 26fb149e by Celine Mercier

C: made build_ref_db cleaner

parent 2b8c066f
......@@ -224,20 +224,30 @@ int build_reference_db(const char* dms_name,
// Read line index
idx1 = obi_get_int_with_elt_idx_and_col_p_in_view(matrix_with_lca_view, matrix_idx1_column, i, 0);
taxid1 = obi_get_int_with_elt_idx_and_col_p_in_view(refs_view, refs_taxid_column, idx1, 0);
if (taxid1 == OBIInt_NA)
{
obidebug(1, "\nError getting a taxid when building a reference database, seq %lld in refs view has no taxid associated", idx1);
return -1;
}
taxon1 = obi_taxo_get_taxon_with_taxid(tax, taxid1);
if (taxon1 == NULL)
{
obidebug(1, "\nError getting a taxon with taxid %d when building a reference database", taxid1);
obidebug(1, "\nError getting a taxon with taxid %d when building a reference database, seq %lld in refs view", taxid1, idx1);
return -1;
}
// Read taxid2 and get taxon2
idx2 = obi_get_int_with_elt_idx_and_col_p_in_view(matrix_with_lca_view, matrix_idx2_column, i, 0);
taxid2 = obi_get_int_with_elt_idx_and_col_p_in_view(refs_view, refs_taxid_column, idx2, 0);
if (taxid2 == OBIInt_NA)
{
obidebug(1, "\nError getting a taxid when building a reference database, seq %lld in refs view has no taxid associated", idx1);
return -1;
}
taxon2 = obi_taxo_get_taxon_with_taxid(tax, taxid2);
if (taxon2 == NULL)
{
obidebug(1, "\nError getting a taxon with taxid %d when building a reference database", taxid2);
obidebug(1, "\nError getting a taxon with taxid %d when building a reference database, seq %lld in refs view", taxid2, idx2);
return -1;
}
......@@ -657,6 +667,20 @@ int build_reference_db(const char* dms_name,
obidebug(1, "\nError closing the final view after building a reference database");
return -1;
}
// Delete temporary views
if (obi_delete_view(dms, matrix_view_name) < 0)
{
obidebug(1, "\nError deleting temporary view %s after building a reference database", matrix_view_name);
return -1;
}
if (obi_delete_view(dms, matrix_with_lca_view_name) < 0)
{
obidebug(1, "\nError deleting temporary view %s after building a reference database", matrix_view_name);
return -1;
}
// Close DMS
if (obi_close_dms(dms, false) < 0)
{
obidebug(1, "\nError closing the DMS after building a reference database");
......
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