Author: rchikhi <rayan.chikhi@univ-lille1.fr>
Date:   Sun Jun 7 23:17:58 2020 +0200
Description: Upstream commit 7cb8a48cc958f4266c74db57f02e937d583ba9b7

diff --git a/gatb-core/src/gatb/debruijn/impl/Graph.cpp b/gatb-core/src/gatb/debruijn/impl/Graph.cpp
index fc19c251..a621658f 100644
--- a/gatb-core/src/gatb/debruijn/impl/Graph.cpp
+++ b/gatb-core/src/gatb/debruijn/impl/Graph.cpp
@@ -417,8 +417,12 @@ void build_visitor_solid<Node,Edge,GraphDataVariant>::operator() (GraphData<span
     DEBUG ((cout << "build_visitor : SortingCountAlgorithm END\n"));
 
     /** We save the state and kmer size at storage root level. */
-    graph.getGroup().setProperty ("state",     Stringify::format("%d", graph._state));
-    graph.getGroup().setProperty ("kmer_size", Stringify::format("%d", graph._kmerSize));
+    graph.getGroup().setProperty ("state",          Stringify::format("%d", graph._state));
+    graph.getGroup().setProperty ("kmer_size",      Stringify::format("%d", graph._kmerSize));
+    graph.getGroup().setProperty ("nb_solid_kmers", Stringify::format("%d", solidCounts->getNbItems()));
+
+    // also set _nbSolidKmers here, as for example, _kmerSize was set at startup since we knew it already
+    graph._nbSolidKmers = solidCounts->getNbItems();
 }
 
 
@@ -605,6 +609,10 @@ void build_visitor_postsolid<Node,Edge,GraphDataVariant>::operator() (GraphData<
     /** We save the state and kmer size at storage root level. */
     graph.getGroup().setProperty ("state",     Stringify::format("%d", graph._state));
     graph.getGroup().setProperty ("kmer_size", Stringify::format("%d", graph._kmerSize));
+    graph.getGroup().setProperty ("nb_solid_kmers", Stringify::format("%d", solidCounts->getNbItems()));
+    
+    // also set _nbSolidKmers here, as for example, _kmerSize was set at startup since we knew it already
+    graph._nbSolidKmers = solidCounts->getNbItems();
 
     /************************************************************/
     /*                        Clean up                          */
@@ -778,7 +786,8 @@ GraphTemplate<Node, Edge, GraphDataVariant_t>::GraphTemplate (const std::string&
 
     /** We get some properties. */
     _state     = (GraphTemplate<Node, Edge, GraphDataVariant_t>::StateMask) atol (getGroup().getProperty ("state").c_str());
-    _kmerSize  =                    atol (getGroup().getProperty ("kmer_size").c_str());
+    _kmerSize  =                                                            atol (getGroup().getProperty ("kmer_size").c_str());
+    _nbSolidKmers=                                                          atol (getGroup().getProperty ("nb_solid_kmers").c_str());
 
     /** We get library information in the root of the storage. */
     string xmlString = getGroup().getProperty ("xml");
@@ -940,8 +949,8 @@ GraphTemplate<Node, Edge, GraphDataVariant>::GraphTemplate ()
 *********************************************************************/
 template<typename Node, typename Edge, typename GraphDataVariant>
 GraphTemplate<Node, Edge, GraphDataVariant>::GraphTemplate (const GraphTemplate<Node, Edge, GraphDataVariant>& graph)
-    : _storageMode(graph._storageMode), _storage(0),
-      _variant(new GraphDataVariant()), _kmerSize(graph._kmerSize), _info("graph"), _name(graph._name), _state(graph._state)
+    : _storageMode(graph._storageMode), _storage(0), 
+      _variant(new GraphDataVariant()), _kmerSize(graph._kmerSize), _nbSolidKmers(graph._nbSolidKmers), _info("graph"), _name(graph._name), _state(graph._state)
 {
     setStorage (graph._storage);
 
@@ -962,6 +971,7 @@ GraphTemplate<Node, Edge, GraphDataVariant>& GraphTemplate<Node, Edge, GraphData
     if (this != &graph)
     {
         _kmerSize        = graph._kmerSize;
+        _nbSolidKmers    = graph._nbSolidKmers;
         _storageMode     = graph._storageMode;
         _name            = graph._name;
         _info            = graph._info;
diff --git a/gatb-core/src/gatb/debruijn/impl/Graph.hpp b/gatb-core/src/gatb/debruijn/impl/Graph.hpp
index 9728e911..a5b9aed2 100644
--- a/gatb-core/src/gatb/debruijn/impl/Graph.hpp
+++ b/gatb-core/src/gatb/debruijn/impl/Graph.hpp
@@ -1044,6 +1044,9 @@ public: // was private: before, but had many compilation errors during the chang
 
     /** kmer size of the graph */
     size_t _kmerSize;
+    
+    /** nb solid kmers in the graph (only populated by GraphUnitigs */
+    size_t _nbSolidKmers;
 
     /** Creation information. */
     tools::misc::impl::Properties _info;
diff --git a/gatb-core/src/gatb/debruijn/impl/GraphUnitigs.cpp b/gatb-core/src/gatb/debruijn/impl/GraphUnitigs.cpp
index 74c16cc9..9eb1e631 100644
--- a/gatb-core/src/gatb/debruijn/impl/GraphUnitigs.cpp
+++ b/gatb-core/src/gatb/debruijn/impl/GraphUnitigs.cpp
@@ -970,6 +970,7 @@ GraphUnitigsTemplate<span>& GraphUnitigsTemplate<span>::operator= (GraphUnitigsT
     if (this != &graph)
     {
         BaseGraph::_kmerSize        = graph._kmerSize;
+        BaseGraph::_nbSolidKmers    = graph._nbSolidKmers;
         BaseGraph::_storageMode     = graph._storageMode;
         BaseGraph::_name            = graph._name;
         BaseGraph::_info            = graph._info;
@@ -1020,6 +1021,7 @@ GraphUnitigsTemplate<span>& GraphUnitigsTemplate<span>::operator= (GraphUnitigsT
     if (this != &graph)
     {
         BaseGraph::_kmerSize        = graph._kmerSize;
+        BaseGraph::_nbSolidKmers    = graph._nbSolidKmers;
         BaseGraph::_storageMode     = graph._storageMode;
         BaseGraph::_name            = graph._name;
         BaseGraph::_info            = graph._info;
diff --git a/gatb-core/src/gatb/debruijn/impl/GraphUnitigs.hpp b/gatb-core/src/gatb/debruijn/impl/GraphUnitigs.hpp
index f327ce60..dc385b71 100644
--- a/gatb-core/src/gatb/debruijn/impl/GraphUnitigs.hpp
+++ b/gatb-core/src/gatb/debruijn/impl/GraphUnitigs.hpp
@@ -252,7 +252,7 @@ public:
     /**********************************************************************/
 
     /* perform tip removal, bulge removal and EC removal, as in Minia */
-    void simplify(unsigned int nbCores = 1, bool verbose=true);
+    void simplify(unsigned int nbCores = 1, bool verbose=false);
 
     /**********************************************************************/
     /*                         SIMPLE PATH METHODS                        */
diff --git a/gatb-core/src/gatb/debruijn/impl/Simplifications.cpp b/gatb-core/src/gatb/debruijn/impl/Simplifications.cpp
index d75ed56a..4bd0e8c1 100644
--- a/gatb-core/src/gatb/debruijn/impl/Simplifications.cpp
+++ b/gatb-core/src/gatb/debruijn/impl/Simplifications.cpp
@@ -406,13 +406,13 @@ unsigned long Simplifications<GraphType,Node,Edge>::removeTips()
     ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem> *itNode; 
     if (_firstNodeIteration )
     {
-        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iterator(), buffer, _verbose);
+        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iterator(), buffer, /*_verbose*/true);
         if (_verbose)
             std::cout << "iterating on " << itNode->size() << " nodes on disk" << std::endl;
     }
     else
     {
-        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iteratorCachedNodes(), buffer, _verbose);
+        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iteratorCachedNodes(), buffer, /*_verbose*/true);
         if (_verbose)
             std::cout << "iterating on " << itNode->size() << " cached nodes" << std::endl;
     }
@@ -1307,13 +1307,13 @@ unsigned long Simplifications<GraphType,Node,Edge>::removeBulges()
     ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem> *itNode; 
     if (_firstNodeIteration )
     {
-        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iterator(), buffer, _verbose);
+        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iterator(), buffer, /*_verbose*/true);
         if (_verbose)
             std::cout << "iterating on " << itNode->size() << " nodes" << std::endl;
     }
     else
     {
-        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iteratorCachedNodes(), buffer, _verbose);
+        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iteratorCachedNodes(), buffer, /*_verbose*/true); // always display
         if (_verbose)
             std::cout << "iterating on " << itNode->size() << " cached nodes" << std::endl;
     }
@@ -1630,13 +1630,13 @@ unsigned long Simplifications<GraphType,Node,Edge>::removeErroneousConnections()
     ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem> *itNode; 
     if (_firstNodeIteration )
     {
-        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iterator(), buffer, _verbose);
+        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iterator(), buffer, /*_verbose*/true);
         if (_verbose)
             std::cout << "iterating on " << itNode->size() << " nodes on disk" << std::endl;
     }
     else
     {
-        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iteratorCachedNodes(), buffer, _verbose);
+        itNode = new ProgressGraphIteratorTemplate<Node,ProgressTimerAndSystem>(_graph.GraphType::iteratorCachedNodes(), buffer, /*_verbose*/true);
         if (_verbose)
             std::cout << "iterating on " << itNode->size() << " cached nodes" << std::endl;
     }
