1+ #include " Assembly/Options.h"
12#if PAIRED_DBG
2- # include " PairedDBG/SequenceCollection .h"
3- # include " PairedDBG/PairedDBGAlgorithms .h"
3+ #include " PairedDBG/PairedDBGAlgorithms .h"
4+ #include " PairedDBG/SequenceCollection .h"
45#else
5- # include " Assembly/SequenceCollection.h"
6+ #include " Assembly/SequenceCollection.h"
67#endif
78#include " Assembly/AssemblyAlgorithms.h"
89#include " Assembly/DotWriter.h"
10+ #include " DataBase/DB.h"
11+
912#include < algorithm>
1013#include < cstdio> // for setvbuf
1114#include < fstream>
1215#include < iostream>
1316#include < sstream>
14- #include " DataBase/DB.h"
1517
1618using namespace std ;
1719
1820DB db;
1921
20- static void removeLowCoverageContigs (SequenceCollectionHash& g)
22+ static void
23+ removeLowCoverageContigs (SequenceCollectionHash& g)
2124{
2225 AssemblyAlgorithms::markAmbiguous (&g);
2326
2427 cout << " Removing low-coverage contigs "
25- " (mean k-mer coverage < " << opt::coverage << " )\n " ;
28+ " (mean k-mer coverage < "
29+ << opt::coverage << " )\n " ;
2630 AssemblyAlgorithms::assemble (&g);
2731 AssemblyAlgorithms::splitAmbiguous (&g);
2832
2933 opt::coverage = 0 ;
3034}
3135
32- static void popBubbles (SequenceCollectionHash& g)
36+ static void
37+ popBubbles (SequenceCollectionHash& g)
3338{
3439 cout << " Popping bubbles" << endl;
3540 ofstream out;
@@ -39,8 +44,8 @@ static void popBubbles(SequenceCollectionHash& g)
3944 cout << " Removed " << numPopped << " bubbles\n " ;
4045}
4146
42- static void write_graph ( const string& path,
43- const SequenceCollectionHash& c)
47+ static void
48+ write_graph ( const string& path, const SequenceCollectionHash& c)
4449{
4550 if (path.empty ())
4651 return ;
@@ -49,16 +54,17 @@ static void write_graph(const string& path,
4954 DotWriter::write (out, c);
5055}
5156
52- static void assemble (const string& pathIn, const string& pathOut)
57+ static void
58+ assemble (const string& pathIn, const string& pathOut)
5359{
5460 Timer timer (__func__);
5561 SequenceCollectionHash g;
5662
5763 if (!pathIn.empty ())
5864 AssemblyAlgorithms::loadSequences (&g, pathIn.c_str ());
59- for_each (opt::inFiles.begin (), opt::inFiles.end (), bind1st (
60- ptr_fun ( AssemblyAlgorithms::loadSequences<SequenceCollectionHash>),
61- &g) );
65+ for_each (opt::inFiles.begin (), opt::inFiles.end (), [&g](std::string s) {
66+ AssemblyAlgorithms::loadSequences (&g, s);
67+ } );
6268 size_t numLoaded = g.size ();
6369 if (!opt::db.empty ())
6470 addToDb (db, " loadedKmer" , numLoaded);
@@ -70,16 +76,14 @@ static void assemble(const string& pathIn, const string& pathOut)
7076 exit (EXIT_FAILURE );
7177 }
7278
73- AssemblyAlgorithms::setCoverageParameters (
74- AssemblyAlgorithms::coverageHistogram (g));
79+ AssemblyAlgorithms::setCoverageParameters (AssemblyAlgorithms::coverageHistogram (g));
7580
7681 if (opt::kc > 0 ) {
7782 cout << " Minimum k-mer multiplicity kc is " << opt::kc << endl;
7883 cout << " Removing low-multiplicity k-mers" << endl;
7984 size_t removed = AssemblyAlgorithms::applyKmerCoverageThreshold (g, opt::kc);
80- cout << " Removed " << removed
81- << " low-multiplicity k-mers, " << g.size ()
82- << " k-mers remaining" << std::endl;
85+ cout << " Removed " << removed << " low-multiplicity k-mers, " << g.size ()
86+ << " k-mers remaining" << std::endl;
8387 }
8488
8589 cout << " Generating adjacency" << endl;
@@ -122,13 +126,14 @@ static void assemble(const string& pathIn, const string& pathOut)
122126
123127 size_t numAssembled = g.size ();
124128 size_t numRemoved = numLoaded - numAssembled;
125- cout << " Removed " << numRemoved << " k-mer. \n "
126- " The signal-to-noise ratio (SNR) is "
127- << 10 * log10 (( double )numAssembled / numRemoved)
128- << " dB.\n " ;
129+ cout << " Removed " << numRemoved
130+ << " k-mer. \n "
131+ " The signal-to-noise ratio (SNR) is "
132+ << 10 * log10 (( double )numAssembled / numRemoved) << " dB.\n " ;
129133}
130134
131- int main (int argc, char * const * argv)
135+ int
136+ main (int argc, char * const * argv)
132137{
133138 Timer timer (" Total" );
134139
@@ -142,16 +147,16 @@ int main(int argc, char* const* argv)
142147
143148 bool krange = opt::kMin != opt::kMax ;
144149 if (krange)
145- cout << " Assembling k=" << opt::kMin << " -" << opt::kMax
146- << " :" << opt::kStep << endl;
150+ cout << " Assembling k=" << opt::kMin << " -" << opt::kMax << " :" << opt::kStep << endl;
147151
148152 if (!opt::db.empty ()) {
149- init (db,
150- opt::getUvalue (),
151- opt::getVvalue (),
152- " ABYSS" ,
153- opt::getCommand (),
154- opt::getMetaValue ());
153+ init (
154+ db,
155+ opt::getUvalue (),
156+ opt::getVvalue (),
157+ " ABYSS" ,
158+ opt::getCommand (),
159+ opt::getMetaValue ());
155160 addToDb (db, " SS" , opt::ss);
156161 addToDb (db, " k" , opt::kmerSize);
157162 addToDb (db, " singleK" , opt::singleKmerSize);
@@ -175,7 +180,7 @@ int main(int argc, char* const* argv)
175180 opt::erodeStrand = (unsigned )-1 ;
176181 opt::coverage = -1 ;
177182 opt::trimLen = k;
178- opt::bubbleLen = 3 * k;
183+ opt::bubbleLen = 3 * k;
179184 }
180185
181186 ostringstream k0, k1;
0 commit comments