From aa836b2acee676cff388c8f0efb0f4c0863e32a9 Mon Sep 17 00:00:00 2001 From: Celine Mercier Date: Tue, 9 Jun 2020 14:36:02 +0200 Subject: [PATCH] uniq: improved progress bar of second browsing --- python/obitools3/commands/uniq.pyx | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/python/obitools3/commands/uniq.pyx b/python/obitools3/commands/uniq.pyx index 5b9b532..48385b4 100644 --- a/python/obitools3/commands/uniq.pyx +++ b/python/obitools3/commands/uniq.pyx @@ -419,12 +419,12 @@ cdef uniq_sequences(View_NUC_SEQS view, View_NUC_SEQS o_view, ProgressBar pb, di print("") logger("info", "Second browsing through the input") # Initialize the progress bar - pb = ProgressBar(len(uniques), seconde=5) + pb = ProgressBar(len(view), seconde=5) o_idx = 0 + total_treated = 0 for unique_id in uniques : PyErr_CheckSignals() - pb(o_idx) merged_sequences = uniques[unique_id] @@ -453,7 +453,8 @@ cdef uniq_sequences(View_NUC_SEQS view, View_NUC_SEQS o_view, ProgressBar pb, di merged_dict[mkey] = {} for i_idx in merged_sequences: - + pb(total_treated) + i_id = i_id_col[i_idx] i_seq = view[i_idx] @@ -504,7 +505,9 @@ cdef uniq_sequences(View_NUC_SEQS view, View_NUC_SEQS o_view, ProgressBar pb, di if key != COUNT_COLUMN and key != ID_COLUMN and key != NUC_SEQUENCE_COLUMN and key in o_seq and o_seq[key] != i_seq[key] \ and key not in merged_dict : o_seq[key] = None - + + total_treated += 1 + # Write merged dicts for mkey in merged_dict: if mkey in str_merged_cols: @@ -526,7 +529,7 @@ cdef uniq_sequences(View_NUC_SEQS view, View_NUC_SEQS o_view, ProgressBar pb, di o_count_col[o_idx] = o_count o_idx += 1 - pb(len(uniques), force=True) + pb(len(view), force=True) # Deletes quality columns if there is one because the matching between sequence and quality will be broken (quality set to NA when sequence not) if QUALITY_COLUMN in view: