[med-svn] [abyss] 03/14: Imported 1.3.4 by hand.
Charles Plessy
plessy at alioth.debian.org
Sun Sep 8 05:30:18 UTC 2013
This is an automated email from the git hooks/post-receive script.
plessy pushed a commit to branch master
in repository abyss.
commit 958745022dcf81507a579791148c4c93b728afb5
Author: Charles Plessy <plessy at debian.org>
Date: Sun Sep 8 11:21:04 2013 +0900
Imported 1.3.4 by hand.
---
ABYSS/Abyss.cpp | 152 +
ABYSS/Makefile.am | 13 +
ABYSS/Makefile.in | 530 ++
AdjList/AdjList.cpp | 284 ++
AdjList/Makefile.am | 13 +
AdjList/Makefile.in | 531 ++
Align/Makefile.am | 23 +
Align/Makefile.in | 637 +++
Align/align.cc | 167 +
Align/alignGlobal.cc | 198 +
Align/alignGlobal.h | 42 +
Align/dialign.cpp | 423 ++
Align/dialign.h | 41 +
Align/dna_diag_prob.cc | 5155 +++++++++++++++++++
Align/smith_waterman.cpp | 290 ++
Align/smith_waterman.h | 59 +
Assembly/AssemblyAlgorithms.cpp | 1028 ++++
Assembly/AssemblyAlgorithms.h | 106 +
Assembly/BranchGroup.cpp | 86 +
Assembly/BranchGroup.h | 142 +
Assembly/BranchRecord.cpp | 59 +
Assembly/BranchRecord.h | 140 +
Assembly/DotWriter.cpp | 70 +
Assembly/DotWriter.h | 13 +
Assembly/ISequenceCollection.h | 87 +
Assembly/KmerData.h | 169 +
Assembly/Makefile.am | 15 +
Assembly/Makefile.in | 578 +++
Assembly/Options.cpp | 271 +
Assembly/Options.h | 27 +
Assembly/SequenceCollection.cpp | 258 +
Assembly/SequenceCollection.h | 333 ++
COPYRIGHT | 358 ++
ChangeLog | 956 ++++
Common/Algorithms.h | 69 +
Common/Alignment.h | 99 +
Common/BitUtil.h | 65 +
Common/ConstString.h | 144 +
Common/ContigID.cpp | 5 +
Common/ContigID.h | 59 +
Common/ContigNode.h | 301 ++
Common/ContigPath.h | 86 +
Common/ContigProperties.h | 240 +
Common/Dictionary.h | 126 +
Common/Estimate.h | 176 +
Common/Fcontrol.cpp | 12 +
Common/Fcontrol.h | 6 +
Common/Functional.h | 78 +
Common/HashFunction.h | 13 +
Common/Histogram.cpp | 102 +
Common/Histogram.h | 327 ++
Common/IOUtil.h | 109 +
Common/Iterator.h | 115 +
Common/Kmer.cpp | 455 ++
Common/Kmer.h | 130 +
Common/Log.cpp | 19 +
Common/Log.h | 8 +
Common/Makefile.am | 38 +
Common/Makefile.in | 706 +++
Common/MemoryUtil.h | 38 +
Common/Options.cpp | 15 +
Common/Options.h | 15 +
Common/PMF.h | 69 +
Common/SAM.h | 347 ++
Common/Sense.h | 24 +
Common/SeqExt.cpp | 16 +
Common/SeqExt.h | 98 +
Common/Sequence.cpp | 171 +
Common/Sequence.h | 51 +
Common/SignalHandler.cpp | 62 +
Common/SignalHandler.h | 6 +
Common/StringUtil.h | 90 +
Common/SuffixArray.h | 85 +
Common/Timer.cpp | 18 +
Common/Timer.h | 20 +
Common/Uncompress.cpp | 179 +
Common/Uncompress.h | 12 +
Common/UnorderedMap.h | 20 +
Common/cholesky.hpp | 230 +
Common/city.cc | 467 ++
Common/city.h | 90 +
Consensus/Consensus.cpp | 503 ++
Consensus/Makefile.am | 12 +
Consensus/Makefile.in | 529 ++
DAssembler/DAssembler.cpp | 550 ++
DAssembler/Makefile.am | 13 +
DAssembler/Makefile.in | 550 ++
DAssembler/RotatedRead.cpp | 21 +
DAssembler/RotatedRead.h | 26 +
DAssembler/Rotation.h | 29 +
DataLayer/FastaIndex.h | 181 +
DataLayer/FastaInterleave.h | 76 +
DataLayer/FastaReader.cpp | 361 ++
DataLayer/FastaReader.h | 183 +
DataLayer/FastaWriter.cpp | 57 +
DataLayer/FastaWriter.h | 32 +
DataLayer/Makefile.am | 28 +
DataLayer/Makefile.in | 632 +++
DataLayer/Options.h | 11 +
DataLayer/abyss-tofastq.cc | 201 +
DataLayer/fac.cc | 201 +
DistanceEst/DistanceEst.cpp | 549 ++
DistanceEst/MLE.cpp | 157 +
DistanceEst/MLE.h | 13 +
DistanceEst/Makefile.am | 11 +
DistanceEst/Makefile.in | 547 ++
FMIndex/BitArrays.h | 120 +
FMIndex/DAWG.h | 176 +
FMIndex/FMIndex.h | 583 +++
FMIndex/Makefile.am | 23 +
FMIndex/Makefile.in | 559 +++
FMIndex/abyss-dawg.cc | 173 +
FMIndex/bit_array.cc | 216 +
FMIndex/bit_array.h | 78 +
FMIndex/count.cc | 216 +
FMIndex/sais.hxx | 600 +++
FilterGraph/FilterGraph.cpp | 598 +++
FilterGraph/Makefile.am | 14 +
FilterGraph/Makefile.in | 533 ++
Graph/AdjIO.h | 204 +
Graph/AsqgIO.h | 156 +
Graph/Assemble.h | 67 +
Graph/ConstrainedSearch.cpp | 131 +
Graph/ConstrainedSearch.h | 30 +
Graph/ContigGraph.h | 518 ++
Graph/ContigGraphAlgorithms.h | 340 ++
Graph/DepthFirstSearch.h | 65 +
Graph/DirectedGraph.h | 822 +++
Graph/DistIO.h | 42 +
Graph/DotIO.h | 300 ++
Graph/FastaIO.h | 45 +
Graph/GraphAlgorithms.h | 103 +
Graph/GraphIO.h | 80 +
Graph/GraphUtil.h | 61 +
Graph/Makefile.am | 34 +
Graph/Makefile.in | 623 +++
Graph/Options.h | 15 +
Graph/PopBubbles.h | 204 +
Graph/Properties.h | 83 +
Graph/SAMIO.h | 72 +
Graph/gc.cc | 111 +
Graph/todot.cc | 164 +
KAligner/Aligner.cpp | 249 +
KAligner/Aligner.h | 156 +
KAligner/KAligner.cpp | 587 +++
KAligner/Makefile.am | 14 +
KAligner/Makefile.in | 552 +++
KAligner/Options.h | 9 +
KAligner/Pipe.h | 102 +
KAligner/PipeMux.h | 146 +
KAligner/Semaphore.h | 96 +
LICENSE | 230 +
Makefile.am | 38 +
Makefile.in | 844 ++++
Map/Makefile.am | 41 +
Map/Makefile.in | 607 +++
Map/index.cc | 288 ++
Map/map.cc | 481 ++
Map/overlap.cc | 461 ++
MergePaths/Makefile.am | 44 +
MergePaths/Makefile.in | 614 +++
MergePaths/MergeContigs.cpp | 589 +++
MergePaths/MergePaths.cpp | 1422 ++++++
MergePaths/PathConsensus.cpp | 935 ++++
Overlap/Makefile.am | 13 +
Overlap/Makefile.in | 531 ++
Overlap/Overlap.cpp | 572 +++
Parallel/CommLayer.cpp | 272 +
Parallel/CommLayer.h | 100 +
Parallel/Makefile.am | 19 +
Parallel/Makefile.in | 605 +++
Parallel/MessageBuffer.cpp | 151 +
Parallel/MessageBuffer.h | 77 +
Parallel/Messages.cpp | 197 +
Parallel/Messages.h | 207 +
Parallel/NetworkSequenceCollection.cpp | 1396 ++++++
Parallel/NetworkSequenceCollection.h | 231 +
Parallel/parallelAbyss.cpp | 104 +
ParseAligns/Makefile.am | 18 +
ParseAligns/Makefile.in | 568 +++
ParseAligns/ParseAligns.cpp | 680 +++
ParseAligns/abyss-fixmate.cc | 330 ++
PathOverlap/Makefile.am | 13 +
PathOverlap/Makefile.in | 531 ++
PathOverlap/PathOverlap.cpp | 663 +++
PopBubbles/Makefile.am | 17 +
PopBubbles/Makefile.in | 537 ++
PopBubbles/PopBubbles.cpp | 735 +++
README.css | 39 +
README.html | 354 ++
README.md | 330 ++
Scaffold/Makefile.am | 26 +
Scaffold/Makefile.in | 589 +++
Scaffold/drawgraph.cc | 268 +
Scaffold/junction.cc | 223 +
Scaffold/scaffold.cc | 741 +++
SimpleGraph/Makefile.am | 14 +
SimpleGraph/Makefile.in | 530 ++
SimpleGraph/SimpleGraph.cpp | 688 +++
aclocal.m4 | 986 ++++
bin/Makefile.am | 14 +
bin/Makefile.in | 438 ++
bin/abyss-adjtodot.pl | 52 +
bin/abyss-bowtie | 56 +
bin/abyss-bowtie2 | 57 +
bin/abyss-bwa | 58 +
bin/abyss-bwasw | 74 +
bin/abyss-cstont | 105 +
bin/abyss-fac.pl | 121 +
bin/abyss-fatoagp | 53 +
bin/abyss-joindist | 79 +
bin/abyss-kaligner | 3 +
bin/abyss-pe | 558 +++
bin/abyss-samtoafg | 210 +
config.h.in | 282 ++
configure | 8552 ++++++++++++++++++++++++++++++++
configure.ac | 202 +
depcomp | 630 +++
dialign/Makefile.am | 17 +
dialign/Makefile.in | 501 ++
dialign/alig.c | 1074 ++++
dialign/assemble.c | 1418 ++++++
dialign/diag.c | 2125 ++++++++
dialign/io.c | 1158 +++++
dialign/io.h | 47 +
dialign/museq.c | 315 ++
dialign/orf.c | 902 ++++
dialign/orf.h | 39 +
dialign/parameters.c | 341 ++
dialign/parameters.h | 163 +
dialign/prob.c | 250 +
dialign/struct.h | 222 +
dialign/translate.c | 603 +++
dialign/translate.h | 35 +
doc/ABYSS.1 | 86 +
doc/Makefile.am | 2 +
doc/Makefile.in | 471 ++
doc/abyss-pe.1 | 224 +
doc/abyss-tofastq.1 | 21 +
doc/flowchart.pdf | Bin 0 -> 77904 bytes
doxygen.conf | 1252 +++++
install-sh | 520 ++
kmerprint/Makefile.am | 11 +
kmerprint/Makefile.in | 486 ++
kmerprint/kmerprint.cc | 96 +
missing | 376 ++
246 files changed, 78656 insertions(+)
diff --git a/ABYSS/Abyss.cpp b/ABYSS/Abyss.cpp
new file mode 100644
index 0000000..510951c
--- /dev/null
+++ b/ABYSS/Abyss.cpp
@@ -0,0 +1,152 @@
+#include "Assembly/Options.h"
+#include "AssemblyAlgorithms.h"
+#include "DotWriter.h"
+#include "FastaWriter.h"
+#include "Histogram.h"
+#include "ISequenceCollection.h"
+#include "SequenceCollection.h"
+#include "Timer.h"
+#include "Uncompress.h"
+#include <algorithm>
+#include <cstdio> // for setvbuf
+#include <fstream>
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+static void removeLowCoverageContigs(SequenceCollectionHash& g)
+{
+ AssemblyAlgorithms::markAmbiguous(&g);
+
+ cout << "Removing low-coverage contigs "
+ "(mean k-mer coverage < " << opt::coverage << ")\n";
+ AssemblyAlgorithms::assemble(&g);
+ AssemblyAlgorithms::splitAmbiguous(&g);
+
+ opt::coverage = 0;
+}
+
+static void popBubbles(SequenceCollectionHash& g)
+{
+ cout << "Popping bubbles" << endl;
+ ofstream out;
+ AssemblyAlgorithms::openBubbleFile(out);
+ unsigned numPopped = AssemblyAlgorithms::popBubbles(&g, out);
+ assert(out.good());
+ cout << "Removed " << numPopped << " bubbles\n";
+}
+
+static void write_graph(const string& path,
+ const SequenceCollectionHash& c)
+{
+ if (path.empty())
+ return;
+ cout << "Writing graph to `" << path << "'\n";
+ ofstream out(path.c_str());
+ DotWriter::write(out, c);
+}
+
+static void assemble(const string& pathIn, const string& pathOut)
+{
+ Timer timer(__func__);
+ SequenceCollectionHash g;
+
+ if (!pathIn.empty())
+ AssemblyAlgorithms::loadSequences(&g, pathIn.c_str());
+ for_each(opt::inFiles.begin(), opt::inFiles.end(),
+ bind1st(ptr_fun(AssemblyAlgorithms::loadSequences), &g));
+ size_t numLoaded = g.size();
+ cout << "Loaded " << numLoaded << " k-mer\n";
+ g.shrink();
+ if (g.empty()) {
+ cerr << "error: no usable sequence\n";
+ exit(EXIT_FAILURE);
+ }
+
+ AssemblyAlgorithms::setCoverageParameters(
+ AssemblyAlgorithms::coverageHistogram(g));
+
+ cout << "Generating adjacency" << endl;
+ AssemblyAlgorithms::generateAdjacency(&g);
+
+erode:
+ if (opt::erode > 0) {
+ cout << "Eroding tips" << endl;
+ AssemblyAlgorithms::erodeEnds(&g);
+ assert(AssemblyAlgorithms::erodeEnds(&g) == 0);
+ g.cleanup();
+ }
+
+ AssemblyAlgorithms::performTrim(&g);
+ g.cleanup();
+
+ if (opt::coverage > 0) {
+ removeLowCoverageContigs(g);
+ g.wipeFlag(SeqFlag(SF_MARK_SENSE | SF_MARK_ANTISENSE));
+ g.cleanup();
+ goto erode;
+ }
+
+ if (opt::bubbleLen > 0)
+ popBubbles(g);
+
+ write_graph(opt::graphPath, g);
+
+ AssemblyAlgorithms::markAmbiguous(&g);
+
+ FastaWriter writer(pathOut.c_str());
+ unsigned nContigs = AssemblyAlgorithms::assemble(&g, &writer);
+ if (nContigs == 0) {
+ cerr << "error: no contigs assembled\n";
+ exit(EXIT_FAILURE);
+ }
+
+ size_t numAssembled = g.size();
+ size_t numRemoved = numLoaded - numAssembled;
+ cout << "Removed " << numRemoved << " k-mer.\n"
+ "The signal-to-noise ratio (SNR) is "
+ << 10 * log10((double)numAssembled / numRemoved)
+ << " dB.\n";
+}
+
+int main(int argc, char* const* argv)
+{
+ Timer timer("Total");
+
+ // Set stdout to be line buffered.
+ setvbuf(stdout, NULL, _IOLBF, 0);
+
+ opt::parse(argc, argv);
+
+ bool krange = opt::kMin != opt::kMax;
+ if (krange)
+ cout << "Assembling k=" << opt::kMin << "-" << opt::kMax
+ << ":" << opt::kStep << endl;
+
+ for (unsigned k = opt::kMin; k <= opt::kMax; k += opt::kStep) {
+ if (krange)
+ cout << "Assembling k=" << k << endl;
+ opt::kmerSize = k;
+ Kmer::setLength(k);
+
+ if (k > opt::kMin) {
+ // Reset the assembly options to defaults.
+ opt::erode = (unsigned)-1;
+ opt::erodeStrand = (unsigned)-1;
+ opt::coverage = -1;
+ opt::trimLen = k;
+ opt::bubbleLen = 3*k;
+ }
+
+ ostringstream k0, k1;
+ if (k > opt::kMin)
+ k0 << "contigs-k" << k - opt::kStep << ".fa";
+ if (k < opt::kMax)
+ k1 << "contigs-k" << k << ".fa";
+ else
+ k1 << opt::contigsPath.c_str();
+ assemble(k0.str(), k1.str());
+ }
+ return 0;
+}
diff --git a/ABYSS/Makefile.am b/ABYSS/Makefile.am
new file mode 100644
index 0000000..3ff28e1
--- /dev/null
+++ b/ABYSS/Makefile.am
@@ -0,0 +1,13 @@
+bin_PROGRAMS = ABYSS
+
+ABYSS_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Assembly \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+ABYSS_LDADD = \
+ $(top_builddir)/Assembly/libassembly.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+ABYSS_SOURCES = Abyss.cpp
diff --git a/ABYSS/Makefile.in b/ABYSS/Makefile.in
new file mode 100644
index 0000000..a5768e0
--- /dev/null
+++ b/ABYSS/Makefile.in
@@ -0,0 +1,530 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = ABYSS$(EXEEXT)
+subdir = ABYSS
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_ABYSS_OBJECTS = ABYSS-Abyss.$(OBJEXT)
+ABYSS_OBJECTS = $(am_ABYSS_OBJECTS)
+ABYSS_DEPENDENCIES = $(top_builddir)/Assembly/libassembly.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(ABYSS_SOURCES)
+DIST_SOURCES = $(ABYSS_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+ABYSS_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Assembly \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+ABYSS_LDADD = \
+ $(top_builddir)/Assembly/libassembly.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+ABYSS_SOURCES = Abyss.cpp
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ABYSS/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign ABYSS/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+ABYSS$(EXEEXT): $(ABYSS_OBJECTS) $(ABYSS_DEPENDENCIES) $(EXTRA_ABYSS_DEPENDENCIES)
+ @rm -f ABYSS$(EXEEXT)
+ $(CXXLINK) $(ABYSS_OBJECTS) $(ABYSS_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ABYSS-Abyss.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ABYSS-Abyss.o: Abyss.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS-Abyss.o -MD -MP -MF $(DEPDIR)/ABYSS-Abyss.Tpo -c -o ABYSS-Abyss.o `test -f 'Abyss.cpp' || echo '$(srcdir)/'`Abyss.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS-Abyss.Tpo $(DEPDIR)/ABYSS-Abyss.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Abyss.cpp' object='ABYSS-Abyss.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS-Abyss.o `test -f 'Abyss.cpp' || echo '$(srcdir)/'`Abyss.cpp
+
+ABYSS-Abyss.obj: Abyss.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS-Abyss.obj -MD -MP -MF $(DEPDIR)/ABYSS-Abyss.Tpo -c -o ABYSS-Abyss.obj `if test -f 'Abyss.cpp'; then $(CYGPATH_W) 'Abyss.cpp'; else $(CYGPATH_W) '$(srcdir)/Abyss.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS-Abyss.Tpo $(DEPDIR)/ABYSS-Abyss.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Abyss.cpp' object='ABYSS-Abyss.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS-Abyss.obj `if test -f 'Abyss.cpp'; then $(CYGPATH_W) 'Abyss.cpp'; else $(CYGPATH_W) '$(srcdir)/Abyss.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/AdjList/AdjList.cpp b/AdjList/AdjList.cpp
new file mode 100644
index 0000000..95df027
--- /dev/null
+++ b/AdjList/AdjList.cpp
@@ -0,0 +1,284 @@
+#include "Common/Options.h"
+#include "DataLayer/Options.h"
+#include "ContigNode.h"
+#include "ContigProperties.h"
+#include "FastaReader.h"
+#include "Iterator.h"
+#include "Kmer.h"
+#include "StringUtil.h"
+#include "SuffixArray.h"
+#include "Uncompress.h"
+#include "UnorderedMap.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/GraphIO.h"
+#include "Graph/GraphUtil.h"
+#include <cassert>
+#include <cctype>
+#include <cstdlib>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <set>
+#include <sstream>
+#include <vector>
+
+using namespace std;
+
+#define PROGRAM "AdjList"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... [FILE]...\n"
+"Find overlaps of [m,k) bases. Contigs may be read from FILE(s)\n"
+"or standard input. Output is written to standard output.\n"
+"Overlaps of exactly k-1 bases are found using a hash table.\n"
+"Overlaps of fewer than k-1 bases are found using a suffix array.\n"
+"\n"
+" -k, --kmer=K find overlaps of up to K-1 bases\n"
+" -m, --min-overlap=M require a minimum overlap of M bases [30]\n"
+" --adj output the results in adj format [default]\n"
+" --dot output the results in dot format\n"
+" --sam output the results in SAM format\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by GraphIO
+ int format; // used by GraphIO
+
+ /** The minimum required amount of overlap. */
+ static unsigned minOverlap = 30;
+}
+
+static const char shortopts[] = "k:m:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "kmer", required_argument, NULL, 'k' },
+ { "min-overlap", required_argument, NULL, 'm' },
+ { "adj", no_argument, &opt::format, ADJ },
+ { "dot", no_argument, &opt::format, DOT },
+ { "sam", no_argument, &opt::format, SAM },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** A contig adjacency graph. */
+typedef DirectedGraph<ContigProperties, Distance> DG;
+typedef ContigGraph<DG> Graph;
+
+/** Parse and return the coverage from the specified FASTA comment. */
+static unsigned getCoverage(const string& comment)
+{
+ istringstream ss(comment);
+ unsigned length, coverage = 0;
+ ss >> length >> coverage;
+ return coverage;
+}
+
+/** Add the overlaps of vseq to the graph. */
+static void addOverlapsSA(Graph& g, const SuffixArray& sa,
+ ContigNode v, const string& vseq)
+{
+ assert(!vseq.empty());
+ set<ContigNode> seen;
+ typedef SuffixArray::const_iterator It;
+ for (string q(vseq, 0, vseq.size() - 1);
+ q.size() >= opt::minOverlap; chop(q)) {
+ pair<It, It> range = sa.equal_range(q);
+ for (It it = range.first; it != range.second; ++it) {
+ ContigNode u(it->second);
+ if (seen.insert(u).second) {
+ // Add the longest overlap between two vertices.
+ unsigned overlap = it->first.size();
+ add_edge(u, v, -overlap, static_cast<DG&>(g));
+ }
+ }
+ }
+}
+
+/** Add overlaps of fewer than k-1 bp to the graph. */
+static void addOverlapsSA(Graph& g, const vector<Kmer>& prefixes)
+{
+ // Construct a suffix array of the blunt contigs.
+ typedef pair<string, ContigNode> Suffix;
+ typedef vector<Suffix> Suffixes;
+ Suffixes suffixes;
+ SuffixArray sa(opt::minOverlap);
+
+ typedef graph_traits<Graph>::vertex_descriptor V;
+ typedef graph_traits<Graph>::vertex_iterator Vit;
+ pair<Vit, Vit> vertices = g.vertices();
+ for (Vit it = vertices.first; it != vertices.second; ++it) {
+ ContigNode u(*it);
+ if (out_degree(u, g) > 0)
+ continue;
+ size_t uci = get(vertex_index, g,
+ get(vertex_complement, g, u));
+ assert(uci < prefixes.size());
+ string suffix(reverseComplement(prefixes[uci]).str());
+ suffixes.push_back(Suffix(suffix, u));
+ sa.insert(suffixes.back());
+ }
+ sa.construct();
+
+ for (Suffixes::const_iterator it = suffixes.begin();
+ it != suffixes.end(); ++it) {
+ V uc = get(vertex_complement, g, it->second);
+ addOverlapsSA(g, sa, uc, reverseComplement(it->first));
+ }
+}
+
+/** An index of suffixes of k-1 bp. */
+typedef unordered_map<Kmer, vector<ContigNode>, hashKmer> SuffixMap;
+
+/** Read contigs. Add contig properties to the graph. Add prefixes to
+ * the collection and add suffixes to their index.
+ */
+static void readContigs(const string& path,
+ Graph& g, vector<Kmer>& prefixes, SuffixMap& suffixMap)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading `" << path << "'...\n";
+
+ unsigned count = 0;
+ FastaReader in(path.c_str(), FastaReader::FOLD_CASE);
+ for (FastaRecord rec; in >> rec;) {
+ const Sequence& seq = rec.seq;
+ if (count++ == 0) {
+ // Detect colour-space contigs.
+ opt::colourSpace = isdigit(seq[0]);
+ } else {
+ if (opt::colourSpace)
+ assert(isdigit(seq[0]));
+ else
+ assert(isalpha(seq[0]));
+ }
+
+ // Add the prefix to the collection.
+ unsigned overlap = opt::k - 1;
+ assert(seq.length() > overlap);
+ Kmer prefix(seq.substr(0, overlap));
+ Kmer suffix(seq.substr(seq.length() - overlap));
+ prefixes.push_back(prefix);
+ prefixes.push_back(reverseComplement(suffix));
+
+ // Add the suffix to the index.
+ ContigProperties vp(seq.length(), getCoverage(rec.comment));
+ ContigNode u = add_vertex(vp, g);
+ put(vertex_name, g, u, rec.id);
+ suffixMap[suffix].push_back(u);
+ suffixMap[reverseComplement(prefix)].push_back(
+ get(vertex_complement, g, u));
+ }
+ assert(in.eof());
+}
+
+int main(int argc, char** argv)
+{
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'k': arg >> opt::k; break;
+ case 'm': arg >> opt::minOverlap; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": " << "missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ if (opt::minOverlap == 0)
+ opt::minOverlap = opt::k - 1;
+ opt::minOverlap = min(opt::minOverlap, opt::k - 1);
+
+ opt::trimMasked = false;
+ Kmer::setLength(opt::k - 1);
+ Graph g;
+ vector<Kmer> prefixes;
+ SuffixMap suffixMap(prefixes.size());
+ if (optind < argc) {
+ for (; optind < argc; optind++)
+ readContigs(argv[optind], g, prefixes, suffixMap);
+ } else
+ readContigs("-", g, prefixes, suffixMap);
+ g_contigNames.lock();
+
+ // Add the overlap edges of exactly k-1 bp.
+ typedef graph_traits<Graph>::vertex_descriptor V;
+ if (opt::verbose > 0)
+ cerr << "Finding overlaps of exactly k-1 bp...\n";
+ for (vector<Kmer>::const_iterator it = prefixes.begin();
+ it != prefixes.end(); ++it) {
+ ContigNode v(it - prefixes.begin());
+ const SuffixMap::mapped_type& edges = suffixMap[*it];
+ for (SuffixMap::mapped_type::const_iterator
+ itu = edges.begin(); itu != edges.end(); ++itu) {
+ V uc = get(vertex_complement, g, *itu);
+ V vc = get(vertex_complement, g, v);
+ add_edge(vc, uc, -(int)opt::k + 1, static_cast<DG&>(g));
+ }
+ }
+ SuffixMap().swap(suffixMap);
+
+ if (opt::verbose > 0)
+ printGraphStats(cerr, g);
+
+ if (opt::minOverlap < opt::k - 1) {
+ // Add the overlap edges of fewer than k-1 bp.
+ if (opt::verbose > 0)
+ cerr << "Finding overlaps of fewer than k-1 bp...\n";
+ addOverlapsSA(g, prefixes);
+ if (opt::verbose > 0)
+ printGraphStats(cerr, g);
+ }
+
+ // Output the graph.
+ write_graph(cout, g, PROGRAM, commandLine);
+ assert(cout.good());
+
+ return 0;
+}
diff --git a/AdjList/Makefile.am b/AdjList/Makefile.am
new file mode 100644
index 0000000..7e6e622
--- /dev/null
+++ b/AdjList/Makefile.am
@@ -0,0 +1,13 @@
+bin_PROGRAMS = AdjList
+
+AdjList_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+AdjList_LDADD = \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+AdjList_SOURCES = \
+ AdjList.cpp
diff --git a/AdjList/Makefile.in b/AdjList/Makefile.in
new file mode 100644
index 0000000..8f5b8d2
--- /dev/null
+++ b/AdjList/Makefile.in
@@ -0,0 +1,531 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = AdjList$(EXEEXT)
+subdir = AdjList
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_AdjList_OBJECTS = AdjList-AdjList.$(OBJEXT)
+AdjList_OBJECTS = $(am_AdjList_OBJECTS)
+AdjList_DEPENDENCIES = $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(AdjList_SOURCES)
+DIST_SOURCES = $(AdjList_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+AdjList_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+AdjList_LDADD = \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+AdjList_SOURCES = \
+ AdjList.cpp
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign AdjList/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign AdjList/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+AdjList$(EXEEXT): $(AdjList_OBJECTS) $(AdjList_DEPENDENCIES) $(EXTRA_AdjList_DEPENDENCIES)
+ @rm -f AdjList$(EXEEXT)
+ $(CXXLINK) $(AdjList_OBJECTS) $(AdjList_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/AdjList-AdjList.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+AdjList-AdjList.o: AdjList.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AdjList_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT AdjList-AdjList.o -MD -MP -MF $(DEPDIR)/AdjList-AdjList.Tpo -c -o AdjList-AdjList.o `test -f 'AdjList.cpp' || echo '$(srcdir)/'`AdjList.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/AdjList-AdjList.Tpo $(DEPDIR)/AdjList-AdjList.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AdjList.cpp' object='AdjList-AdjList.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AdjList_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o AdjList-AdjList.o `test -f 'AdjList.cpp' || echo '$(srcdir)/'`AdjList.cpp
+
+AdjList-AdjList.obj: AdjList.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AdjList_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT AdjList-AdjList.obj -MD -MP -MF $(DEPDIR)/AdjList-AdjList.Tpo -c -o AdjList-AdjList.obj `if test -f 'AdjList.cpp'; then $(CYGPATH_W) 'AdjList.cpp'; else $(CYGPATH_W) '$(srcdir)/AdjList.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/AdjList-AdjList.Tpo $(DEPDIR)/AdjList-AdjList.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AdjList.cpp' object='AdjList-AdjList.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AdjList_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o AdjList-AdjList.obj `if test -f 'AdjList.cpp'; then $(CYGPATH_W) 'AdjList.cpp'; else $(CYGPATH_W) '$(srcdir)/AdjList.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Align/Makefile.am b/Align/Makefile.am
new file mode 100644
index 0000000..cab3d2f
--- /dev/null
+++ b/Align/Makefile.am
@@ -0,0 +1,23 @@
+noinst_LIBRARIES = libalign.a
+
+libalign_a_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/Common
+
+libalign_a_SOURCES = \
+ alignGlobal.cc alignGlobal.h \
+ dialign.cpp dialign.h dna_diag_prob.cc \
+ smith_waterman.cpp smith_waterman.h
+
+bin_PROGRAMS = abyss-align
+
+abyss_align_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+abyss_align_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+
+abyss_align_LDADD = $(builddir)/libalign.a \
+ $(top_builddir)/dialign/libdialign.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_align_SOURCES = align.cc
diff --git a/Align/Makefile.in b/Align/Makefile.in
new file mode 100644
index 0000000..5e50d9a
--- /dev/null
+++ b/Align/Makefile.in
@@ -0,0 +1,637 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = abyss-align$(EXEEXT)
+subdir = Align
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libalign_a_AR = $(AR) $(ARFLAGS)
+libalign_a_LIBADD =
+am_libalign_a_OBJECTS = libalign_a-alignGlobal.$(OBJEXT) \
+ libalign_a-dialign.$(OBJEXT) \
+ libalign_a-dna_diag_prob.$(OBJEXT) \
+ libalign_a-smith_waterman.$(OBJEXT)
+libalign_a_OBJECTS = $(am_libalign_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_abyss_align_OBJECTS = abyss_align-align.$(OBJEXT)
+abyss_align_OBJECTS = $(am_abyss_align_OBJECTS)
+abyss_align_DEPENDENCIES = $(builddir)/libalign.a \
+ $(top_builddir)/dialign/libdialign.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+abyss_align_LINK = $(CXXLD) $(abyss_align_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libalign_a_SOURCES) $(abyss_align_SOURCES)
+DIST_SOURCES = $(libalign_a_SOURCES) $(abyss_align_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LIBRARIES = libalign.a
+libalign_a_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/Common
+libalign_a_SOURCES = \
+ alignGlobal.cc alignGlobal.h \
+ dialign.cpp dialign.h dna_diag_prob.cc \
+ smith_waterman.cpp smith_waterman.h
+
+abyss_align_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+abyss_align_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+abyss_align_LDADD = $(builddir)/libalign.a \
+ $(top_builddir)/dialign/libdialign.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_align_SOURCES = align.cc
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Align/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Align/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libalign.a: $(libalign_a_OBJECTS) $(libalign_a_DEPENDENCIES) $(EXTRA_libalign_a_DEPENDENCIES)
+ -rm -f libalign.a
+ $(libalign_a_AR) libalign.a $(libalign_a_OBJECTS) $(libalign_a_LIBADD)
+ $(RANLIB) libalign.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+abyss-align$(EXEEXT): $(abyss_align_OBJECTS) $(abyss_align_DEPENDENCIES) $(EXTRA_abyss_align_DEPENDENCIES)
+ @rm -f abyss-align$(EXEEXT)
+ $(abyss_align_LINK) $(abyss_align_OBJECTS) $(abyss_align_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_align-align.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libalign_a-alignGlobal.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libalign_a-dialign.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libalign_a-dna_diag_prob.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libalign_a-smith_waterman.Po at am__quote@
+
+.cc.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+libalign_a-alignGlobal.o: alignGlobal.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libalign_a-alignGlobal.o -MD -MP -MF $(DEPDIR)/libalign_a-alignGlobal.Tpo -c -o libalign_a-alignGlobal.o `test -f 'alignGlobal.cc' || echo '$(srcdir)/'`alignGlobal.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalign_a-alignGlobal.Tpo $(DEPDIR)/libalign_a-alignGlobal.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='alignGlobal.cc' object='libalign_a-alignGlobal.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libalign_a-alignGlobal.o `test -f 'alignGlobal.cc' || echo '$(srcdir)/'`alignGlobal.cc
+
+libalign_a-alignGlobal.obj: alignGlobal.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libalign_a-alignGlobal.obj -MD -MP -MF $(DEPDIR)/libalign_a-alignGlobal.Tpo -c -o libalign_a-alignGlobal.obj `if test -f 'alignGlobal.cc'; then $(CYGPATH_W) 'alignGlobal.cc'; else $(CYGPATH_W) '$(srcdir)/alignGlobal.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalign_a-alignGlobal.Tpo $(DEPDIR)/libalign_a-alignGlobal.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='alignGlobal.cc' object='libalign_a-alignGlobal.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libalign_a-alignGlobal.obj `if test -f 'alignGlobal.cc'; then $(CYGPATH_W) 'alignGlobal.cc'; else $(CYGPATH_W) '$(srcdir)/alignGlobal.cc'; fi`
+
+libalign_a-dialign.o: dialign.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libalign_a-dialign.o -MD -MP -MF $(DEPDIR)/libalign_a-dialign.Tpo -c -o libalign_a-dialign.o `test -f 'dialign.cpp' || echo '$(srcdir)/'`dialign.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalign_a-dialign.Tpo $(DEPDIR)/libalign_a-dialign.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dialign.cpp' object='libalign_a-dialign.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libalign_a-dialign.o `test -f 'dialign.cpp' || echo '$(srcdir)/'`dialign.cpp
+
+libalign_a-dialign.obj: dialign.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libalign_a-dialign.obj -MD -MP -MF $(DEPDIR)/libalign_a-dialign.Tpo -c -o libalign_a-dialign.obj `if test -f 'dialign.cpp'; then $(CYGPATH_W) 'dialign.cpp'; else $(CYGPATH_W) '$(srcdir)/dialign.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalign_a-dialign.Tpo $(DEPDIR)/libalign_a-dialign.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dialign.cpp' object='libalign_a-dialign.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libalign_a-dialign.obj `if test -f 'dialign.cpp'; then $(CYGPATH_W) 'dialign.cpp'; else $(CYGPATH_W) '$(srcdir)/dialign.cpp'; fi`
+
+libalign_a-dna_diag_prob.o: dna_diag_prob.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libalign_a-dna_diag_prob.o -MD -MP -MF $(DEPDIR)/libalign_a-dna_diag_prob.Tpo -c -o libalign_a-dna_diag_prob.o `test -f 'dna_diag_prob.cc' || echo '$(srcdir)/'`dna_diag_prob.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalign_a-dna_diag_prob.Tpo $(DEPDIR)/libalign_a-dna_diag_prob.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dna_diag_prob.cc' object='libalign_a-dna_diag_prob.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libalign_a-dna_diag_prob.o `test -f 'dna_diag_prob.cc' || echo '$(srcdir)/'`dna_diag_prob.cc
+
+libalign_a-dna_diag_prob.obj: dna_diag_prob.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libalign_a-dna_diag_prob.obj -MD -MP -MF $(DEPDIR)/libalign_a-dna_diag_prob.Tpo -c -o libalign_a-dna_diag_prob.obj `if test -f 'dna_diag_prob.cc'; then $(CYGPATH_W) 'dna_diag_prob.cc'; else $(CYGPATH_W) '$(srcdir)/dna_diag_prob.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalign_a-dna_diag_prob.Tpo $(DEPDIR)/libalign_a-dna_diag_prob.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='dna_diag_prob.cc' object='libalign_a-dna_diag_prob.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libalign_a-dna_diag_prob.obj `if test -f 'dna_diag_prob.cc'; then $(CYGPATH_W) 'dna_diag_prob.cc'; else $(CYGPATH_W) '$(srcdir)/dna_diag_prob.cc'; fi`
+
+libalign_a-smith_waterman.o: smith_waterman.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libalign_a-smith_waterman.o -MD -MP -MF $(DEPDIR)/libalign_a-smith_waterman.Tpo -c -o libalign_a-smith_waterman.o `test -f 'smith_waterman.cpp' || echo '$(srcdir)/'`smith_waterman.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalign_a-smith_waterman.Tpo $(DEPDIR)/libalign_a-smith_waterman.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='smith_waterman.cpp' object='libalign_a-smith_waterman.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libalign_a-smith_waterman.o `test -f 'smith_waterman.cpp' || echo '$(srcdir)/'`smith_waterman.cpp
+
+libalign_a-smith_waterman.obj: smith_waterman.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libalign_a-smith_waterman.obj -MD -MP -MF $(DEPDIR)/libalign_a-smith_waterman.Tpo -c -o libalign_a-smith_waterman.obj `if test -f 'smith_waterman.cpp'; then $(CYGPATH_W) 'smith_waterman.cpp'; else $(CYGPATH_W) '$(srcdir)/smith_waterman.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libalign_a-smith_waterman.Tpo $(DEPDIR)/libalign_a-smith_waterman.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='smith_waterman.cpp' object='libalign_a-smith_waterman.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libalign_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libalign_a-smith_waterman.obj `if test -f 'smith_waterman.cpp'; then $(CYGPATH_W) 'smith_waterman.cpp'; else $(CYGPATH_W) '$(srcdir)/smith_waterman.cpp'; fi`
+
+abyss_align-align.o: align.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_align_CPPFLAGS) $(CPPFLAGS) $(abyss_align_CXXFLAGS) $(CXXFLAGS) -MT abyss_align-align.o -MD -MP -MF $(DEPDIR)/abyss_align-align.Tpo -c -o abyss_align-align.o `test -f 'align.cc' || echo '$(srcdir)/'`align.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_align-align.Tpo $(DEPDIR)/abyss_align-align.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='align.cc' object='abyss_align-align.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_align_CPPFLAGS) $(CPPFLAGS) $(abyss_align_CXXFLAGS) $(CXXFLAGS) -c -o abyss_align-align.o `test -f 'align.cc' || echo '$(srcdir)/'`align.cc
+
+abyss_align-align.obj: align.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_align_CPPFLAGS) $(CPPFLAGS) $(abyss_align_CXXFLAGS) $(CXXFLAGS) -MT abyss_align-align.obj -MD -MP -MF $(DEPDIR)/abyss_align-align.Tpo -c -o abyss_align-align.obj `if test -f 'align.cc'; then $(CYGPATH_W) 'align.cc'; else $(CYGPATH_W) '$(srcdir)/align.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_align-align.Tpo $(DEPDIR)/abyss_align-align.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='align.cc' object='abyss_align-align.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_align_CPPFLAGS) $(CPPFLAGS) $(abyss_align_CXXFLAGS) $(CXXFLAGS) -c -o abyss_align-align.obj `if test -f 'align.cc'; then $(CYGPATH_W) 'align.cc'; else $(CYGPATH_W) '$(srcdir)/align.cc'; fi`
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-noinstLIBRARIES cscopelist ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Align/align.cc b/Align/align.cc
new file mode 100644
index 0000000..e7164a5
--- /dev/null
+++ b/Align/align.cc
@@ -0,0 +1,167 @@
+#include "dialign.h"
+#include "config.h"
+#include "Common/Options.h"
+#include "FastaReader.h"
+#include "IOUtil.h"
+#include "Uncompress.h"
+#include "alignGlobal.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdlib>
+#include <getopt.h>
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <vector>
+
+using namespace std;
+
+#define PROGRAM "abyss-align"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... [FASTA]...\n"
+"Align multiple sequences globally using either Needleman-Wunsch\n"
+"or DIALIGN-TX. Groups of sequences may be separated using `#.'\n"
+" FASTA sequences in FASTA format\n"
+"\n"
+" Options:\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+" DIALIGN-TX options:\n"
+" -D, --dialign-d=N dialign debug level, default: 0\n"
+" -M, --dialign-m=FILE score matrix, default: dna_matrix.scr\n"
+" -P, --dialign-p=FILE diagonal length probability distribution\n"
+" default: dna_diag_prob_100_exp_550000\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ static int dialign_debug;
+ static string dialign_score;
+ static string dialign_prob;
+}
+
+static const char shortopts[] = "v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { "dialign-d", required_argument, NULL, 'D' },
+ { "dialign-m", required_argument, NULL, 'M' },
+ { "dialign-p", required_argument, NULL, 'P' },
+ { NULL, 0, NULL, 0 }
+};
+
+/** Align two sequences using the Needlman-Wunsch algorithm.
+ */
+static void alignPair(const string& seq0, const string& seq1,
+ ostream& out)
+{
+ NWAlignment align;
+ unsigned match = alignGlobal(seq0, seq1, align);
+ float identity = (float)match / align.size();
+ out << align << identity << "\n\n";
+}
+
+/** Align multiple sequences using DIALIGN-TX. */
+static void alignMulti(const vector<string>& seq, ostream& out)
+{
+ unsigned match;
+ string alignment;
+ string consensus = dialign(seq, alignment, match);
+ float identity = (float)match / consensus.size();
+ out << alignment << consensus << '\n' << identity << "\n\n";
+}
+
+/** Align the specified sequences. */
+static void align(const vector<string>& seq, ostream& out)
+{
+ switch (seq.size()) {
+ case 0:
+ return;
+ case 1:
+ out << seq.front() << '\n' << 1 << "\n\n";
+ return;
+ case 2:
+ return alignPair(seq[0], seq[1], out);
+ default:
+ return alignMulti(seq, out);
+ }
+}
+
+
+/** Align multiple sequences. */
+static void alignFile(const char* path) {
+ if (opt::verbose > 0)
+ cerr << "Aligning `" << path << "'\n";
+ FastaReader in(path, FastaReader::NO_FOLD_CASE);
+ for (vector<string> seq; in;) {
+ seq.clear();
+ FastaRecord fa;
+ if (in >> fa)
+ seq.push_back(fa.seq);
+ while (in.peek() == '>' && in >> fa)
+ seq.push_back(fa.seq);
+ align(seq, cout);
+ }
+ assert(in.eof());
+}
+
+int main(int argc, char** argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'D': arg >> opt::dialign_debug; break;
+ case 'M': arg >> opt::dialign_score; break;
+ case 'P': arg >> opt::dialign_prob; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ // Initialize dialign.
+ init_parameters();
+ set_parameters_dna();
+ para->DEBUG = opt::dialign_debug;
+ para->SCR_MATRIX_FILE_NAME = (char*)opt::dialign_score.c_str();
+ para->DIAG_PROB_FILE_NAME = (char*)opt::dialign_prob.c_str();
+ initDialign();
+
+ if (optind < argc)
+ for_each(&argv[optind], &argv[argc], alignFile);
+ else
+ alignFile("-");
+
+ return 0;
+}
diff --git a/Align/alignGlobal.cc b/Align/alignGlobal.cc
new file mode 100644
index 0000000..35acab5
--- /dev/null
+++ b/Align/alignGlobal.cc
@@ -0,0 +1,198 @@
+/** Global sequence alignment with an affine gap penalty using the
+ * Needleman-Wunsch algorithm and the improvement by Gotoh.
+ * @author Shaun Jackman <sjackman at bcgsc.ca>
+ */
+
+#include "alignGlobal.h"
+#include "Sequence.h"
+#include <algorithm>
+#include <cassert>
+#include <cctype>
+#include <climits>
+#include <cstdlib> // for abort
+
+using namespace std;
+
+/** A character representing a gap. */
+static const char GAP = '*';
+
+/** The score of a match. */
+static const int MATCH = 5;
+
+/** The penalty of a mismatch. */
+static const int MISMATCH = -4;
+
+/** The penalty of opening a gap. */
+static const int GAP_OPEN = -12;
+
+/** The penalty of extending a gap. */
+static const int GAP_EXTEND = -4;
+
+/** Return the score of the alignment of a and b.
+ * @param [out] consensus the consensus of a and b
+ * @return the score
+ */
+static int score(char a, char b, char& c)
+{
+ if (a == b) {
+ c = a;
+ return MATCH;
+ } else {
+ c = ambiguityOr(a, b);
+ return c == a || c == b ? MATCH : MISMATCH;
+ }
+}
+
+/** Return the score of the alignment of a and b. */
+static int score(char a, char b)
+{
+ char c;
+ return score(a, b, c);
+}
+
+/** Find the optimal alignment from the score matrices.
+ * @param[out] align the alignment
+ * @return the number of matches
+ */
+static unsigned backtrack(int** f, int** g, int** h,
+ const string& seqA, const string& seqB, NWAlignment& align)
+{
+ string alignmentA, alignmentB, consensus;
+ unsigned matches = 0;
+ unsigned i = seqA.size(), j = seqB.size();
+ while (i > 0 && j > 0) {
+ int fij = f[i][j];
+ char a = seqA[i-1], b = seqB[j-1], c;
+ int s = score(a, b, c);
+ if (fij == f[i-1][j-1] + s) {
+ alignmentA += a;
+ alignmentB += b;
+ consensus += c;
+ if (s == MATCH)
+ matches++;
+ i--;
+ j--;
+ } else if (fij == f[i-1][j] + GAP_OPEN
+ || fij == g[i-1][j] + GAP_EXTEND) {
+ while (g[i][j] == g[i-1][j] + GAP_EXTEND) {
+ char a = seqA[i-1];
+ alignmentA += a;
+ alignmentB += GAP;
+ consensus += tolower(a);
+ i--;
+ assert(i > 0);
+ }
+ assert(g[i][j] == f[i-1][j] + GAP_OPEN);
+ char a = seqA[i-1];
+ alignmentA += a;
+ alignmentB += GAP;
+ consensus += tolower(a);
+ i--;
+ } else if (fij == f[i][j-1] + GAP_OPEN
+ || fij == h[i][j-1] + GAP_EXTEND) {
+ while (h[i][j] == h[i][j-1] + GAP_EXTEND) {
+ char b = seqB[j-1];
+ alignmentA += GAP;
+ alignmentB += b;
+ consensus += tolower(b);
+ j--;
+ assert(j > 0);
+ }
+ assert(h[i][j] == f[i][j-1] + GAP_OPEN);
+ char b = seqB[j-1];
+ alignmentA += GAP;
+ alignmentB += b;
+ consensus += tolower(b);
+ j--;
+ } else {
+ assert(false);
+ abort();
+ }
+ }
+
+ while (i > 0) {
+ char a = seqA[i-1];
+ alignmentA += a;
+ alignmentB += GAP;
+ consensus += tolower(a);
+ i--;
+ }
+
+ while (j > 0) {
+ char b = seqB[j-1];
+ alignmentA += GAP;
+ alignmentB += b;
+ consensus += tolower(b);
+ j--;
+ }
+
+ reverse(alignmentA.begin(), alignmentA.end());
+ reverse(alignmentB.begin(), alignmentB.end());
+ reverse(consensus.begin(), consensus.end());
+ align.query_align = alignmentA;
+ align.target_align = alignmentB;
+ align.match_align = consensus;
+ return matches;
+}
+
+/** Find the optimal global alignment of the two sequences using the
+ * Needleman-Wunsch algorithm and the improvement by Gotoh to use an
+ * affine gap penalty rather than a linear gap penalty.
+ * @param[out] align the alignment
+ * @return the number of matches
+ */
+unsigned alignGlobal(const string& seqA, const string& seqB,
+ NWAlignment& align)
+{
+ unsigned lenA = seqA.size();
+ unsigned lenB = seqB.size();
+ int** f = new int*[lenA + 1];
+ int** g = new int*[lenA + 1];
+ int** h = new int*[lenA + 1];
+ for (unsigned i = 0; i <= lenA; i++) {
+ f[i] = new int[lenB + 1];
+ g[i] = new int[lenB + 1];
+ h[i] = new int[lenB + 1];
+ }
+
+ // Initialize the score matrix.
+ for (unsigned i = 0; i <= lenA; i++) {
+ f[i][0] = g[i][0] = i == 0 ? 0
+ : GAP_OPEN + GAP_EXTEND * ((int)i - 1);
+ h[i][0] = INT_MIN/2;
+ }
+ for (unsigned j = 0; j <= lenB; j++) {
+ f[0][j] = h[0][j] = j == 0 ? 0
+ : GAP_OPEN + GAP_EXTEND * ((int)j - 1);
+ g[0][j] = INT_MIN/2;
+ }
+
+ // Calculate the score matrix.
+ for (unsigned i = 1; i <= lenA; i++) {
+ for (unsigned j = 1; j <= lenB; j++) {
+ g[i][j] = max(
+ f[i-1][j] + GAP_OPEN,
+ g[i-1][j] + GAP_EXTEND);
+ h[i][j] = max(
+ f[i][j-1] + GAP_OPEN,
+ h[i][j-1] + GAP_EXTEND);
+ f[i][j] = max(
+ f[i-1][j-1] + score(seqA[i-1], seqB[j-1]),
+ max(g[i][j], h[i][j]));
+ }
+ }
+
+ // Find the best alignment.
+ unsigned matches = backtrack(f, g, h, seqA, seqB, align);
+
+ for (unsigned i = 0; i <= lenA; i++) {
+ delete[] f[i];
+ delete[] g[i];
+ delete[] h[i];
+ }
+ delete[] f;
+ delete[] g;
+ delete[] h;
+
+ return matches;
+}
diff --git a/Align/alignGlobal.h b/Align/alignGlobal.h
new file mode 100644
index 0000000..ef6f259
--- /dev/null
+++ b/Align/alignGlobal.h
@@ -0,0 +1,42 @@
+#ifndef ALIGNGLOBAL_H
+#define ALIGNGLOBAL_H
+
+#include <cassert>
+#include <cctype>
+#include <ostream>
+#include <string>
+
+/** The result of a Needleman-Wunsch alignment. */
+struct NWAlignment {
+ std::string query_align;
+ std::string target_align;
+ std::string match_align; //consensus sequence
+
+ NWAlignment() {}
+
+ unsigned size() { return match_align.length(); }
+ std::string consensus() { return match_align; }
+
+ friend std::ostream& operator<<(std::ostream& out,
+ const NWAlignment& o)
+ {
+ const std::string& a = o.query_align;
+ const std::string& b = o.target_align;
+ const std::string& c = o.match_align;
+ assert(a.size() == c.size());
+ assert(b.size() == c.size());
+ for (unsigned i = 0; i < c.size(); ++i)
+ out << (toupper(a[i]) == toupper(c[i]) ? '.' : a[i]);
+ out << '\n';
+ for (unsigned i = 0; i < c.size(); ++i)
+ out << (toupper(b[i]) == toupper(c[i]) ? '.' : b[i]);
+ out << '\n';
+ return out << c << '\n';
+ }
+};
+
+unsigned alignGlobal(
+ const std::string& a, const std::string& b,
+ NWAlignment& align);
+
+#endif
diff --git a/Align/dialign.cpp b/Align/dialign.cpp
new file mode 100644
index 0000000..c377c48
--- /dev/null
+++ b/Align/dialign.cpp
@@ -0,0 +1,423 @@
+#include "dialign.h"
+#include "Common/Options.h"
+#include "Sequence.h"
+#include "Uncompress.h"
+#include <algorithm> // for min
+#include <cassert>
+#include <cmath> // for log
+#include <cstdlib>
+#include <cstdio>
+#include <cstring>
+#include <ctime> // for clock
+#include <iostream>
+#include <sstream>
+#include <vector>
+
+using namespace std;
+
+/** Score matrix. */
+scr_matrix* smatrix;
+
+/** Diagonal length probability distribution. */
+prob_dist* pdist;
+
+/** Return a DNA score matrix. */
+static scr_matrix* newDefaultScoreMatrix()
+{
+ string s("ACGT?#$");
+ struct scr_matrix* p = (scr_matrix*)calloc(1, sizeof *smatrix);
+ p->length = s.size();
+ p->num2char = (int*)calloc(256, sizeof(int));
+ p->char2num = (int*)calloc(256, sizeof(int));
+ for (unsigned i = 0; i < s.size(); ++i) {
+ unsigned c = s[i];
+ p->num2char[i] = c;
+ p->char2num[c] = i;
+ }
+
+ p->data = (int*)calloc(s.size() * s.size(), sizeof(int));
+ unsigned n = s.size() - 3; // ignore ?#$
+ // Set the diagonal to 1.
+ for (unsigned i = 0; i < n; i++)
+ p->data[s.size() * i + i] = 1;
+ p->max_score = 1;
+ p->avg_sim_score = para->PROT_SIM_SCORE_THRESHOLD;
+ p->dist = (int*)calloc(2, sizeof(int));
+ p->dist[0] = n * n - n;
+ p->dist[1] = n;
+ return p;
+}
+
+/** Return a probability distribution for diagonal lengths
+ * for a DNA score matrix.
+ */
+static prob_dist* newDefaultDiagProbDist()
+{
+ prob_dist *o = (prob_dist*)calloc(1, sizeof *o);
+ o->smatrix = smatrix;
+ unsigned length = 100;
+ o->max_dlen = length;
+ o->data = (long double**)calloc(
+ length + 1, sizeof(long double *));
+ o->log_data = (double**)calloc(length + 1, sizeof(double *));
+
+ long double **dist = o->data;
+ double **log_dist = o->log_data;
+ const double* p = dna_diag_prob_100_exp_550000;
+ for (unsigned i = 1; i <= length; i++) {
+ unsigned mxscr = i * smatrix->max_score;
+ dist[i] = (long double*)calloc(
+ mxscr + 1, sizeof(long double));
+ log_dist[i] = (double*)calloc(mxscr + 1, sizeof(double));
+ for (unsigned scr = 0; scr <= mxscr; scr++) {
+ double weight = *p++;
+ assert(weight > 0);
+ dist[i][scr] = weight;
+ log_dist[i][scr] = -log(weight);
+ }
+ }
+ return o;
+}
+
+/** Initialize dialign. */
+void initDialign()
+{
+ // Score matrix
+ smatrix = strlen(para->SCR_MATRIX_FILE_NAME) > 0
+ ? read_scr_matrix(para->SCR_MATRIX_FILE_NAME)
+ : newDefaultScoreMatrix();
+ if (para->DEBUG > 5)
+ print_scr_matrix(smatrix);
+
+ // Probability distribution for diagonal lengths
+ pdist = strlen(para->DIAG_PROB_FILE_NAME) > 0
+ ? read_diag_prob_dist(smatrix, para->DIAG_PROB_FILE_NAME)
+ : newDefaultDiagProbDist();
+}
+
+static void free_scr_matrix(struct scr_matrix* smatrix)
+{
+ free(smatrix->dist);
+ free(smatrix->data);
+ free(smatrix->char2num);
+ free(smatrix->num2char);
+ free(smatrix);
+}
+
+void free_prob_dist(struct prob_dist* pdist)
+{
+ unsigned int length = pdist->max_dlen;
+ unsigned int i;
+ for (i=1; i<=length; i++) {
+ free(pdist->data[i]);
+ free(pdist->log_data[i]);
+ }
+ free(pdist->data);
+ free(pdist->log_data);
+ free_scr_matrix(pdist->smatrix);
+ free(pdist);
+}
+
+static void free_seq_col(struct seq_col* scol)
+{
+ unsigned int length = scol->length;
+ unsigned int i;
+ for (i=0; i<length; i++)
+ free((scol->seqs[i]).data);
+ free(scol->seqs);
+ free(scol);
+}
+
+/** Print a dialign alignment. */
+static ostream& print(ostream& out, const alignment& o,
+ const string& consensus)
+{
+ const seq_col& scol = *o.scol;
+ vector<int> proc(scol.length, 0);
+ algn_pos **ap = o.algn;
+ for (int s = 0; s < scol.length; s++) {
+ const seq& sq = scol.seqs[s];
+ for (int j = 0; j < o.max_pos; j++) {
+ if (proc[s] < sq.length) {
+ const algn_pos& ap1 = *find_eqc(ap, s, proc[s]);
+ assert(j <= *ap1.eqcAlgnPos);
+ if (*ap1.eqcAlgnPos == j) {
+ char c = sq.data[proc[s]];
+ if (toupper(c) == toupper(consensus[j]))
+ out << '.';
+ else if (ap1.state & para->STATE_ORPHANE)
+ out << (char)tolower(c);
+ else
+ out << c;
+ proc[s]++;
+ } else
+ out << '*';
+ } else
+ out << '*';
+ }
+ out << '\n';
+ }
+ return out;
+}
+
+/** Return the minimum number of matches. */
+static unsigned countMatches(const alignment& o,
+ const string& consensus)
+{
+ unsigned minMatches = consensus.size();
+ const seq_col& scol = *o.scol;
+ vector<int> proc(scol.length, 0);
+ algn_pos **ap = o.algn;
+ for (int s = 0; s < scol.length; s++) {
+ unsigned matches = 0;
+ const seq& sq = scol.seqs[s];
+ for (int j = 0; j < o.max_pos; j++) {
+ if (proc[s] < sq.length) {
+ const algn_pos& ap1 = *find_eqc(ap, s, proc[s]);
+ assert(j <= *ap1.eqcAlgnPos);
+ if (*ap1.eqcAlgnPos == j) {
+ char c = sq.data[proc[s]];
+ if (toupper(c) == toupper(consensus[j]))
+ matches++;
+ proc[s]++;
+ }
+ }
+ }
+ minMatches = min(minMatches, matches);
+ }
+ return minMatches;
+}
+
+static struct seq_col* read_seqs(const vector<string>& amb_seqs)
+{
+ struct seq_col* scol = (struct seq_col*)calloc(1, sizeof(struct seq_col));
+ struct seq* seqs = (scol->seqs = (struct seq*)calloc(amb_seqs.size(), sizeof(struct seq)));
+ if(scol==NULL || seqs==NULL) {
+ cerr << "read_seqs(): Out of memory !\n";
+ exit(EXIT_FAILURE);
+ }
+ scol->length = amb_seqs.size();
+ scol->avg_length = 0;
+
+ seq* seq;
+ for (size_t i=0; i<amb_seqs.size(); i++) {
+ assert(!amb_seqs[i].empty());
+ seq = &(scol->seqs[i]);
+ seq->max_seen = 0;
+ //seq->name = calloc(rlen, sizeof(char)); //do I need this?
+ seq->num = i;
+ seq->orf_frame=0;
+ seq->crick_strand=0;
+ //strncpy(seq->name, &(rline[1]), rlen-2);
+ seq->data = (char*)calloc(amb_seqs[i].length()+1, sizeof(char));
+ if (seq->data == NULL) {
+ cerr << "seq->data out of memory !\n";
+ exit(EXIT_FAILURE);
+ }
+ strcpy(seq->data, amb_seqs[i].c_str());
+ seq->length = amb_seqs[i].length();
+ scol->avg_length += amb_seqs[i].length();
+ if(para->DEBUG >1) printf("DEBUG: seq:%s\n", seq->data);
+ }
+ scol->avg_length /= scol->length;
+ if(para->DEBUG >1) printf("DEBUG: total # of amb_seqs: %i, avg_length: %i\n", scol->length, scol->avg_length);
+ return scol;
+}
+
+// assume initial sequences contain only a/c/g/t/n
+static string get_alignment_consensus(struct alignment *algn)
+{
+ struct seq_col *scol = algn->scol;
+ unsigned int slen = scol->length;
+
+ int j;
+ unsigned int s,max;
+ struct seq* sq;
+ struct algn_pos **ap = algn->algn;
+
+ prepare_alignment(algn);
+ max = algn->max_pos;
+ if (para->DEBUG > 5) printf("slen is %u, max pos is %u\n", slen, max);
+ struct algn_pos *ap1;
+
+ max = algn->max_pos;
+ int* proc = new int[slen];
+ for (j=0; j<(int)slen; j++)
+ proc[j] = 0;
+ string consensus;
+ for (j=0; j<(int)max; j++) {
+ char c = 'X';
+ bool gap = false;
+ for(s=0;s<slen;s++) {
+ sq = &(scol->seqs[s]);
+ if(proc[s] < sq->length) {
+ ap1 = find_eqc(ap,s,proc[s]);
+ if(*ap1->eqcAlgnPos==j) {
+ char cur_char = toupper(sq->data[proc[s]]);
+ c = c == 'X' ? cur_char
+ : ambiguityOr(c, cur_char);
+ proc[s]++;
+ } else
+ gap = true;
+ } else
+ gap = true;
+ }
+ consensus += gap ? tolower(c) : c;
+ }
+ delete[] proc;
+ return consensus;
+}
+
+/** Align multiple sequences using DIALIGN-TX.
+ * @param [out] alignment the alignment
+ * @param [out] matches the minimum number of matches
+ * @return the consensus sequence
+ */
+string dialign(const vector<string>& amb_seqs,
+ string& alignment, unsigned& matches)
+{
+ int i;
+ struct seq_col *in_seq_col = NULL;
+ double tim = clock();
+
+ in_seq_col = read_seqs(amb_seqs);
+
+ // fast mode has higher threshold weights
+ struct parameters *dialign_para = para;
+ if(dialign_para->FAST_MODE)
+ dialign_para->PROT_SIM_SCORE_THRESHOLD += 0.25;
+
+ // Consider Anchors -> default for DNA: DO_ANCHOR = 0;
+ struct alignment *algn = NULL;
+ if (!dialign_para->FAST_MODE)
+ algn = create_empty_alignment(in_seq_col);
+ struct alignment *salgn = create_empty_alignment(in_seq_col);
+ if (dialign_para->DEBUG > 1)
+ printf("empty alignments created\n");
+
+ // Compute pairwise diagonals
+ struct diag_col *all_diags = find_all_diags(smatrix, pdist,
+ in_seq_col, salgn, 1);
+ double duration = (clock()-tim)/CLOCKS_PER_SEC;
+ if (dialign_para->DEBUG > 1)
+ printf("Found %i diags in %f secs\n",
+ all_diags->diag_amount, duration);
+ int diag_amount = all_diags->diag_amount;
+
+ // Compute alignment
+ double tim2 = clock();
+ if (!dialign_para->FAST_MODE) {
+ vector<diag*> cp_diags(all_diags->diag_amount);
+ for(i = 0; i < diag_amount; i++) {
+ cp_diags[i] = (diag*)malloc(sizeof(struct diag));
+ *(cp_diags[i]) = *(all_diags->diags[i]);
+ }
+ guided_aligner(algn, in_seq_col, all_diags, smatrix,
+ pdist, all_diags->gt_root, 1);
+
+ for(i = 0; i < diag_amount; i++)
+ all_diags->diags[i] = cp_diags[i];
+
+ all_diags->diag_amount = diag_amount;
+ }
+ simple_aligner(in_seq_col, all_diags, smatrix, pdist,
+ salgn, 1);
+ duration = (clock()-tim2)/CLOCKS_PER_SEC;
+
+ if (!dialign_para->FAST_MODE) {
+ if (dialign_para->DEBUG > 1)
+ printf("First alignment after %f secs. "
+ "simple: %f guided: %f\n",
+ duration, salgn->total_weight, algn->total_weight);
+ else
+ if (dialign_para->DEBUG > 1)
+ printf("First alignment after %f secs. simple: %f \n",
+ duration, salgn->total_weight);
+ }
+
+ free_diag_col(all_diags);
+
+ dialign_para->DO_ANCHOR = 0; // anchors done
+
+ // round 2+
+ int round;
+ char newFound = 0;
+ int type;
+
+ // consider sensitivity level
+ if (!dialign_para->FAST_MODE) {
+ if (dialign_para->SENS_MODE == 0) {
+ dialign_para->DIAG_THRESHOLD_WEIGHT = 0.0;
+ } else if (dialign_para->SENS_MODE == 1) {
+ dialign_para->DIAG_THRESHOLD_WEIGHT
+ = -log(0.75);//-log(.875+0.125/2.0);
+ } else if (dialign_para->SENS_MODE == 2) {
+ dialign_para->DIAG_THRESHOLD_WEIGHT
+ = -log(0.5);//-log(0.875);
+ }
+ }
+
+ int stype = (dialign_para->FAST_MODE ? 1 : 0);
+ for (type = stype; type < 2; type++) {
+ for (round = 2; round <= 20; round++) {
+ tim2 = clock();
+ all_diags = find_all_diags(smatrix, pdist,
+ in_seq_col, (type ? salgn : algn), round);
+ duration = (clock()-tim2)/CLOCKS_PER_SEC;
+ if (dialign_para->DEBUG > 1)
+ printf("Found %i diags after %f secs\n",
+ all_diags->diag_amount, duration);
+ if (all_diags->diag_amount == 0) {
+ free_diag_col(all_diags);
+ break;
+ } else {
+ // round 2 and further we use the simple aligner
+ newFound = simple_aligner(in_seq_col,
+ all_diags, smatrix, pdist,
+ (type ? salgn : algn), round);
+ free_diag_col(all_diags);
+ if (!newFound)
+ break;
+ }
+ }
+ }
+ if (dialign_para->DEBUG > 1)
+ printf("Alignment ready!\n");
+
+ if (!dialign_para->FAST_MODE) {
+ if (dialign_para->DEBUG > 1)
+ printf("Final alignment simple: %f guided: %f\n",
+ salgn->total_weight, algn->total_weight);
+ } else {
+ if (dialign_para->DEBUG > 1)
+ printf("Final alignment simple: %f \n",
+ salgn->total_weight);
+ }
+
+ if (dialign_para->FAST_MODE
+ || salgn->total_weight > algn->total_weight) {
+ if (!dialign_para->FAST_MODE)
+ free_alignment(algn);
+ algn = salgn;
+ } else {
+ free_alignment(salgn);
+ }
+
+ if (opt::verbose > 3)
+ simple_print_alignment_default(algn);
+ string consensus = get_alignment_consensus(algn);
+ matches = countMatches(*algn, consensus);
+ ostringstream ss;
+ print(ss, *algn, consensus);
+ alignment = ss.str();
+
+ if (dialign_para->DEBUG > 0) {
+ duration = (clock()-tim)/CLOCKS_PER_SEC;
+ cerr << "Total time: " << duration << " s\n"
+ "Total weight: " << algn->total_weight << '\n';
+ }
+
+ free_alignment(algn);
+ free_seq_col(in_seq_col);
+ return consensus;
+}
diff --git a/Align/dialign.h b/Align/dialign.h
new file mode 100644
index 0000000..c10f14f
--- /dev/null
+++ b/Align/dialign.h
@@ -0,0 +1,41 @@
+#ifndef DIALIGN_H
+#define DIALIGN_H 1
+
+extern "C" {
+#include "dialign/io.h"
+#include "dialign/parameters.h"
+#include "dialign/struct.h"
+
+extern struct scr_matrix *smatrix;
+extern struct prob_dist *pdist;
+extern const double dna_diag_prob_100_exp_550000[5151];
+
+struct alignment* create_empty_alignment(struct seq_col *scol);
+struct diag_col *find_all_diags(struct scr_matrix *smatrix,
+ struct prob_dist *pdist,
+ struct seq_col *in_seq_col, struct alignment *algn, int round);
+struct alignment* guided_aligner(struct alignment *palgn,
+ struct seq_col *scol, struct diag_col *dcol,
+ struct scr_matrix* smatrix,
+ struct prob_dist *pdist,
+ struct gt_node *gtn,
+ int round);
+char simple_aligner(struct seq_col *scol, struct diag_col *dcol,
+ struct scr_matrix* smatrix,
+ struct prob_dist *pdist,
+ struct alignment *algn, int round);
+void prepare_alignment(struct alignment *algn);
+struct algn_pos *find_eqc(struct algn_pos **ap, int seqnum, int pos);
+void free_alignment(struct alignment* algn);
+void free_diag_col(struct diag_col* dcol);
+}
+
+#include <string>
+#include <vector>
+
+void initDialign();
+void free_prob_dist(struct prob_dist* pdist);
+std::string dialign(const std::vector<std::string>& amb_seqs,
+ std::string& alignment, unsigned& matches);
+
+#endif
diff --git a/Align/dna_diag_prob.cc b/Align/dna_diag_prob.cc
new file mode 100644
index 0000000..9d4c1b8
--- /dev/null
+++ b/Align/dna_diag_prob.cc
@@ -0,0 +1,5155 @@
+#include "dialign.h"
+
+/* Probability distribution for diagonal lengths. */
+const double dna_diag_prob_100_exp_550000[5151] = {
+/* 1 0 */ 1.000000e+00,
+/* 1 1 */ 6.730455e-01,
+/* 2 0 */ 1.000000e+00,
+/* 2 1 */ 9.670818e-01,
+/* 2 2 */ 4.120255e-01,
+/* 3 0 */ 1.000000e+00,
+/* 3 1 */ 9.979000e-01,
+/* 3 2 */ 8.519509e-01,
+/* 3 3 */ 1.974073e-01,
+/* 4 0 */ 1.000000e+00,
+/* 4 1 */ 9.998618e-01,
+/* 4 2 */ 9.809545e-01,
+/* 4 3 */ 5.966600e-01,
+/* 4 4 */ 7.885273e-02,
+/* 5 0 */ 1.000000e+00,
+/* 5 1 */ 9.999909e-01,
+/* 5 2 */ 9.982182e-01,
+/* 5 3 */ 8.905636e-01,
+/* 5 4 */ 3.229873e-01,
+/* 5 5 */ 2.844545e-02,
+/* 6 0 */ 1.000000e+00,
+/* 6 1 */ 1.000000e+00,
+/* 6 2 */ 9.998564e-01,
+/* 6 3 */ 9.827782e-01,
+/* 6 4 */ 6.597564e-01,
+/* 6 5 */ 1.446764e-01,
+/* 6 6 */ 9.710909e-03,
+/* 7 0 */ 1.000000e+00,
+/* 7 1 */ 1.000000e+00,
+/* 7 2 */ 9.999964e-01,
+/* 7 3 */ 9.980182e-01,
+/* 7 4 */ 8.957327e-01,
+/* 7 5 */ 3.821818e-01,
+/* 7 6 */ 5.771455e-02,
+/* 7 7 */ 3.210909e-03,
+/* 8 0 */ 1.000000e+00,
+/* 8 1 */ 1.000000e+00,
+/* 8 2 */ 1.000000e+00,
+/* 8 3 */ 9.998164e-01,
+/* 8 4 */ 9.798309e-01,
+/* 8 5 */ 6.726545e-01,
+/* 8 6 */ 1.831455e-01,
+/* 8 7 */ 2.081818e-02,
+/* 8 8 */ 1.034545e-03,
+/* 9 0 */ 1.000000e+00,
+/* 9 1 */ 1.000000e+00,
+/* 9 2 */ 1.000000e+00,
+/* 9 3 */ 9.999891e-01,
+/* 9 4 */ 9.971818e-01,
+/* 9 5 */ 8.838709e-01,
+/* 9 6 */ 4.005764e-01,
+/* 9 7 */ 7.684182e-02,
+/* 9 8 */ 7.283636e-03,
+/* 9 9 */ 3.327273e-04,
+/* 10 0 */ 1.000000e+00,
+/* 10 1 */ 1.000000e+00,
+/* 10 2 */ 1.000000e+00,
+/* 10 3 */ 9.999982e-01,
+/* 10 4 */ 9.996382e-01,
+/* 10 5 */ 9.730073e-01,
+/* 10 6 */ 6.584691e-01,
+/* 10 7 */ 1.977636e-01,
+/* 10 8 */ 2.972182e-02,
+/* 10 9 */ 2.398182e-03,
+/* 10 10 */ 1.127273e-04,
+/* 11 0 */ 1.000000e+00,
+/* 11 1 */ 1.000000e+00,
+/* 11 2 */ 1.000000e+00,
+/* 11 3 */ 1.000000e+00,
+/* 11 4 */ 9.999655e-01,
+/* 11 5 */ 9.953236e-01,
+/* 11 6 */ 8.598509e-01,
+/* 11 7 */ 3.929982e-01,
+/* 11 8 */ 8.693273e-02,
+/* 11 9 */ 1.099091e-02,
+/* 11 10 */ 7.872727e-04,
+/* 11 11 */ 3.272727e-05,
+/* 12 0 */ 1.000000e+00,
+/* 12 1 */ 1.000000e+00,
+/* 12 2 */ 1.000000e+00,
+/* 12 3 */ 1.000000e+00,
+/* 12 4 */ 9.999945e-01,
+/* 12 5 */ 9.993891e-01,
+/* 12 6 */ 9.605727e-01,
+/* 12 7 */ 6.266636e-01,
+/* 12 8 */ 1.981436e-01,
+/* 12 9 */ 3.510364e-02,
+/* 12 10 */ 3.932727e-03,
+/* 12 11 */ 2.781818e-04,
+/* 12 12 */ 1.007318e-05,
+/* 13 0 */ 1.000000e+00,
+/* 13 1 */ 1.000000e+00,
+/* 13 2 */ 1.000000e+00,
+/* 13 3 */ 1.000000e+00,
+/* 13 4 */ 1.000000e+00,
+/* 13 5 */ 9.999000e-01,
+/* 13 6 */ 9.921364e-01,
+/* 13 7 */ 8.258491e-01,
+/* 13 8 */ 3.724073e-01,
+/* 13 9 */ 8.930182e-02,
+/* 13 10 */ 1.366727e-02,
+/* 13 11 */ 1.394545e-03,
+/* 13 12 */ 7.818182e-05,
+/* 13 13 */ 2.920628e-06,
+/* 14 0 */ 1.000000e+00,
+/* 14 1 */ 1.000000e+00,
+/* 14 2 */ 1.000000e+00,
+/* 14 3 */ 1.000000e+00,
+/* 14 4 */ 1.000000e+00,
+/* 14 5 */ 9.999964e-01,
+/* 14 6 */ 9.987527e-01,
+/* 14 7 */ 9.410745e-01,
+/* 14 8 */ 5.849291e-01,
+/* 14 9 */ 1.902582e-01,
+/* 14 10 */ 3.750727e-02,
+/* 14 11 */ 5.054545e-03,
+/* 14 12 */ 4.563636e-04,
+/* 14 13 */ 3.454545e-05,
+/* 14 14 */ 8.381903e-07,
+/* 15 0 */ 1.000000e+00,
+/* 15 1 */ 1.000000e+00,
+/* 15 2 */ 1.000000e+00,
+/* 15 3 */ 1.000000e+00,
+/* 15 4 */ 1.000000e+00,
+/* 15 5 */ 1.000000e+00,
+/* 15 6 */ 9.998218e-01,
+/* 15 7 */ 9.857345e-01,
+/* 15 8 */ 7.810727e-01,
+/* 15 9 */ 3.435873e-01,
+/* 15 10 */ 8.694000e-02,
+/* 15 11 */ 1.504909e-02,
+/* 15 12 */ 1.870909e-03,
+/* 15 13 */ 1.400000e-04,
+/* 15 14 */ 1.096725e-05,
+/* 15 15 */ 2.384186e-07,
+/* 16 0 */ 1.000000e+00,
+/* 16 1 */ 1.000000e+00,
+/* 16 2 */ 1.000000e+00,
+/* 16 3 */ 1.000000e+00,
+/* 16 4 */ 1.000000e+00,
+/* 16 5 */ 1.000000e+00,
+/* 16 6 */ 9.999818e-01,
+/* 16 7 */ 9.972691e-01,
+/* 16 8 */ 9.120782e-01,
+/* 16 9 */ 5.356636e-01,
+/* 16 10 */ 1.751473e-01,
+/* 16 11 */ 3.724182e-02,
+/* 16 12 */ 5.770909e-03,
+/* 16 13 */ 6.545455e-04,
+/* 16 14 */ 4.363636e-05,
+/* 16 15 */ 3.297115e-06,
+/* 16 16 */ 6.728806e-08,
+/* 17 0 */ 1.000000e+00,
+/* 17 1 */ 1.000000e+00,
+/* 17 2 */ 1.000000e+00,
+/* 17 3 */ 1.000000e+00,
+/* 17 4 */ 1.000000e+00,
+/* 17 5 */ 1.000000e+00,
+/* 17 6 */ 9.999982e-01,
+/* 17 7 */ 9.996127e-01,
+/* 17 8 */ 9.740327e-01,
+/* 17 9 */ 7.278618e-01,
+/* 17 10 */ 3.094855e-01,
+/* 17 11 */ 8.132909e-02,
+/* 17 12 */ 1.516182e-02,
+/* 17 13 */ 2.134545e-03,
+/* 17 14 */ 2.309091e-04,
+/* 17 15 */ 2.406444e-05,
+/* 17 16 */ 9.806827e-07,
+/* 17 17 */ 1.885928e-08,
+/* 18 0 */ 1.000000e+00,
+/* 18 1 */ 1.000000e+00,
+/* 18 2 */ 1.000000e+00,
+/* 18 3 */ 1.000000e+00,
+/* 18 4 */ 1.000000e+00,
+/* 18 5 */ 1.000000e+00,
+/* 18 6 */ 1.000000e+00,
+/* 18 7 */ 9.999382e-01,
+/* 18 8 */ 9.941927e-01,
+/* 18 9 */ 8.733745e-01,
+/* 18 10 */ 4.831091e-01,
+/* 18 11 */ 1.582600e-01,
+/* 18 12 */ 3.553818e-02,
+/* 18 13 */ 6.020000e-03,
+/* 18 14 */ 8.090909e-04,
+/* 18 15 */ 8.000000e-05,
+/* 18 16 */ 7.522642e-06,
+/* 18 17 */ 2.889283e-07,
+/* 18 18 */ 5.253241e-09,
+/* 19 0 */ 1.000000e+00,
+/* 19 1 */ 1.000000e+00,
+/* 19 2 */ 1.000000e+00,
+/* 19 3 */ 1.000000e+00,
+/* 19 4 */ 1.000000e+00,
+/* 19 5 */ 1.000000e+00,
+/* 19 6 */ 1.000000e+00,
+/* 19 7 */ 9.999927e-01,
+/* 19 8 */ 9.989600e-01,
+/* 19 9 */ 9.548018e-01,
+/* 19 10 */ 6.672091e-01,
+/* 19 11 */ 2.747782e-01,
+/* 19 12 */ 7.364909e-02,
+/* 19 13 */ 1.470364e-02,
+/* 19 14 */ 2.361818e-03,
+/* 19 15 */ 3.127273e-04,
+/* 19 16 */ 3.454545e-05,
+/* 19 17 */ 2.323941e-06,
+/* 19 18 */ 8.440111e-08,
+/* 19 19 */ 1.455192e-09,
+/* 20 0 */ 1.000000e+00,
+/* 20 1 */ 1.000000e+00,
+/* 20 2 */ 1.000000e+00,
+/* 20 3 */ 1.000000e+00,
+/* 20 4 */ 1.000000e+00,
+/* 20 5 */ 1.000000e+00,
+/* 20 6 */ 1.000000e+00,
+/* 20 7 */ 9.999945e-01,
+/* 20 8 */ 9.998364e-01,
+/* 20 9 */ 9.880182e-01,
+/* 20 10 */ 8.238018e-01,
+/* 20 11 */ 4.288382e-01,
+/* 20 12 */ 1.396818e-01,
+/* 20 13 */ 3.265455e-02,
+/* 20 14 */ 5.916364e-03,
+/* 20 15 */ 9.327273e-04,
+/* 20 16 */ 1.145455e-04,
+/* 20 17 */ 1.305579e-05,
+/* 20 18 */ 7.103254e-07,
+/* 20 19 */ 2.446632e-08,
+/* 20 20 */ 4.010872e-10,
+/* 21 0 */ 1.000000e+00,
+/* 21 1 */ 1.000000e+00,
+/* 21 2 */ 1.000000e+00,
+/* 21 3 */ 1.000000e+00,
+/* 21 4 */ 1.000000e+00,
+/* 21 5 */ 1.000000e+00,
+/* 21 6 */ 1.000000e+00,
+/* 21 7 */ 1.000000e+00,
+/* 21 8 */ 9.999709e-01,
+/* 21 9 */ 9.974091e-01,
+/* 21 10 */ 9.260218e-01,
+/* 21 11 */ 6.026582e-01,
+/* 21 12 */ 2.398145e-01,
+/* 21 13 */ 6.590545e-02,
+/* 21 14 */ 1.380364e-02,
+/* 21 15 */ 2.380000e-03,
+/* 21 16 */ 3.672727e-04,
+/* 21 17 */ 4.363636e-05,
+/* 21 18 */ 4.166890e-06,
+/* 21 19 */ 2.150355e-07,
+/* 21 20 */ 7.043127e-09,
+/* 21 21 */ 1.100489e-10,
+/* 22 0 */ 1.000000e+00,
+/* 22 1 */ 1.000000e+00,
+/* 22 2 */ 1.000000e+00,
+/* 22 3 */ 1.000000e+00,
+/* 22 4 */ 1.000000e+00,
+/* 22 5 */ 1.000000e+00,
+/* 22 6 */ 1.000000e+00,
+/* 22 7 */ 1.000000e+00,
+/* 22 8 */ 9.999964e-01,
+/* 22 9 */ 9.995200e-01,
+/* 22 10 */ 9.760564e-01,
+/* 22 11 */ 7.642291e-01,
+/* 22 12 */ 3.756655e-01,
+/* 22 13 */ 1.211818e-01,
+/* 22 14 */ 2.931455e-02,
+/* 22 15 */ 5.654545e-03,
+/* 22 16 */ 9.218182e-04,
+/* 22 17 */ 1.345455e-04,
+/* 22 18 */ 1.913187e-05,
+/* 22 19 */ 1.314848e-06,
+/* 22 20 */ 6.453058e-08,
+/* 22 21 */ 2.014701e-09,
+/* 22 22 */ 3.007017e-11,
+/* 23 0 */ 1.000000e+00,
+/* 23 1 */ 1.000000e+00,
+/* 23 2 */ 1.000000e+00,
+/* 23 3 */ 1.000000e+00,
+/* 23 4 */ 1.000000e+00,
+/* 23 5 */ 1.000000e+00,
+/* 23 6 */ 1.000000e+00,
+/* 23 7 */ 1.000000e+00,
+/* 23 8 */ 1.000000e+00,
+/* 23 9 */ 9.999091e-01,
+/* 23 10 */ 9.939800e-01,
+/* 23 11 */ 8.861836e-01,
+/* 23 12 */ 5.363855e-01,
+/* 23 13 */ 2.062655e-01,
+/* 23 14 */ 5.769273e-02,
+/* 23 15 */ 1.282000e-02,
+/* 23 16 */ 2.223636e-03,
+/* 23 17 */ 3.818182e-04,
+/* 23 18 */ 4.909091e-05,
+/* 23 19 */ 6.281672e-06,
+/* 23 20 */ 4.106150e-07,
+/* 23 21 */ 1.921126e-08,
+/* 23 22 */ 5.729817e-10,
+/* 23 23 */ 8.185452e-12,
+/* 24 0 */ 1.000000e+00,
+/* 24 1 */ 1.000000e+00,
+/* 24 2 */ 1.000000e+00,
+/* 24 3 */ 1.000000e+00,
+/* 24 4 */ 1.000000e+00,
+/* 24 5 */ 1.000000e+00,
+/* 24 6 */ 1.000000e+00,
+/* 24 7 */ 1.000000e+00,
+/* 24 8 */ 1.000000e+00,
+/* 24 9 */ 9.999873e-01,
+/* 24 10 */ 9.987582e-01,
+/* 24 11 */ 9.557455e-01,
+/* 24 12 */ 6.970909e-01,
+/* 24 13 */ 3.241800e-01,
+/* 24 14 */ 1.044855e-01,
+/* 24 15 */ 2.595818e-02,
+/* 24 16 */ 5.249091e-03,
+/* 24 17 */ 9.036364e-04,
+/* 24 18 */ 1.381818e-04,
+/* 24 19 */ 2.497199e-05,
+/* 24 20 */ 2.038172e-06,
+/* 24 21 */ 1.270206e-07,
+/* 24 22 */ 5.677681e-09,
+/* 24 23 */ 1.620926e-10,
+/* 24 24 */ 2.220446e-12,
+/* 25 0 */ 1.000000e+00,
+/* 25 1 */ 1.000000e+00,
+/* 25 2 */ 1.000000e+00,
+/* 25 3 */ 1.000000e+00,
+/* 25 4 */ 1.000000e+00,
+/* 25 5 */ 1.000000e+00,
+/* 25 6 */ 1.000000e+00,
+/* 25 7 */ 1.000000e+00,
+/* 25 8 */ 1.000000e+00,
+/* 25 9 */ 9.999982e-01,
+/* 25 10 */ 9.997836e-01,
+/* 25 11 */ 9.863527e-01,
+/* 25 12 */ 8.327455e-01,
+/* 25 13 */ 4.696527e-01,
+/* 25 14 */ 1.758091e-01,
+/* 25 15 */ 4.943091e-02,
+/* 25 16 */ 1.134000e-02,
+/* 25 17 */ 2.156364e-03,
+/* 25 18 */ 3.509091e-04,
+/* 25 19 */ 6.727273e-05,
+/* 25 20 */ 8.405790e-06,
+/* 25 21 */ 6.541608e-07,
+/* 25 22 */ 3.895211e-08,
+/* 25 23 */ 1.666734e-09,
+/* 25 24 */ 4.563105e-11,
+/* 25 25 */ 6.004086e-13,
+/* 26 0 */ 1.000000e+00,
+/* 26 1 */ 1.000000e+00,
+/* 26 2 */ 1.000000e+00,
+/* 26 3 */ 1.000000e+00,
+/* 26 4 */ 1.000000e+00,
+/* 26 5 */ 1.000000e+00,
+/* 26 6 */ 1.000000e+00,
+/* 26 7 */ 1.000000e+00,
+/* 26 8 */ 1.000000e+00,
+/* 26 9 */ 1.000000e+00,
+/* 26 10 */ 9.999618e-01,
+/* 26 11 */ 9.967691e-01,
+/* 26 12 */ 9.239927e-01,
+/* 26 13 */ 6.252236e-01,
+/* 26 14 */ 2.766891e-01,
+/* 26 15 */ 8.827091e-02,
+/* 26 16 */ 2.257636e-02,
+/* 26 17 */ 4.838182e-03,
+/* 26 18 */ 8.618182e-04,
+/* 26 19 */ 1.400000e-04,
+/* 26 20 */ 2.909091e-05,
+/* 26 21 */ 2.795292e-06,
+/* 26 22 */ 2.078667e-07,
+/* 26 23 */ 1.184957e-08,
+/* 26 24 */ 4.862590e-10,
+/* 26 25 */ 1.278777e-11,
+/* 26 26 */ 1.618705e-13,
+/* 27 0 */ 1.000000e+00,
+/* 27 1 */ 1.000000e+00,
+/* 27 2 */ 1.000000e+00,
+/* 27 3 */ 1.000000e+00,
+/* 27 4 */ 1.000000e+00,
+/* 27 5 */ 1.000000e+00,
+/* 27 6 */ 1.000000e+00,
+/* 27 7 */ 1.000000e+00,
+/* 27 8 */ 1.000000e+00,
+/* 27 9 */ 1.000000e+00,
+/* 27 10 */ 9.999945e-01,
+/* 27 11 */ 9.993291e-01,
+/* 27 12 */ 9.726164e-01,
+/* 27 13 */ 7.696218e-01,
+/* 27 14 */ 4.050855e-01,
+/* 27 15 */ 1.481582e-01,
+/* 27 16 */ 4.218000e-02,
+/* 27 17 */ 1.004000e-02,
+/* 27 18 */ 1.972727e-03,
+/* 27 19 */ 3.290909e-04,
+/* 27 20 */ 6.727273e-05,
+/* 27 21 */ 1.031061e-05,
+/* 27 22 */ 9.192084e-07,
+/* 27 23 */ 6.544501e-08,
+/* 27 24 */ 3.578101e-09,
+/* 27 25 */ 1.410507e-10,
+/* 27 26 */ 3.568701e-12,
+/* 27 27 */ 4.352074e-14,
+/* 28 0 */ 1.000000e+00,
+/* 28 1 */ 1.000000e+00,
+/* 28 2 */ 1.000000e+00,
+/* 28 3 */ 1.000000e+00,
+/* 28 4 */ 1.000000e+00,
+/* 28 5 */ 1.000000e+00,
+/* 28 6 */ 1.000000e+00,
+/* 28 7 */ 1.000000e+00,
+/* 28 8 */ 1.000000e+00,
+/* 28 9 */ 1.000000e+00,
+/* 28 10 */ 1.000000e+00,
+/* 28 11 */ 9.999000e-01,
+/* 28 12 */ 9.922545e-01,
+/* 28 13 */ 8.798709e-01,
+/* 28 14 */ 5.509618e-01,
+/* 28 15 */ 2.333200e-01,
+/* 28 16 */ 7.442364e-02,
+/* 28 17 */ 1.933455e-02,
+/* 28 18 */ 4.320000e-03,
+/* 28 19 */ 7.781818e-04,
+/* 28 20 */ 1.381818e-04,
+/* 28 21 */ 2.727273e-05,
+/* 28 22 */ 3.504586e-06,
+/* 28 23 */ 2.991620e-07,
+/* 28 24 */ 2.042947e-08,
+/* 28 25 */ 1.073040e-09,
+/* 28 26 */ 4.069754e-11,
+/* 28 27 */ 9.920537e-13,
+/* 28 28 */ 1.167122e-14,
+/* 29 0 */ 1.000000e+00,
+/* 29 1 */ 1.000000e+00,
+/* 29 2 */ 1.000000e+00,
+/* 29 3 */ 1.000000e+00,
+/* 29 4 */ 1.000000e+00,
+/* 29 5 */ 1.000000e+00,
+/* 29 6 */ 1.000000e+00,
+/* 29 7 */ 1.000000e+00,
+/* 29 8 */ 1.000000e+00,
+/* 29 9 */ 1.000000e+00,
+/* 29 10 */ 1.000000e+00,
+/* 29 11 */ 9.999873e-01,
+/* 29 12 */ 9.982291e-01,
+/* 29 13 */ 9.487145e-01,
+/* 29 14 */ 6.981673e-01,
+/* 29 15 */ 3.453327e-01,
+/* 29 16 */ 1.235055e-01,
+/* 29 17 */ 3.544727e-02,
+/* 29 18 */ 8.707273e-03,
+/* 29 19 */ 1.783636e-03,
+/* 29 20 */ 3.090909e-04,
+/* 29 21 */ 5.090909e-05,
+/* 29 22 */ 1.183615e-05,
+/* 29 23 */ 1.177724e-06,
+/* 29 24 */ 9.643441e-08,
+/* 29 25 */ 6.326911e-09,
+/* 29 26 */ 3.197442e-10,
+/* 29 27 */ 1.168440e-11,
+/* 29 28 */ 2.747802e-13,
+/* 29 29 */ 3.122502e-15,
+/* 30 0 */ 1.000000e+00,
+/* 30 1 */ 1.000000e+00,
+/* 30 2 */ 1.000000e+00,
+/* 30 3 */ 1.000000e+00,
+/* 30 4 */ 1.000000e+00,
+/* 30 5 */ 1.000000e+00,
+/* 30 6 */ 1.000000e+00,
+/* 30 7 */ 1.000000e+00,
+/* 30 8 */ 1.000000e+00,
+/* 30 9 */ 1.000000e+00,
+/* 30 10 */ 1.000000e+00,
+/* 30 11 */ 9.999982e-01,
+/* 30 12 */ 9.996145e-01,
+/* 30 13 */ 9.822418e-01,
+/* 30 14 */ 8.227145e-01,
+/* 30 15 */ 4.789527e-01,
+/* 30 16 */ 1.952782e-01,
+/* 30 17 */ 6.181273e-02,
+/* 30 18 */ 1.640727e-02,
+/* 30 19 */ 3.714545e-03,
+/* 30 20 */ 7.036364e-04,
+/* 30 21 */ 1.200000e-04,
+/* 30 22 */ 3.611135e-05,
+/* 30 23 */ 4.102757e-06,
+/* 30 24 */ 3.916149e-07,
+/* 30 25 */ 3.080943e-08,
+/* 30 26 */ 1.944996e-09,
+/* 30 27 */ 9.471121e-11,
+/* 30 28 */ 3.339140e-12,
+/* 30 29 */ 7.585165e-14,
+/* 30 30 */ 8.335346e-16,
+/* 31 0 */ 1.000000e+00,
+/* 31 1 */ 1.000000e+00,
+/* 31 2 */ 1.000000e+00,
+/* 31 3 */ 1.000000e+00,
+/* 31 4 */ 1.000000e+00,
+/* 31 5 */ 1.000000e+00,
+/* 31 6 */ 1.000000e+00,
+/* 31 7 */ 1.000000e+00,
+/* 31 8 */ 1.000000e+00,
+/* 31 9 */ 1.000000e+00,
+/* 31 10 */ 1.000000e+00,
+/* 31 11 */ 1.000000e+00,
+/* 31 12 */ 9.999218e-01,
+/* 31 13 */ 9.951964e-01,
+/* 31 14 */ 9.121473e-01,
+/* 31 15 */ 6.207782e-01,
+/* 31 16 */ 2.910200e-01,
+/* 31 17 */ 1.022600e-01,
+/* 31 18 */ 2.944727e-02,
+/* 31 19 */ 7.225455e-03,
+/* 31 20 */ 1.632727e-03,
+/* 31 21 */ 2.781818e-04,
+/* 31 22 */ 5.454545e-05,
+/* 31 23 */ 1.289846e-05,
+/* 31 24 */ 1.405896e-06,
+/* 31 25 */ 1.289439e-07,
+/* 31 26 */ 9.761676e-09,
+/* 31 27 */ 5.938159e-10,
+/* 31 28 */ 2.789857e-11,
+/* 31 29 */ 9.501289e-13,
+/* 31 30 */ 2.087219e-14,
+/* 31 31 */ 2.220446e-16,
+/* 32 0 */ 1.000000e+00,
+/* 32 1 */ 1.000000e+00,
+/* 32 2 */ 1.000000e+00,
+/* 32 3 */ 1.000000e+00,
+/* 32 4 */ 1.000000e+00,
+/* 32 5 */ 1.000000e+00,
+/* 32 6 */ 1.000000e+00,
+/* 32 7 */ 1.000000e+00,
+/* 32 8 */ 1.000000e+00,
+/* 32 9 */ 1.000000e+00,
+/* 32 10 */ 1.000000e+00,
+/* 32 11 */ 1.000000e+00,
+/* 32 12 */ 9.999800e-01,
+/* 32 13 */ 9.989327e-01,
+/* 32 14 */ 9.638855e-01,
+/* 32 15 */ 7.548182e-01,
+/* 32 16 */ 4.098745e-01,
+/* 32 17 */ 1.615600e-01,
+/* 32 18 */ 5.084727e-02,
+/* 32 19 */ 1.364182e-02,
+/* 32 20 */ 3.136364e-03,
+/* 32 21 */ 6.763636e-04,
+/* 32 22 */ 1.345455e-04,
+/* 32 23 */ 2.363636e-05,
+/* 32 24 */ 4.550656e-06,
+/* 32 25 */ 4.766309e-07,
+/* 32 26 */ 4.206818e-08,
+/* 32 27 */ 3.068960e-09,
+/* 32 28 */ 1.801294e-10,
+/* 32 29 */ 8.175199e-12,
+/* 32 30 */ 2.692578e-13,
+/* 32 31 */ 5.726376e-15,
+/* 32 32 */ 5.903481e-17,
+/* 33 0 */ 1.000000e+00,
+/* 33 1 */ 1.000000e+00,
+/* 33 2 */ 1.000000e+00,
+/* 33 3 */ 1.000000e+00,
+/* 33 4 */ 1.000000e+00,
+/* 33 5 */ 1.000000e+00,
+/* 33 6 */ 1.000000e+00,
+/* 33 7 */ 1.000000e+00,
+/* 33 8 */ 1.000000e+00,
+/* 33 9 */ 1.000000e+00,
+/* 33 10 */ 1.000000e+00,
+/* 33 11 */ 1.000000e+00,
+/* 33 12 */ 9.999982e-01,
+/* 33 13 */ 9.997782e-01,
+/* 33 14 */ 9.881109e-01,
+/* 33 15 */ 8.623436e-01,
+/* 33 16 */ 5.440909e-01,
+/* 33 17 */ 2.428600e-01,
+/* 33 18 */ 8.408545e-02,
+/* 33 19 */ 2.426545e-02,
+/* 33 20 */ 6.121818e-03,
+/* 33 21 */ 1.385455e-03,
+/* 33 22 */ 2.618182e-04,
+/* 33 23 */ 5.818182e-05,
+/* 33 24 */ 1.347999e-05,
+/* 33 25 */ 1.587125e-06,
+/* 33 26 */ 1.599811e-07,
+/* 33 27 */ 1.360743e-08,
+/* 33 28 */ 9.578529e-10,
+/* 33 29 */ 5.431157e-11,
+/* 33 30 */ 2.383911e-12,
+/* 33 31 */ 7.601493e-14,
+/* 33 32 */ 1.566672e-15,
+/* 33 33 */ 1.566672e-17,
+/* 34 0 */ 1.000000e+00,
+/* 34 1 */ 1.000000e+00,
+/* 34 2 */ 1.000000e+00,
+/* 34 3 */ 1.000000e+00,
+/* 34 4 */ 1.000000e+00,
+/* 34 5 */ 1.000000e+00,
+/* 34 6 */ 1.000000e+00,
+/* 34 7 */ 1.000000e+00,
+/* 34 8 */ 1.000000e+00,
+/* 34 9 */ 1.000000e+00,
+/* 34 10 */ 1.000000e+00,
+/* 34 11 */ 1.000000e+00,
+/* 34 12 */ 1.000000e+00,
+/* 34 13 */ 9.999491e-01,
+/* 34 14 */ 9.967473e-01,
+/* 34 15 */ 9.345491e-01,
+/* 34 16 */ 6.803855e-01,
+/* 34 17 */ 3.466745e-01,
+/* 34 18 */ 1.326655e-01,
+/* 34 19 */ 4.164000e-02,
+/* 34 20 */ 1.138000e-02,
+/* 34 21 */ 2.674545e-03,
+/* 34 22 */ 6.127273e-04,
+/* 34 23 */ 1.236364e-04,
+/* 34 24 */ 3.272727e-05,
+/* 34 25 */ 4.832540e-06,
+/* 34 26 */ 5.476121e-07,
+/* 34 27 */ 5.319727e-08,
+/* 34 28 */ 4.366179e-09,
+/* 34 29 */ 2.969215e-10,
+/* 34 30 */ 1.628299e-11,
+/* 34 31 */ 6.919649e-13,
+/* 34 32 */ 2.138318e-14,
+/* 34 33 */ 4.274975e-16,
+/* 34 34 */ 4.150461e-18,
+/* 35 0 */ 1.000000e+00,
+/* 35 1 */ 1.000000e+00,
+/* 35 2 */ 1.000000e+00,
+/* 35 3 */ 1.000000e+00,
+/* 35 4 */ 1.000000e+00,
+/* 35 5 */ 1.000000e+00,
+/* 35 6 */ 1.000000e+00,
+/* 35 7 */ 1.000000e+00,
+/* 35 8 */ 1.000000e+00,
+/* 35 9 */ 1.000000e+00,
+/* 35 10 */ 1.000000e+00,
+/* 35 11 */ 1.000000e+00,
+/* 35 12 */ 1.000000e+00,
+/* 35 13 */ 9.999891e-01,
+/* 35 14 */ 9.993000e-01,
+/* 35 15 */ 9.741855e-01,
+/* 35 16 */ 8.002673e-01,
+/* 35 17 */ 4.693836e-01,
+/* 35 18 */ 2.005109e-01,
+/* 35 19 */ 6.863273e-02,
+/* 35 20 */ 2.008182e-02,
+/* 35 21 */ 4.994545e-03,
+/* 35 22 */ 1.203636e-03,
+/* 35 23 */ 2.509091e-04,
+/* 35 24 */ 6.909091e-05,
+/* 35 25 */ 1.361253e-05,
+/* 35 26 */ 1.712671e-06,
+/* 35 27 */ 1.870482e-07,
+/* 35 28 */ 1.753457e-08,
+/* 35 29 */ 1.390408e-09,
+/* 35 30 */ 9.145275e-11,
+/* 35 31 */ 4.855738e-12,
+/* 35 32 */ 1.999846e-13,
+/* 35 33 */ 5.994838e-15,
+/* 35 34 */ 1.163620e-16,
+/* 35 35 */ 1.097755e-18,
+/* 36 0 */ 1.000000e+00,
+/* 36 1 */ 1.000000e+00,
+/* 36 2 */ 1.000000e+00,
+/* 36 3 */ 1.000000e+00,
+/* 36 4 */ 1.000000e+00,
+/* 36 5 */ 1.000000e+00,
+/* 36 6 */ 1.000000e+00,
+/* 36 7 */ 1.000000e+00,
+/* 36 8 */ 1.000000e+00,
+/* 36 9 */ 1.000000e+00,
+/* 36 10 */ 1.000000e+00,
+/* 36 11 */ 1.000000e+00,
+/* 36 12 */ 1.000000e+00,
+/* 36 13 */ 1.000000e+00,
+/* 36 14 */ 9.998473e-01,
+/* 36 15 */ 9.916673e-01,
+/* 36 16 */ 8.920873e-01,
+/* 36 17 */ 6.013491e-01,
+/* 36 18 */ 2.898691e-01,
+/* 36 19 */ 1.085455e-01,
+/* 36 20 */ 3.413636e-02,
+/* 36 21 */ 9.327273e-03,
+/* 36 22 */ 2.260000e-03,
+/* 36 23 */ 5.000000e-04,
+/* 36 24 */ 1.254545e-04,
+/* 36 25 */ 2.727273e-05,
+/* 36 26 */ 4.951677e-06,
+/* 36 27 */ 6.004733e-07,
+/* 36 28 */ 6.328771e-08,
+/* 36 29 */ 5.732104e-09,
+/* 36 30 */ 4.396344e-10,
+/* 36 31 */ 2.799794e-11,
+/* 36 32 */ 1.440749e-12,
+/* 36 33 */ 5.756166e-14,
+/* 36 34 */ 1.675315e-15,
+/* 36 35 */ 3.159878e-17,
+/* 36 36 */ 2.898970e-19,
+/* 37 0 */ 1.000000e+00,
+/* 37 1 */ 1.000000e+00,
+/* 37 2 */ 1.000000e+00,
+/* 37 3 */ 1.000000e+00,
+/* 37 4 */ 1.000000e+00,
+/* 37 5 */ 1.000000e+00,
+/* 37 6 */ 1.000000e+00,
+/* 37 7 */ 1.000000e+00,
+/* 37 8 */ 1.000000e+00,
+/* 37 9 */ 1.000000e+00,
+/* 37 10 */ 1.000000e+00,
+/* 37 11 */ 1.000000e+00,
+/* 37 12 */ 1.000000e+00,
+/* 37 13 */ 1.000000e+00,
+/* 37 14 */ 9.999709e-01,
+/* 37 15 */ 9.978782e-01,
+/* 37 16 */ 9.506036e-01,
+/* 37 17 */ 7.282236e-01,
+/* 37 18 */ 3.987636e-01,
+/* 37 19 */ 1.646855e-01,
+/* 37 20 */ 5.604727e-02,
+/* 37 21 */ 1.618545e-02,
+/* 37 22 */ 4.296364e-03,
+/* 37 23 */ 1.007273e-03,
+/* 37 24 */ 2.272727e-04,
+/* 37 25 */ 5.272727e-05,
+/* 37 26 */ 1.335903e-05,
+/* 37 27 */ 1.780765e-06,
+/* 37 28 */ 2.084087e-07,
+/* 37 29 */ 2.122332e-08,
+/* 37 30 */ 1.859323e-09,
+/* 37 31 */ 1.380787e-10,
+/* 37 32 */ 8.522708e-12,
+/* 37 33 */ 4.254562e-13,
+/* 37 34 */ 1.650411e-14,
+/* 37 35 */ 4.667715e-16,
+/* 37 36 */ 8.561809e-18,
+/* 37 37 */ 7.644472e-20,
+/* 38 0 */ 1.000000e+00,
+/* 38 1 */ 1.000000e+00,
+/* 38 2 */ 1.000000e+00,
+/* 38 3 */ 1.000000e+00,
+/* 38 4 */ 1.000000e+00,
+/* 38 5 */ 1.000000e+00,
+/* 38 6 */ 1.000000e+00,
+/* 38 7 */ 1.000000e+00,
+/* 38 8 */ 1.000000e+00,
+/* 38 9 */ 1.000000e+00,
+/* 38 10 */ 1.000000e+00,
+/* 38 11 */ 1.000000e+00,
+/* 38 12 */ 1.000000e+00,
+/* 38 13 */ 1.000000e+00,
+/* 38 14 */ 1.000000e+00,
+/* 38 15 */ 9.995291e-01,
+/* 38 16 */ 9.810600e-01,
+/* 38 17 */ 8.353509e-01,
+/* 38 18 */ 5.225836e-01,
+/* 38 19 */ 2.401600e-01,
+/* 38 20 */ 8.822364e-02,
+/* 38 21 */ 2.739455e-02,
+/* 38 22 */ 7.583636e-03,
+/* 38 23 */ 1.885455e-03,
+/* 38 24 */ 4.309091e-04,
+/* 38 25 */ 1.000000e-04,
+/* 38 26 */ 2.909091e-05,
+/* 38 27 */ 4.924639e-06,
+/* 38 28 */ 6.335722e-07,
+/* 38 29 */ 7.164674e-08,
+/* 38 30 */ 7.057612e-09,
+/* 38 31 */ 5.986987e-10,
+/* 38 32 */ 4.309330e-11,
+/* 38 33 */ 2.580401e-12,
+/* 38 34 */ 1.250740e-13,
+/* 38 35 */ 4.714790e-15,
+/* 38 36 */ 1.296792e-16,
+/* 38 37 */ 2.314981e-18,
+/* 38 38 */ 2.013027e-20,
+/* 39 0 */ 1.000000e+00,
+/* 39 1 */ 1.000000e+00,
+/* 39 2 */ 1.000000e+00,
+/* 39 3 */ 1.000000e+00,
+/* 39 4 */ 1.000000e+00,
+/* 39 5 */ 1.000000e+00,
+/* 39 6 */ 1.000000e+00,
+/* 39 7 */ 1.000000e+00,
+/* 39 8 */ 1.000000e+00,
+/* 39 9 */ 1.000000e+00,
+/* 39 10 */ 1.000000e+00,
+/* 39 11 */ 1.000000e+00,
+/* 39 12 */ 1.000000e+00,
+/* 39 13 */ 1.000000e+00,
+/* 39 14 */ 1.000000e+00,
+/* 39 15 */ 9.998836e-01,
+/* 39 16 */ 9.940309e-01,
+/* 39 17 */ 9.138745e-01,
+/* 39 18 */ 6.495091e-01,
+/* 39 19 */ 3.354945e-01,
+/* 39 20 */ 1.346200e-01,
+/* 39 21 */ 4.504364e-02,
+/* 39 22 */ 1.313636e-02,
+/* 39 23 */ 3.481818e-03,
+/* 39 24 */ 8.290909e-04,
+/* 39 25 */ 1.836364e-04,
+/* 39 26 */ 5.636364e-05,
+/* 39 27 */ 1.279770e-05,
+/* 39 28 */ 1.794965e-06,
+/* 39 29 */ 2.231459e-07,
+/* 39 30 */ 2.441015e-08,
+/* 39 31 */ 2.328391e-09,
+/* 39 32 */ 1.914474e-10,
+/* 39 33 */ 1.336871e-11,
+/* 39 34 */ 7.772841e-13,
+/* 39 35 */ 3.661232e-14,
+/* 39 36 */ 1.342230e-15,
+/* 39 37 */ 3.593008e-17,
+/* 39 38 */ 6.246868e-19,
+/* 39 39 */ 5.293956e-21,
+/* 40 0 */ 1.000000e+00,
+/* 40 1 */ 1.000000e+00,
+/* 40 2 */ 1.000000e+00,
+/* 40 3 */ 1.000000e+00,
+/* 40 4 */ 1.000000e+00,
+/* 40 5 */ 1.000000e+00,
+/* 40 6 */ 1.000000e+00,
+/* 40 7 */ 1.000000e+00,
+/* 40 8 */ 1.000000e+00,
+/* 40 9 */ 1.000000e+00,
+/* 40 10 */ 1.000000e+00,
+/* 40 11 */ 1.000000e+00,
+/* 40 12 */ 1.000000e+00,
+/* 40 13 */ 1.000000e+00,
+/* 40 14 */ 1.000000e+00,
+/* 40 15 */ 9.999855e-01,
+/* 40 16 */ 9.985218e-01,
+/* 40 17 */ 9.615964e-01,
+/* 40 18 */ 7.668636e-01,
+/* 40 19 */ 4.470873e-01,
+/* 40 20 */ 1.971200e-01,
+/* 40 21 */ 7.127636e-02,
+/* 40 22 */ 2.214545e-02,
+/* 40 23 */ 6.107273e-03,
+/* 40 24 */ 1.563636e-03,
+/* 40 25 */ 4.000000e-04,
+/* 40 26 */ 9.818182e-05,
+/* 40 27 */ 2.727273e-05,
+/* 40 28 */ 4.775773e-06,
+/* 40 29 */ 6.472909e-07,
+/* 40 30 */ 7.784511e-08,
+/* 40 31 */ 8.246177e-09,
+/* 40 32 */ 7.624211e-10,
+/* 40 33 */ 6.081897e-11,
+/* 40 34 */ 4.123850e-12,
+/* 40 35 */ 2.330079e-13,
+/* 40 36 */ 1.067409e-14,
+/* 40 37 */ 3.808568e-16,
+/* 40 38 */ 9.929493e-18,
+/* 40 39 */ 1.682494e-19,
+/* 40 40 */ 1.390491e-21,
+/* 41 0 */ 1.000000e+00,
+/* 41 1 */ 1.000000e+00,
+/* 41 2 */ 1.000000e+00,
+/* 41 3 */ 1.000000e+00,
+/* 41 4 */ 1.000000e+00,
+/* 41 5 */ 1.000000e+00,
+/* 41 6 */ 1.000000e+00,
+/* 41 7 */ 1.000000e+00,
+/* 41 8 */ 1.000000e+00,
+/* 41 9 */ 1.000000e+00,
+/* 41 10 */ 1.000000e+00,
+/* 41 11 */ 1.000000e+00,
+/* 41 12 */ 1.000000e+00,
+/* 41 13 */ 1.000000e+00,
+/* 41 14 */ 1.000000e+00,
+/* 41 15 */ 9.999982e-01,
+/* 41 16 */ 9.996836e-01,
+/* 41 17 */ 9.854945e-01,
+/* 41 18 */ 8.630436e-01,
+/* 41 19 */ 5.692127e-01,
+/* 41 20 */ 2.783564e-01,
+/* 41 21 */ 1.091036e-01,
+/* 41 22 */ 3.642364e-02,
+/* 41 23 */ 1.052545e-02,
+/* 41 24 */ 2.803636e-03,
+/* 41 25 */ 7.127273e-04,
+/* 41 26 */ 1.727273e-04,
+/* 41 27 */ 4.363636e-05,
+/* 41 28 */ 1.200995e-05,
+/* 41 29 */ 1.762333e-06,
+/* 41 30 */ 2.310793e-07,
+/* 41 31 */ 2.691219e-08,
+/* 41 32 */ 2.763383e-09,
+/* 41 33 */ 2.478829e-10,
+/* 41 34 */ 1.920108e-11,
+/* 41 35 */ 1.265251e-12,
+/* 41 36 */ 6.952903e-14,
+/* 41 37 */ 3.100028e-15,
+/* 41 38 */ 1.077303e-16,
+/* 41 39 */ 2.737359e-18,
+/* 41 40 */ 4.523354e-20,
+/* 41 41 */ 3.647867e-22,
+/* 42 0 */ 1.000000e+00,
+/* 42 1 */ 1.000000e+00,
+/* 42 2 */ 1.000000e+00,
+/* 42 3 */ 1.000000e+00,
+/* 42 4 */ 1.000000e+00,
+/* 42 5 */ 1.000000e+00,
+/* 42 6 */ 1.000000e+00,
+/* 42 7 */ 1.000000e+00,
+/* 42 8 */ 1.000000e+00,
+/* 42 9 */ 1.000000e+00,
+/* 42 10 */ 1.000000e+00,
+/* 42 11 */ 1.000000e+00,
+/* 42 12 */ 1.000000e+00,
+/* 42 13 */ 1.000000e+00,
+/* 42 14 */ 1.000000e+00,
+/* 42 15 */ 1.000000e+00,
+/* 42 16 */ 9.999400e-01,
+/* 42 17 */ 9.956200e-01,
+/* 42 18 */ 9.298000e-01,
+/* 42 19 */ 6.904818e-01,
+/* 42 20 */ 3.770509e-01,
+/* 42 21 */ 1.607691e-01,
+/* 42 22 */ 5.732000e-02,
+/* 42 23 */ 1.790182e-02,
+/* 42 24 */ 4.956364e-03,
+/* 42 25 */ 1.287273e-03,
+/* 42 26 */ 3.236364e-04,
+/* 42 27 */ 8.909091e-05,
+/* 42 28 */ 2.870078e-05,
+/* 42 29 */ 4.532606e-06,
+/* 42 30 */ 6.434737e-07,
+/* 42 31 */ 8.171026e-08,
+/* 42 32 */ 9.224648e-09,
+/* 42 33 */ 9.190054e-10,
+/* 42 34 */ 8.005158e-11,
+/* 42 35 */ 6.026240e-12,
+/* 42 36 */ 3.862141e-13,
+/* 42 37 */ 2.065689e-14,
+/* 42 38 */ 8.970424e-16,
+/* 42 39 */ 3.038228e-17,
+/* 42 40 */ 7.528752e-19,
+/* 42 41 */ 1.214006e-20,
+/* 42 42 */ 9.559106e-23,
+/* 43 0 */ 1.000000e+00,
+/* 43 1 */ 1.000000e+00,
+/* 43 2 */ 1.000000e+00,
+/* 43 3 */ 1.000000e+00,
+/* 43 4 */ 1.000000e+00,
+/* 43 5 */ 1.000000e+00,
+/* 43 6 */ 1.000000e+00,
+/* 43 7 */ 1.000000e+00,
+/* 43 8 */ 1.000000e+00,
+/* 43 9 */ 1.000000e+00,
+/* 43 10 */ 1.000000e+00,
+/* 43 11 */ 1.000000e+00,
+/* 43 12 */ 1.000000e+00,
+/* 43 13 */ 1.000000e+00,
+/* 43 14 */ 1.000000e+00,
+/* 43 15 */ 1.000000e+00,
+/* 43 16 */ 9.999873e-01,
+/* 43 17 */ 9.989127e-01,
+/* 43 18 */ 9.693127e-01,
+/* 43 19 */ 7.987545e-01,
+/* 43 20 */ 4.900527e-01,
+/* 43 21 */ 2.294218e-01,
+/* 43 22 */ 8.803091e-02,
+/* 43 23 */ 2.904545e-02,
+/* 43 24 */ 8.496364e-03,
+/* 43 25 */ 2.352727e-03,
+/* 43 26 */ 5.927273e-04,
+/* 43 27 */ 1.581818e-04,
+/* 43 28 */ 3.454545e-05,
+/* 43 29 */ 1.107221e-05,
+/* 43 30 */ 1.691782e-06,
+/* 43 31 */ 2.326039e-07,
+/* 43 32 */ 2.863275e-08,
+/* 43 33 */ 3.136358e-09,
+/* 43 34 */ 3.034254e-10,
+/* 43 35 */ 2.568689e-11,
+/* 43 36 */ 1.880737e-12,
+/* 43 37 */ 1.173182e-13,
+/* 43 38 */ 6.111650e-15,
+/* 43 39 */ 2.586715e-16,
+/* 43 40 */ 8.544185e-18,
+/* 43 41 */ 2.066084e-19,
+/* 43 42 */ 3.252888e-21,
+/* 43 43 */ 2.502221e-23,
+/* 44 0 */ 1.000000e+00,
+/* 44 1 */ 1.000000e+00,
+/* 44 2 */ 1.000000e+00,
+/* 44 3 */ 1.000000e+00,
+/* 44 4 */ 1.000000e+00,
+/* 44 5 */ 1.000000e+00,
+/* 44 6 */ 1.000000e+00,
+/* 44 7 */ 1.000000e+00,
+/* 44 8 */ 1.000000e+00,
+/* 44 9 */ 1.000000e+00,
+/* 44 10 */ 1.000000e+00,
+/* 44 11 */ 1.000000e+00,
+/* 44 12 */ 1.000000e+00,
+/* 44 13 */ 1.000000e+00,
+/* 44 14 */ 1.000000e+00,
+/* 44 15 */ 1.000000e+00,
+/* 44 16 */ 9.999945e-01,
+/* 44 17 */ 9.997709e-01,
+/* 44 18 */ 9.887491e-01,
+/* 44 19 */ 8.835436e-01,
+/* 44 20 */ 6.091655e-01,
+/* 44 21 */ 3.144418e-01,
+/* 44 22 */ 1.304509e-01,
+/* 44 23 */ 4.616182e-02,
+/* 44 24 */ 1.412727e-02,
+/* 44 25 */ 4.100000e-03,
+/* 44 26 */ 1.101818e-03,
+/* 44 27 */ 2.872727e-04,
+/* 44 28 */ 6.545455e-05,
+/* 44 29 */ 2.580812e-05,
+/* 44 30 */ 4.222470e-06,
+/* 44 31 */ 6.248615e-07,
+/* 44 32 */ 8.328601e-08,
+/* 44 33 */ 9.947662e-09,
+/* 44 34 */ 1.058166e-09,
+/* 44 35 */ 9.949435e-11,
+/* 44 36 */ 8.192334e-12,
+/* 44 37 */ 5.838328e-13,
+/* 44 38 */ 3.547233e-14,
+/* 44 39 */ 1.801075e-15,
+/* 44 40 */ 7.434345e-17,
+/* 44 41 */ 2.396322e-18,
+/* 44 42 */ 5.657843e-20,
+/* 44 43 */ 8.702360e-22,
+/* 44 44 */ 6.543128e-24,
+/* 45 0 */ 1.000000e+00,
+/* 45 1 */ 1.000000e+00,
+/* 45 2 */ 1.000000e+00,
+/* 45 3 */ 1.000000e+00,
+/* 45 4 */ 1.000000e+00,
+/* 45 5 */ 1.000000e+00,
+/* 45 6 */ 1.000000e+00,
+/* 45 7 */ 1.000000e+00,
+/* 45 8 */ 1.000000e+00,
+/* 45 9 */ 1.000000e+00,
+/* 45 10 */ 1.000000e+00,
+/* 45 11 */ 1.000000e+00,
+/* 45 12 */ 1.000000e+00,
+/* 45 13 */ 1.000000e+00,
+/* 45 14 */ 1.000000e+00,
+/* 45 15 */ 1.000000e+00,
+/* 45 16 */ 1.000000e+00,
+/* 45 17 */ 9.999564e-01,
+/* 45 18 */ 9.966509e-01,
+/* 45 19 */ 9.415818e-01,
+/* 45 20 */ 7.239727e-01,
+/* 45 21 */ 4.167873e-01,
+/* 45 22 */ 1.870564e-01,
+/* 45 23 */ 7.046545e-02,
+/* 45 24 */ 2.312182e-02,
+/* 45 25 */ 6.969091e-03,
+/* 45 26 */ 1.892727e-03,
+/* 45 27 */ 5.000000e-04,
+/* 45 28 */ 1.309091e-04,
+/* 45 29 */ 2.363636e-05,
+/* 45 30 */ 1.005114e-05,
+/* 45 31 */ 1.592761e-06,
+/* 45 32 */ 2.285070e-07,
+/* 45 33 */ 2.955320e-08,
+/* 45 34 */ 3.427961e-09,
+/* 45 35 */ 3.544035e-10,
+/* 45 36 */ 3.241173e-11,
+/* 45 37 */ 2.597673e-12,
+/* 45 38 */ 1.803171e-13,
+/* 45 39 */ 1.067811e-14,
+/* 45 40 */ 5.287662e-16,
+/* 45 41 */ 2.129909e-17,
+/* 45 42 */ 6.703430e-19,
+/* 45 43 */ 1.546225e-20,
+/* 45 44 */ 2.324636e-22,
+/* 45 45 */ 1.709291e-24,
+/* 46 0 */ 1.000000e+00,
+/* 46 1 */ 1.000000e+00,
+/* 46 2 */ 1.000000e+00,
+/* 46 3 */ 1.000000e+00,
+/* 46 4 */ 1.000000e+00,
+/* 46 5 */ 1.000000e+00,
+/* 46 6 */ 1.000000e+00,
+/* 46 7 */ 1.000000e+00,
+/* 46 8 */ 1.000000e+00,
+/* 46 9 */ 1.000000e+00,
+/* 46 10 */ 1.000000e+00,
+/* 46 11 */ 1.000000e+00,
+/* 46 12 */ 1.000000e+00,
+/* 46 13 */ 1.000000e+00,
+/* 46 14 */ 1.000000e+00,
+/* 46 15 */ 1.000000e+00,
+/* 46 16 */ 1.000000e+00,
+/* 46 17 */ 9.999873e-01,
+/* 46 18 */ 9.991945e-01,
+/* 46 19 */ 9.749400e-01,
+/* 46 20 */ 8.239800e-01,
+/* 46 21 */ 5.291509e-01,
+/* 46 22 */ 2.600491e-01,
+/* 46 23 */ 1.046618e-01,
+/* 46 24 */ 3.656909e-02,
+/* 46 25 */ 1.147636e-02,
+/* 46 26 */ 3.390909e-03,
+/* 46 27 */ 8.654545e-04,
+/* 46 28 */ 2.163636e-04,
+/* 46 29 */ 6.363636e-05,
+/* 46 30 */ 2.291027e-05,
+/* 46 31 */ 3.870297e-06,
+/* 46 32 */ 5.946037e-07,
+/* 46 33 */ 8.277658e-08,
+/* 46 34 */ 1.039699e-08,
+/* 46 35 */ 1.172141e-09,
+/* 46 36 */ 1.178721e-10,
+/* 46 37 */ 1.049294e-11,
+/* 46 38 */ 8.191423e-13,
+/* 46 39 */ 5.542111e-14,
+/* 46 40 */ 3.200859e-15,
+/* 46 41 */ 1.546779e-16,
+/* 46 42 */ 6.083654e-18,
+/* 46 43 */ 1.870577e-19,
+/* 46 44 */ 4.217467e-21,
+/* 46 45 */ 6.200846e-23,
+/* 46 46 */ 4.461040e-25,
+/* 47 0 */ 1.000000e+00,
+/* 47 1 */ 1.000000e+00,
+/* 47 2 */ 1.000000e+00,
+/* 47 3 */ 1.000000e+00,
+/* 47 4 */ 1.000000e+00,
+/* 47 5 */ 1.000000e+00,
+/* 47 6 */ 1.000000e+00,
+/* 47 7 */ 1.000000e+00,
+/* 47 8 */ 1.000000e+00,
+/* 47 9 */ 1.000000e+00,
+/* 47 10 */ 1.000000e+00,
+/* 47 11 */ 1.000000e+00,
+/* 47 12 */ 1.000000e+00,
+/* 47 13 */ 1.000000e+00,
+/* 47 14 */ 1.000000e+00,
+/* 47 15 */ 1.000000e+00,
+/* 47 16 */ 1.000000e+00,
+/* 47 17 */ 1.000000e+00,
+/* 47 18 */ 9.998400e-01,
+/* 47 19 */ 9.908709e-01,
+/* 47 20 */ 9.002327e-01,
+/* 47 21 */ 6.445527e-01,
+/* 47 22 */ 3.496745e-01,
+/* 47 23 */ 1.514055e-01,
+/* 47 24 */ 5.606727e-02,
+/* 47 25 */ 1.855091e-02,
+/* 47 26 */ 5.649091e-03,
+/* 47 27 */ 1.465455e-03,
+/* 47 28 */ 4.400000e-04,
+/* 47 29 */ 1.018182e-04,
+/* 47 30 */ 2.181818e-05,
+/* 47 31 */ 9.001442e-06,
+/* 47 32 */ 1.474317e-06,
+/* 47 33 */ 2.197961e-07,
+/* 47 34 */ 2.971721e-08,
+/* 47 35 */ 3.627943e-09,
+/* 47 36 */ 3.978434e-10,
+/* 47 37 */ 3.894349e-11,
+/* 47 38 */ 3.376828e-12,
+/* 47 39 */ 2.569460e-13,
+/* 47 40 */ 1.695502e-14,
+/* 47 41 */ 9.556262e-16,
+/* 47 42 */ 4.509145e-17,
+/* 47 43 */ 1.732648e-18,
+/* 47 44 */ 5.207469e-20,
+/* 47 45 */ 1.148217e-21,
+/* 47 46 */ 1.651776e-23,
+/* 47 47 */ 1.163223e-25,
+/* 48 0 */ 1.000000e+00,
+/* 48 1 */ 1.000000e+00,
+/* 48 2 */ 1.000000e+00,
+/* 48 3 */ 1.000000e+00,
+/* 48 4 */ 1.000000e+00,
+/* 48 5 */ 1.000000e+00,
+/* 48 6 */ 1.000000e+00,
+/* 48 7 */ 1.000000e+00,
+/* 48 8 */ 1.000000e+00,
+/* 48 9 */ 1.000000e+00,
+/* 48 10 */ 1.000000e+00,
+/* 48 11 */ 1.000000e+00,
+/* 48 12 */ 1.000000e+00,
+/* 48 13 */ 1.000000e+00,
+/* 48 14 */ 1.000000e+00,
+/* 48 15 */ 1.000000e+00,
+/* 48 16 */ 1.000000e+00,
+/* 48 17 */ 1.000000e+00,
+/* 48 18 */ 9.999691e-01,
+/* 48 19 */ 9.972855e-01,
+/* 48 20 */ 9.503600e-01,
+/* 48 21 */ 7.527745e-01,
+/* 48 22 */ 4.519164e-01,
+/* 48 23 */ 2.128200e-01,
+/* 48 24 */ 8.375636e-02,
+/* 48 25 */ 2.908182e-02,
+/* 48 26 */ 9.198182e-03,
+/* 48 27 */ 2.627273e-03,
+/* 48 28 */ 7.218182e-04,
+/* 48 29 */ 1.927273e-04,
+/* 48 30 */ 4.545455e-05,
+/* 48 31 */ 2.010826e-05,
+/* 48 32 */ 3.497392e-06,
+/* 48 33 */ 5.558840e-07,
+/* 48 34 */ 8.048867e-08,
+/* 48 35 */ 1.057759e-08,
+/* 48 36 */ 1.256115e-09,
+/* 48 37 */ 1.340855e-10,
+/* 48 38 */ 1.278501e-11,
+/* 48 39 */ 1.080571e-12,
+/* 48 40 */ 8.019253e-14,
+/* 48 41 */ 5.164104e-15,
+/* 48 42 */ 2.842071e-16,
+/* 48 43 */ 1.310165e-17,
+/* 48 44 */ 4.920988e-19,
+/* 48 45 */ 1.446419e-20,
+/* 48 46 */ 3.120494e-22,
+/* 48 47 */ 4.394208e-24,
+/* 48 48 */ 3.030488e-26,
+/* 49 0 */ 1.000000e+00,
+/* 49 1 */ 1.000000e+00,
+/* 49 2 */ 1.000000e+00,
+/* 49 3 */ 1.000000e+00,
+/* 49 4 */ 1.000000e+00,
+/* 49 5 */ 1.000000e+00,
+/* 49 6 */ 1.000000e+00,
+/* 49 7 */ 1.000000e+00,
+/* 49 8 */ 1.000000e+00,
+/* 49 9 */ 1.000000e+00,
+/* 49 10 */ 1.000000e+00,
+/* 49 11 */ 1.000000e+00,
+/* 49 12 */ 1.000000e+00,
+/* 49 13 */ 1.000000e+00,
+/* 49 14 */ 1.000000e+00,
+/* 49 15 */ 1.000000e+00,
+/* 49 16 */ 1.000000e+00,
+/* 49 17 */ 1.000000e+00,
+/* 49 18 */ 9.999964e-01,
+/* 49 19 */ 9.993364e-01,
+/* 49 20 */ 9.790891e-01,
+/* 49 21 */ 8.448345e-01,
+/* 49 22 */ 5.628055e-01,
+/* 49 23 */ 2.895964e-01,
+/* 49 24 */ 1.218327e-01,
+/* 49 25 */ 4.456364e-02,
+/* 49 26 */ 1.467455e-02,
+/* 49 27 */ 4.443636e-03,
+/* 49 28 */ 1.227273e-03,
+/* 49 29 */ 3.490909e-04,
+/* 49 30 */ 9.090909e-05,
+/* 49 31 */ 4.327777e-05,
+/* 49 32 */ 7.965546e-06,
+/* 49 33 */ 1.344503e-06,
+/* 49 34 */ 2.075567e-07,
+/* 49 35 */ 2.921216e-08,
+/* 49 36 */ 3.734365e-09,
+/* 49 37 */ 4.316877e-10,
+/* 49 38 */ 4.488768e-11,
+/* 49 39 */ 4.171887e-12,
+/* 49 40 */ 3.439059e-13,
+/* 49 41 */ 2.490755e-14,
+/* 49 42 */ 1.566203e-15,
+/* 49 43 */ 8.421283e-17,
+/* 49 44 */ 3.794760e-18,
+/* 49 45 */ 1.393928e-19,
+/* 49 46 */ 4.008833e-21,
+/* 49 47 */ 8.466055e-23,
+/* 49 48 */ 1.167514e-24,
+/* 49 49 */ 7.888609e-27,
+/* 50 0 */ 1.000000e+00,
+/* 50 1 */ 1.000000e+00,
+/* 50 2 */ 1.000000e+00,
+/* 50 3 */ 1.000000e+00,
+/* 50 4 */ 1.000000e+00,
+/* 50 5 */ 1.000000e+00,
+/* 50 6 */ 1.000000e+00,
+/* 50 7 */ 1.000000e+00,
+/* 50 8 */ 1.000000e+00,
+/* 50 9 */ 1.000000e+00,
+/* 50 10 */ 1.000000e+00,
+/* 50 11 */ 1.000000e+00,
+/* 50 12 */ 1.000000e+00,
+/* 50 13 */ 1.000000e+00,
+/* 50 14 */ 1.000000e+00,
+/* 50 15 */ 1.000000e+00,
+/* 50 16 */ 1.000000e+00,
+/* 50 17 */ 1.000000e+00,
+/* 50 18 */ 1.000000e+00,
+/* 50 19 */ 9.998582e-01,
+/* 50 20 */ 9.925655e-01,
+/* 50 21 */ 9.130836e-01,
+/* 50 22 */ 6.745400e-01,
+/* 50 23 */ 3.807000e-01,
+/* 50 24 */ 1.719945e-01,
+/* 50 25 */ 6.671273e-02,
+/* 50 26 */ 2.311818e-02,
+/* 50 27 */ 7.265455e-03,
+/* 50 28 */ 2.103636e-03,
+/* 50 29 */ 5.945455e-04,
+/* 50 30 */ 1.854545e-04,
+/* 50 31 */ 4.363636e-05,
+/* 50 32 */ 1.747206e-05,
+/* 50 33 */ 3.120954e-06,
+/* 50 34 */ 5.116619e-07,
+/* 50 35 */ 7.677976e-08,
+/* 50 36 */ 1.051201e-08,
+/* 50 37 */ 1.308154e-09,
+/* 50 38 */ 1.473078e-10,
+/* 50 39 */ 1.493061e-11,
+/* 50 40 */ 1.353458e-12,
+/* 50 41 */ 1.088853e-13,
+/* 50 42 */ 7.700562e-15,
+/* 50 43 */ 4.730807e-16,
+/* 50 44 */ 2.486481e-17,
+/* 50 45 */ 1.095785e-18,
+/* 50 46 */ 3.938416e-20,
+/* 50 47 */ 1.108758e-21,
+/* 50 48 */ 2.293122e-23,
+/* 50 49 */ 3.098259e-25,
+/* 50 50 */ 2.051827e-27,
+/* 51 0 */ 1.000000e+00,
+/* 51 1 */ 1.000000e+00,
+/* 51 2 */ 1.000000e+00,
+/* 51 3 */ 1.000000e+00,
+/* 51 4 */ 1.000000e+00,
+/* 51 5 */ 1.000000e+00,
+/* 51 6 */ 1.000000e+00,
+/* 51 7 */ 1.000000e+00,
+/* 51 8 */ 1.000000e+00,
+/* 51 9 */ 1.000000e+00,
+/* 51 10 */ 1.000000e+00,
+/* 51 11 */ 1.000000e+00,
+/* 51 12 */ 1.000000e+00,
+/* 51 13 */ 1.000000e+00,
+/* 51 14 */ 1.000000e+00,
+/* 51 15 */ 1.000000e+00,
+/* 51 16 */ 1.000000e+00,
+/* 51 17 */ 1.000000e+00,
+/* 51 18 */ 1.000000e+00,
+/* 51 19 */ 9.999818e-01,
+/* 51 20 */ 9.977582e-01,
+/* 51 21 */ 9.574091e-01,
+/* 51 22 */ 7.771127e-01,
+/* 51 23 */ 4.843073e-01,
+/* 51 24 */ 2.370891e-01,
+/* 51 25 */ 9.729818e-02,
+/* 51 26 */ 3.544000e-02,
+/* 51 27 */ 1.151636e-02,
+/* 51 28 */ 3.529091e-03,
+/* 51 29 */ 9.763636e-04,
+/* 51 30 */ 2.963636e-04,
+/* 51 31 */ 8.727273e-05,
+/* 51 32 */ 3.700954e-05,
+/* 51 33 */ 6.974399e-06,
+/* 51 34 */ 1.210079e-06,
+/* 51 35 */ 1.928461e-07,
+/* 51 36 */ 2.815128e-08,
+/* 51 37 */ 3.752039e-09,
+/* 51 38 */ 4.548453e-10,
+/* 51 39 */ 4.992671e-11,
+/* 51 40 */ 4.935757e-12,
+/* 51 41 */ 4.366615e-13,
+/* 51 42 */ 3.430342e-14,
+/* 51 43 */ 2.370237e-15,
+/* 51 44 */ 1.423408e-16,
+/* 51 45 */ 7.316749e-18,
+/* 51 46 */ 3.155025e-19,
+/* 51 47 */ 1.110044e-20,
+/* 51 48 */ 3.060458e-22,
+/* 51 49 */ 6.201397e-24,
+/* 51 50 */ 8.212358e-26,
+/* 51 51 */ 5.332700e-28,
+/* 52 0 */ 1.000000e+00,
+/* 52 1 */ 1.000000e+00,
+/* 52 2 */ 1.000000e+00,
+/* 52 3 */ 1.000000e+00,
+/* 52 4 */ 1.000000e+00,
+/* 52 5 */ 1.000000e+00,
+/* 52 6 */ 1.000000e+00,
+/* 52 7 */ 1.000000e+00,
+/* 52 8 */ 1.000000e+00,
+/* 52 9 */ 1.000000e+00,
+/* 52 10 */ 1.000000e+00,
+/* 52 11 */ 1.000000e+00,
+/* 52 12 */ 1.000000e+00,
+/* 52 13 */ 1.000000e+00,
+/* 52 14 */ 1.000000e+00,
+/* 52 15 */ 1.000000e+00,
+/* 52 16 */ 1.000000e+00,
+/* 52 17 */ 1.000000e+00,
+/* 52 18 */ 1.000000e+00,
+/* 52 19 */ 9.999927e-01,
+/* 52 20 */ 9.994291e-01,
+/* 52 21 */ 9.819764e-01,
+/* 52 22 */ 8.613145e-01,
+/* 52 23 */ 5.942745e-01,
+/* 52 24 */ 3.165400e-01,
+/* 52 25 */ 1.389745e-01,
+/* 52 26 */ 5.301636e-02,
+/* 52 27 */ 1.834909e-02,
+/* 52 28 */ 5.754545e-03,
+/* 52 29 */ 1.683636e-03,
+/* 52 30 */ 5.000000e-04,
+/* 52 31 */ 1.636364e-04,
+/* 52 32 */ 2.909091e-05,
+/* 52 33 */ 1.504559e-05,
+/* 52 34 */ 2.754107e-06,
+/* 52 35 */ 4.645180e-07,
+/* 52 36 */ 7.201697e-08,
+/* 52 37 */ 1.023441e-08,
+/* 52 38 */ 1.328815e-09,
+/* 52 39 */ 1.570260e-10,
+/* 52 40 */ 1.681192e-11,
+/* 52 41 */ 1.622068e-12,
+/* 52 42 */ 1.401310e-13,
+/* 52 43 */ 1.075558e-14,
+/* 52 44 */ 7.264703e-16,
+/* 52 45 */ 4.266767e-17,
+/* 52 46 */ 2.146032e-18,
+/* 52 47 */ 9.058708e-20,
+/* 52 48 */ 3.121320e-21,
+/* 52 49 */ 8.431414e-23,
+/* 52 50 */ 1.674536e-24,
+/* 52 51 */ 2.174362e-26,
+/* 52 52 */ 1.384944e-28,
+/* 53 0 */ 1.000000e+00,
+/* 53 1 */ 1.000000e+00,
+/* 53 2 */ 1.000000e+00,
+/* 53 3 */ 1.000000e+00,
+/* 53 4 */ 1.000000e+00,
+/* 53 5 */ 1.000000e+00,
+/* 53 6 */ 1.000000e+00,
+/* 53 7 */ 1.000000e+00,
+/* 53 8 */ 1.000000e+00,
+/* 53 9 */ 1.000000e+00,
+/* 53 10 */ 1.000000e+00,
+/* 53 11 */ 1.000000e+00,
+/* 53 12 */ 1.000000e+00,
+/* 53 13 */ 1.000000e+00,
+/* 53 14 */ 1.000000e+00,
+/* 53 15 */ 1.000000e+00,
+/* 53 16 */ 1.000000e+00,
+/* 53 17 */ 1.000000e+00,
+/* 53 18 */ 1.000000e+00,
+/* 53 19 */ 9.999982e-01,
+/* 53 20 */ 9.998927e-01,
+/* 53 21 */ 9.935582e-01,
+/* 53 22 */ 9.235200e-01,
+/* 53 23 */ 7.005618e-01,
+/* 53 24 */ 4.099745e-01,
+/* 53 25 */ 1.929582e-01,
+/* 53 26 */ 7.798000e-02,
+/* 53 27 */ 2.814909e-02,
+/* 53 28 */ 9.010909e-03,
+/* 53 29 */ 2.787273e-03,
+/* 53 30 */ 8.090909e-04,
+/* 53 31 */ 2.509091e-04,
+/* 53 32 */ 6.363636e-05,
+/* 53 33 */ 3.140881e-05,
+/* 53 34 */ 6.048937e-06,
+/* 53 35 */ 1.076413e-06,
+/* 53 36 */ 1.766232e-07,
+/* 53 37 */ 2.665825e-08,
+/* 53 38 */ 3.690638e-09,
+/* 53 39 */ 4.671135e-10,
+/* 53 40 */ 5.384108e-11,
+/* 53 41 */ 5.625972e-12,
+/* 53 42 */ 5.300656e-13,
+/* 53 43 */ 4.474118e-14,
+/* 53 44 */ 3.356926e-15,
+/* 53 45 */ 2.217554e-16,
+/* 53 46 */ 1.274407e-17,
+/* 53 47 */ 6.274730e-19,
+/* 53 48 */ 2.593959e-20,
+/* 53 49 */ 8.756985e-22,
+/* 53 50 */ 2.318520e-23,
+/* 53 51 */ 4.515094e-25,
+/* 53 52 */ 5.750796e-27,
+/* 53 53 */ 3.594247e-29,
+/* 54 0 */ 1.000000e+00,
+/* 54 1 */ 1.000000e+00,
+/* 54 2 */ 1.000000e+00,
+/* 54 3 */ 1.000000e+00,
+/* 54 4 */ 1.000000e+00,
+/* 54 5 */ 1.000000e+00,
+/* 54 6 */ 1.000000e+00,
+/* 54 7 */ 1.000000e+00,
+/* 54 8 */ 1.000000e+00,
+/* 54 9 */ 1.000000e+00,
+/* 54 10 */ 1.000000e+00,
+/* 54 11 */ 1.000000e+00,
+/* 54 12 */ 1.000000e+00,
+/* 54 13 */ 1.000000e+00,
+/* 54 14 */ 1.000000e+00,
+/* 54 15 */ 1.000000e+00,
+/* 54 16 */ 1.000000e+00,
+/* 54 17 */ 1.000000e+00,
+/* 54 18 */ 1.000000e+00,
+/* 54 19 */ 1.000000e+00,
+/* 54 20 */ 9.999673e-01,
+/* 54 21 */ 9.980673e-01,
+/* 54 22 */ 9.630091e-01,
+/* 54 23 */ 7.965091e-01,
+/* 54 24 */ 5.125364e-01,
+/* 54 25 */ 2.606636e-01,
+/* 54 26 */ 1.116873e-01,
+/* 54 27 */ 4.187091e-02,
+/* 54 28 */ 1.438727e-02,
+/* 54 29 */ 4.538182e-03,
+/* 54 30 */ 1.352727e-03,
+/* 54 31 */ 4.254545e-04,
+/* 54 32 */ 1.200000e-04,
+/* 54 33 */ 3.090909e-05,
+/* 54 34 */ 1.285200e-05,
+/* 54 35 */ 2.406249e-06,
+/* 54 36 */ 4.165814e-07,
+/* 54 37 */ 6.654741e-08,
+/* 54 38 */ 9.785129e-09,
+/* 54 39 */ 1.320579e-09,
+/* 54 40 */ 1.630338e-10,
+/* 54 41 */ 1.834062e-11,
+/* 54 42 */ 1.871477e-12,
+/* 54 43 */ 1.722800e-13,
+/* 54 44 */ 1.421521e-14,
+/* 54 45 */ 1.043135e-15,
+/* 54 46 */ 6.742650e-17,
+/* 54 47 */ 3.793308e-18,
+/* 54 48 */ 1.829139e-19,
+/* 54 49 */ 7.408627e-21,
+/* 54 50 */ 2.451469e-22,
+/* 54 51 */ 6.364255e-24,
+/* 54 52 */ 1.215710e-25,
+/* 54 53 */ 1.519405e-27,
+/* 54 54 */ 9.321501e-30,
+/* 55 0 */ 1.000000e+00,
+/* 55 1 */ 1.000000e+00,
+/* 55 2 */ 1.000000e+00,
+/* 55 3 */ 1.000000e+00,
+/* 55 4 */ 1.000000e+00,
+/* 55 5 */ 1.000000e+00,
+/* 55 6 */ 1.000000e+00,
+/* 55 7 */ 1.000000e+00,
+/* 55 8 */ 1.000000e+00,
+/* 55 9 */ 1.000000e+00,
+/* 55 10 */ 1.000000e+00,
+/* 55 11 */ 1.000000e+00,
+/* 55 12 */ 1.000000e+00,
+/* 55 13 */ 1.000000e+00,
+/* 55 14 */ 1.000000e+00,
+/* 55 15 */ 1.000000e+00,
+/* 55 16 */ 1.000000e+00,
+/* 55 17 */ 1.000000e+00,
+/* 55 18 */ 1.000000e+00,
+/* 55 19 */ 1.000000e+00,
+/* 55 20 */ 9.999909e-01,
+/* 55 21 */ 9.995073e-01,
+/* 55 22 */ 9.845073e-01,
+/* 55 23 */ 8.751073e-01,
+/* 55 24 */ 6.197382e-01,
+/* 55 25 */ 3.424109e-01,
+/* 55 26 */ 1.563109e-01,
+/* 55 27 */ 6.148000e-02,
+/* 55 28 */ 2.202182e-02,
+/* 55 29 */ 7.229091e-03,
+/* 55 30 */ 2.185455e-03,
+/* 55 31 */ 6.818182e-04,
+/* 55 32 */ 2.054545e-04,
+/* 55 33 */ 5.818182e-05,
+/* 55 34 */ 2.647316e-05,
+/* 55 35 */ 5.201807e-06,
+/* 55 36 */ 9.475367e-07,
+/* 55 37 */ 1.597089e-07,
+/* 55 38 */ 2.485547e-08,
+/* 55 39 */ 3.562824e-09,
+/* 55 40 */ 4.690213e-10,
+/* 55 41 */ 5.651425e-11,
+/* 55 42 */ 6.208515e-12,
+/* 55 43 */ 6.189887e-13,
+/* 55 44 */ 5.570305e-14,
+/* 55 45 */ 4.495265e-15,
+/* 55 46 */ 3.227786e-16,
+/* 55 47 */ 2.042454e-17,
+/* 55 48 */ 1.125344e-18,
+/* 55 49 */ 5.316680e-20,
+/* 55 50 */ 2.110727e-21,
+/* 55 51 */ 6.848393e-23,
+/* 55 52 */ 1.743970e-24,
+/* 55 53 */ 3.268936e-26,
+/* 55 54 */ 4.010372e-28,
+/* 55 55 */ 2.415887e-30,
+/* 56 0 */ 1.000000e+00,
+/* 56 1 */ 1.000000e+00,
+/* 56 2 */ 1.000000e+00,
+/* 56 3 */ 1.000000e+00,
+/* 56 4 */ 1.000000e+00,
+/* 56 5 */ 1.000000e+00,
+/* 56 6 */ 1.000000e+00,
+/* 56 7 */ 1.000000e+00,
+/* 56 8 */ 1.000000e+00,
+/* 56 9 */ 1.000000e+00,
+/* 56 10 */ 1.000000e+00,
+/* 56 11 */ 1.000000e+00,
+/* 56 12 */ 1.000000e+00,
+/* 56 13 */ 1.000000e+00,
+/* 56 14 */ 1.000000e+00,
+/* 56 15 */ 1.000000e+00,
+/* 56 16 */ 1.000000e+00,
+/* 56 17 */ 1.000000e+00,
+/* 56 18 */ 1.000000e+00,
+/* 56 19 */ 1.000000e+00,
+/* 56 20 */ 9.999982e-01,
+/* 56 21 */ 9.998964e-01,
+/* 56 22 */ 9.944836e-01,
+/* 56 23 */ 9.311891e-01,
+/* 56 24 */ 7.227964e-01,
+/* 56 25 */ 4.365145e-01,
+/* 56 26 */ 2.129782e-01,
+/* 56 27 */ 8.882182e-02,
+/* 56 28 */ 3.311455e-02,
+/* 56 29 */ 1.130182e-02,
+/* 56 30 */ 3.514545e-03,
+/* 56 31 */ 1.089091e-03,
+/* 56 32 */ 3.145455e-04,
+/* 56 33 */ 9.636364e-05,
+/* 56 34 */ 2.545455e-05,
+/* 56 35 */ 1.089870e-05,
+/* 56 36 */ 2.083571e-06,
+/* 56 37 */ 3.695176e-07,
+/* 56 38 */ 6.067924e-08,
+/* 56 39 */ 9.206175e-09,
+/* 56 40 */ 1.287242e-09,
+/* 56 41 */ 1.653934e-10,
+/* 56 42 */ 1.946183e-11,
+/* 56 43 */ 2.089027e-12,
+/* 56 44 */ 2.036059e-13,
+/* 56 45 */ 1.792048e-14,
+/* 56 46 */ 1.415118e-15,
+/* 56 47 */ 9.947271e-17,
+/* 56 48 */ 6.164546e-18,
+/* 56 49 */ 3.327854e-19,
+/* 56 50 */ 1.541073e-20,
+/* 56 51 */ 5.999095e-22,
+/* 56 52 */ 1.909302e-23,
+/* 56 53 */ 4.771033e-25,
+/* 56 54 */ 8.778431e-27,
+/* 56 55 */ 1.057492e-28,
+/* 56 56 */ 6.257346e-31,
+/* 57 0 */ 1.000000e+00,
+/* 57 1 */ 1.000000e+00,
+/* 57 2 */ 1.000000e+00,
+/* 57 3 */ 1.000000e+00,
+/* 57 4 */ 1.000000e+00,
+/* 57 5 */ 1.000000e+00,
+/* 57 6 */ 1.000000e+00,
+/* 57 7 */ 1.000000e+00,
+/* 57 8 */ 1.000000e+00,
+/* 57 9 */ 1.000000e+00,
+/* 57 10 */ 1.000000e+00,
+/* 57 11 */ 1.000000e+00,
+/* 57 12 */ 1.000000e+00,
+/* 57 13 */ 1.000000e+00,
+/* 57 14 */ 1.000000e+00,
+/* 57 15 */ 1.000000e+00,
+/* 57 16 */ 1.000000e+00,
+/* 57 17 */ 1.000000e+00,
+/* 57 18 */ 1.000000e+00,
+/* 57 19 */ 1.000000e+00,
+/* 57 20 */ 1.000000e+00,
+/* 57 21 */ 9.999691e-01,
+/* 57 22 */ 9.982818e-01,
+/* 57 23 */ 9.670418e-01,
+/* 57 24 */ 8.133236e-01,
+/* 57 25 */ 5.386000e-01,
+/* 57 26 */ 2.829636e-01,
+/* 57 27 */ 1.253164e-01,
+/* 57 28 */ 4.860545e-02,
+/* 57 29 */ 1.748545e-02,
+/* 57 30 */ 5.656364e-03,
+/* 57 31 */ 1.780000e-03,
+/* 57 32 */ 5.363636e-04,
+/* 57 33 */ 1.690909e-04,
+/* 57 34 */ 4.727273e-05,
+/* 57 35 */ 2.217481e-05,
+/* 57 36 */ 4.439106e-06,
+/* 57 37 */ 8.262776e-07,
+/* 57 38 */ 1.427695e-07,
+/* 57 39 */ 2.285578e-08,
+/* 57 40 */ 3.382612e-09,
+/* 57 41 */ 4.616369e-10,
+/* 57 42 */ 5.792491e-11,
+/* 57 43 */ 6.659900e-12,
+/* 57 44 */ 6.988516e-13,
+/* 57 45 */ 6.661924e-14,
+/* 57 46 */ 5.737602e-15,
+/* 57 47 */ 4.435469e-16,
+/* 57 48 */ 3.053546e-17,
+/* 57 49 */ 1.854109e-18,
+/* 57 50 */ 9.810829e-20,
+/* 57 51 */ 4.454908e-21,
+/* 57 52 */ 1.701125e-22,
+/* 57 53 */ 5.312699e-24,
+/* 57 54 */ 1.303145e-25,
+/* 57 55 */ 2.354406e-27,
+/* 57 56 */ 2.785896e-29,
+/* 57 57 */ 1.619707e-31,
+/* 58 0 */ 1.000000e+00,
+/* 58 1 */ 1.000000e+00,
+/* 58 2 */ 1.000000e+00,
+/* 58 3 */ 1.000000e+00,
+/* 58 4 */ 1.000000e+00,
+/* 58 5 */ 1.000000e+00,
+/* 58 6 */ 1.000000e+00,
+/* 58 7 */ 1.000000e+00,
+/* 58 8 */ 1.000000e+00,
+/* 58 9 */ 1.000000e+00,
+/* 58 10 */ 1.000000e+00,
+/* 58 11 */ 1.000000e+00,
+/* 58 12 */ 1.000000e+00,
+/* 58 13 */ 1.000000e+00,
+/* 58 14 */ 1.000000e+00,
+/* 58 15 */ 1.000000e+00,
+/* 58 16 */ 1.000000e+00,
+/* 58 17 */ 1.000000e+00,
+/* 58 18 */ 1.000000e+00,
+/* 58 19 */ 1.000000e+00,
+/* 58 20 */ 1.000000e+00,
+/* 58 21 */ 9.999891e-01,
+/* 58 22 */ 9.996018e-01,
+/* 58 23 */ 9.863200e-01,
+/* 58 24 */ 8.862327e-01,
+/* 58 25 */ 6.426800e-01,
+/* 58 26 */ 3.667018e-01,
+/* 58 27 */ 1.722927e-01,
+/* 58 28 */ 7.062909e-02,
+/* 58 29 */ 2.618909e-02,
+/* 58 30 */ 8.863636e-03,
+/* 58 31 */ 2.780000e-03,
+/* 58 32 */ 8.654545e-04,
+/* 58 33 */ 2.836364e-04,
+/* 58 34 */ 8.363636e-05,
+/* 58 35 */ 4.389190e-05,
+/* 58 36 */ 9.181637e-06,
+/* 58 37 */ 1.789636e-06,
+/* 58 38 */ 3.245551e-07,
+/* 58 39 */ 5.467178e-08,
+/* 58 40 */ 8.537870e-09,
+/* 58 41 */ 1.233334e-09,
+/* 58 42 */ 1.643778e-10,
+/* 58 43 */ 2.015353e-11,
+/* 58 44 */ 2.265251e-12,
+/* 58 45 */ 2.324916e-13,
+/* 58 46 */ 2.168693e-14,
+/* 58 47 */ 1.828519e-15,
+/* 58 48 */ 1.384415e-16,
+/* 58 49 */ 9.338316e-18,
+/* 58 50 */ 5.557891e-19,
+/* 58 51 */ 2.883751e-20,
+/* 58 52 */ 1.284484e-21,
+/* 58 53 */ 4.813036e-23,
+/* 58 54 */ 1.475504e-24,
+/* 58 55 */ 3.553893e-26,
+/* 58 56 */ 6.306941e-28,
+/* 58 57 */ 7.332677e-30,
+/* 58 58 */ 4.190101e-32,
+/* 59 0 */ 1.000000e+00,
+/* 59 1 */ 1.000000e+00,
+/* 59 2 */ 1.000000e+00,
+/* 59 3 */ 1.000000e+00,
+/* 59 4 */ 1.000000e+00,
+/* 59 5 */ 1.000000e+00,
+/* 59 6 */ 1.000000e+00,
+/* 59 7 */ 1.000000e+00,
+/* 59 8 */ 1.000000e+00,
+/* 59 9 */ 1.000000e+00,
+/* 59 10 */ 1.000000e+00,
+/* 59 11 */ 1.000000e+00,
+/* 59 12 */ 1.000000e+00,
+/* 59 13 */ 1.000000e+00,
+/* 59 14 */ 1.000000e+00,
+/* 59 15 */ 1.000000e+00,
+/* 59 16 */ 1.000000e+00,
+/* 59 17 */ 1.000000e+00,
+/* 59 18 */ 1.000000e+00,
+/* 59 19 */ 1.000000e+00,
+/* 59 20 */ 1.000000e+00,
+/* 59 21 */ 9.999964e-01,
+/* 59 22 */ 9.999127e-01,
+/* 59 23 */ 9.950327e-01,
+/* 59 24 */ 9.379564e-01,
+/* 59 25 */ 7.414873e-01,
+/* 59 26 */ 4.604600e-01,
+/* 59 27 */ 2.318527e-01,
+/* 59 28 */ 9.998182e-02,
+/* 59 29 */ 3.844182e-02,
+/* 59 30 */ 1.356727e-02,
+/* 59 31 */ 4.440000e-03,
+/* 59 32 */ 1.414545e-03,
+/* 59 33 */ 4.527273e-04,
+/* 59 34 */ 1.290909e-04,
+/* 59 35 */ 3.636364e-05,
+/* 59 36 */ 1.846973e-05,
+/* 59 37 */ 3.761991e-06,
+/* 59 38 */ 7.144417e-07,
+/* 59 39 */ 1.263181e-07,
+/* 59 40 */ 2.075750e-08,
+/* 59 41 */ 3.164058e-09,
+/* 59 42 */ 4.463720e-10,
+/* 59 43 */ 5.813116e-11,
+/* 59 44 */ 6.967641e-12,
+/* 59 45 */ 7.660021e-13,
+/* 59 46 */ 7.693110e-14,
+/* 59 47 */ 7.025349e-15,
+/* 59 48 */ 5.801376e-16,
+/* 59 49 */ 4.303671e-17,
+/* 59 50 */ 2.845480e-18,
+/* 59 51 */ 1.660648e-19,
+/* 59 52 */ 8.452131e-21,
+/* 59 53 */ 3.694305e-22,
+/* 59 54 */ 1.358839e-23,
+/* 59 55 */ 4.090516e-25,
+/* 59 56 */ 9.677654e-27,
+/* 59 57 */ 1.687512e-28,
+/* 59 58 */ 1.928337e-30,
+/* 59 59 */ 1.083336e-32,
+/* 60 0 */ 1.000000e+00,
+/* 60 1 */ 1.000000e+00,
+/* 60 2 */ 1.000000e+00,
+/* 60 3 */ 1.000000e+00,
+/* 60 4 */ 1.000000e+00,
+/* 60 5 */ 1.000000e+00,
+/* 60 6 */ 1.000000e+00,
+/* 60 7 */ 1.000000e+00,
+/* 60 8 */ 1.000000e+00,
+/* 60 9 */ 1.000000e+00,
+/* 60 10 */ 1.000000e+00,
+/* 60 11 */ 1.000000e+00,
+/* 60 12 */ 1.000000e+00,
+/* 60 13 */ 1.000000e+00,
+/* 60 14 */ 1.000000e+00,
+/* 60 15 */ 1.000000e+00,
+/* 60 16 */ 1.000000e+00,
+/* 60 17 */ 1.000000e+00,
+/* 60 18 */ 1.000000e+00,
+/* 60 19 */ 1.000000e+00,
+/* 60 20 */ 1.000000e+00,
+/* 60 21 */ 1.000000e+00,
+/* 60 22 */ 9.999764e-01,
+/* 60 23 */ 9.984418e-01,
+/* 60 24 */ 9.702473e-01,
+/* 60 25 */ 8.273545e-01,
+/* 60 26 */ 5.613109e-01,
+/* 60 27 */ 3.040182e-01,
+/* 60 28 */ 1.385364e-01,
+/* 60 29 */ 5.582545e-02,
+/* 60 30 */ 2.043636e-02,
+/* 60 31 */ 6.976364e-03,
+/* 60 32 */ 2.280000e-03,
+/* 60 33 */ 7.400000e-04,
+/* 60 34 */ 2.327273e-04,
+/* 60 35 */ 7.272727e-05,
+/* 60 36 */ 2.363636e-05,
+/* 60 37 */ 7.688956e-06,
+/* 60 38 */ 1.525950e-06,
+/* 60 39 */ 2.825366e-07,
+/* 60 40 */ 4.873234e-08,
+/* 60 41 */ 7.816599e-09,
+/* 60 42 */ 1.163633e-09,
+/* 60 43 */ 1.604075e-10,
+/* 60 44 */ 2.042263e-11,
+/* 60 45 */ 2.394269e-12,
+/* 60 46 */ 2.575747e-13,
+/* 60 47 */ 2.532532e-14,
+/* 60 48 */ 2.265097e-15,
+/* 60 49 */ 1.832716e-16,
+/* 60 50 */ 1.332664e-17,
+/* 60 51 */ 8.640147e-19,
+/* 60 52 */ 4.946376e-20,
+/* 60 53 */ 2.470440e-21,
+/* 60 54 */ 1.059957e-22,
+/* 60 55 */ 3.828378e-24,
+/* 60 56 */ 1.132023e-25,
+/* 60 57 */ 2.631550e-27,
+/* 60 58 */ 4.510064e-29,
+/* 60 59 */ 5.066858e-31,
+/* 60 60 */ 2.799369e-33,
+/* 61 0 */ 1.000000e+00,
+/* 61 1 */ 1.000000e+00,
+/* 61 2 */ 1.000000e+00,
+/* 61 3 */ 1.000000e+00,
+/* 61 4 */ 1.000000e+00,
+/* 61 5 */ 1.000000e+00,
+/* 61 6 */ 1.000000e+00,
+/* 61 7 */ 1.000000e+00,
+/* 61 8 */ 1.000000e+00,
+/* 61 9 */ 1.000000e+00,
+/* 61 10 */ 1.000000e+00,
+/* 61 11 */ 1.000000e+00,
+/* 61 12 */ 1.000000e+00,
+/* 61 13 */ 1.000000e+00,
+/* 61 14 */ 1.000000e+00,
+/* 61 15 */ 1.000000e+00,
+/* 61 16 */ 1.000000e+00,
+/* 61 17 */ 1.000000e+00,
+/* 61 18 */ 1.000000e+00,
+/* 61 19 */ 1.000000e+00,
+/* 61 20 */ 1.000000e+00,
+/* 61 21 */ 1.000000e+00,
+/* 61 22 */ 9.999945e-01,
+/* 61 23 */ 9.995945e-01,
+/* 61 24 */ 9.874273e-01,
+/* 61 25 */ 8.950982e-01,
+/* 61 26 */ 6.628473e-01,
+/* 61 27 */ 3.880236e-01,
+/* 61 28 */ 1.881018e-01,
+/* 61 29 */ 7.946909e-02,
+/* 61 30 */ 3.018182e-02,
+/* 61 31 */ 1.063455e-02,
+/* 61 32 */ 3.509091e-03,
+/* 61 33 */ 1.150909e-03,
+/* 61 34 */ 3.527273e-04,
+/* 61 35 */ 1.309091e-04,
+/* 61 36 */ 4.545455e-05,
+/* 61 37 */ 1.530465e-05,
+/* 61 38 */ 3.168073e-06,
+/* 61 39 */ 6.130048e-07,
+/* 61 40 */ 1.107264e-07,
+/* 61 41 */ 1.864204e-08,
+/* 61 42 */ 2.920318e-09,
+/* 61 43 */ 4.248067e-10,
+/* 61 44 */ 5.725076e-11,
+/* 61 45 */ 7.129487e-12,
+/* 61 46 */ 8.179200e-13,
+/* 61 47 */ 8.614410e-14,
+/* 61 48 */ 8.295594e-15,
+/* 61 49 */ 7.269902e-16,
+/* 61 50 */ 5.765781e-17,
+/* 61 51 */ 4.111223e-18,
+/* 61 52 */ 2.614679e-19,
+/* 61 53 */ 1.468878e-20,
+/* 61 54 */ 7.201500e-22,
+/* 61 55 */ 3.034106e-23,
+/* 61 56 */ 1.076440e-24,
+/* 61 57 */ 3.127496e-26,
+/* 61 58 */ 7.145780e-28,
+/* 61 59 */ 1.204044e-29,
+/* 61 60 */ 1.330276e-31,
+/* 61 61 */ 7.229760e-34,
+/* 62 0 */ 1.000000e+00,
+/* 62 1 */ 1.000000e+00,
+/* 62 2 */ 1.000000e+00,
+/* 62 3 */ 1.000000e+00,
+/* 62 4 */ 1.000000e+00,
+/* 62 5 */ 1.000000e+00,
+/* 62 6 */ 1.000000e+00,
+/* 62 7 */ 1.000000e+00,
+/* 62 8 */ 1.000000e+00,
+/* 62 9 */ 1.000000e+00,
+/* 62 10 */ 1.000000e+00,
+/* 62 11 */ 1.000000e+00,
+/* 62 12 */ 1.000000e+00,
+/* 62 13 */ 1.000000e+00,
+/* 62 14 */ 1.000000e+00,
+/* 62 15 */ 1.000000e+00,
+/* 62 16 */ 1.000000e+00,
+/* 62 17 */ 1.000000e+00,
+/* 62 18 */ 1.000000e+00,
+/* 62 19 */ 1.000000e+00,
+/* 62 20 */ 1.000000e+00,
+/* 62 21 */ 1.000000e+00,
+/* 62 22 */ 1.000000e+00,
+/* 62 23 */ 9.999055e-01,
+/* 62 24 */ 9.954673e-01,
+/* 62 25 */ 9.430218e-01,
+/* 62 26 */ 7.576345e-01,
+/* 62 27 */ 4.823636e-01,
+/* 62 28 */ 2.498327e-01,
+/* 62 29 */ 1.111527e-01,
+/* 62 30 */ 4.388727e-02,
+/* 62 31 */ 1.600727e-02,
+/* 62 32 */ 5.414545e-03,
+/* 62 33 */ 1.745455e-03,
+/* 62 34 */ 5.872727e-04,
+/* 62 35 */ 1.963636e-04,
+/* 62 36 */ 6.000000e-05,
+/* 62 37 */ 2.971200e-05,
+/* 62 38 */ 6.403902e-06,
+/* 62 39 */ 1.292477e-06,
+/* 62 40 */ 2.439800e-07,
+/* 62 41 */ 4.301795e-08,
+/* 62 42 */ 7.073523e-09,
+/* 62 43 */ 1.082786e-09,
+/* 62 44 */ 1.539895e-10,
+/* 62 45 */ 2.029911e-11,
+/* 62 46 */ 2.473719e-12,
+/* 62 47 */ 2.778383e-13,
+/* 62 48 */ 2.866035e-14,
+/* 62 49 */ 2.704311e-15,
+/* 62 50 */ 2.323072e-16,
+/* 62 51 */ 1.806687e-17,
+/* 62 52 */ 1.263706e-18,
+/* 62 53 */ 7.886742e-20,
+/* 62 54 */ 4.349284e-21,
+/* 62 55 */ 2.093878e-22,
+/* 62 56 */ 8.665508e-24,
+/* 62 57 */ 3.020800e-25,
+/* 62 58 */ 8.626352e-27,
+/* 62 59 */ 1.937777e-28,
+/* 62 60 */ 3.211009e-30,
+/* 62 61 */ 3.489822e-32,
+/* 62 62 */ 1.866215e-34,
+/* 63 0 */ 1.000000e+00,
+/* 63 1 */ 1.000000e+00,
+/* 63 2 */ 1.000000e+00,
+/* 63 3 */ 1.000000e+00,
+/* 63 4 */ 1.000000e+00,
+/* 63 5 */ 1.000000e+00,
+/* 63 6 */ 1.000000e+00,
+/* 63 7 */ 1.000000e+00,
+/* 63 8 */ 1.000000e+00,
+/* 63 9 */ 1.000000e+00,
+/* 63 10 */ 1.000000e+00,
+/* 63 11 */ 1.000000e+00,
+/* 63 12 */ 1.000000e+00,
+/* 63 13 */ 1.000000e+00,
+/* 63 14 */ 1.000000e+00,
+/* 63 15 */ 1.000000e+00,
+/* 63 16 */ 1.000000e+00,
+/* 63 17 */ 1.000000e+00,
+/* 63 18 */ 1.000000e+00,
+/* 63 19 */ 1.000000e+00,
+/* 63 20 */ 1.000000e+00,
+/* 63 21 */ 1.000000e+00,
+/* 63 22 */ 1.000000e+00,
+/* 63 23 */ 9.999782e-01,
+/* 63 24 */ 9.985273e-01,
+/* 63 25 */ 9.728036e-01,
+/* 63 26 */ 8.386218e-01,
+/* 63 27 */ 5.818691e-01,
+/* 63 28 */ 3.231600e-01,
+/* 63 29 */ 1.519018e-01,
+/* 63 30 */ 6.306909e-02,
+/* 63 31 */ 2.366000e-02,
+/* 63 32 */ 8.256364e-03,
+/* 63 33 */ 2.745455e-03,
+/* 63 34 */ 9.290909e-04,
+/* 63 35 */ 2.745455e-04,
+/* 63 36 */ 1.036364e-04,
+/* 63 37 */ 3.090909e-05,
+/* 63 38 */ 1.262229e-05,
+/* 63 39 */ 2.652579e-06,
+/* 63 40 */ 5.222986e-07,
+/* 63 41 */ 9.624253e-08,
+/* 63 42 */ 1.657350e-08,
+/* 63 43 */ 2.663040e-09,
+/* 63 44 */ 3.985459e-10,
+/* 63 45 */ 5.544069e-11,
+/* 63 46 */ 7.151814e-12,
+/* 63 47 */ 8.532648e-13,
+/* 63 48 */ 9.386522e-14,
+/* 63 49 */ 9.487489e-15,
+/* 63 50 */ 8.775163e-16,
+/* 63 51 */ 7.391887e-17,
+/* 63 52 */ 5.639350e-18,
+/* 63 53 */ 3.870787e-19,
+/* 63 54 */ 2.371410e-20,
+/* 63 55 */ 1.284179e-21,
+/* 63 56 */ 6.072903e-23,
+/* 63 57 */ 2.469506e-24,
+/* 63 58 */ 8.461326e-26,
+/* 63 59 */ 2.375578e-27,
+/* 63 60 */ 5.247986e-29,
+/* 63 61 */ 8.554499e-31,
+/* 63 62 */ 9.148167e-33,
+/* 63 63 */ 4.814825e-35,
+/* 64 0 */ 1.000000e+00,
+/* 64 1 */ 1.000000e+00,
+/* 64 2 */ 1.000000e+00,
+/* 64 3 */ 1.000000e+00,
+/* 64 4 */ 1.000000e+00,
+/* 64 5 */ 1.000000e+00,
+/* 64 6 */ 1.000000e+00,
+/* 64 7 */ 1.000000e+00,
+/* 64 8 */ 1.000000e+00,
+/* 64 9 */ 1.000000e+00,
+/* 64 10 */ 1.000000e+00,
+/* 64 11 */ 1.000000e+00,
+/* 64 12 */ 1.000000e+00,
+/* 64 13 */ 1.000000e+00,
+/* 64 14 */ 1.000000e+00,
+/* 64 15 */ 1.000000e+00,
+/* 64 16 */ 1.000000e+00,
+/* 64 17 */ 1.000000e+00,
+/* 64 18 */ 1.000000e+00,
+/* 64 19 */ 1.000000e+00,
+/* 64 20 */ 1.000000e+00,
+/* 64 21 */ 1.000000e+00,
+/* 64 22 */ 1.000000e+00,
+/* 64 23 */ 1.000000e+00,
+/* 64 24 */ 9.995673e-01,
+/* 64 25 */ 9.884709e-01,
+/* 64 26 */ 9.025364e-01,
+/* 64 27 */ 6.803455e-01,
+/* 64 28 */ 4.089236e-01,
+/* 64 29 */ 2.032127e-01,
+/* 64 30 */ 8.823091e-02,
+/* 64 31 */ 3.457636e-02,
+/* 64 32 */ 1.244364e-02,
+/* 64 33 */ 4.245455e-03,
+/* 64 34 */ 1.403636e-03,
+/* 64 35 */ 4.454545e-04,
+/* 64 36 */ 1.563636e-04,
+/* 64 37 */ 4.363636e-05,
+/* 64 38 */ 2.429234e-05,
+/* 64 39 */ 5.307045e-06,
+/* 64 40 */ 1.088091e-06,
+/* 64 41 */ 2.091422e-07,
+/* 64 42 */ 3.764001e-08,
+/* 64 43 */ 6.334051e-09,
+/* 64 44 */ 9.950509e-10,
+/* 64 45 */ 1.456645e-10,
+/* 64 46 */ 1.982948e-11,
+/* 64 47 */ 2.504367e-12,
+/* 64 48 */ 2.926505e-13,
+/* 64 49 */ 3.154507e-14,
+/* 64 50 */ 3.125437e-15,
+/* 64 51 */ 2.834734e-16,
+/* 64 52 */ 2.342444e-17,
+/* 64 53 */ 1.753691e-18,
+/* 64 54 */ 1.181631e-19,
+/* 64 55 */ 7.108705e-21,
+/* 64 56 */ 3.781370e-22,
+/* 64 57 */ 1.757087e-23,
+/* 64 58 */ 7.022788e-25,
+/* 64 59 */ 2.365732e-26,
+/* 64 60 */ 6.531982e-28,
+/* 64 61 */ 1.419496e-29,
+/* 64 62 */ 2.276751e-31,
+/* 64 63 */ 2.396319e-33,
+/* 64 64 */ 1.241616e-35,
+/* 65 0 */ 1.000000e+00,
+/* 65 1 */ 1.000000e+00,
+/* 65 2 */ 1.000000e+00,
+/* 65 3 */ 1.000000e+00,
+/* 65 4 */ 1.000000e+00,
+/* 65 5 */ 1.000000e+00,
+/* 65 6 */ 1.000000e+00,
+/* 65 7 */ 1.000000e+00,
+/* 65 8 */ 1.000000e+00,
+/* 65 9 */ 1.000000e+00,
+/* 65 10 */ 1.000000e+00,
+/* 65 11 */ 1.000000e+00,
+/* 65 12 */ 1.000000e+00,
+/* 65 13 */ 1.000000e+00,
+/* 65 14 */ 1.000000e+00,
+/* 65 15 */ 1.000000e+00,
+/* 65 16 */ 1.000000e+00,
+/* 65 17 */ 1.000000e+00,
+/* 65 18 */ 1.000000e+00,
+/* 65 19 */ 1.000000e+00,
+/* 65 20 */ 1.000000e+00,
+/* 65 21 */ 1.000000e+00,
+/* 65 22 */ 1.000000e+00,
+/* 65 23 */ 1.000000e+00,
+/* 65 24 */ 9.999073e-01,
+/* 65 25 */ 9.958218e-01,
+/* 65 26 */ 9.467673e-01,
+/* 65 27 */ 7.717836e-01,
+/* 65 28 */ 5.023564e-01,
+/* 65 29 */ 2.667618e-01,
+/* 65 30 */ 1.216418e-01,
+/* 65 31 */ 4.977636e-02,
+/* 65 32 */ 1.856727e-02,
+/* 65 33 */ 6.527273e-03,
+/* 65 34 */ 2.114545e-03,
+/* 65 35 */ 7.218182e-04,
+/* 65 36 */ 2.127273e-04,
+/* 65 37 */ 6.909091e-05,
+/* 65 38 */ 4.570693e-05,
+/* 65 39 */ 1.036508e-05,
+/* 65 40 */ 2.209270e-06,
+/* 65 41 */ 4.421772e-07,
+/* 65 42 */ 8.301201e-08,
+/* 65 43 */ 1.459960e-08,
+/* 65 44 */ 2.402039e-09,
+/* 65 45 */ 3.691116e-10,
+/* 65 46 */ 5.287847e-11,
+/* 65 47 */ 7.047590e-12,
+/* 65 48 */ 8.717975e-13,
+/* 65 49 */ 9.982346e-14,
+/* 65 50 */ 1.054755e-14,
+/* 65 51 */ 1.024783e-15,
+/* 65 52 */ 9.117874e-17,
+/* 65 53 */ 7.393733e-18,
+/* 65 54 */ 5.433866e-19,
+/* 65 55 */ 3.595355e-20,
+/* 65 56 */ 2.124675e-21,
+/* 65 57 */ 1.110521e-22,
+/* 65 58 */ 5.071958e-24,
+/* 65 59 */ 1.993065e-25,
+/* 65 60 */ 6.602797e-27,
+/* 65 61 */ 1.793391e-28,
+/* 65 62 */ 3.834823e-30,
+/* 65 63 */ 6.053656e-32,
+/* 65 64 */ 6.272555e-34,
+/* 65 65 */ 3.200283e-36,
+/* 66 0 */ 1.000000e+00,
+/* 66 1 */ 1.000000e+00,
+/* 66 2 */ 1.000000e+00,
+/* 66 3 */ 1.000000e+00,
+/* 66 4 */ 1.000000e+00,
+/* 66 5 */ 1.000000e+00,
+/* 66 6 */ 1.000000e+00,
+/* 66 7 */ 1.000000e+00,
+/* 66 8 */ 1.000000e+00,
+/* 66 9 */ 1.000000e+00,
+/* 66 10 */ 1.000000e+00,
+/* 66 11 */ 1.000000e+00,
+/* 66 12 */ 1.000000e+00,
+/* 66 13 */ 1.000000e+00,
+/* 66 14 */ 1.000000e+00,
+/* 66 15 */ 1.000000e+00,
+/* 66 16 */ 1.000000e+00,
+/* 66 17 */ 1.000000e+00,
+/* 66 18 */ 1.000000e+00,
+/* 66 19 */ 1.000000e+00,
+/* 66 20 */ 1.000000e+00,
+/* 66 21 */ 1.000000e+00,
+/* 66 22 */ 1.000000e+00,
+/* 66 23 */ 1.000000e+00,
+/* 66 24 */ 9.999727e-01,
+/* 66 25 */ 9.986800e-01,
+/* 66 26 */ 9.743327e-01,
+/* 66 27 */ 8.483073e-01,
+/* 66 28 */ 5.999273e-01,
+/* 66 29 */ 3.415018e-01,
+/* 66 30 */ 1.643382e-01,
+/* 66 31 */ 6.988000e-02,
+/* 66 32 */ 2.721636e-02,
+/* 66 33 */ 9.720000e-03,
+/* 66 34 */ 3.261818e-03,
+/* 66 35 */ 1.074545e-03,
+/* 66 36 */ 3.327273e-04,
+/* 66 37 */ 1.018182e-04,
+/* 66 38 */ 2.909091e-05,
+/* 66 39 */ 1.978679e-05,
+/* 66 40 */ 4.377932e-06,
+/* 66 41 */ 9.109396e-07,
+/* 66 42 */ 1.780794e-07,
+/* 66 43 */ 3.267067e-08,
+/* 66 44 */ 5.617875e-09,
+/* 66 45 */ 9.041309e-10,
+/* 66 46 */ 1.359651e-10,
+/* 66 47 */ 1.907033e-11,
+/* 66 48 */ 2.489505e-12,
+/* 66 49 */ 3.017574e-13,
+/* 66 50 */ 3.387003e-14,
+/* 66 51 */ 3.509452e-15,
+/* 66 52 */ 3.344901e-16,
+/* 66 53 */ 2.920528e-17,
+/* 66 54 */ 2.324854e-18,
+/* 66 55 */ 1.677829e-19,
+/* 66 56 */ 1.090499e-20,
+/* 66 57 */ 6.332189e-22,
+/* 66 58 */ 3.253082e-23,
+/* 66 59 */ 1.460748e-24,
+/* 66 60 */ 5.645127e-26,
+/* 66 61 */ 1.839710e-27,
+/* 66 62 */ 4.916764e-29,
+/* 66 63 */ 1.034766e-30,
+/* 66 64 */ 1.608103e-32,
+/* 66 65 */ 1.640753e-34,
+/* 66 66 */ 8.244991e-37,
+/* 67 0 */ 1.000000e+00,
+/* 67 1 */ 1.000000e+00,
+/* 67 2 */ 1.000000e+00,
+/* 67 3 */ 1.000000e+00,
+/* 67 4 */ 1.000000e+00,
+/* 67 5 */ 1.000000e+00,
+/* 67 6 */ 1.000000e+00,
+/* 67 7 */ 1.000000e+00,
+/* 67 8 */ 1.000000e+00,
+/* 67 9 */ 1.000000e+00,
+/* 67 10 */ 1.000000e+00,
+/* 67 11 */ 1.000000e+00,
+/* 67 12 */ 1.000000e+00,
+/* 67 13 */ 1.000000e+00,
+/* 67 14 */ 1.000000e+00,
+/* 67 15 */ 1.000000e+00,
+/* 67 16 */ 1.000000e+00,
+/* 67 17 */ 1.000000e+00,
+/* 67 18 */ 1.000000e+00,
+/* 67 19 */ 1.000000e+00,
+/* 67 20 */ 1.000000e+00,
+/* 67 21 */ 1.000000e+00,
+/* 67 22 */ 1.000000e+00,
+/* 67 23 */ 1.000000e+00,
+/* 67 24 */ 9.999964e-01,
+/* 67 25 */ 9.996564e-01,
+/* 67 26 */ 9.892164e-01,
+/* 67 27 */ 9.085345e-01,
+/* 67 28 */ 6.953600e-01,
+/* 67 29 */ 4.264436e-01,
+/* 67 30 */ 2.178000e-01,
+/* 67 31 */ 9.685636e-02,
+/* 67 32 */ 3.918909e-02,
+/* 67 33 */ 1.462000e-02,
+/* 67 34 */ 5.047273e-03,
+/* 67 35 */ 1.730909e-03,
+/* 67 36 */ 5.400000e-04,
+/* 67 37 */ 1.727273e-04,
+/* 67 38 */ 5.454545e-05,
+/* 67 39 */ 3.696268e-05,
+/* 67 40 */ 8.477655e-06,
+/* 67 41 */ 1.831149e-06,
+/* 67 42 */ 3.721599e-07,
+/* 67 43 */ 7.109862e-08,
+/* 67 44 */ 1.275342e-08,
+/* 67 45 */ 2.145197e-09,
+/* 67 46 */ 3.378709e-10,
+/* 67 47 */ 4.974639e-11,
+/* 67 48 */ 6.834239e-12,
+/* 67 49 */ 8.742175e-13,
+/* 67 50 */ 1.038745e-13,
+/* 67 51 */ 1.143340e-14,
+/* 67 52 */ 1.162160e-15,
+/* 67 53 */ 1.087000e-16,
+/* 67 54 */ 9.316973e-18,
+/* 67 55 */ 7.283141e-19,
+/* 67 56 */ 5.163188e-20,
+/* 67 57 */ 3.297431e-21,
+/* 67 58 */ 1.881974e-22,
+/* 67 59 */ 9.505793e-24,
+/* 67 60 */ 4.197813e-25,
+/* 67 61 */ 1.595852e-26,
+/* 67 62 */ 5.117440e-28,
+/* 67 63 */ 1.346098e-29,
+/* 67 64 */ 2.788948e-31,
+/* 67 65 */ 4.267918e-33,
+/* 67 66 */ 4.288938e-35,
+/* 67 67 */ 2.123237e-37,
+/* 68 0 */ 1.000000e+00,
+/* 68 1 */ 1.000000e+00,
+/* 68 2 */ 1.000000e+00,
+/* 68 3 */ 1.000000e+00,
+/* 68 4 */ 1.000000e+00,
+/* 68 5 */ 1.000000e+00,
+/* 68 6 */ 1.000000e+00,
+/* 68 7 */ 1.000000e+00,
+/* 68 8 */ 1.000000e+00,
+/* 68 9 */ 1.000000e+00,
+/* 68 10 */ 1.000000e+00,
+/* 68 11 */ 1.000000e+00,
+/* 68 12 */ 1.000000e+00,
+/* 68 13 */ 1.000000e+00,
+/* 68 14 */ 1.000000e+00,
+/* 68 15 */ 1.000000e+00,
+/* 68 16 */ 1.000000e+00,
+/* 68 17 */ 1.000000e+00,
+/* 68 18 */ 1.000000e+00,
+/* 68 19 */ 1.000000e+00,
+/* 68 20 */ 1.000000e+00,
+/* 68 21 */ 1.000000e+00,
+/* 68 22 */ 1.000000e+00,
+/* 68 23 */ 1.000000e+00,
+/* 68 24 */ 1.000000e+00,
+/* 68 25 */ 9.999091e-01,
+/* 68 26 */ 9.960218e-01,
+/* 68 27 */ 9.500491e-01,
+/* 68 28 */ 7.830400e-01,
+/* 68 29 */ 5.190255e-01,
+/* 68 30 */ 2.823655e-01,
+/* 68 31 */ 1.322473e-01,
+/* 68 32 */ 5.526364e-02,
+/* 68 33 */ 2.137091e-02,
+/* 68 34 */ 7.643636e-03,
+/* 68 35 */ 2.589091e-03,
+/* 68 36 */ 8.781818e-04,
+/* 68 37 */ 2.727273e-04,
+/* 68 38 */ 9.818182e-05,
+/* 68 39 */ 2.181818e-05,
+/* 68 40 */ 1.606108e-05,
+/* 68 41 */ 3.596260e-06,
+/* 68 42 */ 7.587403e-07,
+/* 68 43 */ 1.507004e-07,
+/* 68 44 */ 2.814974e-08,
+/* 68 45 */ 4.939385e-09,
+/* 68 46 */ 8.130997e-10,
+/* 68 47 */ 1.253855e-10,
+/* 68 48 */ 1.808261e-11,
+/* 68 49 */ 2.434270e-12,
+/* 68 50 */ 3.052438e-13,
+/* 68 51 */ 3.556715e-14,
+/* 68 52 */ 3.840482e-15,
+/* 68 53 */ 3.830887e-16,
+/* 68 54 */ 3.517491e-17,
+/* 68 55 */ 2.960674e-18,
+/* 68 56 */ 2.273444e-19,
+/* 68 57 */ 1.583675e-20,
+/* 68 58 */ 9.941117e-22,
+/* 68 59 */ 5.578389e-23,
+/* 68 60 */ 2.771022e-24,
+/* 68 61 */ 1.203781e-25,
+/* 68 62 */ 4.503013e-27,
+/* 68 63 */ 1.421213e-28,
+/* 68 64 */ 3.680320e-30,
+/* 68 65 */ 7.508525e-32,
+/* 68 66 */ 1.131712e-33,
+/* 68 67 */ 1.120399e-35,
+/* 68 68 */ 5.465360e-38,
+/* 69 0 */ 1.000000e+00,
+/* 69 1 */ 1.000000e+00,
+/* 69 2 */ 1.000000e+00,
+/* 69 3 */ 1.000000e+00,
+/* 69 4 */ 1.000000e+00,
+/* 69 5 */ 1.000000e+00,
+/* 69 6 */ 1.000000e+00,
+/* 69 7 */ 1.000000e+00,
+/* 69 8 */ 1.000000e+00,
+/* 69 9 */ 1.000000e+00,
+/* 69 10 */ 1.000000e+00,
+/* 69 11 */ 1.000000e+00,
+/* 69 12 */ 1.000000e+00,
+/* 69 13 */ 1.000000e+00,
+/* 69 14 */ 1.000000e+00,
+/* 69 15 */ 1.000000e+00,
+/* 69 16 */ 1.000000e+00,
+/* 69 17 */ 1.000000e+00,
+/* 69 18 */ 1.000000e+00,
+/* 69 19 */ 1.000000e+00,
+/* 69 20 */ 1.000000e+00,
+/* 69 21 */ 1.000000e+00,
+/* 69 22 */ 1.000000e+00,
+/* 69 23 */ 1.000000e+00,
+/* 69 24 */ 1.000000e+00,
+/* 69 25 */ 9.999673e-01,
+/* 69 26 */ 9.987545e-01,
+/* 69 27 */ 9.754800e-01,
+/* 69 28 */ 8.571036e-01,
+/* 69 29 */ 6.147436e-01,
+/* 69 30 */ 3.579145e-01,
+/* 69 31 */ 1.770345e-01,
+/* 69 32 */ 7.712364e-02,
+/* 69 33 */ 3.093455e-02,
+/* 69 34 */ 1.142182e-02,
+/* 69 35 */ 4.003636e-03,
+/* 69 36 */ 1.376364e-03,
+/* 69 37 */ 3.981818e-04,
+/* 69 38 */ 1.436364e-04,
+/* 69 39 */ 3.818182e-05,
+/* 69 40 */ 2.980109e-05,
+/* 69 41 */ 6.908438e-06,
+/* 69 42 */ 1.510983e-06,
+/* 69 43 */ 3.115482e-07,
+/* 69 44 */ 6.050374e-08,
+/* 69 45 */ 1.105559e-08,
+/* 69 46 */ 1.898527e-09,
+/* 69 47 */ 3.059943e-10,
+/* 69 48 */ 4.621947e-11,
+/* 69 49 */ 6.531641e-12,
+/* 69 50 */ 8.619517e-13,
+/* 69 51 */ 1.059931e-13,
+/* 69 52 */ 1.211584e-14,
+/* 69 53 */ 1.283857e-15,
+/* 69 54 */ 1.257197e-16,
+/* 69 55 */ 1.133580e-17,
+/* 69 56 */ 9.372644e-19,
+/* 69 57 */ 7.071979e-20,
+/* 69 58 */ 4.842130e-21,
+/* 69 59 */ 2.988432e-22,
+/* 69 60 */ 1.649208e-23,
+/* 69 61 */ 8.059003e-25,
+/* 69 62 */ 3.444902e-26,
+/* 69 63 */ 1.268323e-27,
+/* 69 64 */ 3.940849e-29,
+/* 69 65 */ 1.004900e-30,
+/* 69 66 */ 2.019292e-32,
+/* 69 67 */ 2.998366e-34,
+/* 69 68 */ 2.924961e-36,
+/* 69 69 */ 1.406231e-38,
+/* 70 0 */ 1.000000e+00,
+/* 70 1 */ 1.000000e+00,
+/* 70 2 */ 1.000000e+00,
+/* 70 3 */ 1.000000e+00,
+/* 70 4 */ 1.000000e+00,
+/* 70 5 */ 1.000000e+00,
+/* 70 6 */ 1.000000e+00,
+/* 70 7 */ 1.000000e+00,
+/* 70 8 */ 1.000000e+00,
+/* 70 9 */ 1.000000e+00,
+/* 70 10 */ 1.000000e+00,
+/* 70 11 */ 1.000000e+00,
+/* 70 12 */ 1.000000e+00,
+/* 70 13 */ 1.000000e+00,
+/* 70 14 */ 1.000000e+00,
+/* 70 15 */ 1.000000e+00,
+/* 70 16 */ 1.000000e+00,
+/* 70 17 */ 1.000000e+00,
+/* 70 18 */ 1.000000e+00,
+/* 70 19 */ 1.000000e+00,
+/* 70 20 */ 1.000000e+00,
+/* 70 21 */ 1.000000e+00,
+/* 70 22 */ 1.000000e+00,
+/* 70 23 */ 1.000000e+00,
+/* 70 24 */ 1.000000e+00,
+/* 70 25 */ 9.999945e-01,
+/* 70 26 */ 9.996545e-01,
+/* 70 27 */ 9.895091e-01,
+/* 70 28 */ 9.136618e-01,
+/* 70 29 */ 7.081473e-01,
+/* 70 30 */ 4.425527e-01,
+/* 70 31 */ 2.320400e-01,
+/* 70 32 */ 1.058727e-01,
+/* 70 33 */ 4.385091e-02,
+/* 70 34 */ 1.680182e-02,
+/* 70 35 */ 5.967273e-03,
+/* 70 36 */ 2.050909e-03,
+/* 70 37 */ 6.600000e-04,
+/* 70 38 */ 2.145455e-04,
+/* 70 39 */ 6.727273e-05,
+/* 70 40 */ 2.000000e-05,
+/* 70 41 */ 1.299508e-05,
+/* 70 42 */ 2.942654e-06,
+/* 70 43 */ 6.290003e-07,
+/* 70 44 */ 1.268119e-07,
+/* 70 45 */ 2.409148e-08,
+/* 70 46 */ 4.308299e-09,
+/* 70 47 */ 7.243892e-10,
+/* 70 48 */ 1.143620e-10,
+/* 70 49 */ 1.692706e-11,
+/* 70 50 */ 2.344964e-12,
+/* 70 51 */ 3.034710e-13,
+/* 70 52 */ 3.660913e-14,
+/* 70 53 */ 4.106721e-15,
+/* 70 54 */ 4.272031e-16,
+/* 70 55 */ 4.108083e-17,
+/* 70 56 */ 3.638674e-18,
+/* 70 57 */ 2.956248e-19,
+/* 70 58 */ 2.192480e-20,
+/* 70 59 */ 1.475948e-21,
+/* 70 60 */ 8.958564e-23,
+/* 70 61 */ 4.863479e-24,
+/* 70 62 */ 2.338529e-25,
+/* 70 63 */ 9.838693e-27,
+/* 70 64 */ 3.566119e-28,
+/* 70 65 */ 1.091098e-29,
+/* 70 66 */ 2.740347e-31,
+/* 70 67 */ 5.424843e-33,
+/* 70 68 */ 7.937298e-35,
+/* 70 69 */ 7.631322e-37,
+/* 70 70 */ 3.616740e-39,
+/* 71 0 */ 1.000000e+00,
+/* 71 1 */ 1.000000e+00,
+/* 71 2 */ 1.000000e+00,
+/* 71 3 */ 1.000000e+00,
+/* 71 4 */ 1.000000e+00,
+/* 71 5 */ 1.000000e+00,
+/* 71 6 */ 1.000000e+00,
+/* 71 7 */ 1.000000e+00,
+/* 71 8 */ 1.000000e+00,
+/* 71 9 */ 1.000000e+00,
+/* 71 10 */ 1.000000e+00,
+/* 71 11 */ 1.000000e+00,
+/* 71 12 */ 1.000000e+00,
+/* 71 13 */ 1.000000e+00,
+/* 71 14 */ 1.000000e+00,
+/* 71 15 */ 1.000000e+00,
+/* 71 16 */ 1.000000e+00,
+/* 71 17 */ 1.000000e+00,
+/* 71 18 */ 1.000000e+00,
+/* 71 19 */ 1.000000e+00,
+/* 71 20 */ 1.000000e+00,
+/* 71 21 */ 1.000000e+00,
+/* 71 22 */ 1.000000e+00,
+/* 71 23 */ 1.000000e+00,
+/* 71 24 */ 1.000000e+00,
+/* 71 25 */ 9.999982e-01,
+/* 71 26 */ 9.999164e-01,
+/* 71 27 */ 9.961473e-01,
+/* 71 28 */ 9.527655e-01,
+/* 71 29 */ 7.929055e-01,
+/* 71 30 */ 5.340600e-01,
+/* 71 31 */ 2.971418e-01,
+/* 71 32 */ 1.422764e-01,
+/* 71 33 */ 6.150909e-02,
+/* 71 34 */ 2.423273e-02,
+/* 71 35 */ 8.849091e-03,
+/* 71 36 */ 3.105455e-03,
+/* 71 37 */ 1.063636e-03,
+/* 71 38 */ 3.072727e-04,
+/* 71 39 */ 1.236364e-04,
+/* 71 40 */ 3.090909e-05,
+/* 71 41 */ 2.395975e-05,
+/* 71 42 */ 5.610527e-06,
+/* 71 43 */ 1.241665e-06,
+/* 71 44 */ 2.595177e-07,
+/* 71 45 */ 5.118347e-08,
+/* 71 46 */ 9.516609e-09,
+/* 71 47 */ 1.666332e-09,
+/* 71 48 */ 2.744391e-10,
+/* 71 49 */ 4.245695e-11,
+/* 71 50 */ 6.160422e-12,
+/* 71 51 */ 8.369309e-13,
+/* 71 52 */ 1.062556e-13,
+/* 71 53 */ 1.257932e-14,
+/* 71 54 */ 1.385296e-15,
+/* 71 55 */ 1.415151e-16,
+/* 71 56 */ 1.336797e-17,
+/* 71 57 */ 1.163482e-18,
+/* 71 58 */ 9.291277e-20,
+/* 71 59 */ 6.775049e-21,
+/* 71 60 */ 4.485495e-22,
+/* 71 61 */ 2.678282e-23,
+/* 71 62 */ 1.430726e-24,
+/* 71 63 */ 6.771001e-26,
+/* 71 64 */ 2.804494e-27,
+/* 71 65 */ 1.000974e-28,
+/* 71 66 */ 3.016481e-30,
+/* 71 67 */ 7.463613e-32,
+/* 71 68 */ 1.455901e-33,
+/* 71 69 */ 2.099473e-35,
+/* 71 70 */ 1.989846e-37,
+/* 71 71 */ 9.298344e-40,
+/* 72 0 */ 1.000000e+00,
+/* 72 1 */ 1.000000e+00,
+/* 72 2 */ 1.000000e+00,
+/* 72 3 */ 1.000000e+00,
+/* 72 4 */ 1.000000e+00,
+/* 72 5 */ 1.000000e+00,
+/* 72 6 */ 1.000000e+00,
+/* 72 7 */ 1.000000e+00,
+/* 72 8 */ 1.000000e+00,
+/* 72 9 */ 1.000000e+00,
+/* 72 10 */ 1.000000e+00,
+/* 72 11 */ 1.000000e+00,
+/* 72 12 */ 1.000000e+00,
+/* 72 13 */ 1.000000e+00,
+/* 72 14 */ 1.000000e+00,
+/* 72 15 */ 1.000000e+00,
+/* 72 16 */ 1.000000e+00,
+/* 72 17 */ 1.000000e+00,
+/* 72 18 */ 1.000000e+00,
+/* 72 19 */ 1.000000e+00,
+/* 72 20 */ 1.000000e+00,
+/* 72 21 */ 1.000000e+00,
+/* 72 22 */ 1.000000e+00,
+/* 72 23 */ 1.000000e+00,
+/* 72 24 */ 1.000000e+00,
+/* 72 25 */ 1.000000e+00,
+/* 72 26 */ 9.999836e-01,
+/* 72 27 */ 9.987836e-01,
+/* 72 28 */ 9.770964e-01,
+/* 72 29 */ 8.636182e-01,
+/* 72 30 */ 6.278745e-01,
+/* 72 31 */ 3.720873e-01,
+/* 72 32 */ 1.881782e-01,
+/* 72 33 */ 8.431455e-02,
+/* 72 34 */ 3.458727e-02,
+/* 72 35 */ 1.306182e-02,
+/* 72 36 */ 4.589091e-03,
+/* 72 37 */ 1.563636e-03,
+/* 72 38 */ 4.781818e-04,
+/* 72 39 */ 1.800000e-04,
+/* 72 40 */ 4.727273e-05,
+/* 72 41 */ 4.334026e-05,
+/* 72 42 */ 1.048307e-05,
+/* 72 43 */ 2.399161e-06,
+/* 72 44 */ 5.191813e-07,
+/* 72 45 */ 1.061555e-07,
+/* 72 46 */ 2.049087e-08,
+/* 72 47 */ 3.730404e-09,
+/* 72 48 */ 6.398217e-10,
+/* 72 49 */ 1.032622e-10,
+/* 72 50 */ 1.566068e-11,
+/* 72 51 */ 2.228439e-12,
+/* 72 52 */ 2.970059e-13,
+/* 72 53 */ 3.700530e-14,
+/* 72 54 */ 4.300826e-15,
+/* 72 55 */ 4.651158e-16,
+/* 72 56 */ 4.667474e-17,
+/* 72 57 */ 4.332488e-18,
+/* 72 58 */ 3.706400e-19,
+/* 72 59 */ 2.910132e-20,
+/* 72 60 */ 2.086960e-21,
+/* 72 61 */ 1.359229e-22,
+/* 72 62 */ 7.986046e-24,
+/* 72 63 */ 4.198890e-25,
+/* 72 64 */ 1.956318e-26,
+/* 72 65 */ 7.979072e-28,
+/* 72 66 */ 2.804993e-29,
+/* 72 67 */ 8.327564e-31,
+/* 72 68 */ 2.030341e-32,
+/* 72 69 */ 3.903424e-34,
+/* 72 70 */ 5.548905e-36,
+/* 72 71 */ 5.185446e-38,
+/* 72 72 */ 2.389606e-40,
+/* 73 0 */ 1.000000e+00,
+/* 73 1 */ 1.000000e+00,
+/* 73 2 */ 1.000000e+00,
+/* 73 3 */ 1.000000e+00,
+/* 73 4 */ 1.000000e+00,
+/* 73 5 */ 1.000000e+00,
+/* 73 6 */ 1.000000e+00,
+/* 73 7 */ 1.000000e+00,
+/* 73 8 */ 1.000000e+00,
+/* 73 9 */ 1.000000e+00,
+/* 73 10 */ 1.000000e+00,
+/* 73 11 */ 1.000000e+00,
+/* 73 12 */ 1.000000e+00,
+/* 73 13 */ 1.000000e+00,
+/* 73 14 */ 1.000000e+00,
+/* 73 15 */ 1.000000e+00,
+/* 73 16 */ 1.000000e+00,
+/* 73 17 */ 1.000000e+00,
+/* 73 18 */ 1.000000e+00,
+/* 73 19 */ 1.000000e+00,
+/* 73 20 */ 1.000000e+00,
+/* 73 21 */ 1.000000e+00,
+/* 73 22 */ 1.000000e+00,
+/* 73 23 */ 1.000000e+00,
+/* 73 24 */ 1.000000e+00,
+/* 73 25 */ 1.000000e+00,
+/* 73 26 */ 9.999982e-01,
+/* 73 27 */ 9.996455e-01,
+/* 73 28 */ 9.902618e-01,
+/* 73 29 */ 9.175218e-01,
+/* 73 30 */ 7.185400e-01,
+/* 73 31 */ 4.565764e-01,
+/* 73 32 */ 2.443255e-01,
+/* 73 33 */ 1.140218e-01,
+/* 73 34 */ 4.873636e-02,
+/* 73 35 */ 1.892909e-02,
+/* 73 36 */ 6.830909e-03,
+/* 73 37 */ 2.400000e-03,
+/* 73 38 */ 7.636364e-04,
+/* 73 39 */ 2.490909e-04,
+/* 73 40 */ 8.727273e-05,
+/* 73 41 */ 2.545455e-05,
+/* 73 42 */ 1.921314e-05,
+/* 73 43 */ 4.542068e-06,
+/* 73 44 */ 1.016463e-06,
+/* 73 45 */ 2.151885e-07,
+/* 73 46 */ 4.306303e-08,
+/* 73 47 */ 8.139008e-09,
+/* 73 48 */ 1.451430e-09,
+/* 73 49 */ 2.439508e-10,
+/* 73 50 */ 3.859718e-11,
+/* 73 51 */ 5.740601e-12,
+/* 73 52 */ 8.013766e-13,
+/* 73 53 */ 1.048193e-13,
+/* 73 54 */ 1.282112e-14,
+/* 73 55 */ 1.463325e-15,
+/* 73 56 */ 1.554582e-16,
+/* 73 57 */ 1.532956e-17,
+/* 73 58 */ 1.398648e-18,
+/* 73 59 */ 1.176441e-19,
+/* 73 60 */ 9.084415e-21,
+/* 73 61 */ 6.408863e-22,
+/* 73 62 */ 4.107283e-23,
+/* 73 63 */ 2.375189e-24,
+/* 73 64 */ 1.229450e-25,
+/* 73 65 */ 5.640645e-27,
+/* 73 66 */ 2.265971e-28,
+/* 73 67 */ 7.847718e-30,
+/* 73 68 */ 2.295796e-31,
+/* 73 69 */ 5.516701e-33,
+/* 73 70 */ 1.045540e-34,
+/* 73 71 */ 1.465456e-36,
+/* 73 72 */ 1.350538e-38,
+/* 73 73 */ 6.138808e-41,
+/* 74 0 */ 1.000000e+00,
+/* 74 1 */ 1.000000e+00,
+/* 74 2 */ 1.000000e+00,
+/* 74 3 */ 1.000000e+00,
+/* 74 4 */ 1.000000e+00,
+/* 74 5 */ 1.000000e+00,
+/* 74 6 */ 1.000000e+00,
+/* 74 7 */ 1.000000e+00,
+/* 74 8 */ 1.000000e+00,
+/* 74 9 */ 1.000000e+00,
+/* 74 10 */ 1.000000e+00,
+/* 74 11 */ 1.000000e+00,
+/* 74 12 */ 1.000000e+00,
+/* 74 13 */ 1.000000e+00,
+/* 74 14 */ 1.000000e+00,
+/* 74 15 */ 1.000000e+00,
+/* 74 16 */ 1.000000e+00,
+/* 74 17 */ 1.000000e+00,
+/* 74 18 */ 1.000000e+00,
+/* 74 19 */ 1.000000e+00,
+/* 74 20 */ 1.000000e+00,
+/* 74 21 */ 1.000000e+00,
+/* 74 22 */ 1.000000e+00,
+/* 74 23 */ 1.000000e+00,
+/* 74 24 */ 1.000000e+00,
+/* 74 25 */ 1.000000e+00,
+/* 74 26 */ 1.000000e+00,
+/* 74 27 */ 9.999073e-01,
+/* 74 28 */ 9.963455e-01,
+/* 74 29 */ 9.545073e-01,
+/* 74 30 */ 8.003109e-01,
+/* 74 31 */ 5.471964e-01,
+/* 74 32 */ 3.100909e-01,
+/* 74 33 */ 1.521491e-01,
+/* 74 34 */ 6.699455e-02,
+/* 74 35 */ 2.708909e-02,
+/* 74 36 */ 1.015273e-02,
+/* 74 37 */ 3.541818e-03,
+/* 74 38 */ 1.196364e-03,
+/* 74 39 */ 3.690909e-04,
+/* 74 40 */ 1.345455e-04,
+/* 74 41 */ 4.181818e-05,
+/* 74 42 */ 3.457071e-05,
+/* 74 43 */ 8.433222e-06,
+/* 74 44 */ 1.949504e-06,
+/* 74 45 */ 4.268128e-07,
+/* 74 46 */ 8.843700e-08,
+/* 74 47 */ 1.732904e-08,
+/* 74 48 */ 3.208309e-09,
+/* 74 49 */ 5.606722e-10,
+/* 74 50 */ 9.238271e-11,
+/* 74 51 */ 1.433445e-11,
+/* 74 52 */ 2.091587e-12,
+/* 74 53 */ 2.865489e-13,
+/* 74 54 */ 3.679532e-14,
+/* 74 55 */ 4.419851e-15,
+/* 74 56 */ 4.955516e-16,
+/* 74 57 */ 5.173205e-17,
+/* 74 58 */ 5.014198e-18,
+/* 74 59 */ 4.498100e-19,
+/* 74 60 */ 3.720998e-20,
+/* 74 61 */ 2.826643e-21,
+/* 74 62 */ 1.962240e-22,
+/* 74 63 */ 1.237747e-23,
+/* 74 64 */ 7.046719e-25,
+/* 74 65 */ 3.591817e-26,
+/* 74 66 */ 1.623103e-27,
+/* 74 67 */ 6.423662e-29,
+/* 74 68 */ 2.192183e-30,
+/* 74 69 */ 6.320670e-32,
+/* 74 70 */ 1.497251e-33,
+/* 74 71 */ 2.797871e-35,
+/* 74 72 */ 3.867374e-37,
+/* 74 73 */ 3.515508e-39,
+/* 74 74 */ 1.576461e-41,
+/* 75 0 */ 1.000000e+00,
+/* 75 1 */ 1.000000e+00,
+/* 75 2 */ 1.000000e+00,
+/* 75 3 */ 1.000000e+00,
+/* 75 4 */ 1.000000e+00,
+/* 75 5 */ 1.000000e+00,
+/* 75 6 */ 1.000000e+00,
+/* 75 7 */ 1.000000e+00,
+/* 75 8 */ 1.000000e+00,
+/* 75 9 */ 1.000000e+00,
+/* 75 10 */ 1.000000e+00,
+/* 75 11 */ 1.000000e+00,
+/* 75 12 */ 1.000000e+00,
+/* 75 13 */ 1.000000e+00,
+/* 75 14 */ 1.000000e+00,
+/* 75 15 */ 1.000000e+00,
+/* 75 16 */ 1.000000e+00,
+/* 75 17 */ 1.000000e+00,
+/* 75 18 */ 1.000000e+00,
+/* 75 19 */ 1.000000e+00,
+/* 75 20 */ 1.000000e+00,
+/* 75 21 */ 1.000000e+00,
+/* 75 22 */ 1.000000e+00,
+/* 75 23 */ 1.000000e+00,
+/* 75 24 */ 1.000000e+00,
+/* 75 25 */ 1.000000e+00,
+/* 75 26 */ 1.000000e+00,
+/* 75 27 */ 9.999764e-01,
+/* 75 28 */ 9.987818e-01,
+/* 75 29 */ 9.776255e-01,
+/* 75 30 */ 8.685945e-01,
+/* 75 31 */ 6.387436e-01,
+/* 75 32 */ 3.855745e-01,
+/* 75 33 */ 1.986418e-01,
+/* 75 34 */ 9.116727e-02,
+/* 75 35 */ 3.802909e-02,
+/* 75 36 */ 1.482545e-02,
+/* 75 37 */ 5.290909e-03,
+/* 75 38 */ 1.870909e-03,
+/* 75 39 */ 5.854545e-04,
+/* 75 40 */ 1.963636e-04,
+/* 75 41 */ 5.454545e-05,
+/* 75 42 */ 1.818182e-05,
+/* 75 43 */ 1.536939e-05,
+/* 75 44 */ 3.666280e-06,
+/* 75 45 */ 8.291621e-07,
+/* 75 46 */ 1.776759e-07,
+/* 75 47 */ 3.604843e-08,
+/* 75 48 */ 6.919383e-09,
+/* 75 49 */ 1.255401e-09,
+/* 75 50 */ 2.150778e-10,
+/* 75 51 */ 3.475510e-11,
+/* 75 52 */ 5.290613e-12,
+/* 75 53 */ 7.576144e-13,
+/* 75 54 */ 1.018976e-13,
+/* 75 55 */ 1.284964e-14,
+/* 75 56 */ 1.516266e-15,
+/* 75 57 */ 1.670542e-16,
+/* 75 58 */ 1.714179e-17,
+/* 75 59 */ 1.633614e-18,
+/* 75 60 */ 1.441279e-19,
+/* 75 61 */ 1.172911e-20,
+/* 75 62 */ 8.767493e-22,
+/* 75 63 */ 5.990517e-23,
+/* 75 64 */ 3.720124e-24,
+/* 75 65 */ 2.085589e-25,
+/* 75 66 */ 1.047060e-26,
+/* 75 67 */ 4.661394e-28,
+/* 75 68 */ 1.817853e-29,
+/* 75 69 */ 6.114352e-31,
+/* 75 70 */ 1.737895e-32,
+/* 75 71 */ 4.059084e-34,
+/* 75 72 */ 7.480285e-36,
+/* 75 73 */ 1.019872e-37,
+/* 75 74 */ 9.146107e-40,
+/* 75 75 */ 4.046950e-42,
+/* 76 0 */ 1.000000e+00,
+/* 76 1 */ 1.000000e+00,
+/* 76 2 */ 1.000000e+00,
+/* 76 3 */ 1.000000e+00,
+/* 76 4 */ 1.000000e+00,
+/* 76 5 */ 1.000000e+00,
+/* 76 6 */ 1.000000e+00,
+/* 76 7 */ 1.000000e+00,
+/* 76 8 */ 1.000000e+00,
+/* 76 9 */ 1.000000e+00,
+/* 76 10 */ 1.000000e+00,
+/* 76 11 */ 1.000000e+00,
+/* 76 12 */ 1.000000e+00,
+/* 76 13 */ 1.000000e+00,
+/* 76 14 */ 1.000000e+00,
+/* 76 15 */ 1.000000e+00,
+/* 76 16 */ 1.000000e+00,
+/* 76 17 */ 1.000000e+00,
+/* 76 18 */ 1.000000e+00,
+/* 76 19 */ 1.000000e+00,
+/* 76 20 */ 1.000000e+00,
+/* 76 21 */ 1.000000e+00,
+/* 76 22 */ 1.000000e+00,
+/* 76 23 */ 1.000000e+00,
+/* 76 24 */ 1.000000e+00,
+/* 76 25 */ 1.000000e+00,
+/* 76 26 */ 1.000000e+00,
+/* 76 27 */ 9.999945e-01,
+/* 76 28 */ 9.996673e-01,
+/* 76 29 */ 9.903782e-01,
+/* 76 30 */ 9.195927e-01,
+/* 76 31 */ 7.270855e-01,
+/* 76 32 */ 4.693382e-01,
+/* 76 33 */ 2.551018e-01,
+/* 76 34 */ 1.216400e-01,
+/* 76 35 */ 5.298545e-02,
+/* 76 36 */ 2.116545e-02,
+/* 76 37 */ 7.898182e-03,
+/* 76 38 */ 2.785455e-03,
+/* 76 39 */ 9.236364e-04,
+/* 76 40 */ 3.054545e-04,
+/* 76 41 */ 1.000000e-04,
+/* 76 42 */ 3.454545e-05,
+/* 76 43 */ 2.751660e-05,
+/* 76 44 */ 6.766674e-06,
+/* 76 45 */ 1.579193e-06,
+/* 76 46 */ 3.495682e-07,
+/* 76 47 */ 7.334807e-08,
+/* 76 48 */ 1.457783e-08,
+/* 76 49 */ 2.742159e-09,
+/* 76 50 */ 4.877450e-10,
+/* 76 51 */ 8.195054e-11,
+/* 76 52 */ 1.299200e-11,
+/* 76 53 */ 1.940951e-12,
+/* 76 54 */ 2.728683e-13,
+/* 76 55 */ 3.604170e-14,
+/* 76 56 */ 4.464826e-15,
+/* 76 57 */ 5.177169e-16,
+/* 76 58 */ 5.606671e-17,
+/* 76 59 */ 5.656630e-18,
+/* 76 60 */ 5.301809e-19,
+/* 76 61 */ 4.601626e-20,
+/* 76 62 */ 3.684930e-21,
+/* 76 63 */ 2.711123e-22,
+/* 76 64 */ 1.823700e-23,
+/* 76 65 */ 1.115229e-24,
+/* 76 66 */ 6.158181e-26,
+/* 76 67 */ 3.045854e-27,
+/* 76 68 */ 1.336168e-28,
+/* 76 69 */ 5.135738e-30,
+/* 76 70 */ 1.702873e-31,
+/* 76 71 */ 4.772319e-33,
+/* 76 72 */ 1.099239e-34,
+/* 76 73 */ 1.998124e-36,
+/* 76 74 */ 2.687631e-38,
+/* 76 75 */ 2.378250e-40,
+/* 76 76 */ 1.038537e-42,
+/* 77 0 */ 1.000000e+00,
+/* 77 1 */ 1.000000e+00,
+/* 77 2 */ 1.000000e+00,
+/* 77 3 */ 1.000000e+00,
+/* 77 4 */ 1.000000e+00,
+/* 77 5 */ 1.000000e+00,
+/* 77 6 */ 1.000000e+00,
+/* 77 7 */ 1.000000e+00,
+/* 77 8 */ 1.000000e+00,
+/* 77 9 */ 1.000000e+00,
+/* 77 10 */ 1.000000e+00,
+/* 77 11 */ 1.000000e+00,
+/* 77 12 */ 1.000000e+00,
+/* 77 13 */ 1.000000e+00,
+/* 77 14 */ 1.000000e+00,
+/* 77 15 */ 1.000000e+00,
+/* 77 16 */ 1.000000e+00,
+/* 77 17 */ 1.000000e+00,
+/* 77 18 */ 1.000000e+00,
+/* 77 19 */ 1.000000e+00,
+/* 77 20 */ 1.000000e+00,
+/* 77 21 */ 1.000000e+00,
+/* 77 22 */ 1.000000e+00,
+/* 77 23 */ 1.000000e+00,
+/* 77 24 */ 1.000000e+00,
+/* 77 25 */ 1.000000e+00,
+/* 77 26 */ 1.000000e+00,
+/* 77 27 */ 1.000000e+00,
+/* 77 28 */ 9.999236e-01,
+/* 77 29 */ 9.962600e-01,
+/* 77 30 */ 9.555727e-01,
+/* 77 31 */ 8.066455e-01,
+/* 77 32 */ 5.586891e-01,
+/* 77 33 */ 3.216600e-01,
+/* 77 34 */ 1.601673e-01,
+/* 77 35 */ 7.201636e-02,
+/* 77 36 */ 2.981091e-02,
+/* 77 37 */ 1.142364e-02,
+/* 77 38 */ 4.109091e-03,
+/* 77 39 */ 1.452727e-03,
+/* 77 40 */ 4.763636e-04,
+/* 77 41 */ 1.436364e-04,
+/* 77 42 */ 6.545455e-05,
+/* 77 43 */ 4.843240e-05,
+/* 77 44 */ 1.226667e-05,
+/* 77 45 */ 2.951251e-06,
+/* 77 46 */ 6.741495e-07,
+/* 77 47 */ 1.461259e-07,
+/* 77 48 */ 3.003560e-08,
+/* 77 49 */ 5.850119e-09,
+/* 77 50 */ 1.078834e-09,
+/* 77 51 */ 1.881937e-10,
+/* 77 52 */ 3.102197e-11,
+/* 77 53 */ 4.826681e-12,
+/* 77 54 */ 7.079245e-13,
+/* 77 55 */ 9.773839e-14,
+/* 77 56 */ 1.268214e-14,
+/* 77 57 */ 1.543826e-15,
+/* 77 58 */ 1.759622e-16,
+/* 77 59 */ 1.873649e-17,
+/* 77 60 */ 1.859158e-18,
+/* 77 61 */ 1.714248e-19,
+/* 77 62 */ 1.464076e-20,
+/* 77 63 */ 1.153966e-21,
+/* 77 64 */ 8.358531e-23,
+/* 77 65 */ 5.536729e-24,
+/* 77 66 */ 3.334898e-25,
+/* 77 67 */ 1.814204e-26,
+/* 77 68 */ 8.842025e-28,
+/* 77 69 */ 3.822997e-29,
+/* 77 70 */ 1.448554e-30,
+/* 77 71 */ 4.735759e-32,
+/* 77 72 */ 1.308868e-33,
+/* 77 73 */ 2.973718e-35,
+/* 77 74 */ 5.332743e-37,
+/* 77 75 */ 7.077763e-39,
+/* 77 76 */ 6.180987e-41,
+/* 77 77 */ 2.664219e-43,
+/* 78 0 */ 1.000000e+00,
+/* 78 1 */ 1.000000e+00,
+/* 78 2 */ 1.000000e+00,
+/* 78 3 */ 1.000000e+00,
+/* 78 4 */ 1.000000e+00,
+/* 78 5 */ 1.000000e+00,
+/* 78 6 */ 1.000000e+00,
+/* 78 7 */ 1.000000e+00,
+/* 78 8 */ 1.000000e+00,
+/* 78 9 */ 1.000000e+00,
+/* 78 10 */ 1.000000e+00,
+/* 78 11 */ 1.000000e+00,
+/* 78 12 */ 1.000000e+00,
+/* 78 13 */ 1.000000e+00,
+/* 78 14 */ 1.000000e+00,
+/* 78 15 */ 1.000000e+00,
+/* 78 16 */ 1.000000e+00,
+/* 78 17 */ 1.000000e+00,
+/* 78 18 */ 1.000000e+00,
+/* 78 19 */ 1.000000e+00,
+/* 78 20 */ 1.000000e+00,
+/* 78 21 */ 1.000000e+00,
+/* 78 22 */ 1.000000e+00,
+/* 78 23 */ 1.000000e+00,
+/* 78 24 */ 1.000000e+00,
+/* 78 25 */ 1.000000e+00,
+/* 78 26 */ 1.000000e+00,
+/* 78 27 */ 1.000000e+00,
+/* 78 28 */ 9.999800e-01,
+/* 78 29 */ 9.987127e-01,
+/* 78 30 */ 9.779600e-01,
+/* 78 31 */ 8.725400e-01,
+/* 78 32 */ 6.480145e-01,
+/* 78 33 */ 3.979891e-01,
+/* 78 34 */ 2.073600e-01,
+/* 78 35 */ 9.732182e-02,
+/* 78 36 */ 4.155818e-02,
+/* 78 37 */ 1.637636e-02,
+/* 78 38 */ 5.943636e-03,
+/* 78 39 */ 2.210909e-03,
+/* 78 40 */ 7.527273e-04,
+/* 78 41 */ 2.290909e-04,
+/* 78 42 */ 8.727273e-05,
+/* 78 43 */ 2.727273e-05,
+/* 78 44 */ 2.185797e-05,
+/* 78 45 */ 5.416361e-06,
+/* 78 46 */ 1.275512e-06,
+/* 78 47 */ 2.853091e-07,
+/* 78 48 */ 6.058219e-08,
+/* 78 49 */ 1.220348e-08,
+/* 78 50 */ 2.330276e-09,
+/* 78 51 */ 4.214559e-10,
+/* 78 52 */ 7.212941e-11,
+/* 78 53 */ 1.166905e-11,
+/* 78 54 */ 1.782453e-12,
+/* 78 55 */ 2.567436e-13,
+/* 78 56 */ 3.482220e-14,
+/* 78 57 */ 4.440102e-15,
+/* 78 58 */ 5.312934e-16,
+/* 78 59 */ 5.954074e-17,
+/* 78 60 */ 6.235350e-18,
+/* 78 61 */ 6.086700e-19,
+/* 78 62 */ 5.522604e-20,
+/* 78 63 */ 4.642451e-21,
+/* 78 64 */ 3.602428e-22,
+/* 78 65 */ 2.569527e-23,
+/* 78 66 */ 1.676473e-24,
+/* 78 67 */ 9.948157e-26,
+/* 78 68 */ 5.332816e-27,
+/* 78 69 */ 2.561673e-28,
+/* 78 70 */ 1.091858e-29,
+/* 78 71 */ 4.079185e-31,
+/* 78 72 */ 1.315190e-32,
+/* 78 73 */ 3.585395e-34,
+/* 78 74 */ 8.036417e-36,
+/* 78 75 */ 1.422042e-37,
+/* 78 76 */ 1.862656e-39,
+/* 78 77 */ 1.605620e-41,
+/* 78 78 */ 6.832425e-44,
+/* 79 0 */ 1.000000e+00,
+/* 79 1 */ 1.000000e+00,
+/* 79 2 */ 1.000000e+00,
+/* 79 3 */ 1.000000e+00,
+/* 79 4 */ 1.000000e+00,
+/* 79 5 */ 1.000000e+00,
+/* 79 6 */ 1.000000e+00,
+/* 79 7 */ 1.000000e+00,
+/* 79 8 */ 1.000000e+00,
+/* 79 9 */ 1.000000e+00,
+/* 79 10 */ 1.000000e+00,
+/* 79 11 */ 1.000000e+00,
+/* 79 12 */ 1.000000e+00,
+/* 79 13 */ 1.000000e+00,
+/* 79 14 */ 1.000000e+00,
+/* 79 15 */ 1.000000e+00,
+/* 79 16 */ 1.000000e+00,
+/* 79 17 */ 1.000000e+00,
+/* 79 18 */ 1.000000e+00,
+/* 79 19 */ 1.000000e+00,
+/* 79 20 */ 1.000000e+00,
+/* 79 21 */ 1.000000e+00,
+/* 79 22 */ 1.000000e+00,
+/* 79 23 */ 1.000000e+00,
+/* 79 24 */ 1.000000e+00,
+/* 79 25 */ 1.000000e+00,
+/* 79 26 */ 1.000000e+00,
+/* 79 27 */ 1.000000e+00,
+/* 79 28 */ 9.999945e-01,
+/* 79 29 */ 9.996473e-01,
+/* 79 30 */ 9.902782e-01,
+/* 79 31 */ 9.217127e-01,
+/* 79 32 */ 7.343291e-01,
+/* 79 33 */ 4.810400e-01,
+/* 79 34 */ 2.647127e-01,
+/* 79 35 */ 1.285164e-01,
+/* 79 36 */ 5.689636e-02,
+/* 79 37 */ 2.329636e-02,
+/* 79 38 */ 8.629091e-03,
+/* 79 39 */ 3.203636e-03,
+/* 79 40 */ 1.160000e-03,
+/* 79 41 */ 3.763636e-04,
+/* 79 42 */ 1.272727e-04,
+/* 79 43 */ 4.909091e-05,
+/* 79 44 */ 3.831186e-05,
+/* 79 45 */ 9.769472e-06,
+/* 79 46 */ 2.369594e-06,
+/* 79 47 */ 5.464353e-07,
+/* 79 48 */ 1.197387e-07,
+/* 79 49 */ 2.491720e-08,
+/* 79 50 */ 4.920829e-09,
+/* 79 51 */ 9.215558e-10,
+/* 79 52 */ 1.635236e-10,
+/* 79 53 */ 2.746651e-11,
+/* 79 54 */ 4.362484e-12,
+/* 79 55 */ 6.544295e-13,
+/* 79 56 */ 9.260317e-14,
+/* 79 57 */ 1.234225e-14,
+/* 79 58 */ 1.546927e-15,
+/* 79 59 */ 1.820005e-16,
+/* 79 60 */ 2.006006e-17,
+/* 79 61 */ 2.066684e-18,
+/* 79 62 */ 1.985190e-19,
+/* 79 63 */ 1.772880e-20,
+/* 79 64 */ 1.467247e-21,
+/* 79 65 */ 1.121176e-22,
+/* 79 66 */ 7.876863e-24,
+/* 79 67 */ 5.063081e-25,
+/* 79 68 */ 2.960552e-26,
+/* 79 69 */ 1.564190e-27,
+/* 79 70 */ 7.407096e-29,
+/* 79 71 */ 3.112920e-30,
+/* 79 72 */ 1.146929e-31,
+/* 79 73 */ 3.647497e-33,
+/* 79 74 */ 9.809933e-35,
+/* 79 75 */ 2.169660e-36,
+/* 79 76 */ 3.788936e-38,
+/* 79 77 */ 4.898764e-40,
+/* 79 78 */ 4.168863e-42,
+/* 79 79 */ 1.751623e-44,
+/* 80 0 */ 1.000000e+00,
+/* 80 1 */ 1.000000e+00,
+/* 80 2 */ 1.000000e+00,
+/* 80 3 */ 1.000000e+00,
+/* 80 4 */ 1.000000e+00,
+/* 80 5 */ 1.000000e+00,
+/* 80 6 */ 1.000000e+00,
+/* 80 7 */ 1.000000e+00,
+/* 80 8 */ 1.000000e+00,
+/* 80 9 */ 1.000000e+00,
+/* 80 10 */ 1.000000e+00,
+/* 80 11 */ 1.000000e+00,
+/* 80 12 */ 1.000000e+00,
+/* 80 13 */ 1.000000e+00,
+/* 80 14 */ 1.000000e+00,
+/* 80 15 */ 1.000000e+00,
+/* 80 16 */ 1.000000e+00,
+/* 80 17 */ 1.000000e+00,
+/* 80 18 */ 1.000000e+00,
+/* 80 19 */ 1.000000e+00,
+/* 80 20 */ 1.000000e+00,
+/* 80 21 */ 1.000000e+00,
+/* 80 22 */ 1.000000e+00,
+/* 80 23 */ 1.000000e+00,
+/* 80 24 */ 1.000000e+00,
+/* 80 25 */ 1.000000e+00,
+/* 80 26 */ 1.000000e+00,
+/* 80 27 */ 1.000000e+00,
+/* 80 28 */ 1.000000e+00,
+/* 80 29 */ 9.999109e-01,
+/* 80 30 */ 9.962982e-01,
+/* 80 31 */ 9.565618e-01,
+/* 80 32 */ 8.112491e-01,
+/* 80 33 */ 5.686655e-01,
+/* 80 34 */ 3.323945e-01,
+/* 80 35 */ 1.681582e-01,
+/* 80 36 */ 7.708909e-02,
+/* 80 37 */ 3.264364e-02,
+/* 80 38 */ 1.276000e-02,
+/* 80 39 */ 4.596364e-03,
+/* 80 40 */ 1.734545e-03,
+/* 80 41 */ 5.927273e-04,
+/* 80 42 */ 1.800000e-04,
+/* 80 43 */ 7.818182e-05,
+/* 80 44 */ 2.000000e-05,
+/* 80 45 */ 1.733034e-05,
+/* 80 46 */ 4.325712e-06,
+/* 80 47 */ 1.027437e-06,
+/* 80 48 */ 2.321085e-07,
+/* 80 49 */ 4.984573e-08,
+/* 80 50 */ 1.016947e-08,
+/* 80 51 */ 1.969709e-09,
+/* 80 52 */ 3.619126e-10,
+/* 80 53 */ 6.302740e-11,
+/* 80 54 */ 1.039354e-11,
+/* 80 55 */ 1.621226e-12,
+/* 80 56 */ 2.389227e-13,
+/* 80 57 */ 3.322273e-14,
+/* 80 58 */ 4.352566e-15,
+/* 80 59 */ 5.363947e-16,
+/* 80 60 */ 6.206826e-17,
+/* 80 61 */ 6.730181e-18,
+/* 80 62 */ 6.823033e-19,
+/* 80 63 */ 6.450933e-20,
+/* 80 64 */ 5.671815e-21,
+/* 80 65 */ 4.622428e-22,
+/* 80 66 */ 3.479077e-23,
+/* 80 67 */ 2.408038e-24,
+/* 80 68 */ 1.525239e-25,
+/* 80 69 */ 8.790225e-27,
+/* 80 70 */ 4.578355e-28,
+/* 80 71 */ 2.137700e-29,
+/* 80 72 */ 8.859910e-31,
+/* 80 73 */ 3.219899e-32,
+/* 80 74 */ 1.010239e-33,
+/* 80 75 */ 2.680997e-35,
+/* 80 76 */ 5.851920e-37,
+/* 80 77 */ 1.008728e-38,
+/* 80 78 */ 1.287553e-40,
+/* 80 79 */ 1.081902e-42,
+/* 80 80 */ 4.489218e-45,
+/* 81 0 */ 1.000000e+00,
+/* 81 1 */ 1.000000e+00,
+/* 81 2 */ 1.000000e+00,
+/* 81 3 */ 1.000000e+00,
+/* 81 4 */ 1.000000e+00,
+/* 81 5 */ 1.000000e+00,
+/* 81 6 */ 1.000000e+00,
+/* 81 7 */ 1.000000e+00,
+/* 81 8 */ 1.000000e+00,
+/* 81 9 */ 1.000000e+00,
+/* 81 10 */ 1.000000e+00,
+/* 81 11 */ 1.000000e+00,
+/* 81 12 */ 1.000000e+00,
+/* 81 13 */ 1.000000e+00,
+/* 81 14 */ 1.000000e+00,
+/* 81 15 */ 1.000000e+00,
+/* 81 16 */ 1.000000e+00,
+/* 81 17 */ 1.000000e+00,
+/* 81 18 */ 1.000000e+00,
+/* 81 19 */ 1.000000e+00,
+/* 81 20 */ 1.000000e+00,
+/* 81 21 */ 1.000000e+00,
+/* 81 22 */ 1.000000e+00,
+/* 81 23 */ 1.000000e+00,
+/* 81 24 */ 1.000000e+00,
+/* 81 25 */ 1.000000e+00,
+/* 81 26 */ 1.000000e+00,
+/* 81 27 */ 1.000000e+00,
+/* 81 28 */ 1.000000e+00,
+/* 81 29 */ 9.999709e-01,
+/* 81 30 */ 9.987473e-01,
+/* 81 31 */ 9.785800e-01,
+/* 81 32 */ 8.746836e-01,
+/* 81 33 */ 6.568109e-01,
+/* 81 34 */ 4.079582e-01,
+/* 81 35 */ 2.168473e-01,
+/* 81 36 */ 1.029455e-01,
+/* 81 37 */ 4.495818e-02,
+/* 81 38 */ 1.837091e-02,
+/* 81 39 */ 6.714545e-03,
+/* 81 40 */ 2.478182e-03,
+/* 81 41 */ 9.290909e-04,
+/* 81 42 */ 2.872727e-04,
+/* 81 43 */ 1.018182e-04,
+/* 81 44 */ 2.909091e-05,
+/* 81 45 */ 1.272727e-05,
+/* 81 46 */ 7.765106e-06,
+/* 81 47 */ 1.898017e-06,
+/* 81 48 */ 4.416469e-07,
+/* 81 49 */ 9.778181e-08,
+/* 81 50 */ 2.058761e-08,
+/* 81 51 */ 4.119512e-09,
+/* 81 52 */ 7.828388e-10,
+/* 81 53 */ 1.411709e-10,
+/* 81 54 */ 2.413712e-11,
+/* 81 55 */ 3.909066e-12,
+/* 81 56 */ 5.990197e-13,
+/* 81 57 */ 8.675069e-14,
+/* 81 58 */ 1.185755e-14,
+/* 81 59 */ 1.527466e-15,
+/* 81 60 */ 1.851379e-16,
+/* 81 61 */ 2.107561e-17,
+/* 81 62 */ 2.248787e-18,
+/* 81 63 */ 2.243976e-19,
+/* 81 64 */ 2.088754e-20,
+/* 81 65 */ 1.808476e-21,
+/* 81 66 */ 1.451730e-22,
+/* 81 67 */ 1.076467e-23,
+/* 81 68 */ 7.342005e-25,
+/* 81 69 */ 4.583476e-26,
+/* 81 70 */ 2.604059e-27,
+/* 81 71 */ 1.337335e-28,
+/* 81 72 */ 6.158023e-30,
+/* 81 73 */ 2.517498e-31,
+/* 81 74 */ 9.026236e-33,
+/* 81 75 */ 2.794413e-34,
+/* 81 76 */ 7.318804e-36,
+/* 81 77 */ 1.576860e-37,
+/* 81 78 */ 2.683437e-39,
+/* 81 79 */ 3.382009e-41,
+/* 81 80 */ 2.806456e-43,
+/* 81 81 */ 1.150187e-45,
+/* 82 0 */ 1.000000e+00,
+/* 82 1 */ 1.000000e+00,
+/* 82 2 */ 1.000000e+00,
+/* 82 3 */ 1.000000e+00,
+/* 82 4 */ 1.000000e+00,
+/* 82 5 */ 1.000000e+00,
+/* 82 6 */ 1.000000e+00,
+/* 82 7 */ 1.000000e+00,
+/* 82 8 */ 1.000000e+00,
+/* 82 9 */ 1.000000e+00,
+/* 82 10 */ 1.000000e+00,
+/* 82 11 */ 1.000000e+00,
+/* 82 12 */ 1.000000e+00,
+/* 82 13 */ 1.000000e+00,
+/* 82 14 */ 1.000000e+00,
+/* 82 15 */ 1.000000e+00,
+/* 82 16 */ 1.000000e+00,
+/* 82 17 */ 1.000000e+00,
+/* 82 18 */ 1.000000e+00,
+/* 82 19 */ 1.000000e+00,
+/* 82 20 */ 1.000000e+00,
+/* 82 21 */ 1.000000e+00,
+/* 82 22 */ 1.000000e+00,
+/* 82 23 */ 1.000000e+00,
+/* 82 24 */ 1.000000e+00,
+/* 82 25 */ 1.000000e+00,
+/* 82 26 */ 1.000000e+00,
+/* 82 27 */ 1.000000e+00,
+/* 82 28 */ 1.000000e+00,
+/* 82 29 */ 1.000000e+00,
+/* 82 30 */ 9.996455e-01,
+/* 82 31 */ 9.905182e-01,
+/* 82 32 */ 9.231127e-01,
+/* 82 33 */ 7.410545e-01,
+/* 82 34 */ 4.910727e-01,
+/* 82 35 */ 2.746691e-01,
+/* 82 36 */ 1.353927e-01,
+/* 82 37 */ 6.124000e-02,
+/* 82 38 */ 2.562727e-02,
+/* 82 39 */ 9.823636e-03,
+/* 82 40 */ 3.667273e-03,
+/* 82 41 */ 1.350909e-03,
+/* 82 42 */ 4.418182e-04,
+/* 82 43 */ 1.581818e-04,
+/* 82 44 */ 6.000000e-05,
+/* 82 45 */ 5.201647e-05,
+/* 82 46 */ 1.371625e-05,
+/* 82 47 */ 3.447358e-06,
+/* 82 48 */ 8.255113e-07,
+/* 82 49 */ 1.882571e-07,
+/* 82 50 */ 4.086492e-08,
+/* 82 51 */ 8.438652e-09,
+/* 82 52 */ 1.656687e-09,
+/* 82 53 */ 3.089885e-10,
+/* 82 54 */ 5.470584e-11,
+/* 82 55 */ 9.186099e-12,
+/* 82 56 */ 1.461537e-12,
+/* 82 57 */ 2.200894e-13,
+/* 82 58 */ 3.133126e-14,
+/* 82 59 */ 4.210842e-15,
+/* 82 60 */ 5.334977e-16,
+/* 82 61 */ 6.361483e-17,
+/* 82 62 */ 7.126172e-18,
+/* 82 63 */ 7.484204e-19,
+/* 82 64 */ 7.352608e-20,
+/* 82 65 */ 6.739665e-21,
+/* 82 66 */ 5.747651e-22,
+/* 82 67 */ 4.545547e-23,
+/* 82 68 */ 3.321369e-24,
+/* 82 69 */ 2.232739e-25,
+/* 82 70 */ 1.374084e-26,
+/* 82 71 */ 7.697514e-28,
+/* 82 72 */ 3.898565e-29,
+/* 82 73 */ 1.770729e-30,
+/* 82 74 */ 7.141767e-32,
+/* 82 75 */ 2.526657e-33,
+/* 82 76 */ 7.719843e-35,
+/* 82 77 */ 1.995767e-36,
+/* 82 78 */ 4.245083e-38,
+/* 82 79 */ 7.133088e-40,
+/* 82 80 */ 8.878151e-42,
+/* 82 81 */ 7.276690e-44,
+/* 82 82 */ 2.946028e-46,
+/* 83 0 */ 1.000000e+00,
+/* 83 1 */ 1.000000e+00,
+/* 83 2 */ 1.000000e+00,
+/* 83 3 */ 1.000000e+00,
+/* 83 4 */ 1.000000e+00,
+/* 83 5 */ 1.000000e+00,
+/* 83 6 */ 1.000000e+00,
+/* 83 7 */ 1.000000e+00,
+/* 83 8 */ 1.000000e+00,
+/* 83 9 */ 1.000000e+00,
+/* 83 10 */ 1.000000e+00,
+/* 83 11 */ 1.000000e+00,
+/* 83 12 */ 1.000000e+00,
+/* 83 13 */ 1.000000e+00,
+/* 83 14 */ 1.000000e+00,
+/* 83 15 */ 1.000000e+00,
+/* 83 16 */ 1.000000e+00,
+/* 83 17 */ 1.000000e+00,
+/* 83 18 */ 1.000000e+00,
+/* 83 19 */ 1.000000e+00,
+/* 83 20 */ 1.000000e+00,
+/* 83 21 */ 1.000000e+00,
+/* 83 22 */ 1.000000e+00,
+/* 83 23 */ 1.000000e+00,
+/* 83 24 */ 1.000000e+00,
+/* 83 25 */ 1.000000e+00,
+/* 83 26 */ 1.000000e+00,
+/* 83 27 */ 1.000000e+00,
+/* 83 28 */ 1.000000e+00,
+/* 83 29 */ 1.000000e+00,
+/* 83 30 */ 9.999145e-01,
+/* 83 31 */ 9.963582e-01,
+/* 83 32 */ 9.573200e-01,
+/* 83 33 */ 8.156473e-01,
+/* 83 34 */ 5.770345e-01,
+/* 83 35 */ 3.419727e-01,
+/* 83 36 */ 1.758200e-01,
+/* 83 37 */ 8.197091e-02,
+/* 83 38 */ 3.548182e-02,
+/* 83 39 */ 1.419818e-02,
+/* 83 40 */ 5.261818e-03,
+/* 83 41 */ 1.983636e-03,
+/* 83 42 */ 6.890909e-04,
+/* 83 43 */ 2.363636e-04,
+/* 83 44 */ 9.454545e-05,
+/* 83 45 */ 2.909091e-05,
+/* 83 46 */ 2.385593e-05,
+/* 83 47 */ 6.160385e-06,
+/* 83 48 */ 1.516874e-06,
+/* 83 49 */ 3.559963e-07,
+/* 83 50 */ 7.959684e-08,
+/* 83 51 */ 1.694630e-08,
+/* 83 52 */ 3.433440e-09,
+/* 83 53 */ 6.615710e-10,
+/* 83 54 */ 1.211437e-10,
+/* 83 55 */ 2.106459e-11,
+/* 83 56 */ 3.474921e-12,
+/* 83 57 */ 5.433102e-13,
+/* 83 58 */ 8.042425e-14,
+/* 83 59 */ 1.125738e-14,
+/* 83 60 */ 1.488053e-15,
+/* 83 61 */ 1.854753e-16,
+/* 83 62 */ 2.176343e-17,
+/* 83 63 */ 2.399653e-18,
+/* 83 64 */ 2.481222e-19,
+/* 83 65 */ 2.400440e-20,
+/* 83 66 */ 2.167285e-21,
+/* 83 67 */ 1.820926e-22,
+/* 83 68 */ 1.419076e-23,
+/* 83 69 */ 1.021986e-24,
+/* 83 70 */ 6.772705e-26,
+/* 83 71 */ 4.109794e-27,
+/* 83 72 */ 2.270509e-28,
+/* 83 73 */ 1.134292e-29,
+/* 83 74 */ 5.082753e-31,
+/* 83 75 */ 2.022816e-32,
+/* 83 76 */ 7.062790e-34,
+/* 83 77 */ 2.130057e-35,
+/* 83 78 */ 5.436467e-37,
+/* 83 79 */ 1.141793e-38,
+/* 83 80 */ 1.894702e-40,
+/* 83 81 */ 2.329241e-42,
+/* 83 82 */ 1.885903e-44,
+/* 83 83 */ 7.543611e-47,
+/* 84 0 */ 1.000000e+00,
+/* 84 1 */ 1.000000e+00,
+/* 84 2 */ 1.000000e+00,
+/* 84 3 */ 1.000000e+00,
+/* 84 4 */ 1.000000e+00,
+/* 84 5 */ 1.000000e+00,
+/* 84 6 */ 1.000000e+00,
+/* 84 7 */ 1.000000e+00,
+/* 84 8 */ 1.000000e+00,
+/* 84 9 */ 1.000000e+00,
+/* 84 10 */ 1.000000e+00,
+/* 84 11 */ 1.000000e+00,
+/* 84 12 */ 1.000000e+00,
+/* 84 13 */ 1.000000e+00,
+/* 84 14 */ 1.000000e+00,
+/* 84 15 */ 1.000000e+00,
+/* 84 16 */ 1.000000e+00,
+/* 84 17 */ 1.000000e+00,
+/* 84 18 */ 1.000000e+00,
+/* 84 19 */ 1.000000e+00,
+/* 84 20 */ 1.000000e+00,
+/* 84 21 */ 1.000000e+00,
+/* 84 22 */ 1.000000e+00,
+/* 84 23 */ 1.000000e+00,
+/* 84 24 */ 1.000000e+00,
+/* 84 25 */ 1.000000e+00,
+/* 84 26 */ 1.000000e+00,
+/* 84 27 */ 1.000000e+00,
+/* 84 28 */ 1.000000e+00,
+/* 84 29 */ 1.000000e+00,
+/* 84 30 */ 9.999727e-01,
+/* 84 31 */ 9.987236e-01,
+/* 84 32 */ 9.785109e-01,
+/* 84 33 */ 8.772145e-01,
+/* 84 34 */ 6.635636e-01,
+/* 84 35 */ 4.174327e-01,
+/* 84 36 */ 2.249873e-01,
+/* 84 37 */ 1.084073e-01,
+/* 84 38 */ 4.819091e-02,
+/* 84 39 */ 1.998182e-02,
+/* 84 40 */ 7.518182e-03,
+/* 84 41 */ 2.838182e-03,
+/* 84 42 */ 1.054545e-03,
+/* 84 43 */ 3.472727e-04,
+/* 84 44 */ 1.327273e-04,
+/* 84 45 */ 5.090909e-05,
+/* 84 46 */ 4.087779e-05,
+/* 84 47 */ 1.083778e-05,
+/* 84 48 */ 2.741887e-06,
+/* 84 49 */ 6.616934e-07,
+/* 84 50 */ 1.522582e-07,
+/* 84 51 */ 3.338996e-08,
+/* 84 52 */ 6.974803e-09,
+/* 84 53 */ 1.386981e-09,
+/* 84 54 */ 2.623881e-10,
+/* 84 55 */ 4.718815e-11,
+/* 84 56 */ 8.060890e-12,
+/* 84 57 */ 1.306780e-12,
+/* 84 58 */ 2.008437e-13,
+/* 84 59 */ 2.923289e-14,
+/* 84 60 */ 4.024523e-15,
+/* 84 61 */ 5.233617e-16,
+/* 84 62 */ 6.419295e-17,
+/* 84 63 */ 7.414018e-18,
+/* 84 64 */ 8.048306e-19,
+/* 84 65 */ 8.195076e-20,
+/* 84 66 */ 7.809230e-21,
+/* 84 67 */ 6.946390e-22,
+/* 84 68 */ 5.751147e-23,
+/* 84 69 */ 4.417509e-24,
+/* 84 70 */ 3.136278e-25,
+/* 84 71 */ 2.049347e-26,
+/* 84 72 */ 1.226424e-27,
+/* 84 73 */ 6.683321e-29,
+/* 84 74 */ 3.293987e-30,
+/* 84 75 */ 1.456468e-31,
+/* 84 76 */ 5.720560e-33,
+/* 84 77 */ 1.971569e-34,
+/* 84 78 */ 5.870187e-36,
+/* 84 79 */ 1.479355e-37,
+/* 84 80 */ 3.068356e-39,
+/* 84 81 */ 5.029082e-41,
+/* 84 82 */ 6.107403e-43,
+/* 84 83 */ 4.885613e-45,
+/* 84 84 */ 1.931073e-47,
+/* 85 0 */ 1.000000e+00,
+/* 85 1 */ 1.000000e+00,
+/* 85 2 */ 1.000000e+00,
+/* 85 3 */ 1.000000e+00,
+/* 85 4 */ 1.000000e+00,
+/* 85 5 */ 1.000000e+00,
+/* 85 6 */ 1.000000e+00,
+/* 85 7 */ 1.000000e+00,
+/* 85 8 */ 1.000000e+00,
+/* 85 9 */ 1.000000e+00,
+/* 85 10 */ 1.000000e+00,
+/* 85 11 */ 1.000000e+00,
+/* 85 12 */ 1.000000e+00,
+/* 85 13 */ 1.000000e+00,
+/* 85 14 */ 1.000000e+00,
+/* 85 15 */ 1.000000e+00,
+/* 85 16 */ 1.000000e+00,
+/* 85 17 */ 1.000000e+00,
+/* 85 18 */ 1.000000e+00,
+/* 85 19 */ 1.000000e+00,
+/* 85 20 */ 1.000000e+00,
+/* 85 21 */ 1.000000e+00,
+/* 85 22 */ 1.000000e+00,
+/* 85 23 */ 1.000000e+00,
+/* 85 24 */ 1.000000e+00,
+/* 85 25 */ 1.000000e+00,
+/* 85 26 */ 1.000000e+00,
+/* 85 27 */ 1.000000e+00,
+/* 85 28 */ 1.000000e+00,
+/* 85 29 */ 1.000000e+00,
+/* 85 30 */ 9.999982e-01,
+/* 85 31 */ 9.996273e-01,
+/* 85 32 */ 9.903636e-01,
+/* 85 33 */ 9.249673e-01,
+/* 85 34 */ 7.449036e-01,
+/* 85 35 */ 4.995436e-01,
+/* 85 36 */ 2.830582e-01,
+/* 85 37 */ 1.419964e-01,
+/* 85 38 */ 6.502545e-02,
+/* 85 39 */ 2.749273e-02,
+/* 85 40 */ 1.094182e-02,
+/* 85 41 */ 4.189091e-03,
+/* 85 42 */ 1.532727e-03,
+/* 85 43 */ 5.381818e-04,
+/* 85 44 */ 2.000000e-04,
+/* 85 45 */ 7.454545e-05,
+/* 85 46 */ 2.363636e-05,
+/* 85 47 */ 1.878203e-05,
+/* 85 48 */ 4.878657e-06,
+/* 85 49 */ 1.209711e-06,
+/* 85 50 */ 2.862349e-07,
+/* 85 51 */ 6.460062e-08,
+/* 85 52 */ 1.389997e-08,
+/* 85 53 */ 2.849826e-09,
+/* 85 54 */ 5.564007e-10,
+/* 85 55 */ 1.033783e-10,
+/* 85 56 */ 1.826500e-11,
+/* 85 57 */ 3.066200e-12,
+/* 85 58 */ 4.886250e-13,
+/* 85 59 */ 7.384287e-14,
+/* 85 60 */ 1.057102e-14,
+/* 85 61 */ 1.431755e-15,
+/* 85 62 */ 1.832213e-16,
+/* 85 63 */ 2.212018e-17,
+/* 85 64 */ 2.515282e-18,
+/* 85 65 */ 2.688876e-19,
+/* 85 66 */ 2.696813e-20,
+/* 85 67 */ 2.531824e-21,
+/* 85 68 */ 2.219244e-22,
+/* 85 69 */ 1.810971e-23,
+/* 85 70 */ 1.371303e-24,
+/* 85 71 */ 9.599656e-26,
+/* 85 72 */ 6.186215e-27,
+/* 85 73 */ 3.651740e-28,
+/* 85 74 */ 1.963271e-29,
+/* 85 75 */ 9.548075e-31,
+/* 85 76 */ 4.166544e-32,
+/* 85 77 */ 1.615356e-33,
+/* 85 78 */ 5.496263e-35,
+/* 85 79 */ 1.615858e-36,
+/* 85 80 */ 4.021493e-38,
+/* 85 81 */ 8.238551e-40,
+/* 85 82 */ 1.333917e-41,
+/* 85 83 */ 1.600497e-43,
+/* 85 84 */ 1.265137e-45,
+/* 85 85 */ 4.941942e-48,
+/* 86 0 */ 1.000000e+00,
+/* 86 1 */ 1.000000e+00,
+/* 86 2 */ 1.000000e+00,
+/* 86 3 */ 1.000000e+00,
+/* 86 4 */ 1.000000e+00,
+/* 86 5 */ 1.000000e+00,
+/* 86 6 */ 1.000000e+00,
+/* 86 7 */ 1.000000e+00,
+/* 86 8 */ 1.000000e+00,
+/* 86 9 */ 1.000000e+00,
+/* 86 10 */ 1.000000e+00,
+/* 86 11 */ 1.000000e+00,
+/* 86 12 */ 1.000000e+00,
+/* 86 13 */ 1.000000e+00,
+/* 86 14 */ 1.000000e+00,
+/* 86 15 */ 1.000000e+00,
+/* 86 16 */ 1.000000e+00,
+/* 86 17 */ 1.000000e+00,
+/* 86 18 */ 1.000000e+00,
+/* 86 19 */ 1.000000e+00,
+/* 86 20 */ 1.000000e+00,
+/* 86 21 */ 1.000000e+00,
+/* 86 22 */ 1.000000e+00,
+/* 86 23 */ 1.000000e+00,
+/* 86 24 */ 1.000000e+00,
+/* 86 25 */ 1.000000e+00,
+/* 86 26 */ 1.000000e+00,
+/* 86 27 */ 1.000000e+00,
+/* 86 28 */ 1.000000e+00,
+/* 86 29 */ 1.000000e+00,
+/* 86 30 */ 1.000000e+00,
+/* 86 31 */ 9.999145e-01,
+/* 86 32 */ 9.961091e-01,
+/* 86 33 */ 9.578036e-01,
+/* 86 34 */ 8.183455e-01,
+/* 86 35 */ 5.846345e-01,
+/* 86 36 */ 3.503655e-01,
+/* 86 37 */ 1.828855e-01,
+/* 86 38 */ 8.655091e-02,
+/* 86 39 */ 3.789273e-02,
+/* 86 40 */ 1.547455e-02,
+/* 86 41 */ 5.954545e-03,
+/* 86 42 */ 2.240000e-03,
+/* 86 43 */ 7.836364e-04,
+/* 86 44 */ 2.745455e-04,
+/* 86 45 */ 1.054545e-04,
+/* 86 46 */ 3.454545e-05,
+/* 86 47 */ 3.208182e-05,
+/* 86 48 */ 8.549921e-06,
+/* 86 49 */ 2.176699e-06,
+/* 86 50 */ 5.291995e-07,
+/* 86 51 */ 1.228163e-07,
+/* 86 52 */ 2.719675e-08,
+/* 86 53 */ 5.743641e-09,
+/* 86 54 */ 1.156183e-09,
+/* 86 55 */ 2.217012e-10,
+/* 86 56 */ 4.046828e-11,
+/* 86 57 */ 7.026501e-12,
+/* 86 58 */ 1.159521e-12,
+/* 86 59 */ 1.816912e-13,
+/* 86 60 */ 2.700625e-14,
+/* 86 61 */ 3.803506e-15,
+/* 86 62 */ 5.069416e-16,
+/* 86 63 */ 6.385496e-17,
+/* 86 64 */ 7.589987e-18,
+/* 86 65 */ 8.499122e-19,
+/* 86 66 */ 8.949349e-20,
+/* 86 67 */ 8.843020e-21,
+/* 86 68 */ 8.180981e-22,
+/* 86 69 */ 7.067884e-23,
+/* 86 70 */ 5.685863e-24,
+/* 86 71 */ 4.245264e-25,
+/* 86 72 */ 2.930869e-26,
+/* 86 73 */ 1.863016e-27,
+/* 86 74 */ 1.084979e-28,
+/* 86 75 */ 5.755841e-30,
+/* 86 76 */ 2.762654e-31,
+/* 86 77 */ 1.189987e-32,
+/* 86 78 */ 4.554713e-34,
+/* 86 79 */ 1.530231e-35,
+/* 86 80 */ 4.442803e-37,
+/* 86 81 */ 1.092124e-38,
+/* 86 82 */ 2.210199e-40,
+/* 86 83 */ 3.535642e-42,
+/* 86 84 */ 4.191941e-44,
+/* 86 85 */ 3.274757e-46,
+/* 86 86 */ 1.264385e-48,
+/* 87 0 */ 1.000000e+00,
+/* 87 1 */ 1.000000e+00,
+/* 87 2 */ 1.000000e+00,
+/* 87 3 */ 1.000000e+00,
+/* 87 4 */ 1.000000e+00,
+/* 87 5 */ 1.000000e+00,
+/* 87 6 */ 1.000000e+00,
+/* 87 7 */ 1.000000e+00,
+/* 87 8 */ 1.000000e+00,
+/* 87 9 */ 1.000000e+00,
+/* 87 10 */ 1.000000e+00,
+/* 87 11 */ 1.000000e+00,
+/* 87 12 */ 1.000000e+00,
+/* 87 13 */ 1.000000e+00,
+/* 87 14 */ 1.000000e+00,
+/* 87 15 */ 1.000000e+00,
+/* 87 16 */ 1.000000e+00,
+/* 87 17 */ 1.000000e+00,
+/* 87 18 */ 1.000000e+00,
+/* 87 19 */ 1.000000e+00,
+/* 87 20 */ 1.000000e+00,
+/* 87 21 */ 1.000000e+00,
+/* 87 22 */ 1.000000e+00,
+/* 87 23 */ 1.000000e+00,
+/* 87 24 */ 1.000000e+00,
+/* 87 25 */ 1.000000e+00,
+/* 87 26 */ 1.000000e+00,
+/* 87 27 */ 1.000000e+00,
+/* 87 28 */ 1.000000e+00,
+/* 87 29 */ 1.000000e+00,
+/* 87 30 */ 1.000000e+00,
+/* 87 31 */ 9.999745e-01,
+/* 87 32 */ 9.987091e-01,
+/* 87 33 */ 9.785836e-01,
+/* 87 34 */ 8.782709e-01,
+/* 87 35 */ 6.693455e-01,
+/* 87 36 */ 4.258327e-01,
+/* 87 37 */ 2.328127e-01,
+/* 87 38 */ 1.138782e-01,
+/* 87 39 */ 5.116545e-02,
+/* 87 40 */ 2.156000e-02,
+/* 87 41 */ 8.500000e-03,
+/* 87 42 */ 3.220000e-03,
+/* 87 43 */ 1.178182e-03,
+/* 87 44 */ 4.272727e-04,
+/* 87 45 */ 1.490909e-04,
+/* 87 46 */ 5.454545e-05,
+/* 87 47 */ 2.000000e-05,
+/* 87 48 */ 1.476659e-05,
+/* 87 49 */ 3.857169e-06,
+/* 87 50 */ 9.628326e-07,
+/* 87 51 */ 2.296007e-07,
+/* 87 52 */ 5.228315e-08,
+/* 87 53 */ 1.136372e-08,
+/* 87 54 */ 2.356296e-09,
+/* 87 55 */ 4.658490e-10,
+/* 87 56 */ 8.775971e-11,
+/* 87 57 */ 1.574270e-11,
+/* 87 58 */ 2.686987e-12,
+/* 87 59 */ 4.360015e-13,
+/* 87 60 */ 6.719599e-14,
+/* 87 61 */ 9.826247e-15,
+/* 87 62 */ 1.361858e-15,
+/* 87 63 */ 1.786641e-16,
+/* 87 64 */ 2.215694e-17,
+/* 87 65 */ 2.593540e-18,
+/* 87 66 */ 2.860626e-19,
+/* 87 67 */ 2.967627e-20,
+/* 87 68 */ 2.889629e-21,
+/* 87 69 */ 2.634880e-22,
+/* 87 70 */ 2.244124e-23,
+/* 87 71 */ 1.780087e-24,
+/* 87 72 */ 1.310752e-25,
+/* 87 73 */ 8.926149e-27,
+/* 87 74 */ 5.597773e-28,
+/* 87 75 */ 3.216830e-29,
+/* 87 76 */ 1.684220e-30,
+/* 87 77 */ 7.979445e-32,
+/* 87 78 */ 3.393251e-33,
+/* 87 79 */ 1.282426e-34,
+/* 87 80 */ 4.254941e-36,
+/* 87 81 */ 1.220184e-37,
+/* 87 82 */ 2.963035e-39,
+/* 87 83 */ 5.924554e-41,
+/* 87 84 */ 9.365135e-43,
+/* 87 85 */ 1.097344e-44,
+/* 87 86 */ 8.473199e-47,
+/* 87 87 */ 3.234045e-49,
+/* 88 0 */ 1.000000e+00,
+/* 88 1 */ 1.000000e+00,
+/* 88 2 */ 1.000000e+00,
+/* 88 3 */ 1.000000e+00,
+/* 88 4 */ 1.000000e+00,
+/* 88 5 */ 1.000000e+00,
+/* 88 6 */ 1.000000e+00,
+/* 88 7 */ 1.000000e+00,
+/* 88 8 */ 1.000000e+00,
+/* 88 9 */ 1.000000e+00,
+/* 88 10 */ 1.000000e+00,
+/* 88 11 */ 1.000000e+00,
+/* 88 12 */ 1.000000e+00,
+/* 88 13 */ 1.000000e+00,
+/* 88 14 */ 1.000000e+00,
+/* 88 15 */ 1.000000e+00,
+/* 88 16 */ 1.000000e+00,
+/* 88 17 */ 1.000000e+00,
+/* 88 18 */ 1.000000e+00,
+/* 88 19 */ 1.000000e+00,
+/* 88 20 */ 1.000000e+00,
+/* 88 21 */ 1.000000e+00,
+/* 88 22 */ 1.000000e+00,
+/* 88 23 */ 1.000000e+00,
+/* 88 24 */ 1.000000e+00,
+/* 88 25 */ 1.000000e+00,
+/* 88 26 */ 1.000000e+00,
+/* 88 27 */ 1.000000e+00,
+/* 88 28 */ 1.000000e+00,
+/* 88 29 */ 1.000000e+00,
+/* 88 30 */ 1.000000e+00,
+/* 88 31 */ 9.999945e-01,
+/* 88 32 */ 9.996291e-01,
+/* 88 33 */ 9.903109e-01,
+/* 88 34 */ 9.251400e-01,
+/* 88 35 */ 7.494745e-01,
+/* 88 36 */ 5.065945e-01,
+/* 88 37 */ 2.911964e-01,
+/* 88 38 */ 1.479655e-01,
+/* 88 39 */ 6.874727e-02,
+/* 88 40 */ 2.957091e-02,
+/* 88 41 */ 1.206727e-02,
+/* 88 42 */ 4.640000e-03,
+/* 88 43 */ 1.761818e-03,
+/* 88 44 */ 6.236364e-04,
+/* 88 45 */ 2.127273e-04,
+/* 88 46 */ 8.363636e-05,
+/* 88 47 */ 3.272727e-05,
+/* 88 48 */ 2.514700e-05,
+/* 88 49 */ 6.735024e-06,
+/* 88 50 */ 1.724962e-06,
+/* 88 51 */ 4.223463e-07,
+/* 88 52 */ 9.882074e-08,
+/* 88 53 */ 2.208713e-08,
+/* 88 54 */ 4.713477e-09,
+/* 88 55 */ 9.599105e-10,
+/* 88 56 */ 1.864484e-10,
+/* 88 57 */ 3.451829e-11,
+/* 88 58 */ 6.086932e-12,
+/* 88 59 */ 1.021576e-12,
+/* 88 60 */ 1.630406e-13,
+/* 88 61 */ 2.472109e-14,
+/* 88 62 */ 3.557449e-15,
+/* 88 63 */ 4.853071e-16,
+/* 88 64 */ 6.268445e-17,
+/* 88 65 */ 7.655455e-18,
+/* 88 66 */ 8.826555e-19,
+/* 88 67 */ 9.591617e-20,
+/* 88 68 */ 9.805396e-21,
+/* 88 69 */ 9.410516e-22,
+/* 88 70 */ 8.459321e-23,
+/* 88 71 */ 7.104121e-24,
+/* 88 72 */ 5.557467e-25,
+/* 88 73 */ 4.036540e-26,
+/* 88 74 */ 2.711971e-27,
+/* 88 75 */ 1.678206e-28,
+/* 88 76 */ 9.517924e-30,
+/* 88 77 */ 4.918924e-31,
+/* 88 78 */ 2.300767e-32,
+/* 88 79 */ 9.660825e-34,
+/* 88 80 */ 3.605759e-35,
+/* 88 81 */ 1.181654e-36,
+/* 88 82 */ 3.347490e-38,
+/* 88 83 */ 8.031396e-40,
+/* 88 84 */ 1.586836e-41,
+/* 88 85 */ 2.478979e-43,
+/* 88 86 */ 2.871065e-45,
+/* 88 87 */ 2.191526e-47,
+/* 88 88 */ 8.269910e-50,
+/* 89 0 */ 1.000000e+00,
+/* 89 1 */ 1.000000e+00,
+/* 89 2 */ 1.000000e+00,
+/* 89 3 */ 1.000000e+00,
+/* 89 4 */ 1.000000e+00,
+/* 89 5 */ 1.000000e+00,
+/* 89 6 */ 1.000000e+00,
+/* 89 7 */ 1.000000e+00,
+/* 89 8 */ 1.000000e+00,
+/* 89 9 */ 1.000000e+00,
+/* 89 10 */ 1.000000e+00,
+/* 89 11 */ 1.000000e+00,
+/* 89 12 */ 1.000000e+00,
+/* 89 13 */ 1.000000e+00,
+/* 89 14 */ 1.000000e+00,
+/* 89 15 */ 1.000000e+00,
+/* 89 16 */ 1.000000e+00,
+/* 89 17 */ 1.000000e+00,
+/* 89 18 */ 1.000000e+00,
+/* 89 19 */ 1.000000e+00,
+/* 89 20 */ 1.000000e+00,
+/* 89 21 */ 1.000000e+00,
+/* 89 22 */ 1.000000e+00,
+/* 89 23 */ 1.000000e+00,
+/* 89 24 */ 1.000000e+00,
+/* 89 25 */ 1.000000e+00,
+/* 89 26 */ 1.000000e+00,
+/* 89 27 */ 1.000000e+00,
+/* 89 28 */ 1.000000e+00,
+/* 89 29 */ 1.000000e+00,
+/* 89 30 */ 1.000000e+00,
+/* 89 31 */ 1.000000e+00,
+/* 89 32 */ 9.999018e-01,
+/* 89 33 */ 9.961400e-01,
+/* 89 34 */ 9.579236e-01,
+/* 89 35 */ 8.207636e-01,
+/* 89 36 */ 5.906891e-01,
+/* 89 37 */ 3.584673e-01,
+/* 89 38 */ 1.897818e-01,
+/* 89 39 */ 9.075818e-02,
+/* 89 40 */ 4.045636e-02,
+/* 89 41 */ 1.669636e-02,
+/* 89 42 */ 6.596364e-03,
+/* 89 43 */ 2.523636e-03,
+/* 89 44 */ 9.290909e-04,
+/* 89 45 */ 3.272727e-04,
+/* 89 46 */ 1.145455e-04,
+/* 89 47 */ 4.727273e-05,
+/* 89 48 */ 4.224722e-05,
+/* 89 49 */ 1.159424e-05,
+/* 89 50 */ 3.044763e-06,
+/* 89 51 */ 7.649037e-07,
+/* 89 52 */ 1.837631e-07,
+/* 89 53 */ 4.220317e-08,
+/* 89 54 */ 9.261558e-09,
+/* 89 55 */ 1.941200e-09,
+/* 89 56 */ 3.883970e-10,
+/* 89 57 */ 7.413919e-11,
+/* 89 58 */ 1.349295e-11,
+/* 89 59 */ 2.339617e-12,
+/* 89 60 */ 3.862091e-13,
+/* 89 61 */ 6.064107e-14,
+/* 89 62 */ 9.048317e-15,
+/* 89 63 */ 1.281666e-15,
+/* 89 64 */ 1.721443e-16,
+/* 89 65 */ 2.189659e-17,
+/* 89 66 */ 2.634065e-18,
+/* 89 67 */ 2.992133e-19,
+/* 89 68 */ 3.204116e-20,
+/* 89 69 */ 3.228483e-21,
+/* 89 70 */ 3.054581e-22,
+/* 89 71 */ 2.707471e-23,
+/* 89 72 */ 2.242394e-24,
+/* 89 73 */ 1.730346e-25,
+/* 89 74 */ 1.239934e-26,
+/* 89 75 */ 8.220240e-28,
+/* 89 76 */ 5.020302e-29,
+/* 89 77 */ 2.810509e-30,
+/* 89 78 */ 1.433978e-31,
+/* 89 79 */ 6.622837e-33,
+/* 89 80 */ 2.746329e-34,
+/* 89 81 */ 1.012437e-35,
+/* 89 82 */ 3.277628e-37,
+/* 89 83 */ 9.173809e-39,
+/* 89 84 */ 2.174925e-40,
+/* 89 85 */ 4.246864e-42,
+/* 89 86 */ 6.557695e-44,
+/* 89 87 */ 7.507942e-46,
+/* 89 88 */ 5.666052e-48,
+/* 89 89 */ 2.114199e-50,
+/* 90 0 */ 1.000000e+00,
+/* 90 1 */ 1.000000e+00,
+/* 90 2 */ 1.000000e+00,
+/* 90 3 */ 1.000000e+00,
+/* 90 4 */ 1.000000e+00,
+/* 90 5 */ 1.000000e+00,
+/* 90 6 */ 1.000000e+00,
+/* 90 7 */ 1.000000e+00,
+/* 90 8 */ 1.000000e+00,
+/* 90 9 */ 1.000000e+00,
+/* 90 10 */ 1.000000e+00,
+/* 90 11 */ 1.000000e+00,
+/* 90 12 */ 1.000000e+00,
+/* 90 13 */ 1.000000e+00,
+/* 90 14 */ 1.000000e+00,
+/* 90 15 */ 1.000000e+00,
+/* 90 16 */ 1.000000e+00,
+/* 90 17 */ 1.000000e+00,
+/* 90 18 */ 1.000000e+00,
+/* 90 19 */ 1.000000e+00,
+/* 90 20 */ 1.000000e+00,
+/* 90 21 */ 1.000000e+00,
+/* 90 22 */ 1.000000e+00,
+/* 90 23 */ 1.000000e+00,
+/* 90 24 */ 1.000000e+00,
+/* 90 25 */ 1.000000e+00,
+/* 90 26 */ 1.000000e+00,
+/* 90 27 */ 1.000000e+00,
+/* 90 28 */ 1.000000e+00,
+/* 90 29 */ 1.000000e+00,
+/* 90 30 */ 1.000000e+00,
+/* 90 31 */ 1.000000e+00,
+/* 90 32 */ 9.999727e-01,
+/* 90 33 */ 9.985945e-01,
+/* 90 34 */ 9.783782e-01,
+/* 90 35 */ 8.799582e-01,
+/* 90 36 */ 6.740891e-01,
+/* 90 37 */ 4.329364e-01,
+/* 90 38 */ 2.400436e-01,
+/* 90 39 */ 1.191818e-01,
+/* 90 40 */ 5.422545e-02,
+/* 90 41 */ 2.318727e-02,
+/* 90 42 */ 9.343636e-03,
+/* 90 43 */ 3.709091e-03,
+/* 90 44 */ 1.358182e-03,
+/* 90 45 */ 4.909091e-04,
+/* 90 46 */ 1.563636e-04,
+/* 90 47 */ 6.000000e-05,
+/* 90 48 */ 2.545455e-05,
+/* 90 49 */ 1.968780e-05,
+/* 90 50 */ 5.297929e-06,
+/* 90 51 */ 1.364697e-06,
+/* 90 52 */ 3.364010e-07,
+/* 90 53 */ 7.932701e-08,
+/* 90 54 */ 1.788794e-08,
+/* 90 55 */ 3.855562e-09,
+/* 90 56 */ 7.939514e-10,
+/* 90 57 */ 1.561159e-10,
+/* 90 58 */ 2.929481e-11,
+/* 90 59 */ 5.242538e-12,
+/* 90 60 */ 8.941039e-13,
+/* 90 61 */ 1.452069e-13,
+/* 90 62 */ 2.243691e-14,
+/* 90 63 */ 3.295356e-15,
+/* 90 64 */ 4.595696e-16,
+/* 90 65 */ 6.078716e-17,
+/* 90 66 */ 7.616165e-18,
+/* 90 67 */ 9.026558e-19,
+/* 90 68 */ 1.010427e-19,
+/* 90 69 */ 1.066475e-20,
+/* 90 70 */ 1.059369e-21,
+/* 90 71 */ 9.883072e-23,
+/* 90 72 */ 8.639305e-24,
+/* 90 73 */ 7.058014e-25,
+/* 90 74 */ 5.373259e-26,
+/* 90 75 */ 3.799397e-27,
+/* 90 76 */ 2.485918e-28,
+/* 90 77 */ 1.498619e-29,
+/* 90 78 */ 8.282795e-31,
+/* 90 79 */ 4.172864e-32,
+/* 90 80 */ 1.903284e-33,
+/* 90 81 */ 7.795539e-35,
+/* 90 82 */ 2.838967e-36,
+/* 90 83 */ 9.080582e-38,
+/* 90 84 */ 2.511465e-39,
+/* 90 85 */ 5.884445e-41,
+/* 90 86 */ 1.135722e-42,
+/* 90 87 */ 1.733626e-44,
+/* 90 88 */ 1.962373e-46,
+/* 90 89 */ 1.464377e-48,
+/* 90 90 */ 5.403605e-51,
+/* 91 0 */ 1.000000e+00,
+/* 91 1 */ 1.000000e+00,
+/* 91 2 */ 1.000000e+00,
+/* 91 3 */ 1.000000e+00,
+/* 91 4 */ 1.000000e+00,
+/* 91 5 */ 1.000000e+00,
+/* 91 6 */ 1.000000e+00,
+/* 91 7 */ 1.000000e+00,
+/* 91 8 */ 1.000000e+00,
+/* 91 9 */ 1.000000e+00,
+/* 91 10 */ 1.000000e+00,
+/* 91 11 */ 1.000000e+00,
+/* 91 12 */ 1.000000e+00,
+/* 91 13 */ 1.000000e+00,
+/* 91 14 */ 1.000000e+00,
+/* 91 15 */ 1.000000e+00,
+/* 91 16 */ 1.000000e+00,
+/* 91 17 */ 1.000000e+00,
+/* 91 18 */ 1.000000e+00,
+/* 91 19 */ 1.000000e+00,
+/* 91 20 */ 1.000000e+00,
+/* 91 21 */ 1.000000e+00,
+/* 91 22 */ 1.000000e+00,
+/* 91 23 */ 1.000000e+00,
+/* 91 24 */ 1.000000e+00,
+/* 91 25 */ 1.000000e+00,
+/* 91 26 */ 1.000000e+00,
+/* 91 27 */ 1.000000e+00,
+/* 91 28 */ 1.000000e+00,
+/* 91 29 */ 1.000000e+00,
+/* 91 30 */ 1.000000e+00,
+/* 91 31 */ 1.000000e+00,
+/* 91 32 */ 9.999964e-01,
+/* 91 33 */ 9.995255e-01,
+/* 91 34 */ 9.901091e-01,
+/* 91 35 */ 9.248764e-01,
+/* 91 36 */ 7.525418e-01,
+/* 91 37 */ 5.127691e-01,
+/* 91 38 */ 2.985800e-01,
+/* 91 39 */ 1.536127e-01,
+/* 91 40 */ 7.255091e-02,
+/* 91 41 */ 3.156545e-02,
+/* 91 42 */ 1.297273e-02,
+/* 91 43 */ 5.234545e-03,
+/* 91 44 */ 1.960000e-03,
+/* 91 45 */ 7.527273e-04,
+/* 91 46 */ 2.472727e-04,
+/* 91 47 */ 8.727273e-05,
+/* 91 48 */ 4.000000e-05,
+/* 91 49 */ 3.299227e-05,
+/* 91 50 */ 9.091975e-06,
+/* 91 51 */ 2.399893e-06,
+/* 91 52 */ 6.065901e-07,
+/* 91 53 */ 1.467688e-07,
+/* 91 54 */ 3.398244e-08,
+/* 91 55 */ 7.526385e-09,
+/* 91 56 */ 1.593814e-09,
+/* 91 57 */ 3.225486e-10,
+/* 91 58 */ 6.234811e-11,
+/* 91 59 */ 1.150434e-11,
+/* 91 60 */ 2.024995e-12,
+/* 91 61 */ 3.397775e-13,
+/* 91 62 */ 5.430351e-14,
+/* 91 63 */ 8.259320e-15,
+/* 91 64 */ 1.194339e-15,
+/* 91 65 */ 1.640293e-16,
+/* 91 66 */ 2.137098e-17,
+/* 91 67 */ 2.638071e-18,
+/* 91 68 */ 3.081076e-19,
+/* 91 69 */ 3.399423e-20,
+/* 91 70 */ 3.537193e-21,
+/* 91 71 */ 3.464561e-22,
+/* 91 72 */ 3.187636e-23,
+/* 91 73 */ 2.748605e-24,
+/* 91 74 */ 2.215397e-25,
+/* 91 75 */ 1.664252e-26,
+/* 91 76 */ 1.161404e-27,
+/* 91 77 */ 7.500937e-29,
+/* 91 78 */ 4.464280e-30,
+/* 91 79 */ 2.436340e-31,
+/* 91 80 */ 1.212171e-32,
+/* 91 81 */ 5.460947e-34,
+/* 91 82 */ 2.209581e-35,
+/* 91 83 */ 7.950357e-37,
+/* 91 84 */ 2.512835e-38,
+/* 91 85 */ 6.868500e-40,
+/* 91 86 */ 1.590683e-41,
+/* 91 87 */ 3.034946e-43,
+/* 91 88 */ 4.580272e-45,
+/* 91 89 */ 5.126603e-47,
+/* 91 90 */ 3.783267e-49,
+/* 91 91 */ 1.380754e-51,
+/* 92 0 */ 1.000000e+00,
+/* 92 1 */ 1.000000e+00,
+/* 92 2 */ 1.000000e+00,
+/* 92 3 */ 1.000000e+00,
+/* 92 4 */ 1.000000e+00,
+/* 92 5 */ 1.000000e+00,
+/* 92 6 */ 1.000000e+00,
+/* 92 7 */ 1.000000e+00,
+/* 92 8 */ 1.000000e+00,
+/* 92 9 */ 1.000000e+00,
+/* 92 10 */ 1.000000e+00,
+/* 92 11 */ 1.000000e+00,
+/* 92 12 */ 1.000000e+00,
+/* 92 13 */ 1.000000e+00,
+/* 92 14 */ 1.000000e+00,
+/* 92 15 */ 1.000000e+00,
+/* 92 16 */ 1.000000e+00,
+/* 92 17 */ 1.000000e+00,
+/* 92 18 */ 1.000000e+00,
+/* 92 19 */ 1.000000e+00,
+/* 92 20 */ 1.000000e+00,
+/* 92 21 */ 1.000000e+00,
+/* 92 22 */ 1.000000e+00,
+/* 92 23 */ 1.000000e+00,
+/* 92 24 */ 1.000000e+00,
+/* 92 25 */ 1.000000e+00,
+/* 92 26 */ 1.000000e+00,
+/* 92 27 */ 1.000000e+00,
+/* 92 28 */ 1.000000e+00,
+/* 92 29 */ 1.000000e+00,
+/* 92 30 */ 1.000000e+00,
+/* 92 31 */ 1.000000e+00,
+/* 92 32 */ 9.999982e-01,
+/* 92 33 */ 9.998873e-01,
+/* 92 34 */ 9.959782e-01,
+/* 92 35 */ 9.570600e-01,
+/* 92 36 */ 8.220836e-01,
+/* 92 37 */ 5.950418e-01,
+/* 92 38 */ 3.650345e-01,
+/* 92 39 */ 1.957327e-01,
+/* 92 40 */ 9.528000e-02,
+/* 92 41 */ 4.273818e-02,
+/* 92 42 */ 1.803818e-02,
+/* 92 43 */ 7.307273e-03,
+/* 92 44 */ 2.823636e-03,
+/* 92 45 */ 1.096364e-03,
+/* 92 46 */ 3.727273e-04,
+/* 92 47 */ 1.236364e-04,
+/* 92 48 */ 5.272727e-05,
+/* 92 49 */ 1.454545e-05,
+/* 92 50 */ 1.090909e-05,
+/* 92 51 */ 4.161937e-06,
+/* 92 52 */ 1.077973e-06,
+/* 92 53 */ 2.674447e-07,
+/* 92 54 */ 6.353810e-08,
+/* 92 55 */ 1.444947e-08,
+/* 92 56 */ 3.144210e-09,
+/* 92 57 */ 6.543615e-10,
+/* 92 58 */ 1.301828e-10,
+/* 92 59 */ 2.474457e-11,
+/* 92 60 */ 4.490891e-12,
+/* 92 61 */ 7.777170e-13,
+/* 92 62 */ 1.284188e-13,
+/* 92 63 */ 2.020249e-14,
+/* 92 64 */ 3.025295e-15,
+/* 92 65 */ 4.308219e-16,
+/* 92 66 */ 5.828219e-17,
+/* 92 67 */ 7.481321e-18,
+/* 92 68 */ 9.100644e-19,
+/* 92 69 */ 1.047634e-19,
+/* 92 70 */ 1.139519e-20,
+/* 92 71 */ 1.169148e-21,
+/* 92 72 */ 1.129370e-22,
+/* 92 73 */ 1.024978e-23,
+/* 92 74 */ 8.719570e-25,
+/* 92 75 */ 6.935020e-26,
+/* 92 76 */ 5.141663e-27,
+/* 92 77 */ 3.541839e-28,
+/* 92 78 */ 2.258361e-29,
+/* 92 79 */ 1.327184e-30,
+/* 92 80 */ 7.152978e-32,
+/* 92 81 */ 3.515187e-33,
+/* 92 82 */ 1.564418e-34,
+/* 92 83 */ 6.254000e-36,
+/* 92 84 */ 2.223614e-37,
+/* 92 85 */ 6.945795e-39,
+/* 92 86 */ 1.876566e-40,
+/* 92 87 */ 4.296222e-42,
+/* 92 88 */ 8.104234e-44,
+/* 92 89 */ 1.209386e-45,
+/* 92 90 */ 1.338659e-47,
+/* 92 91 */ 9.770718e-50,
+/* 92 92 */ 3.527335e-52,
+/* 93 0 */ 1.000000e+00,
+/* 93 1 */ 1.000000e+00,
+/* 93 2 */ 1.000000e+00,
+/* 93 3 */ 1.000000e+00,
+/* 93 4 */ 1.000000e+00,
+/* 93 5 */ 1.000000e+00,
+/* 93 6 */ 1.000000e+00,
+/* 93 7 */ 1.000000e+00,
+/* 93 8 */ 1.000000e+00,
+/* 93 9 */ 1.000000e+00,
+/* 93 10 */ 1.000000e+00,
+/* 93 11 */ 1.000000e+00,
+/* 93 12 */ 1.000000e+00,
+/* 93 13 */ 1.000000e+00,
+/* 93 14 */ 1.000000e+00,
+/* 93 15 */ 1.000000e+00,
+/* 93 16 */ 1.000000e+00,
+/* 93 17 */ 1.000000e+00,
+/* 93 18 */ 1.000000e+00,
+/* 93 19 */ 1.000000e+00,
+/* 93 20 */ 1.000000e+00,
+/* 93 21 */ 1.000000e+00,
+/* 93 22 */ 1.000000e+00,
+/* 93 23 */ 1.000000e+00,
+/* 93 24 */ 1.000000e+00,
+/* 93 25 */ 1.000000e+00,
+/* 93 26 */ 1.000000e+00,
+/* 93 27 */ 1.000000e+00,
+/* 93 28 */ 1.000000e+00,
+/* 93 29 */ 1.000000e+00,
+/* 93 30 */ 1.000000e+00,
+/* 93 31 */ 1.000000e+00,
+/* 93 32 */ 1.000000e+00,
+/* 93 33 */ 9.999709e-01,
+/* 93 34 */ 9.984582e-01,
+/* 93 35 */ 9.776200e-01,
+/* 93 36 */ 8.802127e-01,
+/* 93 37 */ 6.768945e-01,
+/* 93 38 */ 4.390200e-01,
+/* 93 39 */ 2.459364e-01,
+/* 93 40 */ 1.235055e-01,
+/* 93 41 */ 5.715273e-02,
+/* 93 42 */ 2.466727e-02,
+/* 93 43 */ 1.020364e-02,
+/* 93 44 */ 4.041818e-03,
+/* 93 45 */ 1.576364e-03,
+/* 93 46 */ 5.490909e-04,
+/* 93 47 */ 1.854545e-04,
+/* 93 48 */ 6.909091e-05,
+/* 93 49 */ 2.181818e-05,
+/* 93 50 */ 1.090909e-05,
+/* 93 51 */ 7.121256e-06,
+/* 93 52 */ 1.888941e-06,
+/* 93 53 */ 4.802404e-07,
+/* 93 54 */ 1.169907e-07,
+/* 93 55 */ 2.729938e-08,
+/* 93 56 */ 6.099614e-09,
+/* 93 57 */ 1.304430e-09,
+/* 93 58 */ 2.668755e-10,
+/* 93 59 */ 5.220905e-11,
+/* 93 60 */ 9.760883e-12,
+/* 93 61 */ 1.742896e-12,
+/* 93 62 */ 2.970295e-13,
+/* 93 63 */ 4.827832e-14,
+/* 93 64 */ 7.477851e-15,
+/* 93 65 */ 1.102779e-15,
+/* 93 66 */ 1.546909e-16,
+/* 93 67 */ 2.061788e-17,
+/* 93 68 */ 2.608074e-18,
+/* 93 69 */ 3.127066e-19,
+/* 93 70 */ 3.548830e-20,
+/* 93 71 */ 3.806212e-21,
+/* 93 72 */ 3.851407e-22,
+/* 93 73 */ 3.669824e-23,
+/* 93 74 */ 3.285956e-24,
+/* 93 75 */ 2.758396e-25,
+/* 93 76 */ 2.165203e-26,
+/* 93 77 */ 1.584589e-27,
+/* 93 78 */ 1.077643e-28,
+/* 93 79 */ 6.784882e-30,
+/* 93 80 */ 3.937769e-31,
+/* 93 81 */ 2.096247e-32,
+/* 93 82 */ 1.017665e-33,
+/* 93 83 */ 4.474797e-35,
+/* 93 84 */ 1.767681e-36,
+/* 93 85 */ 6.211426e-38,
+/* 93 86 */ 1.917778e-39,
+/* 93 87 */ 5.122030e-41,
+/* 93 88 */ 1.159374e-42,
+/* 93 89 */ 2.162529e-44,
+/* 93 90 */ 3.191405e-46,
+/* 93 91 */ 3.493870e-48,
+/* 93 92 */ 2.522520e-50,
+/* 93 93 */ 9.008998e-53,
+/* 94 0 */ 1.000000e+00,
+/* 94 1 */ 1.000000e+00,
+/* 94 2 */ 1.000000e+00,
+/* 94 3 */ 1.000000e+00,
+/* 94 4 */ 1.000000e+00,
+/* 94 5 */ 1.000000e+00,
+/* 94 6 */ 1.000000e+00,
+/* 94 7 */ 1.000000e+00,
+/* 94 8 */ 1.000000e+00,
+/* 94 9 */ 1.000000e+00,
+/* 94 10 */ 1.000000e+00,
+/* 94 11 */ 1.000000e+00,
+/* 94 12 */ 1.000000e+00,
+/* 94 13 */ 1.000000e+00,
+/* 94 14 */ 1.000000e+00,
+/* 94 15 */ 1.000000e+00,
+/* 94 16 */ 1.000000e+00,
+/* 94 17 */ 1.000000e+00,
+/* 94 18 */ 1.000000e+00,
+/* 94 19 */ 1.000000e+00,
+/* 94 20 */ 1.000000e+00,
+/* 94 21 */ 1.000000e+00,
+/* 94 22 */ 1.000000e+00,
+/* 94 23 */ 1.000000e+00,
+/* 94 24 */ 1.000000e+00,
+/* 94 25 */ 1.000000e+00,
+/* 94 26 */ 1.000000e+00,
+/* 94 27 */ 1.000000e+00,
+/* 94 28 */ 1.000000e+00,
+/* 94 29 */ 1.000000e+00,
+/* 94 30 */ 1.000000e+00,
+/* 94 31 */ 1.000000e+00,
+/* 94 32 */ 1.000000e+00,
+/* 94 33 */ 9.999873e-01,
+/* 94 34 */ 9.994909e-01,
+/* 94 35 */ 9.895655e-01,
+/* 94 36 */ 9.249655e-01,
+/* 94 37 */ 7.539382e-01,
+/* 94 38 */ 5.178655e-01,
+/* 94 39 */ 3.043455e-01,
+/* 94 40 */ 1.588255e-01,
+/* 94 41 */ 7.545818e-02,
+/* 94 42 */ 3.347455e-02,
+/* 94 43 */ 1.406909e-02,
+/* 94 44 */ 5.674545e-03,
+/* 94 45 */ 2.172727e-03,
+/* 94 46 */ 7.963636e-04,
+/* 94 47 */ 2.690909e-04,
+/* 94 48 */ 1.036364e-04,
+/* 94 49 */ 4.181818e-05,
+/* 94 50 */ 1.272727e-05,
+/* 94 51 */ 1.202746e-05,
+/* 94 52 */ 3.265403e-06,
+/* 94 53 */ 8.502207e-07,
+/* 94 54 */ 2.122480e-07,
+/* 94 55 */ 5.078575e-08,
+/* 94 56 */ 1.164339e-08,
+/* 94 57 */ 2.556769e-09,
+/* 94 58 */ 5.375208e-10,
+/* 94 59 */ 1.081403e-10,
+/* 94 60 */ 2.080870e-11,
+/* 94 61 */ 3.827549e-12,
+/* 94 62 */ 6.725812e-13,
+/* 94 63 */ 1.128290e-13,
+/* 94 64 */ 1.805610e-14,
+/* 94 65 */ 2.754225e-15,
+/* 94 66 */ 4.000915e-16,
+/* 94 67 */ 5.529409e-17,
+/* 94 68 */ 7.262619e-18,
+/* 94 69 */ 9.055116e-19,
+/* 94 70 */ 1.070344e-19,
+/* 94 71 */ 1.197757e-20,
+/* 94 72 */ 1.266940e-21,
+/* 94 73 */ 1.264571e-22,
+/* 94 74 */ 1.188798e-23,
+/* 94 75 */ 1.050365e-24,
+/* 94 76 */ 8.702131e-26,
+/* 94 77 */ 6.742652e-27,
+/* 94 78 */ 4.871728e-28,
+/* 94 79 */ 3.271486e-29,
+/* 94 80 */ 2.034152e-30,
+/* 94 81 */ 1.166081e-31,
+/* 94 82 */ 6.132288e-33,
+/* 94 83 */ 2.941371e-34,
+/* 94 84 */ 1.278040e-35,
+/* 94 85 */ 4.989550e-37,
+/* 94 86 */ 1.732982e-38,
+/* 94 87 */ 5.289366e-40,
+/* 94 88 */ 1.396710e-41,
+/* 94 89 */ 3.126090e-43,
+/* 94 90 */ 5.766438e-45,
+/* 94 91 */ 8.416817e-47,
+/* 94 92 */ 9.114743e-49,
+/* 94 93 */ 6.510202e-51,
+/* 94 94 */ 2.300425e-53,
+/* 95 0 */ 1.000000e+00,
+/* 95 1 */ 1.000000e+00,
+/* 95 2 */ 1.000000e+00,
+/* 95 3 */ 1.000000e+00,
+/* 95 4 */ 1.000000e+00,
+/* 95 5 */ 1.000000e+00,
+/* 95 6 */ 1.000000e+00,
+/* 95 7 */ 1.000000e+00,
+/* 95 8 */ 1.000000e+00,
+/* 95 9 */ 1.000000e+00,
+/* 95 10 */ 1.000000e+00,
+/* 95 11 */ 1.000000e+00,
+/* 95 12 */ 1.000000e+00,
+/* 95 13 */ 1.000000e+00,
+/* 95 14 */ 1.000000e+00,
+/* 95 15 */ 1.000000e+00,
+/* 95 16 */ 1.000000e+00,
+/* 95 17 */ 1.000000e+00,
+/* 95 18 */ 1.000000e+00,
+/* 95 19 */ 1.000000e+00,
+/* 95 20 */ 1.000000e+00,
+/* 95 21 */ 1.000000e+00,
+/* 95 22 */ 1.000000e+00,
+/* 95 23 */ 1.000000e+00,
+/* 95 24 */ 1.000000e+00,
+/* 95 25 */ 1.000000e+00,
+/* 95 26 */ 1.000000e+00,
+/* 95 27 */ 1.000000e+00,
+/* 95 28 */ 1.000000e+00,
+/* 95 29 */ 1.000000e+00,
+/* 95 30 */ 1.000000e+00,
+/* 95 31 */ 1.000000e+00,
+/* 95 32 */ 1.000000e+00,
+/* 95 33 */ 9.999945e-01,
+/* 95 34 */ 9.998709e-01,
+/* 95 35 */ 9.957073e-01,
+/* 95 36 */ 9.568036e-01,
+/* 95 37 */ 8.226800e-01,
+/* 95 38 */ 5.988291e-01,
+/* 95 39 */ 3.702836e-01,
+/* 95 40 */ 2.010164e-01,
+/* 95 41 */ 9.868545e-02,
+/* 95 42 */ 4.486545e-02,
+/* 95 43 */ 1.930364e-02,
+/* 95 44 */ 7.840000e-03,
+/* 95 45 */ 3.081818e-03,
+/* 95 46 */ 1.209091e-03,
+/* 95 47 */ 4.290909e-04,
+/* 95 48 */ 1.490909e-04,
+/* 95 49 */ 6.363636e-05,
+/* 95 50 */ 1.818182e-05,
+/* 95 51 */ 7.272727e-06,
+/* 95 52 */ 5.571383e-06,
+/* 95 53 */ 1.484788e-06,
+/* 95 54 */ 3.796085e-07,
+/* 95 55 */ 9.308038e-08,
+/* 95 56 */ 2.188249e-08,
+/* 95 57 */ 4.930610e-09,
+/* 95 58 */ 1.064392e-09,
+/* 95 59 */ 2.200458e-10,
+/* 95 60 */ 4.354404e-11,
+/* 95 61 */ 8.243685e-12,
+/* 95 62 */ 1.492250e-12,
+/* 95 63 */ 2.581165e-13,
+/* 95 64 */ 4.263287e-14,
+/* 95 65 */ 6.718942e-15,
+/* 95 66 */ 1.009548e-15,
+/* 95 67 */ 1.444879e-16,
+/* 95 68 */ 1.967832e-17,
+/* 95 69 */ 2.547587e-18,
+/* 95 70 */ 3.131435e-19,
+/* 95 71 */ 3.649819e-20,
+/* 95 72 */ 4.028078e-21,
+/* 95 73 */ 4.202883e-22,
+/* 95 74 */ 4.138802e-23,
+/* 95 75 */ 3.839339e-24,
+/* 95 76 */ 3.347959e-25,
+/* 95 77 */ 2.737976e-26,
+/* 95 78 */ 2.094450e-27,
+/* 95 79 */ 1.494262e-28,
+/* 95 80 */ 9.909705e-30,
+/* 95 81 */ 6.086073e-31,
+/* 95 82 */ 3.446553e-32,
+/* 95 83 */ 1.790789e-33,
+/* 95 84 */ 8.487866e-35,
+/* 95 85 */ 3.644855e-36,
+/* 95 86 */ 1.406511e-37,
+/* 95 87 */ 4.829242e-39,
+/* 95 88 */ 1.457297e-40,
+/* 95 89 */ 3.805092e-42,
+/* 95 90 */ 8.422257e-44,
+/* 95 91 */ 1.536581e-45,
+/* 95 92 */ 2.218544e-47,
+/* 95 93 */ 2.376770e-49,
+/* 95 94 */ 1.679613e-51,
+/* 95 95 */ 5.872774e-54,
+/* 96 0 */ 1.000000e+00,
+/* 96 1 */ 1.000000e+00,
+/* 96 2 */ 1.000000e+00,
+/* 96 3 */ 1.000000e+00,
+/* 96 4 */ 1.000000e+00,
+/* 96 5 */ 1.000000e+00,
+/* 96 6 */ 1.000000e+00,
+/* 96 7 */ 1.000000e+00,
+/* 96 8 */ 1.000000e+00,
+/* 96 9 */ 1.000000e+00,
+/* 96 10 */ 1.000000e+00,
+/* 96 11 */ 1.000000e+00,
+/* 96 12 */ 1.000000e+00,
+/* 96 13 */ 1.000000e+00,
+/* 96 14 */ 1.000000e+00,
+/* 96 15 */ 1.000000e+00,
+/* 96 16 */ 1.000000e+00,
+/* 96 17 */ 1.000000e+00,
+/* 96 18 */ 1.000000e+00,
+/* 96 19 */ 1.000000e+00,
+/* 96 20 */ 1.000000e+00,
+/* 96 21 */ 1.000000e+00,
+/* 96 22 */ 1.000000e+00,
+/* 96 23 */ 1.000000e+00,
+/* 96 24 */ 1.000000e+00,
+/* 96 25 */ 1.000000e+00,
+/* 96 26 */ 1.000000e+00,
+/* 96 27 */ 1.000000e+00,
+/* 96 28 */ 1.000000e+00,
+/* 96 29 */ 1.000000e+00,
+/* 96 30 */ 1.000000e+00,
+/* 96 31 */ 1.000000e+00,
+/* 96 32 */ 1.000000e+00,
+/* 96 33 */ 9.999982e-01,
+/* 96 34 */ 9.999764e-01,
+/* 96 35 */ 9.984782e-01,
+/* 96 36 */ 9.773127e-01,
+/* 96 37 */ 8.798055e-01,
+/* 96 38 */ 6.793218e-01,
+/* 96 39 */ 4.432273e-01,
+/* 96 40 */ 2.516127e-01,
+/* 96 41 */ 1.279745e-01,
+/* 96 42 */ 5.969636e-02,
+/* 96 43 */ 2.622909e-02,
+/* 96 44 */ 1.099818e-02,
+/* 96 45 */ 4.398182e-03,
+/* 96 46 */ 1.745455e-03,
+/* 96 47 */ 6.236364e-04,
+/* 96 48 */ 2.218182e-04,
+/* 96 49 */ 8.363636e-05,
+/* 96 50 */ 2.545455e-05,
+/* 96 51 */ 7.272727e-06,
+/* 96 52 */ 1.818182e-06,
+/* 96 53 */ 1.818182e-06,
+/* 96 54 */ 6.696392e-07,
+/* 96 55 */ 1.681618e-07,
+/* 96 56 */ 4.051297e-08,
+/* 96 57 */ 9.360587e-09,
+/* 96 58 */ 2.073478e-09,
+/* 96 59 */ 4.401612e-10,
+/* 96 60 */ 8.950545e-11,
+/* 96 61 */ 1.742623e-11,
+/* 96 62 */ 3.246706e-12,
+/* 96 63 */ 5.785165e-13,
+/* 96 64 */ 9.852473e-14,
+/* 96 65 */ 1.602616e-14,
+/* 96 66 */ 2.487929e-15,
+/* 96 67 */ 3.683077e-16,
+/* 96 68 */ 5.194626e-17,
+/* 96 69 */ 6.973308e-18,
+/* 96 70 */ 8.900105e-19,
+/* 96 71 */ 1.078722e-19,
+/* 96 72 */ 1.239996e-20,
+/* 96 73 */ 1.349926e-21,
+/* 96 74 */ 1.389636e-22,
+/* 96 75 */ 1.350350e-23,
+/* 96 76 */ 1.236291e-24,
+/* 96 77 */ 1.064166e-25,
+/* 96 78 */ 8.592018e-27,
+/* 96 79 */ 6.489944e-28,
+/* 96 80 */ 4.572678e-29,
+/* 96 81 */ 2.995323e-30,
+/* 96 82 */ 1.817286e-31,
+/* 96 83 */ 1.016804e-32,
+/* 96 84 */ 5.220649e-34,
+/* 96 85 */ 2.445493e-35,
+/* 96 86 */ 1.037994e-36,
+/* 96 87 */ 3.959693e-38,
+/* 96 88 */ 1.344180e-39,
+/* 96 89 */ 4.010897e-41,
+/* 96 90 */ 1.035684e-42,
+/* 96 91 */ 2.267316e-44,
+/* 96 92 */ 4.091775e-46,
+/* 96 93 */ 5.844501e-48,
+/* 96 94 */ 6.194970e-50,
+/* 96 95 */ 4.331937e-52,
+/* 96 96 */ 1.498940e-54,
+/* 97 0 */ 1.000000e+00,
+/* 97 1 */ 1.000000e+00,
+/* 97 2 */ 1.000000e+00,
+/* 97 3 */ 1.000000e+00,
+/* 97 4 */ 1.000000e+00,
+/* 97 5 */ 1.000000e+00,
+/* 97 6 */ 1.000000e+00,
+/* 97 7 */ 1.000000e+00,
+/* 97 8 */ 1.000000e+00,
+/* 97 9 */ 1.000000e+00,
+/* 97 10 */ 1.000000e+00,
+/* 97 11 */ 1.000000e+00,
+/* 97 12 */ 1.000000e+00,
+/* 97 13 */ 1.000000e+00,
+/* 97 14 */ 1.000000e+00,
+/* 97 15 */ 1.000000e+00,
+/* 97 16 */ 1.000000e+00,
+/* 97 17 */ 1.000000e+00,
+/* 97 18 */ 1.000000e+00,
+/* 97 19 */ 1.000000e+00,
+/* 97 20 */ 1.000000e+00,
+/* 97 21 */ 1.000000e+00,
+/* 97 22 */ 1.000000e+00,
+/* 97 23 */ 1.000000e+00,
+/* 97 24 */ 1.000000e+00,
+/* 97 25 */ 1.000000e+00,
+/* 97 26 */ 1.000000e+00,
+/* 97 27 */ 1.000000e+00,
+/* 97 28 */ 1.000000e+00,
+/* 97 29 */ 1.000000e+00,
+/* 97 30 */ 1.000000e+00,
+/* 97 31 */ 1.000000e+00,
+/* 97 32 */ 1.000000e+00,
+/* 97 33 */ 9.999982e-01,
+/* 97 34 */ 9.999873e-01,
+/* 97 35 */ 9.994655e-01,
+/* 97 36 */ 9.893491e-01,
+/* 97 37 */ 9.243073e-01,
+/* 97 38 */ 7.551709e-01,
+/* 97 39 */ 5.215800e-01,
+/* 97 40 */ 3.095800e-01,
+/* 97 41 */ 1.632655e-01,
+/* 97 42 */ 7.875273e-02,
+/* 97 43 */ 3.541091e-02,
+/* 97 44 */ 1.515455e-02,
+/* 97 45 */ 6.174545e-03,
+/* 97 46 */ 2.432727e-03,
+/* 97 47 */ 9.418182e-04,
+/* 97 48 */ 3.345455e-04,
+/* 97 49 */ 1.290909e-04,
+/* 97 50 */ 4.545455e-05,
+/* 97 51 */ 1.272727e-05,
+/* 97 52 */ 3.636364e-06,
+/* 97 53 */ 3.636364e-06,
+/* 97 54 */ 1.165628e-06,
+/* 97 55 */ 2.996145e-07,
+/* 97 56 */ 7.392618e-08,
+/* 97 57 */ 1.750409e-08,
+/* 97 58 */ 3.975984e-09,
+/* 97 59 */ 8.660753e-10,
+/* 97 60 */ 1.808412e-10,
+/* 97 61 */ 3.618065e-11,
+/* 97 62 */ 6.932340e-12,
+/* 97 63 */ 1.271378e-12,
+/* 97 64 */ 2.230515e-13,
+/* 97 65 */ 3.741038e-14,
+/* 97 66 */ 5.994193e-15,
+/* 97 67 */ 9.168284e-16,
+/* 97 68 */ 1.337523e-16,
+/* 97 69 */ 1.859408e-17,
+/* 97 70 */ 2.460799e-18,
+/* 97 71 */ 3.096948e-19,
+/* 97 72 */ 3.701967e-20,
+/* 97 73 */ 4.197663e-21,
+/* 97 74 */ 4.508584e-22,
+/* 97 75 */ 4.579841e-23,
+/* 97 76 */ 4.392273e-24,
+/* 97 77 */ 3.969448e-25,
+/* 97 78 */ 3.373309e-26,
+/* 97 79 */ 2.689355e-27,
+/* 97 80 */ 2.006170e-28,
+/* 97 81 */ 1.396167e-29,
+/* 97 82 */ 9.034712e-31,
+/* 97 83 */ 5.415782e-32,
+/* 97 84 */ 2.994357e-33,
+/* 97 85 */ 1.519425e-34,
+/* 97 86 */ 7.035069e-36,
+/* 97 87 */ 2.951896e-37,
+/* 97 88 */ 1.113342e-38,
+/* 97 89 */ 3.737146e-40,
+/* 97 90 */ 1.102792e-41,
+/* 97 91 */ 2.816444e-43,
+/* 97 92 */ 6.099007e-45,
+/* 97 93 */ 1.088886e-46,
+/* 97 94 */ 1.538832e-48,
+/* 97 95 */ 1.614003e-50,
+/* 97 96 */ 1.116904e-52,
+/* 97 97 */ 3.825014e-55,
+/* 98 0 */ 1.000000e+00,
+/* 98 1 */ 1.000000e+00,
+/* 98 2 */ 1.000000e+00,
+/* 98 3 */ 1.000000e+00,
+/* 98 4 */ 1.000000e+00,
+/* 98 5 */ 1.000000e+00,
+/* 98 6 */ 1.000000e+00,
+/* 98 7 */ 1.000000e+00,
+/* 98 8 */ 1.000000e+00,
+/* 98 9 */ 1.000000e+00,
+/* 98 10 */ 1.000000e+00,
+/* 98 11 */ 1.000000e+00,
+/* 98 12 */ 1.000000e+00,
+/* 98 13 */ 1.000000e+00,
+/* 98 14 */ 1.000000e+00,
+/* 98 15 */ 1.000000e+00,
+/* 98 16 */ 1.000000e+00,
+/* 98 17 */ 1.000000e+00,
+/* 98 18 */ 1.000000e+00,
+/* 98 19 */ 1.000000e+00,
+/* 98 20 */ 1.000000e+00,
+/* 98 21 */ 1.000000e+00,
+/* 98 22 */ 1.000000e+00,
+/* 98 23 */ 1.000000e+00,
+/* 98 24 */ 1.000000e+00,
+/* 98 25 */ 1.000000e+00,
+/* 98 26 */ 1.000000e+00,
+/* 98 27 */ 1.000000e+00,
+/* 98 28 */ 1.000000e+00,
+/* 98 29 */ 1.000000e+00,
+/* 98 30 */ 1.000000e+00,
+/* 98 31 */ 1.000000e+00,
+/* 98 32 */ 1.000000e+00,
+/* 98 33 */ 9.999982e-01,
+/* 98 34 */ 9.999982e-01,
+/* 98 35 */ 9.998291e-01,
+/* 98 36 */ 9.954018e-01,
+/* 98 37 */ 9.559018e-01,
+/* 98 38 */ 8.228018e-01,
+/* 98 39 */ 6.024091e-01,
+/* 98 40 */ 3.748891e-01,
+/* 98 41 */ 2.062673e-01,
+/* 98 42 */ 1.021473e-01,
+/* 98 43 */ 4.720727e-02,
+/* 98 44 */ 2.056909e-02,
+/* 98 45 */ 8.587273e-03,
+/* 98 46 */ 3.423636e-03,
+/* 98 47 */ 1.374545e-03,
+/* 98 48 */ 4.818182e-04,
+/* 98 49 */ 1.836364e-04,
+/* 98 50 */ 7.090909e-05,
+/* 98 51 */ 2.363636e-05,
+/* 98 52 */ 7.272727e-06,
+/* 98 53 */ 1.818182e-06,
+/* 98 54 */ 1.818182e-06,
+/* 98 55 */ 5.267047e-07,
+/* 98 56 */ 1.330220e-07,
+/* 98 57 */ 3.225799e-08,
+/* 98 58 */ 7.508939e-09,
+/* 98 59 */ 1.677266e-09,
+/* 98 60 */ 3.593731e-10,
+/* 98 61 */ 7.382976e-11,
+/* 98 62 */ 1.453660e-11,
+/* 98 63 */ 2.741727e-12,
+/* 98 64 */ 4.950843e-13,
+/* 98 65 */ 8.554002e-14,
+/* 98 66 */ 1.413230e-14,
+/* 98 67 */ 2.231013e-15,
+/* 98 68 */ 3.362806e-16,
+/* 98 69 */ 4.835559e-17,
+/* 98 70 */ 6.627328e-18,
+/* 98 71 */ 8.648544e-19,
+/* 98 72 */ 1.073461e-19,
+/* 98 73 */ 1.265758e-20,
+/* 98 74 */ 1.416022e-21,
+/* 98 75 */ 1.500800e-22,
+/* 98 76 */ 1.504624e-23,
+/* 98 77 */ 1.424407e-24,
+/* 98 78 */ 1.270905e-25,
+/* 98 79 */ 1.066465e-26,
+/* 98 80 */ 8.396791e-28,
+/* 98 81 */ 6.186907e-29,
+/* 98 82 */ 4.253515e-30,
+/* 98 83 */ 2.719524e-31,
+/* 98 84 */ 1.610901e-32,
+/* 98 85 */ 8.802389e-34,
+/* 98 86 */ 4.414932e-35,
+/* 98 87 */ 2.020777e-36,
+/* 98 88 */ 8.383250e-38,
+/* 98 89 */ 3.126483e-39,
+/* 98 90 */ 1.037857e-40,
+/* 98 91 */ 3.029097e-42,
+/* 98 92 */ 7.652349e-44,
+/* 98 93 */ 1.639369e-45,
+/* 98 94 */ 2.895834e-47,
+/* 98 95 */ 4.049526e-49,
+/* 98 96 */ 4.203260e-51,
+/* 98 97 */ 2.878812e-53,
+/* 98 98 */ 9.758684e-56,
+/* 99 0 */ 1.000000e+00,
+/* 99 1 */ 1.000000e+00,
+/* 99 2 */ 1.000000e+00,
+/* 99 3 */ 1.000000e+00,
+/* 99 4 */ 1.000000e+00,
+/* 99 5 */ 1.000000e+00,
+/* 99 6 */ 1.000000e+00,
+/* 99 7 */ 1.000000e+00,
+/* 99 8 */ 1.000000e+00,
+/* 99 9 */ 1.000000e+00,
+/* 99 10 */ 1.000000e+00,
+/* 99 11 */ 1.000000e+00,
+/* 99 12 */ 1.000000e+00,
+/* 99 13 */ 1.000000e+00,
+/* 99 14 */ 1.000000e+00,
+/* 99 15 */ 1.000000e+00,
+/* 99 16 */ 1.000000e+00,
+/* 99 17 */ 1.000000e+00,
+/* 99 18 */ 1.000000e+00,
+/* 99 19 */ 1.000000e+00,
+/* 99 20 */ 1.000000e+00,
+/* 99 21 */ 1.000000e+00,
+/* 99 22 */ 1.000000e+00,
+/* 99 23 */ 1.000000e+00,
+/* 99 24 */ 1.000000e+00,
+/* 99 25 */ 1.000000e+00,
+/* 99 26 */ 1.000000e+00,
+/* 99 27 */ 1.000000e+00,
+/* 99 28 */ 1.000000e+00,
+/* 99 29 */ 1.000000e+00,
+/* 99 30 */ 1.000000e+00,
+/* 99 31 */ 1.000000e+00,
+/* 99 32 */ 1.000000e+00,
+/* 99 33 */ 9.999982e-01,
+/* 99 34 */ 9.999982e-01,
+/* 99 35 */ 9.999509e-01,
+/* 99 36 */ 9.982255e-01,
+/* 99 37 */ 9.766164e-01,
+/* 99 38 */ 8.793091e-01,
+/* 99 39 */ 6.818582e-01,
+/* 99 40 */ 4.474327e-01,
+/* 99 41 */ 2.563855e-01,
+/* 99 42 */ 1.315418e-01,
+/* 99 43 */ 6.242545e-02,
+/* 99 44 */ 2.772000e-02,
+/* 99 45 */ 1.168909e-02,
+/* 99 46 */ 4.869091e-03,
+/* 99 47 */ 1.847273e-03,
+/* 99 48 */ 7.490909e-04,
+/* 99 49 */ 2.781818e-04,
+/* 99 50 */ 1.109091e-04,
+/* 99 51 */ 3.454545e-05,
+/* 99 52 */ 9.090909e-06,
+/* 99 53 */ 3.636364e-06,
+/* 99 54 */ 3.399340e-06,
+/* 99 55 */ 9.139701e-07,
+/* 99 56 */ 2.361419e-07,
+/* 99 57 */ 5.861544e-08,
+/* 99 58 */ 1.397429e-08,
+/* 99 59 */ 3.198841e-09,
+/* 99 60 */ 7.028326e-10,
+/* 99 61 */ 1.481641e-10,
+/* 99 62 */ 2.995602e-11,
+/* 99 63 */ 5.805985e-12,
+/* 99 64 */ 1.078201e-12,
+/* 99 65 */ 1.917417e-13,
+/* 99 66 */ 3.263364e-14,
+/* 99 67 */ 5.312044e-15,
+/* 99 68 */ 8.264092e-16,
+/* 99 69 */ 1.227802e-16,
+/* 99 70 */ 1.740577e-17,
+/* 99 71 */ 2.352283e-18,
+/* 99 72 */ 3.027479e-19,
+/* 99 73 */ 3.706736e-20,
+/* 99 74 */ 4.312225e-21,
+/* 99 75 */ 4.760386e-22,
+/* 99 76 */ 4.979561e-23,
+/* 99 77 */ 4.927930e-24,
+/* 99 78 */ 4.605854e-25,
+/* 99 79 */ 4.057863e-26,
+/* 99 80 */ 3.362842e-27,
+/* 99 81 */ 2.615259e-28,
+/* 99 82 */ 1.903623e-29,
+/* 99 83 */ 1.293075e-30,
+/* 99 84 */ 8.169561e-32,
+/* 99 85 */ 4.782606e-33,
+/* 99 86 */ 2.583121e-34,
+/* 99 87 */ 1.280779e-35,
+/* 99 88 */ 5.796027e-37,
+/* 99 89 */ 2.377613e-38,
+/* 99 90 */ 8.769106e-40,
+/* 99 91 */ 2.879119e-41,
+/* 99 92 */ 8.312080e-43,
+/* 99 93 */ 2.077380e-44,
+/* 99 94 */ 4.403236e-46,
+/* 99 95 */ 7.696459e-48,
+/* 99 96 */ 1.065101e-49,
+/* 99 97 */ 1.094180e-51,
+/* 99 98 */ 7.417834e-54,
+/* 99 99 */ 2.489206e-56,
+/* 100 0 */ 1.000000e+00,
+/* 100 1 */ 1.000000e+00,
+/* 100 2 */ 1.000000e+00,
+/* 100 3 */ 1.000000e+00,
+/* 100 4 */ 1.000000e+00,
+/* 100 5 */ 1.000000e+00,
+/* 100 6 */ 1.000000e+00,
+/* 100 7 */ 1.000000e+00,
+/* 100 8 */ 1.000000e+00,
+/* 100 9 */ 1.000000e+00,
+/* 100 10 */ 1.000000e+00,
+/* 100 11 */ 1.000000e+00,
+/* 100 12 */ 1.000000e+00,
+/* 100 13 */ 1.000000e+00,
+/* 100 14 */ 1.000000e+00,
+/* 100 15 */ 1.000000e+00,
+/* 100 16 */ 1.000000e+00,
+/* 100 17 */ 1.000000e+00,
+/* 100 18 */ 1.000000e+00,
+/* 100 19 */ 1.000000e+00,
+/* 100 20 */ 1.000000e+00,
+/* 100 21 */ 1.000000e+00,
+/* 100 22 */ 1.000000e+00,
+/* 100 23 */ 1.000000e+00,
+/* 100 24 */ 1.000000e+00,
+/* 100 25 */ 1.000000e+00,
+/* 100 26 */ 1.000000e+00,
+/* 100 27 */ 1.000000e+00,
+/* 100 28 */ 1.000000e+00,
+/* 100 29 */ 1.000000e+00,
+/* 100 30 */ 1.000000e+00,
+/* 100 31 */ 1.000000e+00,
+/* 100 32 */ 1.000000e+00,
+/* 100 33 */ 1.000000e+00,
+/* 100 34 */ 9.999982e-01,
+/* 100 35 */ 9.999873e-01,
+/* 100 36 */ 9.993691e-01,
+/* 100 37 */ 9.888091e-01,
+/* 100 38 */ 9.235400e-01,
+/* 100 39 */ 7.562327e-01,
+/* 100 40 */ 5.248073e-01,
+/* 100 41 */ 3.143236e-01,
+/* 100 42 */ 1.679527e-01,
+/* 100 43 */ 8.159091e-02,
+/* 100 44 */ 3.699455e-02,
+/* 100 45 */ 1.610727e-02,
+/* 100 46 */ 6.689091e-03,
+/* 100 47 */ 2.636364e-03,
+/* 100 48 */ 1.078182e-03,
+/* 100 49 */ 4.018182e-04,
+/* 100 50 */ 1.472727e-04,
+/* 100 51 */ 6.000000e-05,
+/* 100 52 */ 9.090909e-06,
+/* 100 53 */ 3.636364e-06,
+/* 100 54 */ 1.818182e-06,
+/* 100 55 */ 1.566172e-06,
+/* 100 56 */ 4.137515e-07,
+/* 100 57 */ 1.050673e-07,
+/* 100 58 */ 2.563978e-08,
+/* 100 59 */ 6.011147e-09,
+/* 100 60 */ 1.353504e-09,
+/* 100 61 */ 2.925965e-10,
+/* 100 62 */ 6.070414e-11,
+/* 100 63 */ 1.208155e-11,
+/* 100 64 */ 2.305576e-12,
+/* 100 65 */ 4.216651e-13,
+/* 100 66 */ 7.386612e-14,
+/* 100 67 */ 1.238651e-14,
+/* 100 68 */ 1.986969e-15,
+/* 100 69 */ 3.046910e-16,
+/* 100 70 */ 4.462873e-17,
+/* 100 71 */ 6.238579e-18,
+/* 100 72 */ 8.315159e-19,
+/* 100 73 */ 1.055676e-19,
+/* 100 74 */ 1.275228e-20,
+/* 100 75 */ 1.463930e-21,
+/* 100 76 */ 1.594991e-22,
+/* 100 77 */ 1.646936e-23,
+/* 100 78 */ 1.609128e-24,
+/* 100 79 */ 1.485065e-25,
+/* 100 80 */ 1.292139e-26,
+/* 100 81 */ 1.057696e-27,
+/* 100 82 */ 8.125980e-29,
+/* 100 83 */ 5.844013e-30,
+/* 100 84 */ 3.922698e-31,
+/* 100 85 */ 2.449347e-32,
+/* 100 86 */ 1.417312e-33,
+/* 100 87 */ 7.567497e-35,
+/* 100 88 */ 3.709746e-36,
+/* 100 89 */ 1.660037e-37,
+/* 100 90 */ 6.734411e-39,
+/* 100 91 */ 2.456615e-40,
+/* 100 92 */ 7.978409e-42,
+/* 100 93 */ 2.278723e-43,
+/* 100 94 */ 5.634718e-45,
+/* 100 95 */ 1.181819e-46,
+/* 100 96 */ 2.044278e-48,
+/* 100 97 */ 2.799988e-50,
+/* 100 98 */ 2.847185e-52,
+/* 100 99 */ 1.910777e-54,
+/* 100 100 */ 6.348098e-57
+};
diff --git a/Align/smith_waterman.cpp b/Align/smith_waterman.cpp
new file mode 100644
index 0000000..01349dc
--- /dev/null
+++ b/Align/smith_waterman.cpp
@@ -0,0 +1,290 @@
+//////////////////////////////////////////////////////////////////////////////
+// Smith_waterman implementation, with modification, to find sequence overlap
+//
+// Written by Rong She (rshe at bcgsc.ca)
+// Last modified: Jul 7, 2010
+//////////////////////////////////////////////////////////////////////////////
+
+#include "smith_waterman.h"
+#include "Sequence.h"
+#include <algorithm>
+#include <cassert>
+#include <cctype>
+#include <cfloat> // for DBL_MAX
+#include <iostream>
+
+using namespace std;
+
+/** The score of a match. */
+static const int MATCH_SCORE = 5;
+
+/** The score of a mismatch. */
+static const int MISMATCH_SCORE = -4;
+
+/** gap open penalty */
+static const int GAP_OPEN_SCORE = -12;
+
+/** gap extend penalty */
+static const int GAP_EXTEND_SCORE = -4;
+
+/** Print the specified alignment. */
+static ostream& printAlignment(ostream& out,
+ const string& aseq, const string& bseq,
+ unsigned alignPos[], SMAlignment align)
+{
+ unsigned astart = alignPos[0], aend = alignPos[1] + 1;
+ unsigned bstart = alignPos[2], bend = alignPos[3] + 1;
+ assert(aend == aseq.size());
+ assert(bstart == 0);
+ (void)aend; (void)bstart;
+ out << aseq.substr(0, astart) << align.query_align << '\n'
+ << string(astart, ' ');
+ for (unsigned i = 0; i < align.match_align.size(); i++) {
+ char a = align.query_align[i],
+ b = align.target_align[i],
+ c = align.match_align[i];
+ out << (c == a || c == b ? '.' : c);
+ }
+ return out << '\n' << string(astart, ' ')
+ << align.target_align << bseq.substr(bend) << '\n';
+}
+
+/** Index comparison functor. */
+template<class T>
+struct index_cmp {
+ const T arr;
+ index_cmp(const T arr) : arr(arr) {}
+ bool operator()(const int a, const int b) const { return arr[a] > arr[b]; }
+};
+
+/** Return whether the characters a and b match.
+ * @param c [out] the consensus character
+ */
+static bool isMatch(char a, char b, char& c)
+{
+ if (a == b) {
+ c = a;
+ } else if (toupper(a) == toupper(b)) {
+ c = islower(a) || islower(b) ? tolower(a) : a;
+ } else if (a == 'N' || a == 'n') {
+ c = b;
+ } else if (b == 'N' || b == 'n') {
+ c = a;
+ } else {
+ c = ambiguityOr(a, b);
+ return ambiguityIsSubset(a, b);
+ }
+ return true;
+}
+
+/** Return the score of the alignment of a and b. */
+static int matchScore(const char a, const char b)
+{
+ char consensus;
+ return isMatch(a, b, consensus) ? MATCH_SCORE : MISMATCH_SCORE;
+}
+
+/** Return the score of a gap, either newly opened or extended. */
+static int gapScore(bool prev_is_gap)
+{
+ return prev_is_gap ? GAP_EXTEND_SCORE : GAP_OPEN_SCORE;
+}
+
+//the backtrack step in smith_waterman
+unsigned Backtrack(const int i_max, const int j_max, int** I_i, int** I_j,
+ const string& seq_a, const string& seq_b, SMAlignment& align, unsigned* align_pos)
+{
+ // Backtracking from H_max
+ int current_i=i_max,current_j=j_max;
+ int next_i=I_i[current_i][current_j];
+ int next_j=I_j[current_i][current_j];
+ string consensus_a(""), consensus_b(""), match("");
+ unsigned num_of_match = 0;
+ while(((current_i!=next_i) || (current_j!=next_j)) && (next_j!=0) && (next_i!=0)){
+ if(next_i==current_i) {
+ consensus_a += '-'; //deletion in A
+ match += tolower(seq_b[current_j-1]);
+ consensus_b += seq_b[current_j-1]; //b must be some actual char, cannot be '-' aligns with '-'!
+ }
+ else {
+ consensus_a += seq_a[current_i-1]; // match/mismatch in A
+ if(next_j==current_j) {
+ consensus_b += '-'; // deletion in B
+ match += tolower(seq_a[current_i-1]);
+ }
+ else {
+ consensus_b += seq_b[current_j-1]; // match/mismatch in B
+ char consensus_char;
+ if (isMatch(seq_a[current_i-1], seq_b[current_j-1],
+ consensus_char)) {
+ match += consensus_char;
+ num_of_match++;
+ }
+ else {
+ match += ambiguityOr(
+ seq_a[current_i-1], seq_b[current_j-1]);
+ }
+ }
+ }
+
+ current_i = next_i;
+ current_j = next_j;
+ next_i=I_i[current_i][current_j];
+ next_j=I_j[current_i][current_j];
+ }
+
+ //check whether the alignment is what we want (pinned at the ends), modified version of SW (i_max is already fixed)
+ if (current_j > 1)
+ return 0;
+
+ //record the last one
+ consensus_a += seq_a[current_i-1];
+ consensus_b += seq_b[current_j-1];
+ char consensus_char;
+ if (isMatch(seq_a[current_i-1], seq_b[current_j-1],
+ consensus_char)) {
+ match += consensus_char;
+ num_of_match++;
+ }
+ else {
+ match += ambiguityOr(seq_a[current_i-1], seq_b[current_j-1]);
+ }
+ align_pos[0] = current_i-1;
+ align_pos[2] = current_j-1;
+
+ align_pos[1] = i_max-1;
+ align_pos[3] = j_max-1;
+
+ reverse(consensus_a.begin(), consensus_a.end());
+ reverse(consensus_b.begin(), consensus_b.end());
+ reverse(match.begin(), match.end());
+ align.query_align = consensus_a;
+ align.match_align = match;
+ align.target_align = consensus_b;
+
+ return num_of_match;
+}
+
+/* This is the Smith-Waterman algorithm (a variation of
+ * Needleman-Wunsch algorithm), finds one optimal local alignment
+ * Modified to find overlap of seq_a and seq_b (alignment that is
+ * pinned at the end of seq_a and beginning of seq_b).
+ * Actually, this should be a variation of needleman algorithm, that
+ * looks for a global alignment, but without penalizing overhangs...
+ * and make sure the alignment is end-to-end (end of seqA to beginning
+ * of seqB).
+ */
+void alignOverlap(const string& seq_a, const string& seq_b, unsigned seq_a_start_pos,
+ vector<overlap_align>& overlaps, bool multi_align, bool verbose)
+{
+ // get the actual lengths of the sequences
+ int N_a = seq_a.length();
+ int N_b = seq_b.length();
+
+ // initialize H
+ int i, j;
+ double** H;
+ int **I_i, **I_j;
+ H = new double*[N_a+1];
+ I_i = new int*[N_a+1];
+ I_j = new int*[N_a+1];
+ bool** V = new bool*[N_a+1];
+
+ for(i=0;i<=N_a;i++){
+ H[i] = new double[N_b+1];
+ I_i[i] = new int[N_b+1];
+ I_j[i] = new int[N_b+1];
+ H[i][0]=0; //only need to initialize first row and first column
+ I_i[i][0] = i-1;
+ V[i] = new bool[N_b+1];
+ V[i][0] = true; //valid start
+ }
+
+ for (j = 0; j <= N_b; j++) {
+ H[0][j] = 0; //initialize first column
+ I_j[0][j] = j-1;
+ V[0][j] = false; //wrong start, not overlap
+ }
+ V[0][0] = true;
+
+ for(i=1;i<=N_a;i++){
+ for(j=1;j<=N_b;j++){
+ char a = seq_a[i-1], b = seq_b[j-1];
+ double scores[3] = {
+ V[i-1][j-1] ? H[i-1][j-1] + matchScore(a, b)
+ : -DBL_MAX, // match or mismatch
+ V[i-1][j] ? H[i-1][j] + gapScore(I_j[i-1][j] == j)
+ : -DBL_MAX, // deletion in sequence A
+ V[i][j-1] ? H[i][j-1] + gapScore(I_i[i][j-1] == i)
+ : -DBL_MAX // deletion in sequence B
+ };
+ double* pMax = max_element(scores, scores + 3);
+ H[i][j] = *pMax;
+ switch (pMax - scores) {
+ case 0: // match or mismatch
+ I_i[i][j] = i-1;
+ I_j[i][j] = j-1;
+ break;
+ case 1: // deletion in sequence A
+ I_i[i][j] = i-1;
+ I_j[i][j] = j;
+ break;
+ case 2: // deletion in sequence B
+ I_i[i][j] = i;
+ I_j[i][j] = j-1;
+ break;
+ }
+ V[i][j] = H[i][j] == -DBL_MAX ? false : true;
+ }
+ }
+
+ // search H for the maximal score
+ unsigned num_of_match = 0;
+ double H_max = 0.;
+ int i_max=N_a, j_max;
+ int* j_max_indexes=new int[N_b]; //this array holds the index of j_max in H[N_a]
+ for (j=0; j<N_b; j++)
+ j_max_indexes[j]=j+1;
+
+ //sort H[N_a], store the sorted index in j_max_indexes
+ sort(j_max_indexes, j_max_indexes+N_b, index_cmp<double*>(H[N_a]));
+
+ //find ALL overlap alignments, starting from the highest score j_max
+ j = 0;
+ bool found = false;
+ while (j < N_b) {
+ j_max = j_max_indexes[j];
+ H_max = H[N_a][j_max];
+ if (H_max == 0)
+ break;
+
+ SMAlignment align;
+ unsigned align_pos[4];
+ num_of_match = Backtrack(i_max, j_max, I_i, I_j, seq_a, seq_b, align, align_pos);
+ if (num_of_match) {
+ overlaps.push_back(overlap_align(seq_a_start_pos+align_pos[0], align_pos[3], align.match_align, num_of_match));
+ if (!found) {
+ if (verbose)
+ printAlignment(cerr, seq_a, seq_b,
+ align_pos, align);
+ found = true;
+ if (!multi_align
+ || (j+1 < N_b
+ && H[N_a][j_max_indexes[j+1]] < H_max))
+ break;
+ }
+ }
+ j++;
+ }
+ delete [] j_max_indexes;
+ for(i=0;i<=N_a;i++){
+ delete [] H[i];
+ delete [] I_i[i];
+ delete [] I_j[i];
+ delete [] V[i];
+ }
+ delete [] H;
+ delete [] I_i;
+ delete [] I_j;
+ delete [] V;
+}
diff --git a/Align/smith_waterman.h b/Align/smith_waterman.h
new file mode 100644
index 0000000..61fe9c5
--- /dev/null
+++ b/Align/smith_waterman.h
@@ -0,0 +1,59 @@
+//////////////////////////////////////////////////////////////////////////////
+// Smith_waterman header
+//
+// Written by Rong She (rshe at bcgsc.ca)
+// Last modified: Jul 6, 2010
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef SMITH_WATERMAN_H
+#define SMITH_WATERMAN_H
+
+#include <string>
+#include <iostream>
+#include <vector>
+using namespace std;
+
+/* a simple data structure to store alignment sequences */
+struct SMAlignment {
+ string query_align;
+ string target_align;
+ string match_align;
+
+ SMAlignment() {}
+
+ friend ostream& operator<<(ostream& os, const SMAlignment& align)
+ {
+ os << "query:" << align.query_align << endl;
+ os << "match:" << align.match_align << endl;
+ os << "targt:" << align.target_align << endl;
+ return os;
+ }
+};
+
+/* overlap alignment between two sequences t and h */
+struct overlap_align {
+ unsigned overlap_t_pos; //overlap on t is from this pos to end of sequence t
+ unsigned overlap_h_pos; //overlap on h is from beginning of sequence h to this pos
+ string overlap_str;
+ unsigned overlap_match;
+
+ overlap_align() : overlap_t_pos(0), overlap_h_pos(0), overlap_str(""), overlap_match(0) {}
+ overlap_align(unsigned t_pos, unsigned h_pos, string& overlap, unsigned num_of_match) :
+ overlap_t_pos(t_pos), overlap_h_pos(h_pos), overlap_str(overlap), overlap_match(num_of_match) {}
+
+ unsigned length() const { return overlap_str.length(); }
+ double pid() const { return (double)overlap_match / overlap_str.length(); }
+
+ friend ostream& operator<<(ostream& os, const overlap_align& align) {
+ os << "overlap region:" << align.overlap_str << endl
+ << "t:" << align.overlap_t_pos << ", h:" << align.overlap_h_pos
+ << ";num_of_match:" << align.overlap_match
+ << ";len:" << align.length() << ";pid:" << align.pid() << endl;
+ return os;
+ }
+};
+
+void alignOverlap(const string& seq_a, const string& seq_b,
+ unsigned seq_a_start_pos, vector<overlap_align>& overlaps, bool multi_align, bool verbose);
+
+#endif /* SMITH_WATERMAN_H */
diff --git a/Assembly/AssemblyAlgorithms.cpp b/Assembly/AssemblyAlgorithms.cpp
new file mode 100644
index 0000000..bd4bfb2
--- /dev/null
+++ b/Assembly/AssemblyAlgorithms.cpp
@@ -0,0 +1,1028 @@
+#include "AssemblyAlgorithms.h"
+#include "Assembly/Options.h"
+#include "Common/Options.h"
+#include "FastaReader.h"
+#include "FastaWriter.h"
+#include "Histogram.h"
+#include "IOUtil.h"
+#include "Log.h"
+#include "SequenceCollection.h"
+#include "StringUtil.h"
+#include "Timer.h"
+#include <algorithm>
+#include <cctype>
+#include <climits> // for UINT_MAX
+#include <cmath>
+#include <iostream>
+#include <sstream>
+#include <vector>
+
+using namespace std;
+
+namespace AssemblyAlgorithms
+{
+
+/** Return the kmer which are adjacent to this kmer. */
+void generateSequencesFromExtension(const Kmer& currSeq,
+ extDirection dir, SeqExt extension, vector<Kmer>& outseqs)
+{
+ vector<Kmer> extensions;
+ Kmer extSeq(currSeq);
+ extSeq.shift(dir);
+
+ // Check for the existance of the 4 possible extensions
+ for (unsigned i = 0; i < NUM_BASES; i++) {
+ // Does this sequence have an extension?
+ if(extension.checkBase(i))
+ {
+ extSeq.setLastBase(dir, i);
+ outseqs.push_back(extSeq);
+ }
+ }
+}
+
+/** Load k-mer with coverage data.
+ * @return the number of k-mer loaded
+ */
+static size_t loadKmer(ISequenceCollection& g, FastaReader& in)
+{
+ assert(opt::rank == -1);
+ size_t count = 0;
+ for (FastaRecord rec; in >> rec;) {
+ assert(rec.seq.size() == opt::kmerSize);
+ istringstream iss(rec.id);
+ float coverage = 1;
+ iss >> coverage;
+ assert(iss);
+ assert(iss.eof());
+ g.add(Kmer(rec.seq), max(1, (int)ceilf(coverage)));
+
+ if (++count % 1000000 == 0) {
+ logger(1) << "Read " << count << " k-mer. ";
+ g.printLoad();
+ }
+ g.pumpNetwork();
+ }
+ assert(in.eof());
+ return count;
+}
+
+/** Load sequence data into the collection. */
+void loadSequences(ISequenceCollection* seqCollection, string inFile)
+{
+ Timer timer("LoadSequences " + inFile);
+
+ logger(0) << "Reading `" << inFile << "'...\n";
+
+ if (inFile.find(".kmer") != string::npos) {
+ if (opt::rank <= 0)
+ seqCollection->setColourSpace(false);
+ seqCollection->load(inFile.c_str());
+ return;
+ }
+
+ size_t count = 0, count_good = 0,
+ count_small = 0, count_nonACGT = 0;
+ FastaReader reader(inFile.c_str(), FastaReader::FOLD_CASE);
+ if (endsWith(inFile, ".jf") || endsWith(inFile, ".jfq")) {
+ // Load k-mer with coverage data.
+ count = loadKmer(*seqCollection, reader);
+ count_good = count;
+ } else
+ for (Sequence seq; reader >> seq;) {
+ size_t len = seq.length();
+ if (opt::kmerSize > len) {
+ count_small++;
+ continue;
+ }
+
+ if (opt::rank <= 0
+ && count == 0 && seqCollection->empty()) {
+ // Detect colour-space reads.
+ bool colourSpace
+ = seq.find_first_of("0123") != string::npos;
+ seqCollection->setColourSpace(colourSpace);
+ if (colourSpace)
+ cout << "Colour-space assembly\n";
+ }
+
+ if (isalnum(seq[0])) {
+ if (opt::colourSpace)
+ assert(isdigit(seq[0]));
+ else
+ assert(isalpha(seq[0]));
+ }
+
+ bool good = seq.find_first_not_of("ACGT0123") == string::npos;
+ bool discarded = true;
+ for (unsigned i = 0; i < len - opt::kmerSize + 1; i++) {
+ Sequence kmer(seq, i, opt::kmerSize);
+ if (good || kmer.find_first_not_of("ACGT0123")
+ == string::npos) {
+ seqCollection->add(Kmer(kmer));
+ discarded = false;
+ }
+ }
+ if (discarded)
+ count_nonACGT++;
+ else
+ count_good++;
+
+ if (++count % 100000 == 0) {
+ logger(1) << "Read " << count << " reads. ";
+ seqCollection->printLoad();
+ }
+ seqCollection->pumpNetwork();
+ }
+ assert(reader.eof());
+
+ logger(1) << "Read " << count << " reads. ";
+ seqCollection->printLoad();
+
+ if (count_small > 0)
+ cerr << "`" << inFile << "': "
+ "discarded " << count_small << " reads "
+ "shorter than " << opt::kmerSize << " bases\n";
+ if (reader.unchaste() > 0)
+ cerr << "`" << inFile << "': "
+ "discarded " << reader.unchaste() << " unchaste reads\n";
+ if (count_nonACGT > 0)
+ cerr << "`" << inFile << "': "
+ "discarded " << count_nonACGT << " reads "
+ "containing non-ACGT characters\n";
+ if (count_good == 0)
+ cerr << "warning: `" << inFile << "': "
+ "contains no usable sequence\n";
+
+ if (opt::rank <= 0 && count == 0 && seqCollection->empty()) {
+ /* The master process did not load any data, which means that
+ * it hasn't told the slave processes whether this assembly is
+ * in colour-space. Rather than fail right now, assume that
+ * the assembly is not colour space. If the assumption is
+ * incorrect, the assembly will fail pretty quickly as soon as
+ * one of the slave processes sees a colour-space read.
+ */
+ assert(!opt::colourSpace);
+ seqCollection->setColourSpace(false);
+ }
+}
+
+/** Generate the adjacency information for each sequence in the
+ * collection. */
+void generateAdjacency(ISequenceCollection* seqCollection)
+{
+ Timer timer("GenerateAdjacency");
+
+ size_t count = 0;
+ size_t numBasesSet = 0;
+ for (ISequenceCollection::iterator iter = seqCollection->begin();
+ iter != seqCollection->end(); ++iter) {
+ if (iter->second.deleted())
+ continue;
+
+ if (++count % 1000000 == 0)
+ logger(1) << "Finding adjacent k-mer: " << count << '\n';
+
+ for (extDirection dir = SENSE; dir <= ANTISENSE; ++dir) {
+ Kmer testSeq(iter->first);
+ uint8_t adjBase = testSeq.shift(dir);
+ for (unsigned i = 0; i < NUM_BASES; i++) {
+ testSeq.setLastBase(dir, i);
+ if (seqCollection->setBaseExtension(
+ testSeq, !dir, adjBase))
+ numBasesSet++;
+ }
+ }
+ seqCollection->pumpNetwork();
+ }
+
+ if (numBasesSet > 0)
+ logger(0) << "Added " << numBasesSet << " edges.\n";
+}
+
+/** Mark the specified vertex and its neighbours.
+ * @return the number of marked edges
+ */
+static size_t markNeighbours(ISequenceCollection* g,
+ const ISequenceCollection::value_type& u, extDirection sense)
+{
+ vector<Kmer> adj;
+ generateSequencesFromExtension(u.first, sense,
+ u.second.getExtension(sense), adj);
+ for (vector<Kmer>::iterator v = adj.begin(); v != adj.end(); ++v)
+ g->mark(*v, !sense);
+ return adj.size();
+}
+
+/** Mark ambiguous branches and branches from palindromes for removal.
+ * @return the number of branches marked
+ */
+size_t markAmbiguous(ISequenceCollection* g)
+{
+ Timer timer(__func__);
+ size_t progress = 0;
+ size_t countv = 0, counte = 0;
+ for (ISequenceCollection::iterator it = g->begin();
+ it != g->end(); ++it) {
+ if (it->second.deleted())
+ continue;
+
+ if (++progress % 1000000 == 0)
+ logger(1) << "Splitting: " << progress << '\n';
+
+ if (it->first.isPalindrome()) {
+ countv += 2;
+ g->mark(it->first);
+ counte += markNeighbours(g, *it, SENSE);
+ } else {
+ for (extDirection sense = SENSE;
+ sense <= ANTISENSE; ++sense) {
+ if (it->second.getExtension(sense).isAmbiguous()
+ || it->first.isPalindrome(sense)) {
+ countv++;
+ g->mark(it->first, sense);
+ counte += markNeighbours(g, *it, sense);
+ }
+ }
+ }
+
+ g->pumpNetwork();
+ }
+ logger(0) << "Marked " << counte << " edges of " << countv
+ << " ambiguous vertices." << endl;
+ return countv;
+}
+
+/** Remove the edges of marked and deleted vertices.
+ * @return the number of branches removed
+ */
+size_t splitAmbiguous(ISequenceCollection* pSC)
+{
+ Timer timer(__func__);
+ size_t count = 0;
+ for (ISequenceCollection::iterator it = pSC->begin();
+ it != pSC->end(); ++it) {
+ if (!it->second.deleted())
+ continue;
+ for (extDirection sense = SENSE;
+ sense <= ANTISENSE; ++sense) {
+ if (it->second.marked(sense)) {
+ removeExtensionsToSequence(pSC, *it, sense);
+ count++;
+ }
+ }
+ pSC->pumpNetwork();
+ }
+ logger(0) << "Split " << count << " ambigiuous branches.\n";
+ return count;
+}
+
+/** Open the bubble file. */
+void openBubbleFile(ofstream& out)
+{
+ if (opt::snpPath.empty())
+ return;
+ string path;
+ if (opt::rank < 0) {
+ path = opt::snpPath;
+ } else {
+ ostringstream s;
+ s << "snp-" << opt::rank << ".fa";
+ path = s.str();
+ }
+ out.open(path.c_str());
+ assert_good(out, path);
+}
+
+/** Pop bubbles. */
+size_t popBubbles(SequenceCollectionHash* seqCollection, ostream& out)
+{
+ Timer timer("PopBubbles");
+ size_t numPopped = 0;
+
+ // Set the cutoffs
+ const unsigned maxNumBranches = 3;
+ const unsigned maxLength = opt::bubbleLen - opt::kmerSize + 1;
+
+ for (ISequenceCollection::iterator iter = seqCollection->begin();
+ iter != seqCollection->end(); ++iter) {
+ if (iter->second.deleted())
+ continue;
+
+ ExtensionRecord extRec = iter->second.extension();
+ for (extDirection dir = SENSE; dir <= ANTISENSE; ++dir) {
+ if (extRec.dir[dir].isAmbiguous()) {
+ // Found a potential bubble, examine each branch
+ bool stop = false;
+
+ // Create the branch group
+ BranchGroup branchGroup(dir, maxNumBranches,
+ iter->first);
+ initiateBranchGroup(branchGroup, iter->first,
+ extRec.dir[dir]);
+
+ // Iterate over the branches
+ while(!stop)
+ {
+ size_t numBranches = branchGroup.size();
+ for (unsigned j = 0; j < numBranches; ++j) {
+ // Get the extensions of this branch
+ ExtensionRecord extRec;
+ int multiplicity = -1;
+
+ const Kmer& lastKmer
+ = branchGroup[j].back().first;
+ bool success = seqCollection->getSeqData(
+ lastKmer, extRec, multiplicity);
+ assert(success);
+ (void)success;
+ processBranchGroupExtension(branchGroup, j,
+ lastKmer, extRec, multiplicity,
+ maxLength);
+ }
+
+ // At this point all branches should have the same
+ // length or one will be a noext.
+ branchGroup.updateStatus(maxLength);
+ BranchGroupStatus status
+ = branchGroup.getStatus();
+ if (status == BGS_TOOLONG
+ || status == BGS_TOOMANYBRANCHES
+ || status == BGS_NOEXT) {
+ stop = true;
+ }
+ else if(status == BGS_JOINED)
+ {
+ static unsigned snpID;
+ writeBubble(out, branchGroup, ++snpID);
+ assert(branchGroup.isAmbiguous(
+ *seqCollection));
+ collapseJoinedBranches(seqCollection,
+ branchGroup);
+ assert(!branchGroup.isAmbiguous(
+ *seqCollection));
+ numPopped++;
+ stop = true;
+ } else
+ assert(status == BGS_ACTIVE);
+ }
+ }
+ }
+ seqCollection->pumpNetwork();
+ }
+
+ if (numPopped > 0)
+ cout << "Removed " << numPopped << " bubbles.\n";
+ return numPopped;
+}
+
+// Populate a branch group with the inital branches from a sequence
+void initiateBranchGroup(BranchGroup& group, const Kmer& seq,
+ const SeqExt& extension)
+{
+ vector<Kmer> extSeqs;
+ generateSequencesFromExtension(seq, group.getDirection(),
+ extension, extSeqs);
+ assert(extSeqs.size() > 1);
+ for (vector<Kmer>::iterator seqIter = extSeqs.begin();
+ seqIter != extSeqs.end(); ++seqIter)
+ group.addBranch(BranchRecord(group.getDirection()), *seqIter);
+}
+
+/** Process an a branch group extension. */
+bool processBranchGroupExtension(BranchGroup& group,
+ size_t branchIndex, const Kmer& seq,
+ ExtensionRecord ext, int multiplicity,
+ unsigned maxLength)
+{
+ BranchRecord& branch = group[branchIndex];
+ branch.setData(make_pair(seq, KmerData(multiplicity, ext)));
+
+ extDirection dir = group.getDirection();
+ if (ext.dir[!dir].isAmbiguous()) {
+ // Check that this fork is due to branches of our bubble
+ // merging back together. If not, stop this bubble.
+ if (branch.size() < 2) {
+ group.setNoExtension();
+ return false;
+ }
+
+ vector<Kmer> extKmer;
+ generateSequencesFromExtension(seq, !dir,
+ ext.dir[!dir], extKmer);
+ assert(extKmer.size() > 1);
+ for (vector<Kmer>::iterator it = extKmer.begin();
+ it != extKmer.end(); ++it) {
+ assert(branch.size() > 1);
+ if (!group.exists(branch.size() - 2, *it)) {
+ group.setNoExtension();
+ return false;
+ }
+ }
+ // Ignore the ambiguity.
+ ext.dir[!dir].clear();
+ }
+
+ if (ext.dir[dir].isAmbiguous()) {
+ // Create a new branch to follow the fork.
+ vector<Kmer> extKmer;
+ generateSequencesFromExtension(seq, dir,
+ ext.dir[dir], extKmer);
+ assert(extKmer.size() > 1);
+ BranchRecord original = branch;
+ vector<Kmer>::iterator it = extKmer.begin();
+ branch.push_back(make_pair(*it++, KmerData()));
+ for (; it != extKmer.end(); ++it)
+ group.addBranch(original, *it);
+ return group.isExtendable();
+ }
+
+ Kmer nextKmer = seq;
+ if (processLinearExtensionForBranch(branch,
+ nextKmer, ext, multiplicity,
+ maxLength, false))
+ branch.push_back(make_pair(nextKmer, KmerData()));
+ else
+ group.setNoExtension();
+ return group.isExtendable();
+}
+
+/** Write a bubble to the specified file. */
+void writeBubble(ostream& out, const BranchGroup& group, unsigned id)
+{
+ if (opt::snpPath.empty())
+ return;
+
+ char allele = 'A';
+ for (BranchGroup::const_iterator it = group.begin();
+ it != group.end(); ++it) {
+ const BranchRecord& currBranch = *it;
+ Sequence contig(currBranch);
+ out << '>' << id << allele++ << ' '
+ << contig.length() << ' '
+ << currBranch.calculateBranchMultiplicity() << '\n'
+ << contig.c_str() << '\n';
+ }
+ assert(out.good());
+}
+
+/** Collapse a bubble to a single path. */
+void collapseJoinedBranches(ISequenceCollection* collection,
+ BranchGroup& group)
+{
+ const BranchRecord& best = group[0];
+ logger(5) << "Popping " << best.size() << ' '
+ << best.front().first << '\n';
+
+ // Add the k-mer from the dead branches.
+ map<Kmer, KmerData> doomed;
+ for (BranchGroup::const_iterator branchIt = group.begin() + 1;
+ branchIt != group.end(); ++branchIt) {
+ const BranchRecord& branch = *branchIt;
+ for (BranchRecord::const_iterator it = branch.begin();
+ it != branch.end(); ++it)
+ doomed.insert(*it);
+ }
+
+ // Remove the k-mer that are in the good branch.
+ for (BranchRecord::const_iterator it = best.begin();
+ it != best.end(); ++it)
+ doomed.erase(it->first);
+
+ // Remove the dead k-mer from the assembly.
+ for (map<Kmer, KmerData>::const_iterator it = doomed.begin();
+ it != doomed.end(); ++it)
+ removeSequenceAndExtensions(collection, *it);
+}
+
+/**
+ * Remove a k-mer and update the extension records of the k-mer that
+ * extend to it.
+ */
+void removeSequenceAndExtensions(ISequenceCollection* seqCollection,
+ const ISequenceCollection::value_type& seq)
+{
+ // This removes the reverse complement as well
+ seqCollection->remove(seq.first);
+ removeExtensionsToSequence(seqCollection, seq, SENSE);
+ removeExtensionsToSequence(seqCollection, seq, ANTISENSE);
+}
+
+/** Remove all the extensions to this sequence. */
+void removeExtensionsToSequence(ISequenceCollection* seqCollection,
+ const ISequenceCollection::value_type& seq, extDirection dir)
+{
+ SeqExt extension(seq.second.getExtension(dir));
+ Kmer testSeq(seq.first);
+ uint8_t extBase = testSeq.shift(dir);
+ for (unsigned i = 0; i < NUM_BASES; i++) {
+ if (extension.checkBase(i)) {
+ testSeq.setLastBase(dir, i);
+ seqCollection->removeExtension(testSeq, !dir, extBase);
+ }
+ }
+}
+
+/** The number of k-mer that have been eroded. */
+static size_t g_numEroded;
+
+/** Return the number of k-mer that have been eroded. */
+size_t getNumEroded()
+{
+ size_t numEroded = g_numEroded;
+ g_numEroded = 0;
+ logger(0) << "Eroded " << numEroded << " tips.\n";
+ return numEroded;
+}
+
+/** Consider the specified k-mer for erosion.
+ * @return the number of k-mer eroded, zero or one
+ */
+size_t erode(ISequenceCollection* c,
+ const ISequenceCollection::value_type& seq)
+{
+ if (seq.second.deleted())
+ return 0;
+ extDirection dir;
+ SeqContiguity contiguity = checkSeqContiguity(seq, dir);
+ if (contiguity == SC_CONTIGUOUS)
+ return 0;
+
+ const KmerData& data = seq.second;
+ if (data.getMultiplicity() < opt::erode
+ || data.getMultiplicity(SENSE) < opt::erodeStrand
+ || data.getMultiplicity(ANTISENSE) < opt::erodeStrand) {
+ removeSequenceAndExtensions(c, seq);
+ g_numEroded++;
+ return 1;
+ } else
+ return 0;
+}
+
+/** The given sequence has changed. */
+static void erosionObserver(ISequenceCollection* c,
+ const ISequenceCollection::value_type& seq)
+{
+ erode(c, seq);
+}
+
+//
+// Erode data off the ends of the graph, one by one
+//
+size_t erodeEnds(ISequenceCollection* seqCollection)
+{
+ Timer erodeEndsTimer("Erode");
+ assert(g_numEroded == 0);
+ seqCollection->attach(erosionObserver);
+
+ for (ISequenceCollection::iterator iter = seqCollection->begin();
+ iter != seqCollection->end(); ++iter) {
+ erode(seqCollection, *iter);
+ seqCollection->pumpNetwork();
+ }
+
+ seqCollection->detach(erosionObserver);
+ return getNumEroded();
+}
+
+static size_t trimSequences(SequenceCollectionHash* seqCollection,
+ unsigned maxBranchCull);
+
+/** Trimming driver function */
+void performTrim(SequenceCollectionHash* seqCollection)
+{
+ if (opt::trimLen == 0)
+ return;
+ unsigned rounds = 0;
+ size_t total = 0;
+ for (unsigned trim = 1; trim < opt::trimLen; trim *= 2) {
+ rounds++;
+ total += trimSequences(seqCollection, trim);
+ }
+ size_t count;
+ while ((count = trimSequences(seqCollection, opt::trimLen)) > 0) {
+ rounds++;
+ total += count;
+ }
+ cout << "Pruned " << total << " tips in "
+ << rounds << " rounds.\n";
+}
+
+/** Return the adjacency of this sequence.
+ * @param considerMarks when true, treat a marked vertex as having
+ * no edges
+ */
+SeqContiguity checkSeqContiguity(
+ const ISequenceCollection::value_type& seq,
+ extDirection& outDir, bool considerMarks)
+{
+ assert(!seq.second.deleted());
+ bool child = seq.second.hasExtension(SENSE)
+ && !(considerMarks && seq.second.marked(SENSE));
+ bool parent = seq.second.hasExtension(ANTISENSE)
+ && !(considerMarks && seq.second.marked(ANTISENSE));
+ if(!child && !parent)
+ {
+ //this sequence is completely isolated
+ return SC_ISLAND;
+ }
+ else if(!child)
+ {
+ outDir = ANTISENSE;
+ return SC_ENDPOINT;
+ }
+ else if(!parent)
+ {
+ outDir = SENSE;
+ return SC_ENDPOINT;
+ }
+ else
+ {
+ // sequence is contiguous
+ return SC_CONTIGUOUS;
+ }
+}
+
+/** Prune tips shorter than maxBranchCull. */
+static size_t trimSequences(SequenceCollectionHash* seqCollection,
+ unsigned maxBranchCull)
+{
+ Timer timer("TrimSequences");
+ cout << "Pruning tips shorter than "
+ << maxBranchCull << " bp...\n";
+ size_t numBranchesRemoved = 0;
+
+ for (ISequenceCollection::iterator iter = seqCollection->begin();
+ iter != seqCollection->end(); ++iter) {
+ if (iter->second.deleted())
+ continue;
+
+ extDirection dir;
+ // dir will be set to the trimming direction if the sequence
+ // can be trimmed.
+ SeqContiguity status = checkSeqContiguity(*iter, dir);
+
+ if (status == SC_CONTIGUOUS)
+ continue;
+ else if(status == SC_ISLAND)
+ {
+ // remove this sequence, it has no extensions
+ seqCollection->mark(iter->first);
+ numBranchesRemoved++;
+ continue;
+ }
+
+ BranchRecord currBranch(dir);
+ Kmer currSeq = iter->first;
+ while(currBranch.isActive())
+ {
+ ExtensionRecord extRec;
+ int multiplicity = -1;
+ bool success = seqCollection->getSeqData(
+ currSeq, extRec, multiplicity);
+ assert(success);
+ (void)success;
+ processLinearExtensionForBranch(currBranch,
+ currSeq, extRec, multiplicity, maxBranchCull);
+ }
+
+ // The branch has ended check it for removal, returns true if
+ // it was removed.
+ if(processTerminatedBranchTrim(seqCollection, currBranch))
+ {
+ numBranchesRemoved++;
+ }
+ seqCollection->pumpNetwork();
+ }
+
+ size_t numSweeped = removeMarked(seqCollection);
+
+ if (numBranchesRemoved > 0)
+ logger(0) << "Pruned " << numSweeped << " k-mer in "
+ << numBranchesRemoved << " tips.\n";
+ return numBranchesRemoved;
+}
+
+/** Extend this branch. */
+bool extendBranch(BranchRecord& branch, Kmer& kmer, SeqExt ext)
+{
+ if (!ext.hasExtension()) {
+ branch.terminate(BS_NOEXT);
+ return false;
+ } else if (ext.isAmbiguous()) {
+ branch.terminate(BS_AMBI_SAME);
+ return false;
+ } else {
+ vector<Kmer> adj;
+ generateSequencesFromExtension(kmer, branch.getDirection(),
+ ext, adj);
+ assert(adj.size() == 1);
+ kmer = adj.front();
+ return true;
+ }
+}
+
+/**
+ * Process the extension for this branch for the trimming algorithm
+ * CurrSeq is the current sequence being inspected (the next member to
+ * be added to the branch). The extension record is the extensions of
+ * that sequence and multiplicity is the number of times that kmer
+ * appears in the data set. After processing currSeq is unchanged if
+ * the branch is no longer active or else it is the generated
+ * extension. If the parameter addKmer is true, add the k-mer to the
+ * branch.
+ */
+bool processLinearExtensionForBranch(BranchRecord& branch,
+ Kmer& currSeq, ExtensionRecord extensions, int multiplicity,
+ unsigned maxLength, bool addKmer)
+{
+ /** Stop contig assembly at palindromes. */
+ const bool stopAtPalindromes = maxLength == UINT_MAX;
+
+ extDirection dir = branch.getDirection();
+ if (branch.isTooLong(maxLength)) {
+ // Too long.
+ branch.terminate(BS_TOO_LONG);
+ return false;
+ } else if (extensions.dir[!dir].isAmbiguous()) {
+ // Ambiguous.
+ branch.terminate(BS_AMBI_OPP);
+ return false;
+ } else if (stopAtPalindromes && currSeq.isPalindrome()) {
+ // Palindrome.
+ branch.terminate(BS_AMBI_SAME);
+ return false;
+ }
+
+ if (addKmer)
+ branch.push_back(make_pair(currSeq,
+ KmerData(multiplicity, extensions)));
+
+ if (branch.isTooLong(maxLength)) {
+ // Too long.
+ branch.terminate(BS_TOO_LONG);
+ return false;
+ } else if (stopAtPalindromes && currSeq.isPalindrome(dir)) {
+ // Palindrome.
+ branch.terminate(BS_AMBI_SAME);
+ return false;
+ }
+
+ return extendBranch(branch, currSeq, extensions.dir[dir]);
+}
+
+/** Trim the specified branch if it meets trimming criteria.
+ * @return true if the specified branch was trimmed
+ */
+bool processTerminatedBranchTrim(ISequenceCollection* seqCollection,
+ BranchRecord& branch)
+{
+ assert(!branch.isActive());
+ assert(!branch.empty());
+ if (branch.getState() == BS_NOEXT
+ || branch.getState() == BS_AMBI_OPP) {
+ logger(5) << "Pruning " << branch.size() << ' '
+ << branch.front().first << '\n';
+ for (BranchRecord::iterator it = branch.begin();
+ it != branch.end(); ++it)
+ seqCollection->mark(it->first);
+ return true;
+ } else
+ return false;
+}
+
+/** Remove all marked k-mer.
+ * @return the number of removed k-mer
+ */
+size_t removeMarked(ISequenceCollection* pSC)
+{
+ Timer timer(__func__);
+ size_t count = 0;
+ for (ISequenceCollection::iterator it = pSC->begin();
+ it != pSC->end(); ++it) {
+ if (it->second.deleted())
+ continue;
+ if (it->second.marked()) {
+ removeSequenceAndExtensions(pSC, *it);
+ count++;
+ }
+ pSC->pumpNetwork();
+ }
+ if (count > 0)
+ logger(1) << "Removed " << count << " marked k-mer.\n";
+ return count;
+}
+
+/** Assemble a contig.
+ * @return the number of k-mer below the coverage threshold
+ */
+size_t assembleContig(
+ ISequenceCollection* seqCollection, FastaWriter* writer,
+ BranchRecord& branch, unsigned id)
+{
+ assert(!branch.isActive());
+ assert(branch.getState() == BS_NOEXT
+ || branch.getState() == BS_AMBI_SAME
+ || branch.getState() == BS_AMBI_OPP);
+
+ // Assemble the contig.
+ Sequence contig(branch);
+
+ size_t kmerCount = branch.calculateBranchMultiplicity();
+ if (writer != NULL)
+ writer->WriteSequence(contig, id, kmerCount);
+
+ // Remove low-coverage contigs.
+ float coverage = (float)kmerCount / branch.size();
+ if (opt::coverage > 0 && coverage < opt::coverage) {
+ for (BranchRecord::iterator it = branch.begin();
+ it != branch.end(); ++it)
+ seqCollection->remove(it->first);
+ return branch.size();
+ }
+ return 0;
+}
+
+/** Assemble contigs.
+ * @return the number of contigs assembled
+ */
+size_t assemble(SequenceCollectionHash* seqCollection,
+ FastaWriter* fileWriter)
+{
+ Timer timer("Assemble");
+
+ size_t kmerCount = 0;
+ unsigned contigID = 0;
+ size_t assembledKmer = 0;
+ size_t lowCoverageKmer = 0;
+ size_t lowCoverageContigs = 0;
+
+ for (ISequenceCollection::iterator iter = seqCollection->begin();
+ iter != seqCollection->end(); ++iter) {
+ if (iter->second.deleted())
+ continue;
+ kmerCount++;
+
+ extDirection dir;
+ SeqContiguity status = checkSeqContiguity(*iter, dir, true);
+ if (status == SC_CONTIGUOUS)
+ continue;
+ else if(status == SC_ISLAND)
+ {
+ BranchRecord currBranch(SENSE);
+ currBranch.push_back(*iter);
+ currBranch.terminate(BS_NOEXT);
+ size_t removed = assembleContig(seqCollection,
+ fileWriter, currBranch, contigID++);
+ assembledKmer += currBranch.size();
+ if (removed > 0) {
+ lowCoverageContigs++;
+ lowCoverageKmer += removed;
+ }
+ continue;
+ }
+ assert(status == SC_ENDPOINT);
+
+ BranchRecord currBranch(dir);
+ currBranch.push_back(*iter);
+ Kmer currSeq = iter->first;
+ extendBranch(currBranch, currSeq,
+ iter->second.getExtension(dir));
+ assert(currBranch.isActive());
+ while(currBranch.isActive())
+ {
+ ExtensionRecord extRec;
+ int multiplicity = -1;
+ bool success = seqCollection->getSeqData(
+ currSeq, extRec, multiplicity);
+ assert(success);
+ (void)success;
+ processLinearExtensionForBranch(currBranch,
+ currSeq, extRec, multiplicity, UINT_MAX);
+ }
+
+ if (currBranch.isCanonical()) {
+ size_t removed = assembleContig(seqCollection,
+ fileWriter, currBranch, contigID++);
+ assembledKmer += currBranch.size();
+ if (removed > 0) {
+ lowCoverageContigs++;
+ lowCoverageKmer += removed;
+ }
+ }
+
+ seqCollection->pumpNetwork();
+ }
+
+ if (opt::coverage > 0) {
+ cout << "Found " << assembledKmer << " k-mer in " << contigID
+ << " contigs before removing low-coverage contigs.\n"
+ "Removed " << lowCoverageKmer << " k-mer in "
+ << lowCoverageContigs << " low-coverage contigs.\n";
+ } else {
+ assert(assembledKmer <= kmerCount);
+ size_t circularKmer = kmerCount - assembledKmer;
+ if (circularKmer > 0)
+ cout << "Left " << circularKmer
+ << " unassembled k-mer in circular contigs.\n";
+ cout << "Assembled " << assembledKmer << " k-mer in "
+ << contigID << " contigs.\n";
+ }
+ return contigID;
+}
+
+/** Return the k-mer coverage histogram. */
+Histogram coverageHistogram(const ISequenceCollection& c)
+{
+ Histogram h;
+ for (ISequenceCollection::const_iterator it = c.begin();
+ it != c.end(); ++it) {
+ if (it->second.deleted())
+ continue;
+ h.insert(it->second.getMultiplicity());
+ }
+ return h;
+}
+
+/** Calculate a k-mer coverage threshold from the given k-mer coverage
+ * histogram. */
+static float calculateCoverageThreshold(const Histogram& h)
+{
+ float cov = h.firstLocalMinimum();
+ if (opt::rank <= 0) {
+ if (cov == 0)
+ cout << "Unable to determine minimum k-mer coverage\n";
+ else
+ cout << "Minimum k-mer coverage is " << cov << endl;
+ }
+
+ for (unsigned iteration = 0; iteration < 100; iteration++) {
+ Histogram trimmed = h.trimLow((unsigned)roundf(cov));
+ if (opt::rank <= 0)
+ logger(1) << "Coverage: " << cov << "\t"
+ "Reconstruction: " << trimmed.size() << endl;
+
+ unsigned median = trimmed.median();
+ float cov1 = sqrt(median);
+ if (cov1 == cov) {
+ // The coverage threshold has converged.
+ if (opt::rank <= 0)
+ cout << "Using a coverage threshold of "
+ << (unsigned)roundf(cov) << "...\n"
+ "The median k-mer coverage is " << median << "\n"
+ "The reconstruction is " << trimmed.size()
+ << endl;
+ return cov;
+ }
+ cov = cov1;
+ }
+ if (opt::rank <= 0)
+ cerr << "warning: coverage threshold did not converge"
+ << endl;
+ return 0;
+}
+
+/** Set the coverage-related parameters e and c from the given k-mer
+ * coverage histogram. */
+void setCoverageParameters(const Histogram& h)
+{
+ if (!opt::coverageHistPath.empty() && opt::rank <= 0) {
+ ofstream histFile(opt::coverageHistPath.c_str());
+ assert_good(histFile, opt::coverageHistPath);
+ histFile << h;
+ assert(histFile.good());
+ }
+
+ float minCov = calculateCoverageThreshold(h);
+ if (opt::rank <= 0) {
+ if (minCov == 0)
+ cout << "Unable to determine the "
+ "k-mer coverage threshold" << endl;
+ else
+ cout << "The k-mer coverage threshold is " << minCov
+ << endl;
+ }
+ if (minCov < 2)
+ minCov = 2;
+
+ if ((int)opt::erode < 0) {
+ opt::erode = (unsigned)roundf(minCov);
+ if (opt::rank <= 0)
+ cout << "Setting parameter e (erode) to "
+ << opt::erode << endl;
+ }
+ if ((int)opt::erodeStrand < 0) {
+ opt::erodeStrand = minCov <= 2 ? 0 : 1;
+ if (opt::rank <= 0)
+ cout << "Setting parameter E (erodeStrand) to "
+ << opt::erodeStrand << endl;
+ }
+ if (opt::coverage < 0) {
+ opt::coverage = minCov;
+ if (opt::rank <= 0)
+ cout << "Setting parameter c (coverage) to "
+ << opt::coverage << endl;
+ }
+}
+
+};
diff --git a/Assembly/AssemblyAlgorithms.h b/Assembly/AssemblyAlgorithms.h
new file mode 100644
index 0000000..d88b6e3
--- /dev/null
+++ b/Assembly/AssemblyAlgorithms.h
@@ -0,0 +1,106 @@
+#ifndef ASSEMBLYALGORITHMS_H
+#define ASSEMBLYALGORITHMS_H 1
+
+#include "BranchGroup.h"
+#include "BranchRecord.h"
+#include "FastaWriter.h"
+#include "SequenceCollection.h"
+#include <ostream>
+#include <vector>
+
+class Histogram;
+
+/** A summary of the in- and out-degree of a vertex. */
+enum SeqContiguity
+{
+ SC_ISLAND, // sequence is completely isolated
+ SC_ENDPOINT, // one end of the sequence is open
+ SC_CONTIGUOUS // the sequence is closed on both ends
+};
+
+/** De Bruijn graph assembly algorithms. */
+namespace AssemblyAlgorithms
+{
+
+// Read a sequence file and load them into the collection
+void loadSequences(ISequenceCollection* seqCollection,
+ std::string inFile);
+
+/** Generate the adjacency information for all the sequences in the
+ * collection. This is required before any other algorithm can run.
+ */
+void generateAdjacency(ISequenceCollection* seqCollection);
+
+Histogram coverageHistogram(const ISequenceCollection& c);
+void setCoverageParameters(const Histogram& h);
+
+/* Erosion. Remove k-mer from the ends of blunt contigs. */
+size_t erodeEnds(ISequenceCollection* seqCollection);
+size_t erode(ISequenceCollection* c,
+ const ISequenceCollection::value_type& seq);
+size_t getNumEroded();
+
+size_t removeMarked(ISequenceCollection* pSC);
+
+// Check whether a sequence can be trimmed
+SeqContiguity checkSeqContiguity(
+ const ISequenceCollection::value_type& seq,
+ extDirection& outDir, bool considerMarks = false);
+
+// process a terminated branch for trimming
+bool processTerminatedBranchTrim(
+ ISequenceCollection* seqCollection, BranchRecord& branch);
+
+bool extendBranch(BranchRecord& branch, Kmer& kmer, SeqExt ext);
+
+// Process the extensions of the current sequence for trimming
+bool processLinearExtensionForBranch(BranchRecord& branch,
+ Kmer& currSeq, ExtensionRecord extensions, int multiplicity,
+ unsigned maxLength, bool addKmer = true);
+
+/** Populate the branch group with the initial extensions to this
+ * sequence. */
+void initiateBranchGroup(BranchGroup& group, const Kmer& seq,
+ const SeqExt& extension);
+
+// process an a branch group extension
+bool processBranchGroupExtension(BranchGroup& group,
+ size_t branchIndex, const Kmer& seq,
+ ExtensionRecord extensions, int multiplicity,
+ unsigned maxLength);
+
+void openBubbleFile(std::ofstream& out);
+void writeBubble(std::ostream& out, const BranchGroup& group,
+ unsigned id);
+void collapseJoinedBranches(
+ ISequenceCollection* seqCollection, BranchGroup& group);
+
+/* Split the remaining ambiguous nodes to allow for a non-redundant
+ * assembly. Remove extensions to/from ambiguous sequences to avoid
+ * generating redundant/wrong contigs.
+ */
+size_t markAmbiguous(ISequenceCollection* seqCollection);
+size_t splitAmbiguous(ISequenceCollection* seqCollection);
+
+size_t assembleContig(ISequenceCollection* seqCollection,
+ FastaWriter* writer, BranchRecord& branch, unsigned id);
+
+void removeSequenceAndExtensions(ISequenceCollection* seqCollection,
+ const ISequenceCollection::value_type& seq);
+void removeExtensionsToSequence(ISequenceCollection* seqCollection,
+ const ISequenceCollection::value_type& seq, extDirection dir);
+
+void generateSequencesFromExtension(const Kmer& currSeq,
+ extDirection dir, SeqExt extension,
+ std::vector<Kmer>& outseqs);
+
+/* Non-distributed graph algorithms. */
+
+void performTrim(SequenceCollectionHash* seqCollection);
+size_t popBubbles(SequenceCollectionHash* pSC, std::ostream& out);
+size_t assemble(SequenceCollectionHash* seqCollection,
+ FastaWriter* fileWriter = NULL);
+
+};
+
+#endif
diff --git a/Assembly/BranchGroup.cpp b/Assembly/BranchGroup.cpp
new file mode 100644
index 0000000..12cdb1c
--- /dev/null
+++ b/Assembly/BranchGroup.cpp
@@ -0,0 +1,86 @@
+#include "BranchGroup.h"
+#include "Algorithms.h"
+#include <algorithm>
+#include <functional>
+
+using namespace std;
+
+// Check the stop conditions for the bubble growth
+BranchGroupStatus BranchGroup::updateStatus(unsigned maxLength)
+{
+ assert(m_branches.size() <= m_maxNumBranches);
+
+ if (m_status != BGS_ACTIVE)
+ return m_status;
+
+ // Check if the no extension flag is set
+ if(m_noExt)
+ {
+ m_status = BGS_NOEXT;
+ return m_status;
+ }
+
+ // Check if any branches are too long or any sequence has a loop
+ for (BranchGroupData::const_iterator iter = m_branches.begin();
+ iter != m_branches.end(); ++iter) {
+ if (iter->isTooLong(maxLength)) {
+ m_status = BGS_TOOLONG;
+ return m_status;
+ }
+ }
+
+ BranchGroupData::const_iterator it = m_branches.begin();
+ const Kmer& lastSeq = it->back().first;
+ while (++it != m_branches.end())
+ if (it->back().first != lastSeq)
+ return m_status = BGS_ACTIVE;
+
+ // All the branches of the bubble have joined.
+ // Remove the last base, which is identical for every branch.
+ for_each(m_branches.begin(), m_branches.end(),
+ mem_fun_ref(&BranchRecord::pop_back));
+
+ // Sort the branches by coverage.
+ sort_by_transform(m_branches.begin(), m_branches.end(),
+ mem_fun_ref(&BranchRecord::calculateBranchMultiplicity));
+ reverse(m_branches.begin(), m_branches.end());
+
+ return m_status = BGS_JOINED;
+}
+
+/** Return whether any branches of this group are active. */
+bool BranchGroup::isActive() const
+{
+ for (BranchGroupData::const_iterator it = m_branches.begin();
+ it != m_branches.end(); ++it)
+ if (it->isActive())
+ return true;
+ return false;
+}
+
+/** Return whether this branch is extendable. */
+bool BranchGroup::isExtendable()
+{
+ if (m_noExt)
+ return false;
+
+ // A group is extendable when all the branches are the same
+ // length. All the branches are lockstepped for growth.
+ BranchGroupData::iterator it = m_branches.begin();
+ unsigned length = it++->size();
+ for (; it != m_branches.end(); ++it)
+ if (it->size() != length)
+ return false;
+ return true;
+}
+
+/** Return whether this branch is ambiguous at its origin. Also
+ * returns false if the origin of the branch has since been deleted.
+ */
+bool BranchGroup::isAmbiguous(const SequenceCollectionHash& g) const
+{
+ // Get fresh data from the collection to check that this bubble
+ // does in fact still exist.
+ const KmerData& data = g.getSeqAndData(m_origin).second;
+ return data.deleted() ? false : data.isAmbiguous(m_dir);
+}
diff --git a/Assembly/BranchGroup.h b/Assembly/BranchGroup.h
new file mode 100644
index 0000000..6288f8c
--- /dev/null
+++ b/Assembly/BranchGroup.h
@@ -0,0 +1,142 @@
+#ifndef BRANCHGROUP_H
+#define BRANCHGROUP_H 1
+
+#include "BranchRecord.h"
+#include "SequenceCollection.h"
+#include <algorithm> // for swap
+#include <map>
+#include <utility>
+
+enum BranchGroupStatus
+{
+ BGS_ACTIVE,
+ BGS_NOEXT,
+ BGS_JOINED,
+ BGS_TOOLONG,
+ BGS_TOOMANYBRANCHES
+};
+
+/** A container of BranchRecord. */
+class BranchGroup
+{
+ public:
+ typedef std::vector<BranchRecord> BranchGroupData;
+ typedef BranchGroupData::iterator iterator;
+ typedef BranchGroupData::const_iterator const_iterator;
+
+ BranchGroup()
+ : m_dir(SENSE), m_maxNumBranches(0),
+ m_noExt(false), m_status(BGS_ACTIVE)
+ { }
+
+ BranchGroup(extDirection dir, size_t maxNumBranches,
+ const Kmer &origin)
+ : m_dir(dir), m_origin(origin),
+ m_maxNumBranches(maxNumBranches), m_noExt(false),
+ m_status(BGS_ACTIVE)
+ {
+ m_branches.reserve(m_maxNumBranches);
+ }
+
+ BranchGroup(extDirection dir, size_t maxNumBranches,
+ const Kmer &origin, const BranchRecord& branch)
+ : m_dir(dir), m_origin(origin),
+ m_maxNumBranches(maxNumBranches), m_noExt(false),
+ m_status(BGS_ACTIVE)
+ {
+ m_branches.reserve(m_maxNumBranches);
+ m_branches.push_back(branch);
+ }
+
+ BranchGroup(const BranchGroup& o)
+ : m_branches(o.m_branches), m_dir(o.m_dir),
+ m_origin(o.m_origin),
+ m_maxNumBranches(o.m_maxNumBranches),
+ m_noExt(o.m_noExt), m_status(o.m_status)
+ {
+ m_branches.reserve(m_maxNumBranches);
+ }
+
+ /** Add a branch to this group. */
+ BranchRecord& addBranch(const BranchRecord& branch)
+ {
+ assert(m_branches.size() < m_maxNumBranches);
+ m_branches.push_back(branch);
+ return m_branches.back();
+ }
+
+ /** Add a branch to this group and extend the new branch with
+ * the given k-mer. */
+ void addBranch(const BranchRecord& branch,
+ const Kmer& kmer)
+ {
+ if (m_branches.size() < m_maxNumBranches)
+ addBranch(branch).push_back(
+ std::make_pair(kmer, KmerData()));
+ else
+ m_status = BGS_TOOMANYBRANCHES;
+ }
+
+ /** Return the specified branch. */
+ BranchRecord& operator [](unsigned id)
+ {
+ return m_branches[id];
+ }
+
+ /** Return the number of branches in this group. */
+ size_t size() const { return m_branches.size(); }
+
+ /** Return whether a branch contains the specified k-mer at
+ * the index i. */
+ bool exists(unsigned i, const Kmer& kmer) const
+ {
+ for (BranchGroupData::const_iterator it
+ = m_branches.begin();
+ it != m_branches.end(); ++it)
+ if (it->exists(i, kmer))
+ return true;
+ return false;
+ }
+
+ BranchGroupStatus updateStatus(unsigned maxLength);
+
+ // return the current status of the branch
+ BranchGroupStatus getStatus() const { return m_status; }
+
+ // set the no extension flag
+ void setNoExtension() { m_noExt = true; }
+
+ bool isActive() const;
+
+ // is the no extension flag set?
+ bool isNoExt() const { return m_noExt; }
+
+ bool isExtendable();
+
+ // return the direction of growth
+ extDirection getDirection() const { return m_dir; }
+
+ iterator begin() { return m_branches.begin(); }
+ iterator end() { return m_branches.end(); }
+ const_iterator begin() const { return m_branches.begin(); }
+ const_iterator end() const { return m_branches.end(); }
+
+ bool isAmbiguous(const SequenceCollectionHash& c) const;
+
+ private:
+ BranchGroup& operator =(const BranchGroup& o);
+
+ BranchGroupData m_branches;
+ extDirection m_dir;
+ Kmer m_origin;
+ size_t m_maxNumBranches;
+ bool m_noExt;
+ BranchGroupStatus m_status;
+};
+
+namespace std {
+ template <>
+ inline void swap(BranchGroup&, BranchGroup&) { assert(false); }
+}
+
+#endif
diff --git a/Assembly/BranchRecord.cpp b/Assembly/BranchRecord.cpp
new file mode 100644
index 0000000..4a7ff4f
--- /dev/null
+++ b/Assembly/BranchRecord.cpp
@@ -0,0 +1,59 @@
+#include "BranchRecord.h"
+
+using namespace std;
+
+/** Calculate the total multiplicity of this branch. */
+int BranchRecord::calculateBranchMultiplicity() const
+{
+ assert(!m_data.empty());
+ int total = 0;
+ for (BranchData::const_iterator it = m_data.begin();
+ it != m_data.end(); ++it) {
+ int m = it->second.getMultiplicity();
+ assert(m > 0);
+ total += m;
+ }
+ assert(total > 0);
+ return total;
+}
+
+/** Build a contig from a branch. */
+BranchRecord::operator Sequence() const
+{
+ assert(!m_data.empty());
+ Sequence outseq;
+ outseq.reserve(m_data.front().first.length() + m_data.size() - 1);
+
+ if (m_dir == SENSE) {
+ BranchData::const_iterator iter = m_data.begin();
+ outseq = iter->first.str();
+ ++iter;
+ for (; iter != m_data.end(); ++iter)
+ outseq.append(1, iter->first.getLastBaseChar());
+ } else {
+ BranchData::const_reverse_iterator iter = m_data.rbegin();
+ outseq = iter->first.str();
+ ++iter;
+ for (; iter != m_data.rend(); ++iter)
+ outseq.append(1, iter->first.getLastBaseChar());
+ }
+ return outseq;
+}
+
+/**
+ * Return whether this branch is the canonical representation of the
+ * contig that it represents. A contig has two ends, and the contig
+ * is output starting from the lexicographically smaller end.
+ */
+bool BranchRecord::isCanonical() const
+{
+ assert(size() > 1);
+ Kmer first = front().first;
+ Kmer last = back().first;
+ if (getDirection() == SENSE)
+ last.reverseComplement();
+ else
+ first.reverseComplement();
+ assert(first != last);
+ return first < last;
+}
diff --git a/Assembly/BranchRecord.h b/Assembly/BranchRecord.h
new file mode 100644
index 0000000..2b8f9f1
--- /dev/null
+++ b/Assembly/BranchRecord.h
@@ -0,0 +1,140 @@
+#ifndef BRANCHRECORD_H
+#define BRANCHRECORD_H 1
+
+#include "Kmer.h"
+#include "KmerData.h"
+#include <algorithm> // for swap
+#include <cassert>
+#include <utility>
+#include <vector>
+
+enum BranchState
+{
+ // The branch can be extended.
+ BS_ACTIVE,
+ // The branch has ended because of a lack of sequence to extend to
+ BS_NOEXT,
+ // The branch has ended because the extension from this branch is
+ // ambigious.
+ BS_AMBI_SAME,
+ // The branch has ended because the extension to this branch is
+ // ambigiuous.
+ BS_AMBI_OPP,
+ // The branch is too long.
+ BS_TOO_LONG,
+};
+
+/** A sequence of Kmer. */
+class BranchRecord
+{
+ public:
+ typedef std::pair<Kmer, KmerData> value_type;
+ typedef std::vector<value_type> BranchData;
+ typedef BranchData::iterator iterator;
+ typedef BranchData::const_iterator const_iterator;
+
+ BranchRecord() : m_dir(SENSE), m_state(BS_ACTIVE) { }
+
+ explicit BranchRecord(extDirection dir)
+ : m_dir(dir), m_state(BS_ACTIVE) { }
+
+ void swap(BranchRecord& o)
+ {
+ std::swap(m_data, o.m_data);
+ std::swap(m_dir, o.m_dir);
+ std::swap(m_state, o.m_state);
+ }
+
+ operator Sequence() const;
+
+ /** Return true if this sequence has no elements. */
+ bool empty() const { return m_data.empty(); }
+
+ /** Return the number of elements. */
+ size_t size() const { return m_data.size(); }
+
+ /** Add the element x at the end. */
+ void push_back(const value_type& x) { m_data.push_back(x); }
+
+ /** Remove the last k-mer. */
+ void pop_back()
+ {
+ assert(!m_data.empty());
+ m_data.pop_back();
+ }
+
+ /** Return the first element. */
+ const value_type& front() const
+ {
+ assert(!m_data.empty());
+ return m_data.front();
+ }
+
+ /** Return the last element. */
+ const value_type& back() const
+ {
+ assert(!m_data.empty());
+ return m_data.back();
+ }
+
+ /** Terminate this branch with the specified reason. */
+ void terminate(BranchState reason)
+ {
+ assert(reason != BS_ACTIVE);
+ m_state = reason;
+ }
+
+ /** Return whether this branch is active. */
+ bool isActive() const { return m_state == BS_ACTIVE; }
+
+ /** Return the state of this branch. */
+ BranchState getState() const { return m_state; }
+
+ /** Return the direction of this branch. */
+ extDirection getDirection() const { return m_dir; }
+
+ /** Set the properties of the last element. */
+ void setData(const value_type& o)
+ {
+ assert(m_data.back().first == o.first);
+ m_data.back().second = o.second;
+ }
+
+ iterator begin() { return m_data.begin(); }
+ iterator end() { return m_data.end(); }
+ const_iterator begin() const { return m_data.begin(); }
+ const_iterator end() const { return m_data.end(); }
+
+ /** Return true if the k-mer at position i is the specified
+ * k-mer. */
+ bool exists(unsigned i, const Kmer& kmer) const
+ {
+ assert(i < m_data.size());
+ return m_data[i].first == kmer;
+ }
+
+ /** Return true if this branch is longer than maxLength. */
+ bool isTooLong(unsigned maxLength) const
+ {
+ return size() > maxLength;
+ }
+
+ int calculateBranchMultiplicity() const;
+
+ bool isCanonical() const;
+
+ private:
+ BranchData m_data;
+ extDirection m_dir;
+ BranchState m_state;
+};
+
+namespace std {
+ template <>
+ inline void swap(BranchRecord& a, BranchRecord& b)
+ {
+ a.swap(b);
+ }
+}
+
+#endif
diff --git a/Assembly/DotWriter.cpp b/Assembly/DotWriter.cpp
new file mode 100644
index 0000000..f66a858
--- /dev/null
+++ b/Assembly/DotWriter.cpp
@@ -0,0 +1,70 @@
+/** Written by Shaun Jackman <sjackman at bcgsc.ca>. */
+
+#include "DotWriter.h"
+#include "SequenceCollection.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include <cassert>
+#include <ostream>
+
+using namespace std;
+
+typedef SequenceCollectionHash Graph;
+typedef graph_traits<Graph>::vertex_iterator vertex_iterator;
+typedef graph_traits<Graph>::adjacency_iterator adjacency_iterator;
+
+/** Write out the specified contig. */
+static void writeContig(ostream& out, const Graph& g, const Kmer& u)
+{
+ if (contiguous_in(g, u))
+ return;
+ unsigned n = 1;
+ Kmer v = u;
+ while (contiguous_out(g, v)) {
+ n++;
+ v = *adjacent_vertices(v, g).first;
+ }
+ out << u << " -> " << v;
+ if (n > 2)
+ out << " [label=" << n << ']';
+ out << '\n';
+}
+
+/** Write out the contigs that split at the specified sequence. */
+static void writeEdges(ostream& out, const Graph& g, const Kmer& u)
+{
+ unsigned outdeg = out_degree(u, g);
+ if (outdeg == 0)
+ return;
+ out << u << " ->";
+ if (outdeg > 1)
+ out << " {";
+ std::pair<adjacency_iterator, adjacency_iterator>
+ adj = adjacent_vertices(u, g);
+ for (adjacency_iterator v = adj.first; v != adj.second; ++v)
+ out << ' ' << *v;
+ if (outdeg > 1)
+ out << " }";
+ out << '\n';
+}
+
+/** Write out a dot graph around the specified sequence. */
+static void write_vertex(ostream& out, const Graph& g, const Kmer& u)
+{
+ if (contiguous_out(g, u))
+ writeContig(out, g, u);
+ else
+ writeEdges(out, g, u);
+}
+
+/** Write out a dot graph for the specified collection. */
+void DotWriter::write(ostream& out, const Graph& g)
+{
+ out << "digraph g {\n";
+ std::pair<vertex_iterator, vertex_iterator> vit = vertices(g);
+ for (vertex_iterator u = vit.first; u != vit.second; ++u) {
+ if (get(vertex_removed, g, *u))
+ continue;
+ write_vertex(out, g, *u);
+ }
+ out << "}" << endl;
+}
diff --git a/Assembly/DotWriter.h b/Assembly/DotWriter.h
new file mode 100644
index 0000000..3357246
--- /dev/null
+++ b/Assembly/DotWriter.h
@@ -0,0 +1,13 @@
+#ifndef DOTWRITER_H
+#define DOTWRITER_H 1
+
+#include "SequenceCollection.h"
+#include <ostream>
+
+class DotWriter {
+ public:
+ static void write(std::ostream& out,
+ const SequenceCollectionHash& c);
+};
+
+#endif
diff --git a/Assembly/ISequenceCollection.h b/Assembly/ISequenceCollection.h
new file mode 100644
index 0000000..c40f845
--- /dev/null
+++ b/Assembly/ISequenceCollection.h
@@ -0,0 +1,87 @@
+#ifndef ISEQUENCECOLLECTION_H
+#define ISEQUENCECOLLECTION_H 1
+
+#include "config.h"
+#include "Kmer.h"
+#include "KmerData.h"
+
+#if HAVE_GOOGLE_SPARSE_HASH_MAP
+# include <google/sparse_hash_map>
+typedef google::sparse_hash_map<Kmer, KmerData,
+ hashKmer> SequenceDataHash;
+#else
+# include "UnorderedMap.h"
+typedef unordered_map<Kmer, KmerData, hashKmer> SequenceDataHash;
+#endif
+
+/** The interface of a map of Kmer to KmerData. */
+class ISequenceCollection
+{
+ public:
+ typedef SequenceDataHash::value_type value_type;
+ typedef SequenceDataHash::iterator iterator;
+ typedef SequenceDataHash::const_iterator const_iterator;
+
+ virtual ~ISequenceCollection() { }
+
+ virtual void add(const Kmer& seq, unsigned coverage = 1) = 0;
+ virtual void remove(const Kmer& seq) = 0;
+
+ virtual void setFlag(const Kmer& seq, SeqFlag flag) = 0;
+
+ /** Mark the specified sequence in both directions. */
+ void mark(const Kmer& seq)
+ {
+ setFlag(seq, SeqFlag(SF_MARK_SENSE | SF_MARK_ANTISENSE));
+ }
+
+ /** Mark the specified sequence. */
+ void mark(const Kmer& seq, extDirection sense)
+ {
+ setFlag(seq, sense == SENSE
+ ? SF_MARK_SENSE : SF_MARK_ANTISENSE);
+ }
+
+ virtual bool empty() const = 0;
+
+ virtual void printLoad() const = 0;
+
+ virtual void removeExtension(const Kmer& seq,
+ extDirection dir, SeqExt ext) = 0;
+
+ /** Remove the specified edge of this k-mer. */
+ void removeExtension(const Kmer& seq,
+ extDirection dir, uint8_t base)
+ {
+ removeExtension(seq, dir, SeqExt(base));
+ }
+
+ /** Remove all the edges of this k-mer. */
+ void clearExtensions(const Kmer& seq, extDirection dir)
+ {
+ removeExtension(seq, dir, SeqExt::mask(0xf));
+ }
+
+ virtual bool setBaseExtension(const Kmer& seq,
+ extDirection dir, uint8_t base) = 0;
+
+ // Receive and dispatch packets if necessary.
+ virtual size_t pumpNetwork() = 0;
+
+ virtual iterator begin() = 0;
+ virtual const_iterator begin() const = 0;
+ virtual iterator end() = 0;
+ virtual const_iterator end() const = 0;
+
+ // Observer pattern
+ typedef void (*SeqObserver)(ISequenceCollection* c,
+ const value_type& seq);
+ virtual void attach(SeqObserver f) = 0;
+ virtual void detach(SeqObserver f) = 0;
+
+ virtual void load(const char *path) = 0;
+
+ virtual void setColourSpace(bool flag) = 0;
+};
+
+#endif
diff --git a/Assembly/KmerData.h b/Assembly/KmerData.h
new file mode 100644
index 0000000..6a38980
--- /dev/null
+++ b/Assembly/KmerData.h
@@ -0,0 +1,169 @@
+#ifndef KMERDATA_H
+#define KMERDATA_H 1
+
+#include "Sense.h"
+#include "SeqExt.h"
+#include <cassert>
+#include <stdint.h>
+#include <ostream>
+
+enum SeqFlag
+{
+ SF_MARK_SENSE = 0x1,
+ SF_MARK_ANTISENSE = 0x2,
+ SF_DELETE = 0x4,
+};
+
+static inline SeqFlag complement(SeqFlag flag)
+{
+ unsigned out = 0;
+ if (flag & SF_MARK_SENSE)
+ out |= SF_MARK_ANTISENSE;
+ if (flag & SF_MARK_ANTISENSE)
+ out |= SF_MARK_SENSE;
+ if (flag & SF_DELETE)
+ out |= SF_DELETE;
+ return SeqFlag(out);
+}
+
+/** A pair of SeqExt; one for out edges and one for in edges. */
+struct ExtensionRecord
+{
+ SeqExt dir[2];
+ ExtensionRecord operator ~() const
+ {
+ ExtensionRecord o;
+ o.dir[SENSE] = dir[ANTISENSE].complement();
+ o.dir[ANTISENSE] = dir[SENSE].complement();
+ return o;
+ }
+};
+
+/**
+ * The data associated with a Kmer, including its coverage, flags
+ * and adjacent Kmer.
+ */
+class KmerData
+{
+/** Maximum value of k-mer coverage. */
+#define COVERAGE_MAX 32767U
+
+ public:
+ KmerData() : m_flags(0)
+ {
+ m_multiplicity[SENSE] = 1;
+ m_multiplicity[ANTISENSE] = 0;
+ }
+
+ KmerData(extDirection dir, unsigned multiplicity) : m_flags(0)
+ {
+ assert(multiplicity <= COVERAGE_MAX);
+ m_multiplicity[dir] = multiplicity;
+ m_multiplicity[!dir] = 0;
+ }
+
+ KmerData(unsigned multiplicity, ExtensionRecord ext)
+ : m_flags(0), m_ext(ext)
+ {
+ setMultiplicity(multiplicity);
+ }
+
+ unsigned getMultiplicity(extDirection dir) const
+ {
+ return m_multiplicity[dir];
+ }
+
+ unsigned getMultiplicity() const
+ {
+ return m_multiplicity[SENSE] + m_multiplicity[ANTISENSE];
+ }
+
+ void addMultiplicity(extDirection dir, unsigned n = 1)
+ {
+ m_multiplicity[dir]
+ = std::min(m_multiplicity[dir] + n, COVERAGE_MAX);
+ assert(m_multiplicity[dir] > 0);
+ }
+
+ /** Set the multiplicity (not strand specific). */
+ void setMultiplicity(unsigned multiplicity)
+ {
+ assert(multiplicity <= 2*COVERAGE_MAX);
+ // Split the multiplicity over both senses.
+ m_multiplicity[SENSE] = (multiplicity + 1) / 2;
+ m_multiplicity[ANTISENSE] = multiplicity / 2;
+ assert(getMultiplicity() == multiplicity);
+ }
+
+ void setFlag(SeqFlag flag) { m_flags |= flag; }
+ bool isFlagSet(SeqFlag flag) const { return m_flags & flag; }
+ void clearFlag(SeqFlag flag) { m_flags &= ~flag; }
+
+ /** Return true if the specified sequence is deleted. */
+ bool deleted() const { return isFlagSet(SF_DELETE); }
+
+ /** Return true if the specified sequence is marked. */
+ bool marked(extDirection sense) const
+ {
+ return isFlagSet(sense == SENSE
+ ? SF_MARK_SENSE : SF_MARK_ANTISENSE);
+ }
+
+ /** Return true if the specified sequence is marked. */
+ bool marked() const
+ {
+ return isFlagSet(SeqFlag(SF_MARK_SENSE | SF_MARK_ANTISENSE));
+ }
+
+ ExtensionRecord extension() const { return m_ext; }
+
+ SeqExt getExtension(extDirection dir) const
+ {
+ return m_ext.dir[dir];
+ }
+
+ void setBaseExtension(extDirection dir, uint8_t base)
+ {
+ m_ext.dir[dir].setBase(base);
+ }
+
+ void removeExtension(extDirection dir, SeqExt ext)
+ {
+ m_ext.dir[dir].clear(ext);
+ }
+
+ bool hasExtension(extDirection dir) const
+ {
+ return m_ext.dir[dir].hasExtension();
+ }
+
+ bool isAmbiguous(extDirection dir) const
+ {
+ return m_ext.dir[dir].isAmbiguous();
+ }
+
+ /** Return the complement of this data. */
+ KmerData operator~() const
+ {
+ KmerData o;
+ o.m_flags = complement(SeqFlag(m_flags));
+ o.m_multiplicity[0] = m_multiplicity[1];
+ o.m_multiplicity[1] = m_multiplicity[0];
+ o.m_ext = ~m_ext;
+ return o;
+ }
+
+ friend std::ostream& operator<<(
+ std::ostream& out, const KmerData& o)
+ {
+ return out << "C="
+ << o.m_multiplicity[0] + o.m_multiplicity[1];
+ }
+
+ protected:
+ uint8_t m_flags;
+ uint16_t m_multiplicity[2];
+ ExtensionRecord m_ext;
+};
+
+#endif
diff --git a/Assembly/Makefile.am b/Assembly/Makefile.am
new file mode 100644
index 0000000..245f80d
--- /dev/null
+++ b/Assembly/Makefile.am
@@ -0,0 +1,15 @@
+noinst_LIBRARIES = libassembly.a
+
+libassembly_a_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+libassembly_a_SOURCES = \
+ AssemblyAlgorithms.cpp AssemblyAlgorithms.h \
+ BranchGroup.cpp BranchGroup.h \
+ BranchRecord.cpp BranchRecord.h \
+ DotWriter.cpp DotWriter.h \
+ ISequenceCollection.h \
+ KmerData.h \
+ Options.cpp Options.h \
+ SequenceCollection.cpp SequenceCollection.h
diff --git a/Assembly/Makefile.in b/Assembly/Makefile.in
new file mode 100644
index 0000000..4f99958
--- /dev/null
+++ b/Assembly/Makefile.in
@@ -0,0 +1,578 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = Assembly
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libassembly_a_AR = $(AR) $(ARFLAGS)
+libassembly_a_LIBADD =
+am_libassembly_a_OBJECTS = libassembly_a-AssemblyAlgorithms.$(OBJEXT) \
+ libassembly_a-BranchGroup.$(OBJEXT) \
+ libassembly_a-BranchRecord.$(OBJEXT) \
+ libassembly_a-DotWriter.$(OBJEXT) \
+ libassembly_a-Options.$(OBJEXT) \
+ libassembly_a-SequenceCollection.$(OBJEXT)
+libassembly_a_OBJECTS = $(am_libassembly_a_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libassembly_a_SOURCES)
+DIST_SOURCES = $(libassembly_a_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LIBRARIES = libassembly.a
+libassembly_a_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+libassembly_a_SOURCES = \
+ AssemblyAlgorithms.cpp AssemblyAlgorithms.h \
+ BranchGroup.cpp BranchGroup.h \
+ BranchRecord.cpp BranchRecord.h \
+ DotWriter.cpp DotWriter.h \
+ ISequenceCollection.h \
+ KmerData.h \
+ Options.cpp Options.h \
+ SequenceCollection.cpp SequenceCollection.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Assembly/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Assembly/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libassembly.a: $(libassembly_a_OBJECTS) $(libassembly_a_DEPENDENCIES) $(EXTRA_libassembly_a_DEPENDENCIES)
+ -rm -f libassembly.a
+ $(libassembly_a_AR) libassembly.a $(libassembly_a_OBJECTS) $(libassembly_a_LIBADD)
+ $(RANLIB) libassembly.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libassembly_a-AssemblyAlgorithms.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libassembly_a-BranchGroup.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libassembly_a-BranchRecord.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libassembly_a-DotWriter.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libassembly_a-Options.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libassembly_a-SequenceCollection.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+libassembly_a-AssemblyAlgorithms.o: AssemblyAlgorithms.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-AssemblyAlgorithms.o -MD -MP -MF $(DEPDIR)/libassembly_a-AssemblyAlgorithms.Tpo -c -o libassembly_a-AssemblyAlgorithms.o `test -f 'AssemblyAlgorithms.cpp' || echo '$(srcdir)/'`AssemblyAlgorithms.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-AssemblyAlgorithms.Tpo $(DEPDIR)/libassembly_a-AssemblyAlgorithms.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AssemblyAlgorithms.cpp' object='libassembly_a-AssemblyAlgorithms.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-AssemblyAlgorithms.o `test -f 'AssemblyAlgorithms.cpp' || echo '$(srcdir)/'`AssemblyAlgorithms.cpp
+
+libassembly_a-AssemblyAlgorithms.obj: AssemblyAlgorithms.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-AssemblyAlgorithms.obj -MD -MP -MF $(DEPDIR)/libassembly_a-AssemblyAlgorithms.Tpo -c -o libassembly_a-AssemblyAlgorithms.obj `if test -f 'AssemblyAlgorithms.cpp'; then $(CYGPATH_W) 'AssemblyAlgorithms.cpp'; else $(CYGPATH_W) '$(srcdir)/AssemblyAlgorithms.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-AssemblyAlgorithms.Tpo $(DEPDIR)/libassembly_a-AssemblyAlgorithms.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='AssemblyAlgorithms.cpp' object='libassembly_a-AssemblyAlgorithms.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-AssemblyAlgorithms.obj `if test -f 'AssemblyAlgorithms.cpp'; then $(CYGPATH_W) 'AssemblyAlgorithms.cpp'; else $(CYGPATH_W) '$(srcdir)/AssemblyAlgorithms.cpp'; fi`
+
+libassembly_a-BranchGroup.o: BranchGroup.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-BranchGroup.o -MD -MP -MF $(DEPDIR)/libassembly_a-BranchGroup.Tpo -c -o libassembly_a-BranchGroup.o `test -f 'BranchGroup.cpp' || echo '$(srcdir)/'`BranchGroup.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-BranchGroup.Tpo $(DEPDIR)/libassembly_a-BranchGroup.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='BranchGroup.cpp' object='libassembly_a-BranchGroup.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-BranchGroup.o `test -f 'BranchGroup.cpp' || echo '$(srcdir)/'`BranchGroup.cpp
+
+libassembly_a-BranchGroup.obj: BranchGroup.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-BranchGroup.obj -MD -MP -MF $(DEPDIR)/libassembly_a-BranchGroup.Tpo -c -o libassembly_a-BranchGroup.obj `if test -f 'BranchGroup.cpp'; then $(CYGPATH_W) 'BranchGroup.cpp'; else $(CYGPATH_W) '$(srcdir)/BranchGroup.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-BranchGroup.Tpo $(DEPDIR)/libassembly_a-BranchGroup.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='BranchGroup.cpp' object='libassembly_a-BranchGroup.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-BranchGroup.obj `if test -f 'BranchGroup.cpp'; then $(CYGPATH_W) 'BranchGroup.cpp'; else $(CYGPATH_W) '$(srcdir)/BranchGroup.cpp'; fi`
+
+libassembly_a-BranchRecord.o: BranchRecord.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-BranchRecord.o -MD -MP -MF $(DEPDIR)/libassembly_a-BranchRecord.Tpo -c -o libassembly_a-BranchRecord.o `test -f 'BranchRecord.cpp' || echo '$(srcdir)/'`BranchRecord.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-BranchRecord.Tpo $(DEPDIR)/libassembly_a-BranchRecord.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='BranchRecord.cpp' object='libassembly_a-BranchRecord.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-BranchRecord.o `test -f 'BranchRecord.cpp' || echo '$(srcdir)/'`BranchRecord.cpp
+
+libassembly_a-BranchRecord.obj: BranchRecord.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-BranchRecord.obj -MD -MP -MF $(DEPDIR)/libassembly_a-BranchRecord.Tpo -c -o libassembly_a-BranchRecord.obj `if test -f 'BranchRecord.cpp'; then $(CYGPATH_W) 'BranchRecord.cpp'; else $(CYGPATH_W) '$(srcdir)/BranchRecord.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-BranchRecord.Tpo $(DEPDIR)/libassembly_a-BranchRecord.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='BranchRecord.cpp' object='libassembly_a-BranchRecord.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-BranchRecord.obj `if test -f 'BranchRecord.cpp'; then $(CYGPATH_W) 'BranchRecord.cpp'; else $(CYGPATH_W) '$(srcdir)/BranchRecord.cpp'; fi`
+
+libassembly_a-DotWriter.o: DotWriter.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-DotWriter.o -MD -MP -MF $(DEPDIR)/libassembly_a-DotWriter.Tpo -c -o libassembly_a-DotWriter.o `test -f 'DotWriter.cpp' || echo '$(srcdir)/'`DotWriter.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-DotWriter.Tpo $(DEPDIR)/libassembly_a-DotWriter.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DotWriter.cpp' object='libassembly_a-DotWriter.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-DotWriter.o `test -f 'DotWriter.cpp' || echo '$(srcdir)/'`DotWriter.cpp
+
+libassembly_a-DotWriter.obj: DotWriter.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-DotWriter.obj -MD -MP -MF $(DEPDIR)/libassembly_a-DotWriter.Tpo -c -o libassembly_a-DotWriter.obj `if test -f 'DotWriter.cpp'; then $(CYGPATH_W) 'DotWriter.cpp'; else $(CYGPATH_W) '$(srcdir)/DotWriter.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-DotWriter.Tpo $(DEPDIR)/libassembly_a-DotWriter.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DotWriter.cpp' object='libassembly_a-DotWriter.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-DotWriter.obj `if test -f 'DotWriter.cpp'; then $(CYGPATH_W) 'DotWriter.cpp'; else $(CYGPATH_W) '$(srcdir)/DotWriter.cpp'; fi`
+
+libassembly_a-Options.o: Options.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-Options.o -MD -MP -MF $(DEPDIR)/libassembly_a-Options.Tpo -c -o libassembly_a-Options.o `test -f 'Options.cpp' || echo '$(srcdir)/'`Options.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-Options.Tpo $(DEPDIR)/libassembly_a-Options.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Options.cpp' object='libassembly_a-Options.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-Options.o `test -f 'Options.cpp' || echo '$(srcdir)/'`Options.cpp
+
+libassembly_a-Options.obj: Options.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-Options.obj -MD -MP -MF $(DEPDIR)/libassembly_a-Options.Tpo -c -o libassembly_a-Options.obj `if test -f 'Options.cpp'; then $(CYGPATH_W) 'Options.cpp'; else $(CYGPATH_W) '$(srcdir)/Options.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-Options.Tpo $(DEPDIR)/libassembly_a-Options.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Options.cpp' object='libassembly_a-Options.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-Options.obj `if test -f 'Options.cpp'; then $(CYGPATH_W) 'Options.cpp'; else $(CYGPATH_W) '$(srcdir)/Options.cpp'; fi`
+
+libassembly_a-SequenceCollection.o: SequenceCollection.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-SequenceCollection.o -MD -MP -MF $(DEPDIR)/libassembly_a-SequenceCollection.Tpo -c -o libassembly_a-SequenceCollection.o `test -f 'SequenceCollection.cpp' || echo '$(srcdir)/'`SequenceCollection.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-SequenceCollection.Tpo $(DEPDIR)/libassembly_a-SequenceCollection.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SequenceCollection.cpp' object='libassembly_a-SequenceCollection.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-SequenceCollection.o `test -f 'SequenceCollection.cpp' || echo '$(srcdir)/'`SequenceCollection.cpp
+
+libassembly_a-SequenceCollection.obj: SequenceCollection.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libassembly_a-SequenceCollection.obj -MD -MP -MF $(DEPDIR)/libassembly_a-SequenceCollection.Tpo -c -o libassembly_a-SequenceCollection.obj `if test -f 'SequenceCollection.cpp'; then $(CYGPATH_W) 'SequenceCollection.cpp'; else $(CYGPATH_W) '$(srcdir)/SequenceCollection.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libassembly_a-SequenceCollection.Tpo $(DEPDIR)/libassembly_a-SequenceCollection.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SequenceCollection.cpp' object='libassembly_a-SequenceCollection.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libassembly_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libassembly_a-SequenceCollection.obj `if test -f 'SequenceCollection.cpp'; then $(CYGPATH_W) 'SequenceCollection.cpp'; else $(CYGPATH_W) '$(srcdir)/SequenceCollection.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES cscopelist ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Assembly/Options.cpp b/Assembly/Options.cpp
new file mode 100644
index 0000000..3ae935b
--- /dev/null
+++ b/Assembly/Options.cpp
@@ -0,0 +1,271 @@
+/** Written by Shaun Jackman <sjackman at bcgsc.ca>. */
+
+#include "config.h"
+#include "Common/Options.h"
+#include "DataLayer/Options.h"
+#include "Kmer.h"
+#include <algorithm>
+#include <climits> // for INT_MAX
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <vector>
+
+using namespace std;
+
+#define PROGRAM "ABYSS"
+
+namespace opt {
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Jared Simpson and Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... FILE...\n"
+"Assemble the input files, FILE, which may be in FASTA, FASTQ,\n"
+"qseq, export, SAM or BAM format and compressed with gz, bz2 or xz.\n"
+"\n"
+" --chastity discard unchaste reads [default]\n"
+" --no-chastity do not discard unchaste reads\n"
+" --trim-masked trim masked bases from the ends of reads\n"
+" [default]\n"
+" --no-trim-masked do not trim masked bases from the ends of\n"
+" reads\n"
+" -q, --trim-quality=N trim bases from the ends of reads whose\n"
+" quality is less than the threshold\n"
+" --standard-quality zero quality is `!' (33)\n"
+" default for FASTQ and SAM files\n"
+" --illumina-quality zero quality is `@' (64)\n"
+" default for qseq and export files\n"
+" -o, --out=FILE write the contigs to FILE\n"
+" -k, --kmer=N k-mer size\n"
+" -t, --trim-length=N maximum length of dangling edges to trim\n"
+" -c, --coverage=FLOAT remove contigs with mean k-mer coverage\n"
+" less than this threshold\n"
+" -b, --bubbles=N pop bubbles shorter than N bp [3*k]\n"
+" -b0, --no-bubbles do not pop bubbles\n"
+" -e, --erode=N erode bases at the ends of blunt contigs\n"
+" with coverage less than this threshold\n"
+" -E, --erode-strand=N erode bases at the ends of blunt contigs\n"
+" with coverage less than this threshold on\n"
+" either strand\n"
+" --coverage-hist=FILE write the k-mer coverage histogram to FILE\n"
+" -g, --graph=FILE generate a graph in dot format\n"
+" -s, --snp=FILE record popped bubbles in FILE\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+/** k-mer length */
+int kmerSize = -1;
+int k; // used by Graph
+
+/** k-mer range */
+int kMin = -1;
+int kMax = -1;
+int kStep = 1;
+
+/** erosion coverage */
+unsigned erode = (unsigned)-1;
+
+/** erosion strand coverage */
+unsigned erodeStrand = (unsigned)-1;
+
+/** trim length */
+int trimLen = -1;
+
+/** Coverage cutoff. */
+float coverage = -1;
+
+/** Pop bubbles shorter than N bp. */
+int bubbleLen = -1;
+
+/** coverage histogram path */
+string coverageHistPath;
+
+/** output contigs path */
+string contigsPath;
+
+/** temporary output contigs path
+ * Each node stores its contigs in its own file temporarily.
+ */
+string contigsTempPath;
+
+/** graph output */
+string graphPath;
+
+/** output bubble path */
+string snpPath;
+
+/** input FASTA files */
+vector<string> inFiles;
+
+static const char shortopts[] = "b:c:e:E:g:k:o:q:s:t:v";
+
+enum { OPT_HELP = 1, OPT_VERSION, COVERAGE_HIST };
+
+static const struct option longopts[] = {
+ { "out", required_argument, NULL, 'o' },
+ { "kmer", required_argument, NULL, 'k' },
+ { "trim-length", required_argument, NULL, 't' },
+ { "chastity", no_argument, &opt::chastityFilter, 1 },
+ { "no-chastity", no_argument, &opt::chastityFilter, 0 },
+ { "trim-masked", no_argument, &opt::trimMasked, 1 },
+ { "no-trim-masked", no_argument, &opt::trimMasked, 0 },
+ { "trim-quality", required_argument, NULL, 'q' },
+ { "standard-quality", no_argument, &opt::qualityOffset, 33 },
+ { "illumina-quality", no_argument, &opt::qualityOffset, 64 },
+ { "coverage", required_argument, NULL, 'c' },
+ { "coverage-hist", required_argument, NULL, COVERAGE_HIST },
+ { "bubble-length", required_argument, NULL, 'b' },
+ { "no-bubbles", no_argument, &opt::bubbleLen, 0 },
+ { "erode", required_argument, NULL, 'e' },
+ { "erode-strand", required_argument, NULL, 'E' },
+ { "no-erode", no_argument, (int*)&erode, 0 },
+ { "graph", required_argument, NULL, 'g' },
+ { "snp", required_argument, NULL, 's' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** Parse the specified command line. */
+void parse(int argc, char* const* argv)
+{
+ ostringstream sargv;
+ if (opt::rank <= 0) {
+ char* const* last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(sargv, " "));
+ sargv << *last;
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?':
+ die = true;
+ break;
+ case 'b':
+ arg >> bubbleLen;
+ break;
+ case 'c':
+ arg >> coverage;
+ break;
+ case 'k':
+ arg >> kmerSize;
+ k = kmerSize;
+ kMin = kmerSize;
+ switch (arg.get()) {
+ case ',':
+ arg >> kMax;
+ kStep = kMax - kMin;
+ break;
+ case '-':
+ arg >> kMax;
+ if (arg.get() == ':')
+ arg >> kStep;
+ break;
+ default:
+ kMax = kmerSize;
+ }
+ assert(kMin <= kMax);
+ break;
+ case COVERAGE_HIST:
+ getline(arg, coverageHistPath);
+ break;
+ case 'o':
+ getline(arg, contigsPath);
+ break;
+ case 'e':
+ arg >> erode;
+ break;
+ case 'E':
+ arg >> erodeStrand;
+ break;
+ case 't':
+ arg >> trimLen;
+ break;
+ case 'g':
+ getline(arg, graphPath);
+ break;
+ case 'q':
+ arg >> opt::qualityThreshold;
+ break;
+ case 's':
+ getline(arg, snpPath);
+ break;
+ case 'v':
+ verbose++;
+ break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (kmerSize <= 0) {
+ cerr << PROGRAM ": missing -k,--kmer option\n";
+ die = true;
+ }
+ if (contigsPath.empty()) {
+ cerr << PROGRAM ": missing -o,--out option\n";
+ die = true;
+ }
+ if (argv[optind] == NULL) {
+ cerr << PROGRAM ": missing input sequence file argument\n";
+ die = true;
+ }
+ if (die) {
+ cerr << "Try `" PROGRAM " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ assert(opt::qualityThreshold <= 40);
+
+ if (opt::rank <= 0
+ && opt::coverage >= 0 && opt::erode == (unsigned)-1)
+ cerr << "warning: -c,--coverage was specified, "
+ "but -e,--erode was not specified\n"
+ "Previously, the default was -e2 (or --erode=2)." << endl;
+
+ if (trimLen < 0)
+ trimLen = kmerSize;
+ if (bubbleLen < 0)
+ bubbleLen = 3*kmerSize;
+ assert(bubbleLen == 0 || bubbleLen > kmerSize);
+ if (bubbleLen == 0)
+ snpPath.clear();
+
+ Kmer::setLength(kmerSize);
+
+ inFiles.resize(argc - optind);
+ copy(&argv[optind], &argv[argc], inFiles.begin());
+
+ if (rank >= 0) {
+ ostringstream s;
+ s << "contigs-" << opt::rank << ".fa";
+ contigsTempPath = s.str();
+ }
+
+ if (opt::rank <= 0)
+ cout << PACKAGE_STRING "\n" << sargv.str() << endl;
+}
+
+} // namespace opt
diff --git a/Assembly/Options.h b/Assembly/Options.h
new file mode 100644
index 0000000..3e25b4d
--- /dev/null
+++ b/Assembly/Options.h
@@ -0,0 +1,27 @@
+#ifndef ASSEMBLY_OPTIONS_H
+#define ASSEMBLY_OPTIONS_H 1
+
+#include <string>
+#include <vector>
+
+namespace opt {
+ extern unsigned kmerSize;
+ extern unsigned kMin;
+ extern unsigned kMax;
+ extern unsigned kStep;
+ extern unsigned erode;
+ extern unsigned erodeStrand;
+ extern unsigned trimLen;
+ extern float coverage;
+ extern unsigned bubbleLen;
+ extern std::string coverageHistPath;
+ extern std::string contigsPath;
+ extern std::string contigsTempPath;
+ extern std::string graphPath;
+ extern std::string snpPath;
+ extern std::vector<std::string> inFiles;
+
+ void parse(int argc, char* const* argv);
+}
+
+#endif
diff --git a/Assembly/SequenceCollection.cpp b/Assembly/SequenceCollection.cpp
new file mode 100644
index 0000000..b092c7c
--- /dev/null
+++ b/Assembly/SequenceCollection.cpp
@@ -0,0 +1,258 @@
+#include "config.h"
+#include "SequenceCollection.h"
+#include "Log.h"
+#include "Common/Options.h"
+#include "MemoryUtil.h"
+#include "StringUtil.h" // for toSI
+#include "Timer.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdlib>
+#include <iomanip>
+#include <sstream>
+
+using namespace std;
+
+SequenceCollectionHash::SequenceCollectionHash()
+ : m_seqObserver(NULL), m_adjacencyLoaded(false)
+{
+#if HAVE_GOOGLE_SPARSE_HASH_MAP
+ // sparse_hash_set uses 2.67 bits per element on a 64-bit
+ // architecture and 2 bits per element on a 32-bit architecture.
+ // The number of elements is rounded up to a power of two.
+ if (opt::rank >= 0) {
+ // Make room for 200 million k-mers. Approximately 58 million
+ // 96-mers fit into 2 GB of ram, which results in a hash load
+ // of 0.216, and approximately 116 million 32-mers, which
+ // results in a hash load of 0.432.
+ m_data.rehash(200000000);
+ m_data.min_load_factor(0.2);
+ } else {
+ // Allocate a big hash for a single processor.
+ m_data.rehash(1<<29);
+ m_data.max_load_factor(0.4);
+ }
+#endif
+}
+
+/** Add the specified k-mer to this collection. */
+void SequenceCollectionHash::add(const Kmer& seq, unsigned coverage)
+{
+ bool rc;
+ SequenceCollectionHash::iterator it = find(seq, rc);
+ if (it == m_data.end()) {
+#if HAVE_GOOGLE_SPARSE_HASH_MAP
+ if (m_data.empty()) {
+ /* sparse_hash_set requires that set_deleted_key()
+ * is called before calling erase(). */
+ Kmer rc(reverseComplement(seq));
+ assert(rc != seq);
+ m_data.set_deleted_key(rc);
+ }
+#endif
+ m_data.insert(make_pair(seq, KmerData(SENSE, coverage)));
+ } else
+ it->second.addMultiplicity(rc ? ANTISENSE : SENSE, coverage);
+}
+
+/** Clean up by erasing sequences flagged as deleted.
+ * @return the number of sequences erased
+ */
+size_t SequenceCollectionHash::cleanup()
+{
+ Timer(__func__);
+ size_t count = 0;
+ for (iterator it = m_data.begin(); it != m_data.end();) {
+ if (it->second.deleted()) {
+ m_data.erase(it++);
+ count++;
+ } else
+ ++it;
+ }
+ shrink();
+ return count;
+}
+
+/** Return the complement of the specified base.
+ * If the assembly is in colour space, this is a no-op.
+ */
+static inline uint8_t complementBaseCode(uint8_t base)
+{
+ return opt::colourSpace ? base : ~base & 0x3;
+}
+
+/** Add an edge to this k-mer. */
+bool SequenceCollectionHash::setBaseExtension(
+ const Kmer& kmer, extDirection dir, uint8_t base)
+{
+ bool rc;
+ SequenceCollectionHash::iterator it = find(kmer, rc);
+ if (it == m_data.end())
+ return false;
+ bool palindrome = kmer.isPalindrome();
+ if (!rc || palindrome)
+ it->second.setBaseExtension(dir, base);
+ if (rc || palindrome)
+ it->second.setBaseExtension(!dir, complementBaseCode(base));
+ return true;
+}
+
+/** Remove the specified extensions from this k-mer. */
+void SequenceCollectionHash::removeExtension(const Kmer& kmer,
+ extDirection dir, SeqExt ext)
+{
+ bool rc;
+ SequenceCollectionHash::iterator it = find(kmer, rc);
+ assert(it != m_data.end());
+ bool palindrome = kmer.isPalindrome();
+ if (!rc || palindrome)
+ it->second.removeExtension(dir, ext);
+ if (rc || palindrome)
+ it->second.removeExtension(!dir, ~ext);
+ notify(*it);
+}
+
+void SequenceCollectionHash::setFlag(const Kmer& key, SeqFlag flag)
+{
+ bool rc;
+ SequenceCollectionHash::iterator it = find(key, rc);
+ assert(it != m_data.end());
+ it->second.setFlag(rc ? complement(flag) : flag);
+}
+
+void SequenceCollectionHash::wipeFlag(SeqFlag flag)
+{
+ for (SequenceCollectionHash::iterator it = m_data.begin();
+ it != m_data.end(); ++it)
+ it->second.clearFlag(flag);
+}
+
+/** Print the load of the hash table. */
+void SequenceCollectionHash::printLoad() const
+{
+ size_t size = m_data.size();
+ size_t buckets = m_data.bucket_count();
+ logger(1) << "Hash load: " << size << " / " << buckets << " = "
+ << setprecision(3) << (float)size / buckets
+ << " using " << toSI(getMemoryUsage()) << "B" << endl;
+}
+
+/** Return an iterator pointing to the specified k-mer or its
+ * reverse complement. Return in rc whether the sequence is reversed.
+ */
+SequenceCollectionHash::iterator SequenceCollectionHash::find(
+ const Kmer& key, bool& rc)
+{
+ SequenceCollectionHash::iterator it = find(key);
+ if (it != m_data.end()) {
+ rc = false;
+ return it;
+ } else {
+ rc = true;
+ return find(reverseComplement(key));
+ }
+}
+
+/** Return an iterator pointing to the specified k-mer or its
+ * reverse complement. Return in rc whether the sequence is reversed.
+ */
+SequenceCollectionHash::const_iterator SequenceCollectionHash::find(
+ const Kmer& key, bool& rc) const
+{
+ SequenceCollectionHash::const_iterator it = find(key);
+ if (it != m_data.end()) {
+ rc = false;
+ return it;
+ } else {
+ rc = true;
+ return find(reverseComplement(key));
+ }
+}
+
+/** Return the sequence and data of the specified key.
+ * The key sequence may not contain data. The returned sequence will
+ * contain data.
+ */
+const SequenceCollectionHash::value_type& SequenceCollectionHash::
+getSeqAndData(const Kmer& key) const
+{
+ bool rc;
+ SequenceCollectionHash::const_iterator it = find(key, rc);
+ // rc should not be ignored. This seems quite dubious.
+ // The edges of this k-mer should be complemented.
+ assert(it != m_data.end());
+ return *it;
+}
+
+/** Return the data of the specified key. */
+bool SequenceCollectionHash::getSeqData(const Kmer& key,
+ ExtensionRecord& extRecord, int& multiplicity) const
+{
+ bool rc;
+ SequenceCollectionHash::const_iterator it = find(key, rc);
+ if (it == m_data.end())
+ return false;
+ const KmerData data = it->second;
+ extRecord = rc ? ~data.extension() : data.extension();
+ multiplicity = data.getMultiplicity();
+ return true;
+}
+
+#include <cstdio>
+
+/** Write this collection to disk.
+ * @param path does not include the extension
+ */
+void SequenceCollectionHash::store(const char* path)
+{
+ assert(path != NULL);
+#if HAVE_GOOGLE_SPARSE_HASH_MAP
+ ostringstream s;
+ s << path;
+ if (opt::rank >= 0)
+ s << '-' << setfill('0') << setw(3) << opt::rank;
+ s << ".kmer";
+ FILE* f = fopen(s.str().c_str(), "w");
+ if (f == NULL) {
+ perror(s.str().c_str());
+ exit(EXIT_FAILURE);
+ }
+ shrink();
+ m_data.write_metadata(f);
+ m_data.write_nopointer_data(f);
+ fclose(f);
+#else
+ // Not supported.
+ assert(false);
+ exit(EXIT_FAILURE);
+#endif
+}
+
+/** Load this collection from disk. */
+void SequenceCollectionHash::load(const char* path)
+{
+#if HAVE_GOOGLE_SPARSE_HASH_MAP
+ FILE* f = fopen(path, "r");
+ if (f == NULL) {
+ perror(path);
+ exit(EXIT_FAILURE);
+ }
+ m_data.read_metadata(f);
+ m_data.read_nopointer_data(f);
+ fclose(f);
+ m_adjacencyLoaded = true;
+#else
+ (void)path;
+ // Not supported.
+ assert(false);
+ exit(EXIT_FAILURE);
+#endif
+}
+
+/** Indicate that this is a colour-space collection. */
+void SequenceCollectionHash::setColourSpace(bool flag)
+{
+ if (!m_data.empty())
+ assert(opt::colourSpace == flag);
+ opt::colourSpace = flag;
+}
diff --git a/Assembly/SequenceCollection.h b/Assembly/SequenceCollection.h
new file mode 100644
index 0000000..3373c6b
--- /dev/null
+++ b/Assembly/SequenceCollection.h
@@ -0,0 +1,333 @@
+#ifndef SEQUENCECOLLECTION_H
+#define SEQUENCECOLLECTION_H 1
+
+#include "Graph/Properties.h"
+#include "ISequenceCollection.h"
+#include <boost/graph/graph_traits.hpp>
+#include <cassert>
+#include <utility>
+
+using boost::graph_traits;
+
+/** A map of Kmer to KmerData. */
+class SequenceCollectionHash : public ISequenceCollection
+{
+ public:
+ typedef SequenceDataHash::key_type key_type;
+ typedef SequenceDataHash::mapped_type mapped_type;
+ typedef SequenceDataHash::value_type value_type;
+ typedef mapped_type vertex_property_type;
+ typedef no_property edge_property_type;
+
+ SequenceCollectionHash();
+
+ void add(const Kmer& seq, unsigned coverage = 1);
+
+ /** Remove the specified sequence if it exists. */
+ void remove(const Kmer& seq)
+ {
+ setFlag(seq, SF_DELETE);
+ }
+
+ // Clean up by erasing sequences flagged as deleted.
+ size_t cleanup();
+
+ /** Shrink the hash table. */
+ void shrink() {
+ m_data.rehash(0);
+ printLoad();
+ }
+
+ // Print the load of the hash table.
+ void printLoad() const;
+
+ // Set flag for sequence seq
+ void setFlag(const Kmer& seq, SeqFlag flag);
+
+ // Clear the specified flag from every sequence in the
+ // collection.
+ void wipeFlag(SeqFlag flag);
+
+ bool setBaseExtension(const Kmer& seq, extDirection dir,
+ uint8_t base);
+ void removeExtension(const Kmer& seq,
+ extDirection dir, SeqExt ext);
+
+ // get the extensions of a sequence
+ bool getSeqData(const Kmer& seq,
+ ExtensionRecord& extRecord, int& multiplicity) const;
+
+ const value_type& getSeqAndData(const Kmer& key) const;
+
+ /** Return the data associated with the specified key. */
+ const mapped_type operator[](const key_type& key) const
+ {
+ bool rc;
+ SequenceCollectionHash::const_iterator it = find(key, rc);
+ assert(it != m_data.end());
+ return rc ? ~it->second : it->second;
+ }
+
+ iterator begin() { return m_data.begin(); }
+ const_iterator begin() const { return m_data.begin(); }
+ iterator end() { return m_data.end(); }
+ const_iterator end() const { return m_data.end(); }
+
+ /** Return true if this collection is empty. */
+ bool empty() const { return m_data.empty(); }
+
+ /** Return the number of sequences in this collection. */
+ size_t size() const { return m_data.size(); }
+
+ // Not a network sequence collection. Nothing to do.
+ size_t pumpNetwork() { return 0; }
+
+ /** Attach the specified observer. */
+ void attach(SeqObserver f)
+ {
+ assert(m_seqObserver == NULL);
+ m_seqObserver = f;
+ }
+
+ /** Detach the specified observer. */
+ void detach(SeqObserver f)
+ {
+ assert(m_seqObserver == f);
+ (void)f;
+ m_seqObserver = NULL;
+ }
+
+ void load(const char *path);
+ void store(const char* path);
+ bool isAdjacencyLoaded() const { return m_adjacencyLoaded; }
+ void setColourSpace(bool flag);
+
+ private:
+ iterator find(const Kmer& key) { return m_data.find(key); }
+ const_iterator find(const Kmer& key) const
+ {
+ return m_data.find(key);
+ }
+
+ iterator find(const Kmer& key, bool& rc);
+ const_iterator find(const Kmer& key, bool& rc) const;
+
+ /** Call the observers of the specified sequence. */
+ void notify(const value_type& seq)
+ {
+ if (m_seqObserver != NULL)
+ m_seqObserver(this, seq);
+ }
+
+ /** The underlying collection. */
+ SequenceDataHash m_data;
+
+ /** The observers. Only a single observer is implemented.*/
+ SeqObserver m_seqObserver;
+
+ /** Whether adjacency information has been loaded. */
+ bool m_adjacencyLoaded;
+};
+
+// Graph
+
+namespace boost {
+
+template <>
+struct graph_traits<SequenceCollectionHash> {
+ // Graph
+ typedef SequenceCollectionHash::key_type vertex_descriptor;
+ typedef boost::directed_tag directed_category;
+ struct traversal_category
+ : boost::adjacency_graph_tag, boost::vertex_list_graph_tag
+ { };
+ typedef boost::disallow_parallel_edge_tag edge_parallel_category;
+
+ // IncidenceGraph
+ typedef std::pair<vertex_descriptor, vertex_descriptor>
+ edge_descriptor;
+ typedef unsigned degree_size_type;
+ typedef void out_edge_iterator;
+
+ // BidirectionalGraph
+ typedef void in_edge_iterator;
+
+ // VertexListGraph
+ typedef size_t vertices_size_type;
+
+ // EdgeListGraph
+ typedef void edge_iterator;
+ typedef void edges_size_type;
+
+// AdjacencyGraph
+/** Iterate through the adjacent vertices of a vertex. */
+struct adjacency_iterator
+ : public std::iterator<std::input_iterator_tag, vertex_descriptor>
+{
+ /** Skip to the next edge that is present. */
+ void next()
+ {
+ for (; m_i < NUM_BASES && !m_adj.checkBase(m_i); m_i++) {
+ }
+ if (m_i < NUM_BASES)
+ m_v.setLastBase(SENSE, m_i);
+ }
+
+ public:
+ adjacency_iterator() : m_i(NUM_BASES) { }
+
+ adjacency_iterator(
+ vertex_descriptor u, SeqExt adj)
+ : m_v(u), m_adj(adj), m_i(0)
+ {
+ m_v.shift(SENSE);
+ next();
+ }
+
+ const vertex_descriptor& operator*() const
+ {
+ assert(m_i < NUM_BASES);
+ return m_v;
+ }
+
+ bool operator==(const adjacency_iterator& it) const
+ {
+ return m_i == it.m_i;
+ }
+
+ bool operator!=(const adjacency_iterator& it) const
+ {
+ return !(*this == it);
+ }
+
+ adjacency_iterator& operator++()
+ {
+ assert(m_i < NUM_BASES);
+ ++m_i;
+ next();
+ return *this;
+ }
+
+ private:
+ vertex_descriptor m_v;
+ SeqExt m_adj;
+ short unsigned m_i;
+}; // adjacency_iterator
+
+// VertexListGraph
+/** Iterate through the vertices of this graph. */
+struct vertex_iterator
+ : public std::iterator<std::input_iterator_tag, vertex_descriptor>
+{
+ typedef SequenceCollectionHash::const_iterator It;
+
+ public:
+ vertex_iterator(const It& it) : m_it(it), m_sense(false) { }
+
+ const vertex_descriptor operator*() const
+ {
+ return m_sense ? reverseComplement(m_it->first) : m_it->first;
+ }
+
+ bool operator==(const vertex_iterator& it) const
+ {
+ return m_it == it.m_it && m_sense == it.m_sense;
+ }
+
+ bool operator!=(const vertex_iterator& it) const
+ {
+ return !(*this == it);
+ }
+
+ vertex_iterator& operator++()
+ {
+ if (m_sense) {
+ ++m_it;
+ m_sense = false;
+ } else
+ m_sense = true;
+ return *this;
+ }
+
+ private:
+ It m_it;
+ bool m_sense;
+}; // vertex_iterator
+
+}; // graph_traits<SequenceCollectionHash>
+
+} // namespace boost
+
+// IncidenceGraph
+
+static inline
+graph_traits<SequenceCollectionHash>::degree_size_type
+out_degree(
+ graph_traits<SequenceCollectionHash>::vertex_descriptor u,
+ const SequenceCollectionHash& g)
+{
+ return g[u].getExtension(SENSE).outDegree();
+}
+
+// BidirectionalGraph
+
+static inline
+graph_traits<SequenceCollectionHash>::degree_size_type
+in_degree(graph_traits<SequenceCollectionHash>::vertex_descriptor u,
+ const SequenceCollectionHash& g)
+{
+ return g[u].getExtension(ANTISENSE).outDegree();
+}
+
+// AdjacencyGraph
+
+static inline
+std::pair<graph_traits<SequenceCollectionHash>::adjacency_iterator,
+ graph_traits<SequenceCollectionHash>::adjacency_iterator>
+adjacent_vertices(
+ graph_traits<SequenceCollectionHash>::vertex_descriptor u,
+ const SequenceCollectionHash& g)
+{
+ typedef graph_traits<SequenceCollectionHash>::adjacency_iterator
+ adjacency_iterator;
+ SeqExt adj = g[u].getExtension(SENSE);
+ return std::make_pair(adjacency_iterator(u, adj),
+ adjacency_iterator());
+}
+
+// VertexListGraph
+
+static inline
+std::pair<graph_traits<SequenceCollectionHash>::vertex_iterator,
+ graph_traits<SequenceCollectionHash>::vertex_iterator>
+vertices(const SequenceCollectionHash& g)
+{
+ return std::make_pair(g.begin(), g.end());
+}
+
+// PropertyGraph
+
+/** Return the reverse complement of the specified k-mer. */
+static inline
+graph_traits<SequenceCollectionHash>::vertex_descriptor
+get(vertex_complement_t, const SequenceCollectionHash&,
+ graph_traits<SequenceCollectionHash>::vertex_descriptor u)
+{
+ return reverseComplement(u);
+}
+
+static inline
+bool get(vertex_removed_t, const SequenceCollectionHash& g,
+ graph_traits<SequenceCollectionHash>::vertex_descriptor u)
+{
+ return g.getSeqAndData(u).second.deleted();
+}
+
+static inline
+no_property get(edge_bundle_t, const SequenceCollectionHash&,
+ graph_traits<SequenceCollectionHash>::edge_descriptor)
+{
+ return no_property();
+}
+
+#endif
diff --git a/COPYRIGHT b/COPYRIGHT
new file mode 100644
index 0000000..7188bbb
--- /dev/null
+++ b/COPYRIGHT
@@ -0,0 +1,358 @@
+Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+Upstream-Name: ABySS
+Upstream-Contact: Shaun Jackman <sjackman at bcgsc.ca>
+Source: http://www.bcgsc.ca/platform/bioinfo/software/abyss
+
+License: BCCA-Academic
+ Debian may redistribute this software package.
+ .
+ BC CANCER AGENCY SOFTWARE LICENSE AGREEMENT (ACADEMIC USE)
+ CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS. This License
+ Agreement (the "Agreement") is a legal contract between you, your
+ employer, educational institution or organization (collectively, "You")
+ and the British Columbia Cancer Agency ("BCCA") with respect to the
+ license of the software, including all associated documentation
+ (collectively, the "Product").
+ .
+ BCCA is willing to license the Product to You only if You accept the
+ terms and conditions of this Agreement. By clicking on the "I ACCEPT"
+ button, or by copying, downloading, accessing or otherwise using the
+ Product, You automatically agree to be bound by the terms of this
+ Agreement. IF YOU DO NOT WISH TO BE BOUND BY THE TERMS OF THIS
+ AGREEMENT, DO NOT COPY, DOWNLOAD, ACCESS OR OTHERWISE USE THE
+ PRODUCT.
+ .
+ 1. AUTHORITY: In the event that You are an educational institution or
+ organization, Your representative who is clicking the "I ACCEPT"
+ button, or otherwise copying, downloading, accessing or using the
+ Product hereby, in their personal capacity, represents and warrants
+ that they possess the legal authority to enter into this Agreement
+ on Your behalf and to bind You to the terms of this Agreement.
+ .
+ 2. LICENSE TO USE: BCCA hereby grants to You a personal, non-exclusive,
+ non-transferable, limited license to use the Product solely for
+ internal, non-commercial use for non-profit research or educational
+ purposes only on the terms and conditions contained in this Agreement.
+ The Product may be installed at a single site at Your premises only. A
+ copy of the Product installed on a single common machine or cluster of
+ machines may be shared for internal use by Qualified Users only. In
+ order to be a "Qualified User", an individual must be a student,
+ researcher, professor, instructor or staff member of a non-profit
+ educational institution or organization who uses the Product solely for
+ non-profit research or educational purposes.
+ .
+ 3. RESTRICTIONS: You acknowledge and agree that You shall not, and
+ shall not authorize any third party to:
+ (a) make copies of the Product, except as provided in Section 2 and
+ except for a single backup copy, and any such copy together with the
+ original must be kept in Your possession or control;
+ (b) modify, adapt, decompile, disassemble, translate into another
+ computer language, create derivative works of, or otherwise reverse
+ engineer the Product, or disclose any trade secrets relating to the
+ Product, except as permitted in Section 5;
+ (c) license, sublicense, distribute, sell, lease, transfer, assign,
+ trade, rent or publish the Product or any part thereof and/or copies
+ thereof, to any third party;
+ (d) use the Product to process any data other than Your own;
+ (e) use the Product or any part thereof for any commercial or
+ for-profit purpose or any other purpose other than as permitted in
+ Section 2; or
+ (f) use, without its express permission, the name of BCCA.
+ .
+ 4. INTELLECTUAL PROPERTY RIGHTS: Subject to Section 5 below, all
+ patents, copyrights, trade secrets, service marks, trademarks and
+ other proprietary rights in or related to the Product and any
+ improvements, modifications and enhancements thereof are and will
+ remain the exclusive property of BCCA or its licensors. You agree
+ that You will not, either during or after the termination of this
+ Agreement, contest or challenge the title to or the intellectual
+ property rights of BCCA or its licensors in the Product or any
+ portion thereof.
+ .
+ 5. OWNERSHIP OF IMPROVEMENTS: In the event that the Product, in the
+ form provided to You, includes source code (the "Source Code"),
+ You are entitled to make improvements, modifications and
+ enhancements to the Source Code (collectively, "Improvements")
+ which Improvements are to be used by You for non-profit research
+ and educational purposes only and You shall be the owner of those
+ Improvements that You directly make and of all intellectual
+ property rights to such Improvements, subject to the foregoing
+ limits on Your use and distribution of such Improvements. You
+ hereby grant to BCCA a perpetual, non-exclusive, worldwide,
+ fully-paid, irrevocable license to use such Improvements for any
+ purposes whatsoever, and to sublicense such Improvements including
+ the right for third parties to sublicense the same, in perpetuity
+ to the extent such rights are not limited in duration under
+ applicable law, without identifying or seeking Your
+ consent. Notwithstanding the foregoing, You acknowledge that BCCA
+ and its licensors will retain or own all rights in and to any
+ pre-existing code or other technology, content and data that may be
+ incorporated in the Improvements. For greater certainty, this
+ Section applies solely to the Source Code and shall not give You
+ any rights with respect to the object code or any other portion or
+ format of the Product which use, for greater certainty, is limited
+ as set forth in this Agreement including as set out in Section 3(b)
+ above. You acknowledge and agree that you will provide copies of
+ Improvements to BCCA in such format as reasonably requested by BCCA
+ at any time upon the request of BCCA.
+ .
+ 6. CONFIDENTIALITY: You acknowledge that the Product is and
+ incorporates confidential and proprietary information developed,
+ acquired by or licensed to BCCA. You will take all reasonable
+ precautions necessary to safeguard the confidentiality of the
+ Product, and will not disclose any information about the Product to
+ any other person without BCCA's prior written consent. You will
+ not allow the removal or defacement of any confidential or
+ proprietary notice placed on the Product. You acknowledge that any
+ breach of this Section 6 will cause irreparable harm to BCCA and
+ its licensors.
+ .
+ 7. NO WARRANTIES: THIS PRODUCT IS PROVIDED TO YOU BY BCCA IN ORDER TO
+ ALLOW YOU TO OBTAIN ACCESS TO LEADING ACADEMIC RESEARCH. THE PRODUCT
+ IS PROVIDED TO YOU ON AN "AS IS" BASIS WITHOUT WARRANTY OF ANY
+ KIND. NO WARRANTY, REPRESENTATION OR CONDITION EITHER EXPRESS OR
+ IMPLIED, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTY OR
+ CONDITION OF MERCHANTABILITY, NON-INFRINGEMENT, PERFORMANCE,
+ DURABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE SHALL
+ APPLY. BCCA DOES NOT WARRANT THAT THE PRODUCT WILL OPERATE ON A
+ CONTINUOUS OR TROUBLE FREE BASIS.
+ .
+ 8. LIMITATION OF LIABILITY: TO THE MAXIMUM EXTENT PERMITTED BY
+ APPLICABLE LAW, IN NO EVENT SHALL THE AGGREGATE LIABILITY OF BCCA TO
+ YOU EXCEED THE AMOUNT YOU HAVE PAID TO ACQUIRE THE PRODUCT ("MAXIMUM
+ AMOUNT") AND WHERE YOU HAVE NOT PAID ANY AMOUNT FOR THE PRODUCT THEN
+ THE MAXIMUM AMOUNT SHALL BE DEEMED TO BE CDN$100.00. IN NO EVENT SHALL
+ BCCA BE LIABLE FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL, OR SPECIAL
+ DAMAGES, INCLUDING WITHOUT LIMITATION ANY DAMAGES FOR LOST PROFITS OR
+ SAVINGS, REGARDLESS OF WHETHER THEY HAVE BEEN ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE. EXCEPT TO THE EXTENT THAT THE LAWS OF A
+ COMPETENT JURISDICTION REQUIRE LIABILITIES BEYOND AND DESPITE THESE
+ LIMITATIONS, EXCLUSIONS AND DISCLAIMERS, THESE LIMITATIONS, EXCLUSIONS
+ AND DISCLAIMERS SHALL APPLY WHETHER AN ACTION, CLAIM OR DEMAND ARISES
+ FROM A BREACH OF WARRANTY OR CONDITION, BREACH OF CONTRACT,
+ NEGLIGENCE, STRICT LIABILITY OR ANY OTHER KIND OF CIVIL OR STATUTORY
+ LIABILITY CONNECTED WITH OR ARISING FROM THIS AGREEMENT. YOU AGREE
+ THAT THE FOREGOING DISCLAIMER OF WARRANTIES AND LIMITATION OF
+ LIABILITY ARE FAIR IN LIGHT OF THE NATURE OF THE RIGHTS GRANTED HEREIN
+ AND THE AMOUNT OF FEES PAID BY YOU IN RESPECT OF THE PRODUCT.
+ .
+ 9. INDEMNITY: You will indemnify, defend and hold harmless BCCA, its
+ board of directors, staff and agents from and against any and all
+ liability, loss, damage, action, claim or expense (including
+ attorney's fees and costs at trial and appellate levels) in
+ connection with any claim, suit, action, demand or judgement
+ (collectively, "Claim") arising out of, connected with, resulting
+ from, or sustained as a result of Your use of the Product or the
+ downloading of the Product, including without limitation, any Claim
+ relating to infringement of BCCA's intellectual property rights or
+ the intellectual property rights of any third party.
+ .
+ 10. SUPPORT AND MAINTENANCE: You acknowledge and agree that, unless
+ and to the extent expressly agreed by BCCA in a separate written
+ document, the Product is provided to You without any support or
+ maintenance from BCCA and, for greater certainty, BCCA shall have
+ no obligation to issue any update or upgrade to any Product.
+ .
+ 11. TERM: This Agreement is effective until terminated. You may
+ terminate this Agreement at any time by ceasing use of the Product
+ and destroying or deleting any copies of the Product. This
+ Agreement will terminate immediately without notice from BCCA if
+ You fail to comply with any provision of this Agreement. BCCA may
+ terminate this Agreement at any time upon notice to you where BCCA
+ determines, in its sole discretion, that any continued use of the
+ Product could infringe the rights of any third parties. Upon
+ termination of this Agreement, and in any event upon BCCA
+ delivering You notice of termination, You shall immediately purge
+ all Products from Your computer system(s), return to BCCA all
+ copies of the Product that are in Your possession or control, and
+ cease any further development of any Improvements. On any
+ termination of this Agreement Sections 1, 4, 6, 7, 8, 9, 13 and 14
+ shall survive such termination.
+ .
+ 12. GOVERNMENT END USERS: Where any of the Product is used, duplicated
+ or disclosed by or to the United States government or a government
+ contractor or sub contractor, it is provided with RESTRICTED
+ RIGHTS as defined in Title 48 CFR 52.227-19 and is subject to the
+ following: Title 48 CFR 2.101, 52.227-19, 227.7201 through
+ 227.7202-4, FAR 52.227-14, and FAR 52.227-19(c)(1-2) and (6/87),
+ and where applicable, the customary software license, as described
+ in Title 48 CFR 227-7202 with respect to commercial software and
+ commercial software documentation including DFAR 252.227-7013,
+ DFAR 252,227-7014, DFAR 252.227-7015 and DFAR 252.7018, all as
+ applicable.
+ .
+ 13. USE OF THE DOWNLOAD SERVICE: You acknowledge and agree that you
+ will be responsible for all costs, charges and taxes (where
+ applicable) arising out of Your use of the Product and the
+ downloading of the Product. You acknowledge that You are
+ responsible for supplying any hardware or software necessary to
+ use the Product pursuant to this Agreement.
+ .
+ 14. GENERAL PROVISIONS:
+ (a) This Agreement will be governed by the laws of the Province of
+ British Columbia, and the laws of Canada applicable therein, excluding
+ any rules of private international law that lead to the application of
+ the laws of any other jurisdiction. The United Nations Convention on
+ Contracts for the International Sale of Goods (1980) does not apply to
+ this Agreement. The courts of the Province of British Columbia shall
+ have non-exclusive jurisdiction to hear any matter arising in
+ connection with this Agreement.
+ (b) USE OF THE PRODUCT IS PROHIBITED IN ANY JURISDICTION WHICH DOES
+ NOT GIVE EFFECT TO THE TERMS OF THIS AGREEMENT.
+ (c) You agree that no joint venture, partnership, employment,
+ consulting or agency relationship exists between You and BCCA as a
+ result of this Agreement or Your use of the Product.
+ (d) You hereby consent to Your contact information and any other
+ personally identifiable information that You provide to us being
+ disclosed to and maintained and used by us and our business partners
+ for the purposes of (i) managing and developing our respective
+ businesses and operations; (ii) marketing products and services to You
+ and your staff; and (iii) developing new and enhancing existing
+ products. You further agree that we may provide this information to
+ other persons as required to satisfy any legal requirements and to any
+ person that acquires some or all of the assets of BCCA. Where any of
+ the personally identifiable information that You provide to us is in
+ respect of individuals other than Yourself (such as Your staff) then
+ You represent and warrant to use that You have obtained all necessary
+ consents and authorizations from such individuals in order to comply
+ with this provision. Please see the BCCA website for further
+ information regarding personally identifiable information.
+ (e) This Agreement is the entire Agreement between You and BCCA
+ relating to this subject matter. You will not contest the validity of
+ this Agreement merely because it is in electronic form. No
+ modification of this Agreement will be binding, unless in writing and
+ accepted by an authorized representative of each party.
+ (f) The provisions of this Agreement are severable in that if any
+ provision in the Agreement is determined to be invalid or
+ unenforceable under any controlling body of law, that will not affect
+ the validity or enforceability of the remaining provisions of the
+ Agreement.
+ (g) You agree to print out or download a copy of this Agreement and
+ retain it for Your records.
+ (h) You consent to the use of the English language in this Agreement.
+ (i) You may not assign this Agreement or any of Your rights or
+ obligations hereunder without BCCA's prior written consent. BCCA, at
+ its sole discretion may assign this Agreement without notice to You.
+
+Files: *
+Copyright: Copyright 2012 Genome Sciences Centre
+License: BCCA-Academic
+
+Files: Common/* DistanceEst/* ParseAligns/*
+Copyright: Copyright 2012 Genome Sciences Centre
+License: BCCA-Academic or GPL-3+
+
+Files: Common/cholesky.hpp
+Copyright: Copyright 2005 Gunter Winkler, Konstantin Kutzkow
+License: LGPL-2.1+
+
+Files: Common/city.cc Common/city.h
+Copyright: Copyright 2011 Google, Inc.
+License: Expat
+
+Files: dialign/*
+Copyright: Copyright 2008 Amarendran R. Subramanian
+License: LGPL-2.1+
+
+License: LGPL-2.1+
+ On Debian systems, see `/usr/share/common-licenses/LGPL-2.1'.
+ .
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+ .
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+ .
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ .
+ Amarendran R. Subramanian, hereby disclaims all copyright interest in the
+ DIALIGN-TX (a multiple sequence alignment algorithm) written by Amarendran R. Subramanian.
+ .
+ Amarendran R. Subramanian, 2004-2008
+ .
+ DIALIGN-TX has been co-authored by Volker Menrad and Dorothea Emig.
+ .
+ Research work using DIALIGN-TX should cite:
+ .
+ DIALIGN-TX: improvement of the segment-based approach for multiple
+ sequence alignment by combining greedy and progressive alignment
+ strategies
+ Amarendran R. Subramanian, Michael Kaufmann, Burkhard Morgenstern,
+ Algorithms for Molecular Biology 3:6, 2008
+ .
+ DIALIGN-T: An improved algorithm for segment-based multiple
+ sequence alignment
+ Amarendran R. Subramanian, Jan Weyer-Menkhoff, Michael Kaufmann,
+ Burkhard Morgenstern, BMC Bioinformatics 6:66, 2005
+
+Files: FMIndex/bit_array.h
+Copyright: Copyright 2010 Daisuke Okanohara
+License: BSD-3-clause
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ .
+ Redistributions of source code must retain the above Copyright
+ notice, this list of conditions and the following disclaimer.
+ .
+ Redistributions in binary form must reproduce the above Copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+ .
+ Neither the name of the authors nor the names of its contributors
+ may be used to endorse or promote products derived from this
+ software without specific prior written permission.
+
+Files: FMIndex/sais.hxx
+Copyright: Copyright 2010 Yuta Mori
+License: Expat
+
+License: Expat
+ Permission is hereby granted, free of charge, to any person
+ obtaining a copy of this software and associated documentation
+ files (the "Software"), to deal in the Software without
+ restriction, including without limitation the rights to use,
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the
+ Software is furnished to do so, subject to the following
+ conditions:
+ .
+ The above copyright notice and this permission notice shall be
+ included in all copies or substantial portions of the Software.
+ .
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ OTHER DEALINGS IN THE SOFTWARE.
+
+License: GPL-3+
+ This program is free software; you can redistribute it
+ and/or modify it under the terms of the GNU General Public
+ License as published by the Free Software Foundation; either
+ version 3 of the License, or (at your option) any later
+ version.
+ .
+ This program is distributed in the hope that it will be
+ useful, but WITHOUT ANY WARRANTY; without even the implied
+ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
+ PURPOSE. See the GNU General Public License for more
+ details.
+ .
+ You should have received a copy of the GNU General Public
+ License along with this package; if not, write to the Free
+ Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ Boston, MA 02110-1301 USA
+ .
+ On Debian systems, the full text of the GNU General Public
+ License version 3 can be found in the file
+ `/usr/share/common-licenses/GPL-3'.
diff --git a/ChangeLog b/ChangeLog
new file mode 100644
index 0000000..797617c
--- /dev/null
+++ b/ChangeLog
@@ -0,0 +1,956 @@
+2012-05-30 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.3.4.
+ * Do not extend paths, which can cause misassemblies.
+ * Increase the default value of m from 30 to 50.
+ * Various portability fixes.
+
+ abyss-pe:
+ * Increase the default value of m from 30 to 50 to reduce the
+ likelihood of misassemblies.
+ * Integrate with SLURM. Thanks to Timothy Carlson.
+
+ ABYSS:
+ * Use CityHash64 rather than Bob Jenkins' hashlittle.
+
+ SimpleGraph:
+ * Do not extend paths. Closes #8. Extending paths can cause
+ misassemblies when the de Bruijn graph is incomplete.
+
+ MergePaths:
+ * Bug fix. Closes #6. Fix the bug causing the error:
+ Assertion `!m_ambig' failed.
+
+ abyss-fatoagp:
+ * New script. Create a FASTA file of scaftigs and an AGP file.
+
+2012-03-13 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.3.3.
+ * New parameter, l. Specify the minimum alignment length when
+ aligning the reads to the contigs.
+ * Improve the scaffolding algorithm that identifies repeats.
+ * Improve the documentation.
+
+ abyss-pe:
+ * New parameter, l. Specify the minimum alignment length when
+ aligning the reads to the contigs. This option may be specified
+ per library. The default value is k.
+ * New parameter, S. Specify the minimum contig size required for
+ building scaffolds.
+ * New parameter, N. Specify the minimum number of pairs required
+ for building scaffolds.
+ * Integrate with Load Sharing Facility (LSF).
+ * Calculate the assembly contiguity statistics.
+
+ KAligner, abyss-map:
+ * Rename the minimum alignment length option -k to -l.
+
+ DistanceEst:
+ * Dual licensed under the GPL and BCCA-Academic licenses.
+ * New options, --fr and --rf. Specify the orientation of the
+ library. The default behaviour is to detect the orientation.
+ * New options, --mind and --maxd. Specify the minimum and maximum
+ distances for the maximum likelihood estimator.
+ * New option, -l, --min-align. Specify the minimum alignment
+ length of the aligner, which can improve distance estimates.
+ * Increase the default minimum mapping quality, -q, to 10, was 1.
+
+ MergePaths:
+ * Bug fix. Fix the bug causing the error:
+ Assertion `count(it2+1, path2.end(), pivot) == 0' failed.
+
+ PathConsensus:
+ * Bug fix. Fix the bug causing the error:
+ Assertion `fstSol.size() == sndSol.size()' failed.
+
+ MergeContigs:
+ * Calculate the assembly contiguity statistics.
+
+ abyss-scaffold:
+ * Improve the algorithm that identifies repeats.
+ * Remove simple cycles from the scaffold graph.
+ * Calculate the assembly contiguity statistics.
+ * The option -s may specify a range, such as -s200-10000,
+ to find the value of s that maximizes the scaffold N50.
+
+ abyss-fac:
+ * New option, -m, --mmd. Output MultiMarkdown format.
+
+ abyss-index:
+ * New option, -a, --alphabet. Specify the alphabet.
+ * New option, --bwt. Output the Burrows-Wheeler transform.
+
+ abyss-samtoafg:
+ * New script. Convert a SAM file to an AMOS AFG file.
+
+ README, README.html, abyss-pe.1:
+ * Improve the documentation.
+
+2011-12-13 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.3.2.
+ * Enable scaffolding by default.
+ * Remove small shim contigs.
+ * Improved distance estimates.
+ * Reduce sequence duplication.
+ * Read compressed files on Mac OS X.
+
+ abyss-pe:
+ * Enable scaffolding by default. If the mp parameter is not
+ specified, use a default value of ${pe} or ${lib}.
+ * Support using bowtie2 to align reads to contigs by specifying
+ aligner=bowtie2.
+ * The default aligner is abyss-map.
+ * Output the scaffold overlap graph, ${name}-scaffolds.dot.
+ * Set DYLD_FORCE_FLAT_NAMESPACE to read compressed files on OS X.
+
+ ABYSS:
+ * Can read k-mer count data from a Jellyfish file with extension
+ .jf for k-mer counts or .jfq for q-mer counts. Jellyfish must be
+ installed.
+ * Bug fix. Fix the bug causing the error
+ bool chomp(std::string&, char): Assertion `s.length() > 1' failed.
+
+ abyss-filtergraph:
+ * New program. Remove small shim contigs that add no useful
+ sequence to the assembly. Thanks to Tony Raymond (tgr).
+
+ PopBubbles:
+ * New option, -a, --branches. Specify the maximum number of
+ branches of a bubble that may be popped. Default is 2.
+ * Use DIALIGN-TX for multiple sequence alignment. Thanks to tgr.
+
+ DistanceEst:
+ * Improved distance estimates.
+
+ abyss-joindist:
+ * Remove this program. Use abyss-todot instead.
+
+ MergePaths:
+ * Use a non-greedy algorithm that reduces sequence duplication but
+ may reduce contiguity. The greedy algorithm may be used by
+ specifying the option --greedy.
+
+ abyss-fixmate:
+ * Do not output query names by default.
+
+ configure:
+ * New option, --enable-samseqqual. Enable SAM sequence and quality
+ fields.
+
+2011-10-24 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.3.1.
+ * Read sequence files in SRA format. The tool fastq-dump from the
+ sratoolkit must be installed.
+ * Read a contig overlap graph in the ASQG format of SGA.
+ * Fix compile errors for Mac OS X.
+ * Fix the bug that caused the line number of an error in a FASTQ
+ file to be reported incorrectly.
+
+ abyss-pe:
+ * Support using BWA-SW to align reads to contigs by specifying
+ aligner=bwasw.
+ * The parameter ALIGNER_OPTIONS may be used to specify a different
+ value for k when aligning using abyss-map.
+ * New target, bam, may be used to produce a final BAM file of the
+ reads aligned to the scaffolds.
+
+ KAligner:
+ * Fix the bug causing the error:
+ Assertion `qstep >= 0 && qstep <= m_hashSize' failed.
+
+ abyss-scaffold:
+ * The result is independent of the order in which the mate-pair
+ libraries are specified.
+ * Permit scaffolding contigs that have non-numeric identifiers.
+ * The overlap graph is optional.
+
+ abyss-todot:
+ * Convert adj, dist or ASQG formatted graph files to dot format.
+ * Merge multiple graph files into one.
+
+2011-09-09 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.3.0.
+ * Use mate-pair libraries to scaffold contigs.
+ * Support CASAVA-formatted FASTQ files.
+ * Bug fix. Do not trim quality 41 bases from the ends of reads.
+ * Boost C++ Libraries are required to compile ABySS.
+
+ abyss-pe:
+ * New parameter, mp, to specify the mate-pair libraries to be used
+ for scaffolding.
+ * Increase the default value for s from 100 to 200.
+ * Set the default value for n to 10.
+ * Integrate with PBS.
+
+ abyss-scaffold:
+ * New program. Scaffold using mate-pair libraries.
+
+ DistanceEst:
+ * Ignore multimapped alignments with a mapping quality of zero.
+ * New option, -q, --min-mapq. Ignore alignments with mapping
+ quality less than this threshold. Default is 1.
+ * Do not use OpenMP 3.0.
+
+ PopBubbles:
+ * Scaffold over complex bubbles with the option --scaffold.
+ Disabled by default.
+
+ MergePaths:
+ * Fix a bug that causes PathOverlap to die with the error:
+ Distance get(edge_bundle_t, const Graph&, ContigNode, ContigNode):
+ Assertion `e.second' failed.
+ * New option, --no-greedy. Use a non-greedy algorithm that reduces
+ sequence duplication but reduces contiguity. Disabled by default.
+
+ KAligner:
+ * Performance improvements. Thanks to Tony Raymond (tgr).
+ * The output is printed in the same order as the input when
+ multithreaded. (tgr)
+
+ abyss-map:
+ * New program. Use the BWT and FM-index to find the longest common
+ substring. To use it, specify the option aligner=map to abyss-pe.
+
+ abyss-index:
+ * New program. Build a FM-index of a FASTA file.
+
+ abyss-bowtie:
+ * Use abyss-tofastq --interleave to speed up abyss-fixmate.
+
+ abyss-bwa:
+ * Use bwa index -a bwtsw by default.
+ * Use abyss-tofastq --interleave to speed up abyss-fixmate.
+
+ abyss-fac:
+ * Report N80, N50 and N20. Do not report median and mean.
+ * Increase the default minimum contig size threshold, option -t,
+ from 100 to 200.
+
+ abyss-fixmate:
+ * Set the mapping quality of both alignments to the minimum
+ mapping quality of the pair of alignments.
+
+ abyss-tofastq:
+ * New option, -i, --interleave. Interleave the files.
+
+ configure:
+ * New option, --with-boost. Specify the path for Boost.
+ * New option, --disable-popcnt. Do not use the popcnt instruction.
+
+2011-04-15 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.2.7.
+
+ abyss-pe:
+ * Support using bwa or bowtie to align reads to contigs.
+ Specify aligner=bwa or aligner=bowtie.
+ * Integrate with IBM LoadLeveler.
+
+ PopBubbles:
+ * Use an affine gap penalty.
+ * The default maximum bubble length is 10 kbp.
+ * New option, --scaffold. Scaffold over bubbles with insufficient
+ sequence identity to be popped.
+
+ SimpleGraph:
+ * New parameter d to specify the acceptable error of a distance
+ estimate. The default is 6 bp.
+
+ PathConsensus:
+ * Use an affine gap penalty.
+
+ MergePaths:
+ * Fix a bug that causes PathOverlap to die with the error:
+ Distance get(edge_bundle_t, const Graph&, ContigNode, ContigNode):
+ Assertion `e.second' failed.
+
+2011-02-07 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.2.6.
+ * Find contigs that overlap by fewer than k-1 bp.
+ * Pop bubbles with sufficient sequence identity.
+ * Merge paths that overlap unambiguously.
+
+ abyss-pe:
+ * New parameter, m, the minimum number of overlapping bases.
+ The default is 30.
+ * The minimum sequence identity parameter, p, applies to both
+ PopBubbles and PathConsensus.
+
+ ABYSS:
+ * Support values of k larger than 96. The maximum value of k is
+ set when compiling using `configure --enable-maxk´.
+
+ AdjList:
+ * Find sequences that overlap by fewer than k-1 bp. The parameter
+ m specifies the minimum number of overlapping bases.
+
+ PopBubbles:
+ * Align both branches of the bubble and pop bubbles whose sequence
+ identity is sufficient, at least 90% by default.
+ * New parameter, p, the minimum identity required.
+ * The maximum bubble size is unlimited by default. This limit can
+ be changed using the parameter b.
+
+ SimpleGraph:
+ * Extend each path as long as is unambiguously possible.
+
+ PathOverlap:
+ * Merge paths that overlap unambiguously.
+
+ MergeContigs:
+ * Perform an alignment of the two sequences when no simple overlap
+ is found.
+
+ abyss-fac:
+ * New option, -g. Specify the expected genome size.
+
+2010-11-15 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.2.5.
+
+ AdjList:
+ * Fix the colour-space-specific bug causing the error
+ Assertion `seq.length() > (unsigned)opt::overlap' failed.
+
+ PathConsensus:
+ * Fix the bug causing the error
+ Assertion `fstSol.size() == 1' failed.
+
+ abyss-fixmate:
+ * Do not output the @RG header record at the end of the output
+ that gives the median fragment size. It breaks `samtools view -S`.
+ * --no-qname: New option. Set the qname to *.
+
+2010-10-13 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.2.4.
+
+ ABYSS-P:
+ * Fix the bug causing the error
+ Unexpected sequence extension message.
+
+ KAligner:
+ * Reduce the amount of memory used by KAligner.
+
+ PathConsensus:
+ * New program. Replace gaps of Ns that span a region of ambiguous
+ sequence with a consensus sequence of the possible sequences that
+ fill the gap. By default a minimum 90% identity is required. This
+ default can be changed with the parameter, p. The consensus
+ sequence uses IUPAC-IUB ambiguity codes. DIALIGN-TX is used for
+ the multiple sequence alignment.
+
+ PathOverlap:
+ * Fix the bug causing the error
+ Assertion `back(paths, u) == front(paths, v)' failed.
+
+2010-09-08 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.2.3.
+
+ ABYSS-P:
+ * Bug fix. Fix the bug causing the error
+ Assertion `m_comm.receiveEmpty()' failed.
+
+ PopBubbles:
+ * Bug fix. Fix the bug causing the error
+ error: unexpected ID
+
+ PathOverlap:
+ * Include the single-end contigs in the overlap graph.
+
+ abyss-pe:
+ * Output an overlap graph of the paired-end assembly in the file
+ ${name}-contigs.dot.
+ * Do not create the intermediate file ${name}-4.fa.
+
+ abyss-adjtodot:
+ * Convert an overlap graph in adj format to Graphviz dot format or
+ SAM alignment format.
+
+2010-08-25 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.2.2.
+ * Merge contigs after popping bubbles.
+ * Handle multi-line FASTA sequences.
+ * Report the amount of memory used.
+ * Most tools can output their results in SAM format, including
+ AdjList, KAligner, ParseAligns and PathOverlap.
+
+ abyss-pe:
+ * New command, se-dot. Output a Graphviz dot file of the
+ single-end assembly.
+
+ ABYSS:
+ * Handle multi-line FASTA sequences.
+ * Report the amount of memory used.
+ * Improve error messages for incorrectly-formatted FASTA files.
+ * Bug fix. Improved handling of palindromes.
+
+ PopBubbles:
+ * Merge contigs after popping bubbles.
+ * Bug fix. Do not pop bubbles resulting from palindromes.
+
+ KAligner:
+ * Report the amount of memory used.
+ * New option, --sam. Output the alignments in SAM format.
+
+ ParseAligns, DistanceEst:
+ * Bug fix. The CIGAR string was oriented with respect to the
+ query rather than with respect to the target, which is standard.
+
+ AdjList, PathOverlap:
+ * New option, --sam. Output the adjacency graph in SAM format.
+
+ abyss-fixmate:
+ * New program. Similar to samtools fixmate, but does not require
+ that the input be sorted by query ID, although it is faster if it
+ is sorted.
+
+2010-07-12 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.2.1.
+ * Handle reverse-forward oriented mate pair libraries.
+ * Improved distance estimates, particularly with large fragment
+ libraries.
+
+ abyss-pe:
+ * New commands:
+ se-contigs: Assemble single-end contigs.
+ pe-contigs: Assemble paired-end contigs (default).
+ se-sam: Output a gzipped SAM file of the single-end assembly.
+ se-bam: Ouptut a BAM file of the single-end assembly.
+ pe-dot: Output a Graphviz dot file of the paired-end assembly.
+ all: Sam as se-bam pe-contigs pe-dot.
+ * Options for one particular library may be specified:
+ lib='lib1 lib2' lib2_s=1000 lib2_n=25
+ * Input sequence may come from an arbitrary command, which is
+ useful to assemble a region of an aligned BAM file:
+ in='<(samtools view genome.bam chr10)'
+
+ ABYSS:
+ * Bug fix. When reading SAM/BAM files, the quality format
+ incorrectly defaulted to ASCII-64, when it should be ASCII-33.
+
+ ABYSS-P:
+ * May use the Intel MPI library.
+
+ ParseAligns:
+ * Count the number of forward-reverse, reverse-forward and
+ forward-forward oriented alignments.
+
+ DistanceEst:
+ * Handle reverse-forward oriented mate pair libraries.
+ * Improved distance estimates, particularly with large fragment
+ libraries.
+ * Remove duplicate mate pairs.
+ * Print a pretty UTF-8 bar plot of the fragment-size distribution.
+ * Multithreaded using OpenMP. The -j, --threads option specifies
+ the number of threads to use.
+ * Performance improvment.
+
+ Overlap:
+ * Handle cases when more than one gap occurs within the mate pair
+ fragment size.
+
+ SimpleGraph:
+ * Performance improvment.
+
+ MergePaths:
+ * Handle the case when a circular sequence is assmembled into a
+ single contig.
+
+ abyss-tofastq:
+ * New program. Convert qseq, export, SAM and BAM files to FASTA or
+ FASTQ format. The files may be compressed with gz, bz2 or xz and
+ may be tarred.
+
+2010-05-25 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.2.0.
+ * Scaffold over gaps in coverage and unresolved repetitive
+ sequence using Ns.
+ * Read sequence from SAM and BAM files.
+
+ abyss-pe:
+ * Set q=3 by default. Trim bases from the ends of reads whose
+ quality is less than 3.
+ * Do not store the .pair.gz file.
+ * Generate a BAM file of the mate pairs that align to
+ different contigs of the single-end assembly. Disabled by default.
+ * Output a Graphviz dot file of the paired-end assembly.
+ Disabled by default.
+ * Store the bubbles in ${name}-bubbles.fa rather than bubbles.fa.
+ * Store the indel bubbles in ${name}-indel.fa.
+ * Bug fix for mawk.
+
+ ABYSS:
+ * Set -E0 when coverage is low (<2).
+
+ ABYSS-P:
+ * Remove the temporary files contigs-*.fa and snp-*.fa.
+
+ PopBubbles:
+ * Output in Graphviz dot format using --dot.
+
+ KAligner:
+ * Do not ignore sequences (reads or contigs) containing N.
+ * Output SAM headers (but not SAM alignments).
+
+ ParseAligns:
+ * Output in SAM format.
+
+ DistanceEst:
+ * Input in SAM format.
+ * Output in Graphviz dot format using --dot.
+
+ Overlap:
+ * Scaffold over gaps in coverage. Scaffolding can be disabled
+ using the option --no-scaffold.
+ * Merge contigs that overlap at simple repeats. These merges can
+ be prevented using the option --no-merge-repeat.
+
+ SimpleGraph:
+ * Scaffold over repeats. Scaffolding can be disabled using the
+ option --no-scaffold.
+
+ MergePaths:
+ * Merge paths containing ambiguous sequence.
+ * Multithreaded using OpenMP. The -j, --threads option specifies
+ the number of threads to use.
+
+ MergeContigs:
+ * Merge paths and contigs containing ambiguous sequence.
+
+ PathOverlap:
+ * Output in Graphviz dot format using --dot.
+
+ Consensus:
+ * Output the pileup in samtools format.
+
+2010-02-15 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.1.2.
+
+ ABYSS:
+ * Read tar files including compressed tar files.
+ * New parameter -b, --bubble-length=N. Pop bubbles shorter than
+ N bp. The default is b=3*k.
+
+ AdjList:
+ * Include the contig coverage in the output.
+ * The script abyss-adjtodot converts an ABySS adjacency file to
+ GraphViz dot format.
+
+ PopBubbles:
+ * Pop bubbles resulting from indels.
+
+ KAligner:
+ * Synchronize the threads periodically (every ten thousand
+ alignments by default) to ease the computational burden on
+ ParseAligns. This synchronization can be disabled using --sync=0.
+ * Use two threads by default.
+
+ abyss-pe:
+ * New parameter, b.
+ * Use two threads by default.
+ * The read length argument, l, is deprecated. To emulate the
+ behaviour of ABySS 1.0.14 and older, set t=6*(l-k+1). The default
+ is t=k.
+
+2010-01-19 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.1.1.
+
+ ABYSS:
+ * Pop complex bubbles either completely or not at all. Bubble
+ popping now completes in a single round.
+ * Choose better (typically lower) default values for the
+ parameters -e,--erode and -c,--coverage. The default threshold is
+ the square root of the median k-mer coverage.
+
+2009-12-18 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.1.0.
+ * The output format of AdjList, DistanceEst and SimpleGraph has
+ changed to be more humanly readable.
+
+ ABYSS:
+ * New options, -q, --trim-quality. Trim bases from the ends of
+ reads whose quality is less than the specified threshold.
+ --standard-quality: zero quality is `!' (33)
+ default for FASTQ files
+ --illumina-quality: zero quality is `@' (64)
+ default for qseq and export files
+ Thanks to Tony Raymond.
+
+ SimpleGraph:
+ * Multithreaded. The -j, --threads option specifies the number of
+ threads to use.
+ * Expand tandem repeats when it is possible to determine the exact
+ number of the repeat.
+
+ MergePaths:
+ * Bug fix. A repeat that is larger than the fragment size could
+ be misassembled. Thanks to Tony Raymond.
+
+ abyss-pe:
+ * Determine the parameter j (number of threads) by finding the
+ number of slots allocated on the head node in the PE_HOSTFILE.
+ * Store the k-mer coverage histogram in coverage.hist.
+
+2009-11-13 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.16.
+ * Improve the performance and memory usage of KAligner and
+ AdjList, particularly for very large data sets.
+
+ KAligner:
+ * Improve memory usage when maxk is 32 or 96. No change when maxk
+ is the default 64.
+ * New option, -i, --ignore-multimap. Ignore any duplicate k-mer in
+ the target sequence. Thanks to Tony Raymond.
+
+ AdjList:
+ * Improve performance for very large data sets.
+
+ ParseAligns:
+ * For reads whose ID begins with `SRR', expect that the forward
+ and reverse read have identical ID and no suffix, such as
+ /1 and /2.
+
+2009-10-19 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.15.
+
+ ABYSS:
+ * New options, -e, --erode and -E, --erode-strand.
+ The parameter e erodes bases at the ends of blunt contigs with
+ coverage less than the specified threshold.
+ The parameter E erodes bases at the ends of blunt contigs with
+ coverage less than the specified threshold on either strand.
+ * New feature. If the parameters e and c are not specified,
+ attempt to choose appropriate values based on the observed k-mer
+ coverage. This feature will work best for higher coverage data.
+ For lower coverage data, setting e=c=2 is reasonable.
+ * New option, --trim-masked. Removed masked (lower case) sequence
+ at the beginning and end of the read. Disable with
+ --no-trim-masked.
+ * The read length, l, is an optional parameter. If the read length
+ is specified, the trim parameter, t, will default to 6*(l-k+1), as
+ before. If the read length is not specified, t will be set to the
+ same value as k. For longer reads or when k is less than 85% of l,
+ it should not be necessary to specify l. The parameter t may be
+ specified directly if desired.
+
+ DistanceEst:
+ * Bug fix. The standard deviation could be calculated incorrectly
+ for larger numbers, particularly for libraries with large fragment
+ sizes. Thanks to Tony Raymond.
+
+ Overlap:
+ * Bug fix. If Overlap found mate pairs on the same contig with
+ incorrect orientation, it would generate a misassembled contig.
+ These misassembled contigs are easily identified in the
+ xxx-3-overlap.fa file. The two contigs IDs, in the fourth and
+ fifth column, will be identical.
+ * New option, --mask-repeat. If two contigs are joined by mate
+ pairs and are found to overlap by a simple repeat so that the
+ exact number of the repeat is unknown, join the contigs estimating
+ the number of the repeat, and mask (lower case) the repeat
+ sequence. This feature is disabled by default.
+
+ abyss-pe:
+ * Use gunzip -c rather than zcat for portability.
+
+ configure:
+ * New option, --enable-mpich. Use the MPICH2 MPI library.
+
+2009-09-08 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.14.
+ * Read files compressed with xzip (.xz) and compress (.Z).
+
+ abyss-pe:
+ * Assemble multiple libraries with different fragment sizes.
+ * New manual page.
+
+ ABYSS:
+ * Don't necessarily discard reads that contain an N. Keep those
+ k-mer that do not contain an N.
+
+ ABYSS-P:
+ * Serially renumber the contigs output by ABYSS-P using awk.
+
+2009-08-26 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.13.
+ * Read files compressed with gzip (.gz) or bzip2 (.bz2).
+
+ ABYSS-P:
+ * Bug fix. Fix a race condition in the erosion algorithm.
+
+2009-08-18 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.12.
+
+ abyss-pe:
+ * Both ABYSS and KAligner are run only once per assembly, which
+ speeds up the paired-end assembly by nearly a factor of two.
+ * The k-mer coverage information is correct in every contig file.
+ * A new parameter, cs, converts colour-space contigs to nucleotide
+ contigs using Consensus.
+ * A new parameter, ABYSS_OPTIONS, may be used to disable chastity
+ filtering by specifying ABYSS_OPTIONS=--no-chastity.
+
+ ABYSS:
+ * Read files in export format, which is similar to qseq format.
+ * Discard reads that failed the chastity filter. Use the
+ --no-chastity option to retain these unchaste reads. Chastity
+ filtering affects only qseq- and export formatted-files.
+ * Remove low-coverage contigs within ABYSS rather than filtering
+ using awk and reassembling.
+ * Support big-endian architecture machines.
+
+ KAligner:
+ * A new option, -m or --multimap, specifies that a duplicate k-mer
+ may be seen in the target sequence. By default, every k-mer in the
+ target sequence must be unique.
+ * A new option, --seq, prints the read sequence of each alignment.
+
+ Overlap:
+ * A new option, --scaffold, fills the gap between two blunt
+ contigs with Ns. This feature is disabled by default.
+
+ Consensus:
+ * Call the consensus sequence for each contig based on the
+ alignment of reads to contigs.
+ * Convert colour-space contigs to nucleotide contigs.
+ * Written by Tony Raymond.
+
+2009-07-21 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.11.
+ * Assemble colour-space reads. Read identifiers must be named with
+ the suffixes F3 and R3.
+ * Read files in qseq format. Thanks to Tony Raymond (tgr).
+ * Prevent misassemblies mediated by tandem segmental duplications.
+ A sequence XRRY, where R is a repeat sequence, could have been
+ misassembled as XRY. (tgr)
+
+ abyss-pe:
+ * Integrate with Sun Grid Engine (SGE). A parallel, paired-end
+ assembly can be run with a single qsub command. The parameters
+ lib, np and k default to the qsub environment variables JOB_NAME
+ (qsub -N), NSLOTS (qsub -pe) and SGE_TASK_ID (qsub -t)
+ respectively.
+ * The .pair file, the largest intermediate file, is now gzipped.
+
+ ABYSS-P:
+ * Bug fix. At k=19, k-mer would be distributed to even-numbered
+ processes only.
+
+ KAligner:
+ * Multithreaded. The -j, --threads option specifies the number of
+ threads to use. The order in which the alignments are output will
+ vary from run to run, but the alignments are deterministic and
+ will not vary. Each thread reads and aligns one file, so the reads
+ must be in more than one file to use this feature. (tgr)
+
+2009-06-18 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.10.
+
+ abyss-pe:
+ * Start an MPI ABySS assembly if the np option is specified.
+
+ ABYSS:
+ * For a non-parallel assembly, allocate more hash buckets to allow
+ for large single-machine jobs.
+ * Print the hash load during the loading process.
+
+ KAligner:
+ * Output the IDs of reads that do not align.
+ * Print a progress report of the number of reads aligned.
+
+ ParseAligns:
+ * To reduce memory usage, do not track reads that did not align.
+ KAligner and ParseAligns should now be able to handle any number
+ of reads in a single run.
+
+ MergePaths:
+ * Number paired-end contigs so that their IDs do not overlap with
+ the single-end contigs. If a single-end contig is not used in a
+ paired-end contig, its ID will not change.
+ * Merge overlapping paired-end contigs that were previously
+ being missed in some situations.
+
+ configure:
+ * Print a warning if Google sparsehash was not found.
+
+2009-05-15 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.9.
+
+ abyss-pe:
+ * Allow multiple input files specified by the parameter `in'.
+ * Support reading FASTA or FASTQ file formats.
+
+ KAligner:
+ * Support using Google sparsehash to reduce memory usage.
+ Google sparsehash does not provide a multimap, so KAligner built
+ using Google sparsehash cannot handle a duplicate k-mer in the
+ reference sequence. It will print an error message and die if a
+ duplicate k-mer is encountered. If Google sparsehash is not used,
+ the standard STL multimap will be used which does permit duplicate
+ k-mer.
+ * Support reading the query sequence from standard input.
+
+ ParseAligns:
+ * Significantly reduce memory usage if the mate reads are
+ encountered one after the next in the same file.
+
+2009-04-02 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.8.
+ * Bug fix. Fix the undefined behaviour causing the error
+ Assertion `marked == split' failed.
+
+2009-03-31 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.7.
+ * Use a mark-and-sweep trimming algorithm to remove errors at the
+ ends of blunt contigs.
+ * The parallel (ABYSS-P) trimming algorithm is now deterministic;
+ it will produce the same result every time. In addition, the
+ result of the parallel trimming algorithm is identical to the
+ result of the non-parallel trimming algorithm.
+ * Start trimming branches at length 1, previously 2.
+ * Bug fix in ABYSS-P. Repeat sequences of k-1 bases could
+ potentially be misassembled. Use a mark-and-sweep algorithm to
+ split ambiguous edges before contig generation. The previous
+ algorithm was not deterministic.
+ * Reduce memory usage by 200 MB by removing the MPI transmit
+ buffer.
+ * Bug fix in ABYSS-P. Fix an additional race condition in the
+ erosion algorithm.
+
+2009-03-24 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.6.
+ * Bug fix. Fix a race condition in the erosion algorithm.
+ * For the parallel program (ABYSS-P), after bubble popping perform
+ as many trimming rounds as necessary to remove all the tips, as
+ the non-parallel program does.
+ * New script, abyss2afg, to create an AMOS AFG assembly.
+
+2009-03-11 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.5.
+ * Portability fixes. Tested with g++ 4.3.3.
+
+2009-03-04 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.4.
+
+ ABYSS:
+ * Remove the need to specify a -e,--erode parameter by improving
+ the erosion algorithm to complete in a single pass.
+ * Remove the default limit on the maximum number of bubble
+ popping rounds. A limit may be specified using -b,--bubbles.
+ * Generate a warning if an input file is empty, but do not die.
+ * When using a Google sparsehash, allocate room for 100 million
+ k-mers.
+ * Increase the maximum FASTA line length from 64 kB to 256 kB.
+ * Require only one of either -l,--read-length or -t,--trim-length
+ to be specified.
+ * Allow read pairs to be named `_forward' and `_reverse'.
+ * Ensure that exactly k-1 bases of context is given on each side
+ of the bubble sequence. Previously, one side would have k bases of
+ context, and the other side would have k-1 bases.
+ * Add command line options to each of the paired-end programs.
+
+ ABYSS-P:
+ * Use Open MPI as the default MPI library.
+ * Do not link against the Open MPI C++ library.
+
+ abyss-pe:
+ * Use pipes where possible to avoid intermediate files.
+ * The semantics of the n argument have changed. See DistanceEst
+ -n,--npairs below.
+
+ SimpleGraph:
+ * If more than one path is found but only one meets all of the
+ constraints, use it.
+ * Allow for some constant error in distance estimates that does
+ not decrease with the number of samples. The expected fragment
+ size seems to vary with genomic coordinate to a certain degree.
+ So, the distribution of fragment size spanning two given contigs
+ may differ from the empirical distribution by a roughly constant
+ offset.
+
+ DistanceEst:
+ * The semantics of the -n,--npairs option has changed.
+ Require at least NPAIRS pairs between contigs (>= NPAIRS).
+ Previously, required strictly more than NPAIRS pairs between
+ contigs (> NPAIRS).
+ * Give the estimated error to a single decimal place.
+ * When counting the number of pairs that join two contigs, only
+ count pairs that fit the empirical distribution.
+ * When deciding whether the pairs joining two contigs are
+ inconsistent in sense, require NPAIRS read pairs joining two
+ contigs in each sense before considering the pair data to be
+ inconsistent.
+
+ ParseAligns:
+ * Measure fragments in total size, not alignment distance.
+ * Allow a read that spans two contigs to be used in distance
+ estimates.
+ * Add the -h,--hist option to produce a histogram.
+ * Bug fix. When measuring the empirical fragment size, ensure that
+ the sense of the alignments is correct. Output a negative fragment
+ size if the reverse read aligns ahead of the forward read.
+ * Bug fix. Miscalculated the fragment size estimate between two
+ contigs if they did not have the same sense and one contig
+ required flipping. It was possible to see one distance estimate
+ from contig A to contig B and a differing estimate from contig B
+ to contig A. Typically, the distance estimate would be off by
+ one.
+
+2009-01-23 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.3.
+ * Merge contigs that ended due to a lack of coverage, but which
+ are connected by paired-end reads and overlap unambiguously.
+ * Track the multiplicity the sense and antisense strand
+ separately. Erode the end of a blunt contig until it is
+ represented by both strands.
+ * Ignore the case of the nucleotide sequence of a FASTA file.
+ * Increase the maximum FASTA line length from 1 kB to 64 kB to
+ allow loading contigs.
+ * Output the path through the single-end contigs in the comment
+ field of the paired-end contig.
+ * In the paired-end driver script, abyss-pe,
+ Implement a coverage cutoff, c.
+ Pass the erosion parameter, e, to the single-end assembler.
+
+2008-11-21 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.2.
+ * Terminate contig extension at palindromic k-mers.
+ * If erosion (-e,--erode) is enabled, remove the tips of blunt
+ contigs that are represented only once.
+
+2008-11-07 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.1.
+ * Portability improvements to compile for Mac OS X.
+
+2008-08-07 Shaun Jackman <sjackman at bcgsc.ca>
+
+ * Release version 1.0.
diff --git a/Common/Algorithms.h b/Common/Algorithms.h
new file mode 100644
index 0000000..9b2a87e
--- /dev/null
+++ b/Common/Algorithms.h
@@ -0,0 +1,69 @@
+#ifndef ALGORITHMS_H
+#define ALGORITHMS_H 1
+
+#include <algorithm>
+#include <iterator>
+#include <utility>
+#include <vector>
+
+/** Apply function f to each element in the range [first, last) for
+ * which the predicate p is true.
+ */
+template<class It, class Function, class Pred>
+Function for_each_if(It first, It last, Function f, Pred p)
+{
+ for (; first != last; ++first)
+ if (p(*first))
+ f(*first);
+ return f;
+}
+
+#if __GXX_EXPERIMENTAL_CXX0X__
+using std::copy_if;
+#else
+/** Copies each element in the range [first, last) into the range
+ * starting at result for which the predicate p is true. */
+template<class InputIt, class OutputIt, class Pred>
+OutputIt copy_if(InputIt first, InputIt last, OutputIt result,
+ Pred pred)
+{
+ for (; first != last; ++first) {
+ if (pred(*first)) {
+ *result = *first;
+ ++result;
+ }
+ }
+ return result;
+}
+#endif
+
+/** Sorts the elements in the range [first,last) ordered by the value
+ * returned by the unary function op, which is called once for each
+ * element in the range [first,last). The copy constructor of the
+ * value_type of It is not used.
+ */
+template <class It, class Op>
+void sort_by_transform(It first, It last, Op op)
+{
+ typedef typename std::iterator_traits<It>::difference_type
+ size_type;
+ typedef typename Op::result_type key_type;
+
+ size_type n = last - first;
+ std::vector< std::pair<key_type, size_type> > keys;
+ keys.reserve(n);
+ for (It it = first; it != last; ++it)
+ keys.push_back(std::make_pair(op(*it), it - first));
+ sort(keys.begin(), keys.end());
+
+ for (size_type i = 0; i < n; i++) {
+ size_type j = keys[i].second;
+ while (j < i)
+ j = keys[j].second;
+ if (i != j)
+ std::swap(first[i], first[j]);
+ keys[i].second = j;
+ }
+}
+
+#endif
diff --git a/Common/Alignment.h b/Common/Alignment.h
new file mode 100644
index 0000000..1e809e1
--- /dev/null
+++ b/Common/Alignment.h
@@ -0,0 +1,99 @@
+#ifndef ALIGNMENT_H
+#define ALIGNMENT_H 1
+
+#include <cassert>
+#include <istream>
+#include <ostream>
+#include <string>
+
+/** An ungapped alignment of a query to a target. */
+struct Alignment
+{
+
+std::string contig;
+int contig_start_pos;
+int read_start_pos;
+int align_length;
+int read_length;
+bool isRC;
+
+Alignment() { }
+
+Alignment(const Alignment& o,
+ std::string /*qid*/, std::string /*seq*/) { *this = o; }
+
+Alignment(std::string contig, int contig_start, int read_start,
+ int align_length, int read_length, bool isRC) :
+ contig(contig),
+ contig_start_pos(contig_start),
+ read_start_pos(read_start),
+ align_length(align_length),
+ read_length(read_length),
+ isRC(isRC)
+{
+}
+
+/**
+ * Return the taret position at the query start.
+ * Note: not alignment start, and may be negative
+ */
+int targetAtQueryStart() const
+{
+ unsigned tend = contig_start_pos + align_length;
+ return !isRC ? contig_start_pos - read_start_pos
+ : int(tend + read_start_pos);
+}
+
+/** Return the distance between the specified alignments.
+ * May be used to calculate fragment size when the alignments are
+ * mate pairs.
+ */
+int operator-(const Alignment& o) const
+{
+ return targetAtQueryStart() - o.targetAtQueryStart();
+}
+
+/** Return an alignment of the reverse complement of the query to
+ * the same target.
+ */
+Alignment flipQuery() const
+{
+ Alignment rc(*this);
+ unsigned qend = read_start_pos + align_length;
+ assert(qend <= (unsigned)read_length);
+ rc.read_start_pos = read_length - qend;
+ rc.isRC = !isRC;
+ return rc;
+}
+
+static int calculateReverseReadStart(int read_start_pos,
+ int read_length, int align_length)
+{
+ unsigned qend = read_start_pos + align_length;
+ return read_length - qend;
+}
+
+friend std::istream& operator >>(std::istream& in, Alignment& a)
+{
+ return in >> a.contig
+ >> a.contig_start_pos
+ >> a.read_start_pos
+ >> a.align_length
+ >> a.read_length
+ >> a.isRC;
+}
+
+friend std::ostream& operator <<(std::ostream& out,
+ const Alignment& a)
+{
+ return out << a.contig << ' '
+ << a.contig_start_pos << ' '
+ << a.read_start_pos << ' '
+ << a.align_length << ' '
+ << a.read_length << ' '
+ << a.isRC;
+}
+
+}; // struct Alignment
+
+#endif
diff --git a/Common/BitUtil.h b/Common/BitUtil.h
new file mode 100644
index 0000000..40be67d
--- /dev/null
+++ b/Common/BitUtil.h
@@ -0,0 +1,65 @@
+#ifndef BITUTILS_H
+#define BITUTILS_H 1
+
+#include "config.h"
+#include <cstdlib> // for exit
+#include <iostream>
+#include <stdint.h>
+
+/** The return value of the CPUID instruction. */
+struct CPUID { unsigned a, b, c, d; };
+
+/** Return the result of the CPUID instruction
+ * or -1 if it is not supported.
+ */
+static inline CPUID cpuid(unsigned op)
+{
+ CPUID x;
+#if __GNUC__ && __x86_64__
+ __asm__("cpuid" : "=a" (x.a), "=b" (x.b), "=c" (x.c), "=d" (x.d)
+ : "a" (op));
+ return x;
+#else
+ (void)op;
+ x.a = x.b = x.c = x.d = static_cast<unsigned>(-1);
+ return x;
+#endif
+}
+
+/** Return whether this processor has the POPCNT instruction. */
+static inline bool havePopcnt() { return cpuid(1).c & (1 << 23); }
+
+/** Ensure that this machine has the popcount instruction. */
+static inline void checkPopcnt()
+{
+#if ENABLE_POPCNT
+ if (!havePopcnt()) {
+ std::cerr <<
+"error: " PACKAGE " has been compiled to use the POPCNT\n"
+"instruction, which this machine lacks. Recompile using\n"
+"configure --disable-popcnt to disable this feature.\n";
+ exit(EXIT_FAILURE);
+ }
+#endif
+}
+
+/** Return the Hamming weight of x. */
+static inline uint64_t popcount(uint64_t x)
+{
+#if ENABLE_POPCNT && __GNUC__ && __x86_64__
+ __asm__("popcnt %1,%0" : "=r" (x) : "r" (x));
+ return x;
+#else
+ x = (x & 0x5555555555555555ULL) +
+ ((x >> 1) & 0x5555555555555555ULL);
+ x = (x & 0x3333333333333333ULL) +
+ ((x >> 2) & 0x3333333333333333ULL);
+ x = (x + (x >> 4)) & 0x0f0f0f0f0f0f0f0fULL;
+ x = x + (x >> 8);
+ x = x + (x >> 16);
+ x = x + (x >> 32);
+ return x & 0x7FLLU;
+#endif
+}
+
+#endif
diff --git a/Common/ConstString.h b/Common/ConstString.h
new file mode 100644
index 0000000..6e0bf66
--- /dev/null
+++ b/Common/ConstString.h
@@ -0,0 +1,144 @@
+#ifndef CONSTSTRING_H
+#define CONSTSTRING_H 1
+
+#include <cassert>
+#include <cstring>
+#include <ostream>
+#include <string>
+
+/** An immutable string that does not allocate resources. */
+class cstring {
+ public:
+ cstring(const char* p) : m_p(p) { }
+ cstring(const std::string& s) : m_p(s.c_str()) { }
+
+ /** Return the size of this string. */
+ size_t size() const { return strlen(m_p); }
+
+ /** Return a null-terminated sequence of characters. */
+ const char* c_str() const { return m_p; }
+
+ operator const char*() const { return m_p; }
+
+ bool operator==(const cstring& o) const
+ {
+ return m_p == o.m_p || strcmp(m_p, o.m_p) == 0;
+ }
+
+ bool operator<(const cstring& o) const
+ {
+ return m_p != o.m_p && strcmp(m_p, o.m_p) < 0;
+ }
+
+ friend std::ostream& operator<<(std::ostream& out,
+ const cstring& o)
+ {
+ return out << o.m_p;
+ }
+
+ protected:
+ const char* m_p;
+};
+
+/** An immutable string. */
+class const_string : public cstring {
+ public:
+ const_string(const std::string& s)
+ : cstring(strcpy(new char[s.size() + 1], s.c_str())) { }
+
+#if __GXX_EXPERIMENTAL_CXX0X__
+ const_string(const_string&& s) : cstring(s.m_p) { s.m_p = NULL; }
+#endif
+
+#if 0
+ /* Should be like this, but... */
+ const_string(const const_string& s)
+ : cstring(strcpy(new char[s.size() + 1], s.c_str())) { }
+#else
+ /** Copy constructor.
+ * When a vector grows, libstdc++ calls the copy constructor for
+ * each element of the vector, which would invalidate any cstring
+ * that point to this const_string. To work around this issue, the
+ * new const_string gets the original data, and the old
+ * const_string gets the copy, which will probably be destructed
+ * soon. Making the copy is wasteful, but the C++ standard does
+ * not help us out here.
+ */
+ const_string(const const_string& s) : cstring(s.c_str())
+ {
+ const_cast<const_string&>(s).m_p
+ = strcpy(new char[s.size() + 1], s.c_str());
+ }
+#endif
+
+ ~const_string() { delete[] m_p; }
+
+ const_string& operator=(const const_string& s)
+ {
+ assert(false);
+ if (this == &s)
+ return *this;
+ assert(m_p != s.m_p);
+ delete[] m_p;
+ m_p = strcpy(new char[s.size() + 1], s.c_str());
+ return *this;
+ }
+
+ void swap(const_string& s) { std::swap(m_p, s.m_p); }
+
+ private:
+ const_string();
+ const_string(const char* s);
+ const_string(const cstring&);
+ bool operator==(const const_string& s);
+};
+
+namespace std {
+ template <>
+ inline void swap(const_string& a, const_string& b)
+ {
+ a.swap(b);
+ }
+}
+
+#include "HashFunction.h"
+
+/** Return the hash of the null-terminated string s. */
+static inline size_t hash(const char* s)
+{
+ return hashmem(s, strlen(s));
+}
+
+namespace std {
+ template <typename T> struct hash;
+ template <> struct hash<cstring> {
+ size_t operator()(const cstring& s) const
+ {
+ return ::hash(s);
+ }
+ };
+} // namespace std
+
+namespace std {
+ namespace tr1 {
+ template <typename T> struct hash;
+ template <> struct hash<cstring> {
+ size_t operator()(const cstring& s) const
+ {
+ return ::hash(s);
+ }
+ };
+ } // namespace tr1
+} // namespace std
+
+namespace __gnu_cxx {
+ template <typename T> struct hash;
+ template <> struct hash<cstring> {
+ size_t operator()(const cstring& s) const
+ {
+ return ::hash(s);
+ }
+ };
+} // namespace __gnu_cxx
+
+#endif
diff --git a/Common/ContigID.cpp b/Common/ContigID.cpp
new file mode 100644
index 0000000..f27f010
--- /dev/null
+++ b/Common/ContigID.cpp
@@ -0,0 +1,5 @@
+#include "ContigID.h"
+
+Dictionary g_contigNames;
+
+unsigned g_nextContigName;
diff --git a/Common/ContigID.h b/Common/ContigID.h
new file mode 100644
index 0000000..307729a
--- /dev/null
+++ b/Common/ContigID.h
@@ -0,0 +1,59 @@
+#ifndef CONTIGID_H
+#define CONTIGID_H 1
+
+#include "ConstString.h"
+#include "Dictionary.h"
+#include <cassert>
+#include <ostream>
+#include <sstream>
+#include <string>
+
+/** The dictionary of contig names. */
+extern Dictionary g_contigNames;
+
+/** The next unique contig name. */
+extern unsigned g_nextContigName;
+
+/** Set the next contig name returned by createContigName. */
+static inline void setNextContigName(cstring s)
+{
+ std::istringstream iss((std::string)s);
+ if (iss >> g_nextContigName && iss.eof())
+ ++g_nextContigName;
+ else
+ g_nextContigName = 0;
+}
+
+/** Return the next unique contig name. */
+static inline std::string createContigName()
+{
+ if (g_nextContigName == 0) {
+ assert(!g_contigNames.empty());
+ setNextContigName(g_contigNames.back());
+ }
+ std::ostringstream ss;
+ ss << g_nextContigName++;
+ return ss.str();
+}
+
+/** A contig index. */
+class ContigID
+{
+ public:
+ ContigID() { }
+ explicit ContigID(unsigned index) : m_index(index) { };
+
+ /** Return the index. */
+ operator unsigned() const { return m_index; }
+
+ /** The insertion operator is not implemented to prevent
+ * unintentional use of the cast operator (unsigned).
+ */
+ friend std::ostream& operator<<(std::ostream&, const ContigID&);
+
+ private:
+ /** The index. */
+ unsigned m_index;
+};
+
+#endif
diff --git a/Common/ContigNode.h b/Common/ContigNode.h
new file mode 100644
index 0000000..b0b21f6
--- /dev/null
+++ b/Common/ContigNode.h
@@ -0,0 +1,301 @@
+#ifndef CONTIGNODE_H
+#define CONTIGNODE_H 1
+
+#include "config.h" // for WORDS_BIGENDIAN
+#include "ContigID.h"
+#include "Graph/Properties.h"
+#include "StringUtil.h"
+#include <boost/property_map/property_map.hpp>
+#include <cassert>
+#include <cstdlib> // for strtoul
+#include <iostream>
+#include <stdint.h> // for intptr_t
+#include <string>
+#include <utility>
+
+/** A vertex of a contig graph, which is a pair of a contig index and
+ * an orientation.
+ */
+class ContigNode
+{
+public:
+
+ContigNode() { }
+
+ContigNode(const ContigNode& o) : m_index(o.m_index) { }
+
+/** Construct from a vertex index. */
+explicit ContigNode(unsigned index) : m_index(index) { }
+
+/** Construct from a contig index and an orientation. */
+ContigNode(unsigned index, bool sense)
+ : m_index(2 * index + sense) { }
+
+/** Construct from a contig index and an orientation. */
+ContigNode(unsigned index, int sense)
+ : m_index(2 * index + sense)
+{
+ assert(sense == 0 || sense == 1);
+}
+
+/** Construct an ambiguous ContigNode. */
+ContigNode(unsigned n, char c)
+ : m_index(-(int)n)
+{
+ assert(n > 0);
+ assert(c == 'N');
+ (void)c;
+}
+
+bool operator==(const ContigNode& o) const
+{
+ return m_index == o.m_index;
+}
+
+bool operator!=(const ContigNode& o) const
+{
+ return m_index != o.m_index;
+}
+
+bool operator<(const ContigNode& o) const
+{
+ return m_index < o.m_index;
+}
+
+/** Return the complement of this vertex if sense is true. */
+ContigNode operator^(bool sense) const
+{
+ assert(!ambiguous());
+ return ContigNode(m_index ^ sense);
+}
+
+/** Return whether this ContigNode is ambiguous. */
+bool ambiguous() const
+{
+ return m_index < 0;
+}
+
+/** Return the vertex index. */
+unsigned index() const
+{
+ assert(!ambiguous());
+ return m_index;
+}
+
+/** Return the contig index. */
+unsigned id() const
+{
+ return ambiguous() ? m_index : m_index / 2;
+}
+
+/** Return the contig index as a ContigID. */
+ContigID contigIndex() const
+{
+ assert(!ambiguous());
+ return ContigID(id());
+}
+
+/** Return the orientation of this vertex. */
+bool sense() const
+{
+ assert(!ambiguous());
+ return m_index & 1;
+}
+
+/** Return the length in k-mer of this ambiguous contig. */
+unsigned length() const
+{
+ assert(ambiguous());
+ return -m_index;
+}
+
+/** Return the string of Ns. */
+std::string ambiguousSequence() const
+{
+ assert(ambiguous());
+ unsigned n = length();
+ if (n > 100000) {
+ std::cerr
+ << "warning: scaffold gap is longer than 100 kbp: "
+ << n << '\n';
+ } else if (n > 1000000) {
+ std::cerr << "error: scaffold gap is longer than 1 Mbp: "
+ << n << '\n';
+ exit(EXIT_FAILURE);
+ }
+ return std::string(n, 'N');
+}
+
+/** Toggle the orientation of this vertex if sense is true. */
+ContigNode& operator^=(bool sense)
+{
+ assert(!ambiguous());
+ m_index ^= sense;
+ return *this;
+}
+
+/** Increment this vertex index. */
+ContigNode& operator++()
+{
+ assert(!ambiguous());
+ ++m_index;
+ return *this;
+}
+
+private:
+ int m_index;
+};
+
+/** Return the hash value of this ContigNode. */
+static inline unsigned hash_value(const ContigNode& o)
+{
+ return o.index();
+}
+
+/** Vertex index property map of a ContigNode. */
+struct ContigNodeIndexMap
+ : boost::put_get_helper<unsigned, ContigNodeIndexMap>
+{
+ typedef ContigNode key_type;
+ typedef unsigned value_type;
+ typedef value_type reference;
+ typedef boost::readable_property_map_tag category;
+
+ reference operator[](const key_type& u) const
+ {
+ return u.index();
+ }
+};
+
+/** Contig index property map of a ContigNode. */
+struct ContigIndexMap
+ : boost::put_get_helper<ContigID, ContigIndexMap>
+{
+ typedef ContigNode key_type;
+ typedef ContigID value_type;
+ typedef value_type reference;
+ typedef boost::readable_property_map_tag category;
+
+ reference operator[](const key_type& u) const
+ {
+ return u.contigIndex();
+ }
+};
+
+/** Return the contig name of the specified vertex. */
+template <typename Graph>
+Dictionary::name_reference
+get(vertex_contig_name_t, const Graph&, ContigNode u)
+{
+ assert(!u.ambiguous());
+ return get(g_contigNames, u.id());
+}
+
+/** The string representation of a vertex name. */
+struct VertexName : std::pair<intptr_t, char>
+{
+ typedef std::pair<intptr_t, char> Base;
+
+ VertexName(const char* s, char c)
+ : Base(reinterpret_cast<intptr_t>(s), c)
+ {
+ assert(c == '+' || c == '-');
+ }
+
+ VertexName(unsigned n, char c) : Base(n, c)
+ {
+ assert(c == 'N');
+ }
+
+ friend std::ostream& operator<<(
+ std::ostream& out, const VertexName& o)
+ {
+ if (o.second == 'N')
+ out << o.first;
+ else
+ out << reinterpret_cast<const char*>(o.first);
+ return out << o.second;
+ }
+};
+
+/** Return the name of the specified vertex. */
+static inline VertexName get(const Dictionary& pmap, ContigNode u)
+{
+ return u.ambiguous()
+ ? VertexName(u.length(), 'N')
+ : VertexName(get(pmap, u.id()), u.sense() ? '-' : '+');
+}
+
+/** Return the name of the specified vertex. */
+template <typename Graph>
+VertexName get(vertex_name_t, const Graph&, ContigNode u)
+{
+ return get(g_contigNames, u);
+}
+
+/** Set the name of the specified vertex. */
+template <typename Graph>
+void put(vertex_name_t, const Graph&, ContigNode u,
+ const std::string& name)
+{
+ assert(!name.empty());
+ char c = name[name.size() - 1];
+ if (c == '+' || c == '-')
+ put(g_contigNames, u.id(), name.substr(0, name.size() - 1));
+ else
+ put(g_contigNames, u.id(), name);
+}
+
+/** The string representation of an edge name. */
+struct EdgeName : std::pair<VertexName, VertexName>
+{
+ typedef std::pair<VertexName, VertexName> Base;
+
+ EdgeName(Base::first_type a, Base::second_type b)
+ : Base(a, b) { }
+
+ friend std::ostream& operator<<(
+ std::ostream& out, const EdgeName& o)
+ {
+ return out << '"' << o.first << "\" -> \"" << o.second << '"';
+ }
+};
+
+/** Return the name of the specified edge. */
+static inline EdgeName get(const Dictionary& pmap,
+ std::pair<ContigNode, ContigNode> e)
+{
+ return EdgeName(get(pmap, e.first), get(pmap, e.second));
+}
+
+/** Return the name of the specified edge. */
+template <typename Graph>
+EdgeName get(edge_name_t, const Graph& g,
+ std::pair<ContigNode, ContigNode> e)
+{
+ return EdgeName(
+ get(vertex_name, g, source(e, g)),
+ get(vertex_name, g, target(e, g)));
+}
+
+/** Find the vertex with the specified name. */
+static inline ContigNode find_vertex(
+ std::string name, bool sense, const Dictionary& pmap)
+{
+ assert(!name.empty());
+ return ContigNode(get(pmap, name), sense);
+}
+
+/** Find the vertex with the specified name. */
+static inline ContigNode find_vertex(
+ std::string name, const Dictionary& pmap)
+{
+ assert(!name.empty());
+ char c = chop(name);
+ assert(c == '+' || c == '-' || c == 'N');
+ return c == 'N'
+ ? ContigNode(strtoul(name.c_str(), NULL, 0), 'N')
+ : find_vertex(name, c == '-', pmap);
+}
+
+#endif
diff --git a/Common/ContigPath.h b/Common/ContigPath.h
new file mode 100644
index 0000000..f304ba9
--- /dev/null
+++ b/Common/ContigPath.h
@@ -0,0 +1,86 @@
+#ifndef CONTIGPATH_H
+#define CONTIGPATH_H 1
+
+#include "ContigNode.h"
+#include <algorithm>
+#include <cassert>
+#include <functional>
+#include <istream>
+#include <sstream>
+#include <string>
+#include <ostream>
+#include <vector>
+
+/** A sequence of ContigNode. */
+typedef std::vector<ContigNode> ContigPath;
+
+/** Reverse and complement the specified path. */
+template<typename T>
+void reverseComplement(T first, T last)
+{
+ std::reverse(first, last);
+ for (T it = first; it < last; ++it)
+ if (!it->ambiguous())
+ *it ^= 1;
+}
+
+/** Return the reverse complement of the specified path. */
+static inline ContigPath reverseComplement(const ContigPath& path)
+{
+ ContigPath rc(path.rbegin(), path.rend());
+ for (ContigPath::iterator it = rc.begin(); it < rc.end(); ++it)
+ if (!it->ambiguous())
+ *it ^= 1;
+ return rc;
+}
+
+static inline std::ostream& operator<<(std::ostream& out,
+ const ContigPath& o)
+{
+ assert(!o.empty());
+ ContigPath::const_iterator it = o.begin();
+ out << get(g_contigNames, *it);
+ for (++it; it != o.end(); ++it)
+ out << ' ' << get(g_contigNames, *it);
+ return out;
+}
+
+static inline std::istream& operator>>(std::istream& in,
+ ContigPath& o)
+{
+ o.clear();
+ std::string s;
+ if (getline(in, s)) {
+ std::istringstream ss(s);
+ for (std::string name; ss >> name;)
+ o.push_back(find_vertex(name, g_contigNames));
+ assert(ss.eof());
+ }
+ return in;
+}
+
+static inline void markSeenInPath(std::istream& in,
+ std::vector<bool>& marked)
+{
+ assert(in.good());
+ std::string s;
+ ContigPath path;
+ while (in >> s >> path) {
+ if (path.empty()) {
+ size_t i = get(g_contigNames, s);
+ assert(i < marked.size());
+ marked[i] = true;
+ }
+ for (ContigPath::const_iterator it = path.begin();
+ it != path.end(); ++it) {
+ if (!it->ambiguous()) {
+ size_t i = it->contigIndex();
+ assert(i < marked.size());
+ marked[i] = true;
+ }
+ }
+ }
+ assert(in.eof());
+}
+
+#endif
diff --git a/Common/ContigProperties.h b/Common/ContigProperties.h
new file mode 100644
index 0000000..a2f4b9c
--- /dev/null
+++ b/Common/ContigProperties.h
@@ -0,0 +1,240 @@
+#ifndef CONTIGPROPERTIES_H
+#define CONTIGPROPERTIES_H 1
+
+#include "ContigNode.h"
+#include "Graph/Options.h"
+#include "Graph/Properties.h"
+#include "IOUtil.h"
+#include <boost/graph/graph_traits.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <cassert>
+#include <iostream>
+
+using boost::graph_traits;
+
+/** Contig length property. */
+struct Length
+{
+ unsigned length;
+
+ bool operator==(const Length& o) const
+ {
+ return length == o.length;
+ }
+
+ Length& operator+=(const Length& o)
+ {
+ length += o.length;
+ return *this;
+ }
+
+ template <typename T>
+ Length& operator+=(const T& o)
+ {
+ assert((int)length + (int)o.distance > 0);
+ length += o.distance;
+ return *this;
+ }
+
+ friend std::ostream& operator<<(std::ostream& out,
+ const Length& o)
+ {
+ return out << "l=" << o.length;
+ }
+
+ friend std::istream& operator>>(std::istream& in, Length& o)
+ {
+ if (in >> std::ws && in.peek() == 'l')
+ return in >> expect("l =") >> o.length;
+ else
+ return in >> o.length;
+ }
+};
+
+static inline
+void put(vertex_length_t, Length& vp, unsigned length)
+{
+ vp.length = length;
+}
+
+static inline
+void put(vertex_coverage_t, Length&, unsigned)
+{
+}
+
+/** The length and coverage of a contig. */
+struct ContigProperties {
+ unsigned length;
+ unsigned coverage;
+
+ ContigProperties() : length(0), coverage(0) { }
+ ContigProperties(unsigned length, unsigned coverage)
+ : length(length), coverage(coverage) { }
+
+ bool operator==(const ContigProperties& o) const
+ {
+ return length == o.length && coverage == o.coverage;
+ }
+
+ ContigProperties& operator +=(const ContigProperties& o)
+ {
+ length += o.length;
+ coverage += o.coverage;
+ return *this;
+ }
+
+ friend std::ostream& operator <<(std::ostream& out,
+ const ContigProperties& o)
+ {
+ float coverage = opt::k <= 0 ? 0
+ : (float)o.coverage / (o.length - opt::k + 1);
+ switch (opt::format) {
+ case ADJ:
+ return out << ' ' << o.length << ' ' << o.coverage;
+ case DOT:
+ return out << "l=" << o.length << " C=" << o.coverage;
+ case DOT_MEANCOV:
+ assert(opt::k > 0);
+ return out << "l=" << o.length << " c=" << coverage;
+ case SAM:
+ out << "\tLN:" << o.length;
+ return opt::k > 0
+ ? (out << "\tXc:" << coverage)
+ : (out << "\tXC:" << o.coverage);
+ }
+ return out;
+ }
+
+ friend std::istream& operator >>(std::istream& in,
+ ContigProperties& o)
+ {
+ if (in >> std::ws && in.peek() == 'l') {
+ in >> expect("l =") >> o.length;
+ if (in >> std::ws && in.peek() == 'C')
+ in >> expect("C =") >> o.coverage;
+ return in;
+ } else if (in.peek() == 'C') {
+ return in >> expect("C=") >> o.coverage
+ >> expect(", l=") >> o.length;
+ } else
+ return in >> o.length >> o.coverage;
+ }
+};
+
+static inline
+void put(vertex_length_t, ContigProperties& vp, unsigned length)
+{
+ vp.length = length;
+}
+
+static inline
+void put(vertex_coverage_t, ContigProperties& vp, unsigned coverage)
+{
+ vp.coverage = coverage;
+}
+
+/** The distance between two contigs. */
+struct Distance {
+ int distance;
+ Distance() : distance(-opt::k + 1) { }
+ Distance(int d) : distance(d) { }
+
+ bool operator==(const Distance& o) const
+ {
+ return distance == o.distance;
+ }
+
+ bool operator!=(const Distance& o) const
+ {
+ return distance != o.distance;
+ }
+
+ friend std::ostream& operator<<(std::ostream& out,
+ const Distance& o)
+ {
+ return out << "d=" << o.distance;
+ }
+
+ friend std::istream& operator>>(std::istream& in, Distance& o)
+ {
+ in >> expect(" d = ");
+ if (in.peek() == '"')
+ return in >> expect("\"") >> o.distance >> expect("\"");
+ else
+ return in >> o.distance;
+ }
+};
+
+/** Add the specified distance (overlap) to the specified contig
+ * length.
+ */
+template <typename T>
+ContigProperties& operator+=(ContigProperties& a, const T& b)
+{
+ assert((int)a.length + (int)b.distance > 0);
+ a.length += b.distance;
+ return a;
+}
+
+/** Return the distance between two vertices. */
+template <typename Graph>
+int get(edge_distance_t, const Graph& g,
+ typename graph_traits<Graph>::edge_descriptor e)
+{
+ return g[e].distance;
+}
+
+/** Return the edge properties of (u,v) unless either u or v is
+ * ambiguous, in which case return a default-constructed instance of
+ * the edge properties.
+ */
+template <typename Graph>
+typename edge_bundle_type<Graph>::type
+get(edge_bundle_t, const Graph& g, ContigNode u, ContigNode v)
+{
+ typedef typename graph_traits<Graph>::edge_descriptor
+ edge_descriptor;
+ if (u.ambiguous() || v.ambiguous()) {
+ return typename edge_bundle_type<Graph>::type();
+ } else {
+ std::pair<edge_descriptor, bool> e = edge(u, v, g);
+ if (!e.second)
+ std::cerr << "error: no edge "
+ << get(vertex_name, g, u) << " -> "
+ << get(vertex_name, g, v) << '\n';
+ assert(e.second);
+ return g[e.first];
+ }
+}
+
+/** Edge weight property map. */
+template <typename Graph>
+struct EdgeWeightMap {
+ typedef typename Graph::edge_descriptor key_type;
+ typedef int value_type;
+ typedef value_type reference;
+ typedef boost::readable_property_map_tag category;
+
+ EdgeWeightMap(const Graph& g) : m_g(g) { }
+
+ reference operator[](const key_type& e) const
+ {
+ int weight = m_g[e].distance + m_g[target(e, m_g)].length;
+ assert(weight > 0);
+ return weight;
+ }
+
+ private:
+ const Graph& m_g;
+};
+
+/** Return the edge weight. */
+template <typename Graph>
+typename EdgeWeightMap<Graph>::value_type
+get(edge_weight_t, const Graph& g,
+ typename graph_traits<Graph>::edge_descriptor e)
+{
+ return EdgeWeightMap<Graph>(g)[e];
+}
+
+#endif
diff --git a/Common/Dictionary.h b/Common/Dictionary.h
new file mode 100644
index 0000000..f055dfc
--- /dev/null
+++ b/Common/Dictionary.h
@@ -0,0 +1,126 @@
+#ifndef DICTIONARY_H
+#define DICTIONARY_H 1
+
+#include "ConstString.h"
+#include "UnorderedMap.h"
+#include <cassert>
+#include <cstdlib>
+#include <iostream>
+#include <string>
+#include <vector>
+
+/** A bidirectional map of indices and names. */
+class Dictionary
+{
+ public:
+ typedef unsigned index_type;
+ typedef unsigned index_reference;
+ typedef std::string name_type;
+ typedef cstring name_reference;
+
+ typedef std::vector<const_string> Vector;
+ typedef unordered_map<name_reference, index_type> Map;
+
+ Dictionary() : m_locked(false) { }
+
+ /** Insert the specified name. */
+ index_reference insert(const name_type& name)
+ {
+ m_vec.push_back(name);
+ std::pair<Map::const_iterator, bool> inserted
+ = m_map.insert(Map::value_type(
+ m_vec.back(), m_map.size()));
+ if (!inserted.second) {
+ std::cerr << "error: duplicate ID: `"
+ << name << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ return inserted.first->second;
+ }
+
+ /** If the specified index is within this dictionary, ensure
+ * that the name is identical, otherwise append the name to
+ * this dictionary.
+ */
+ void put(index_type index, const name_type& name)
+ {
+ if (index < m_vec.size()) {
+ assert(getName(index) == name);
+ } else {
+ assert(!m_locked);
+ assert(index == m_vec.size());
+ index_type i = insert(name);
+ assert(i == index);
+ (void)i;
+ }
+ }
+
+ /** Return the index of the specified name. */
+ index_reference getIndex(const name_type& name) const
+ {
+ Map::const_iterator it = m_map.find(name);
+ if (it == m_map.end()) {
+ std::cerr << "error: unexpected ID: `"
+ << name << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ return it->second;
+ }
+
+ /** Return the name of the specified index. */
+ name_reference getName(index_type index) const
+ {
+ assert(index < m_vec.size());
+ return m_vec[index];
+ }
+
+ /** Lock this dictionary. No further elements may be added. */
+ void lock() { m_locked = true; }
+
+ /** Unlock this dictionary. */
+ void unlock() { m_locked = false; }
+
+ /** Return true if this dictionary is empty. */
+ bool empty() const { return m_vec.empty(); }
+
+ /** Return the number of elements in this dictionary. */
+ size_t size() const { return m_vec.size(); }
+
+ /** Return the number of elements with the specified name. */
+ size_t count(const name_type& name) const
+ {
+ return m_map.count(name);
+ }
+
+ /** Return the last name in this dictionary. */
+ name_reference back() const
+ {
+ assert(!m_vec.empty());
+ return m_vec.back();
+ }
+
+ private:
+ Map m_map;
+ Vector m_vec;
+ bool m_locked;
+};
+
+static inline Dictionary::name_reference get(
+ const Dictionary& pmap, Dictionary::index_type index)
+{
+ return pmap.getName(index);
+}
+
+static inline void put(Dictionary& pmap, Dictionary::index_type index,
+ const Dictionary::name_type& name)
+{
+ pmap.put(index, name);
+}
+
+static inline Dictionary::index_reference get(
+ const Dictionary& pmap, Dictionary::name_type name)
+{
+ return pmap.getIndex(name);
+}
+
+#endif
diff --git a/Common/Estimate.h b/Common/Estimate.h
new file mode 100644
index 0000000..4e1201b
--- /dev/null
+++ b/Common/Estimate.h
@@ -0,0 +1,176 @@
+#ifndef ESTIMATE_H
+#define ESTIMATE_H 1
+
+#include "ContigID.h"
+#include "ContigNode.h"
+#include "Graph/Options.h" // for opt::k
+#include "IOUtil.h"
+#include <cassert>
+#include <cmath> // for ceilf
+#include <iomanip>
+#include <istream>
+#include <ostream>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
+
+namespace opt {
+ /** The acceptable error of a distance estimate. */
+ extern unsigned distanceError;
+}
+
+/** An estimate of the distance between two contigs. */
+struct DistanceEst
+{
+ int distance;
+ unsigned numPairs;
+ float stdDev;
+
+ DistanceEst() : distance(-opt::k + 1), numPairs(0), stdDev(0) { }
+
+ DistanceEst(int distance)
+ : distance(distance), numPairs(0), stdDev(distance) { }
+
+ DistanceEst(int distance, unsigned numPairs, float stdDev)
+ : distance(distance), numPairs(numPairs), stdDev(stdDev) { }
+
+ bool operator==(const DistanceEst& o) const
+ {
+ return distance == o.distance
+ && numPairs == o.numPairs
+ && stdDev == o.stdDev;
+ }
+
+ friend std::ostream& operator<<(std::ostream& out,
+ const DistanceEst& o)
+ {
+ if (opt::format != DIST) {
+ out << "d=" << o.distance;
+ if (o.stdDev > 0 || o.numPairs > 0)
+ out << " e=" << std::fixed << std::setprecision(1)
+ << o.stdDev
+ << " n=" << o.numPairs;
+ return out;
+ } else
+ return out << o.distance << ',' << o.numPairs << ','
+ << std::fixed << std::setprecision(1) << o.stdDev;
+ }
+
+ friend std::istream& operator>>(std::istream& in, DistanceEst& o)
+ {
+ if (in >> std::ws && in.peek() == 'd') {
+ if (!(in >> expect("d =") >> o.distance >> std::ws))
+ return in;
+ if (in.peek() == ']') {
+ o.stdDev = o.numPairs = 0;
+ return in;
+ } else if (in.peek() == ',')
+ return in >> expect(", e =") >> o.stdDev
+ >> expect(", n =") >> o.numPairs;
+ else
+ return in >> expect(" e =") >> o.stdDev
+ >> expect(" n =") >> o.numPairs;
+ } else
+ return in >> o.distance >> expect(",")
+ >> o.numPairs >> expect(",")
+ >> o.stdDev;
+ }
+};
+
+/** Return the better of two distance estimates.
+ * Return the estimate whose error is least, or when the errors are
+ * equal, return the larger distance estimate.
+ * Add the number of pairs.
+ */
+struct BetterDistanceEst
+{
+ NoProperty operator()(
+ const NoProperty& a, const NoProperty&) const
+ {
+ return a;
+ }
+
+ DistanceEst operator()(
+ const DistanceEst& a, const DistanceEst& b) const
+ {
+ bool which = a.stdDev != b.stdDev ? a.stdDev < b.stdDev
+ : a.distance > b.distance;
+ DistanceEst x = which ? a : b;
+ x.numPairs = a.numPairs + b.numPairs;
+ return x;
+ }
+};
+
+/** Merge two distance estimates. */
+struct MergeDistanceEst
+{
+ DistanceEst operator()(
+ const DistanceEst& a, const DistanceEst& b) const
+ {
+ int x1 = a.distance, x2 = b.distance;
+ double v1 = a.stdDev * a.stdDev, v2 = b.stdDev * b.stdDev;
+ DistanceEst x;
+ x.distance = (int)round((x1 * v2 + x2 * v1) / (v1 + v2));
+ x.stdDev = sqrt(v1 * v2 / (v1 + v2));
+ x.numPairs = a.numPairs + b.numPairs;
+ return x;
+ }
+};
+
+/** Return the allowed error for the given estimate. */
+static inline unsigned allowedError(float stddev)
+{
+ /** The number of standard deviations. */
+ const int NUM_SIGMA = 3;
+ return (unsigned)ceilf(NUM_SIGMA * stddev + opt::distanceError);
+}
+
+/** Distance estimates to and from a particular contig. */
+struct EstimateRecord
+{
+ typedef std::pair<ContigNode, DistanceEst> Estimate;
+ typedef std::vector<Estimate> Estimates;
+
+ ContigID refID;
+ Estimates estimates[2];
+
+ /** Read the distance estimates for one contig. */
+ friend std::istream& operator >>(std::istream& in,
+ EstimateRecord& o)
+ {
+ o.estimates[false].clear();
+ o.estimates[true].clear();
+
+ std::string name;
+ in >> name;
+ if (!in)
+ return in;
+ o.refID = ContigID(get(g_contigNames, name));
+
+ for (int rc = false; rc <= true; ++rc) {
+ std::string s;
+ std::getline(in, s, !rc ? ';' : '\n');
+ std::istringstream ss(s);
+ for (Estimate ep; getline(ss >> std::ws, s, ',');) {
+ ep.first = find_vertex(s, g_contigNames);
+ if (ss >> ep.second)
+ o.estimates[rc].push_back(ep);
+ }
+ assert(ss.eof());
+ }
+
+ return in;
+ }
+
+};
+
+namespace std {
+ template<>
+ inline void swap(EstimateRecord&, EstimateRecord&)
+ {
+ assert(false);
+ }
+}
+
+#endif
diff --git a/Common/Fcontrol.cpp b/Common/Fcontrol.cpp
new file mode 100644
index 0000000..246379a
--- /dev/null
+++ b/Common/Fcontrol.cpp
@@ -0,0 +1,12 @@
+#include "Fcontrol.h"
+#include <fcntl.h>
+
+/* Set the FD_CLOEXEC flag of the specified file descriptor. */
+int setCloexec(int fd)
+{
+ int flags = fcntl(fd, F_GETFD, 0);
+ if (flags == -1)
+ return -1;
+ flags |= FD_CLOEXEC;
+ return fcntl(fd, F_SETFD, flags);
+}
diff --git a/Common/Fcontrol.h b/Common/Fcontrol.h
new file mode 100644
index 0000000..601964d
--- /dev/null
+++ b/Common/Fcontrol.h
@@ -0,0 +1,6 @@
+#ifndef FCONTROL_H
+#define FCONTROL_H 1
+
+int setCloexec(int fd);
+
+#endif
diff --git a/Common/Functional.h b/Common/Functional.h
new file mode 100644
index 0000000..a7d36c3
--- /dev/null
+++ b/Common/Functional.h
@@ -0,0 +1,78 @@
+#ifndef FUNCTIONAL_H
+#define FUNCTIONAL_H 1
+
+#include <functional>
+
+/** A functor that always returns true. */
+template <typename Arg>
+struct True : std::unary_function<Arg, bool> {
+ bool operator()(const Arg&) const { return true; }
+};
+
+/** A functor to adapt a pointer to a member variable. */
+template <typename Arg, typename Result>
+struct MemVar : std::unary_function<Arg, Result>
+{
+ MemVar(Result Arg::* p) : m_p(p) { }
+ Result operator()(const Arg& arg) const { return arg.*m_p; }
+ private:
+ Result Arg::* m_p;
+};
+
+/** Return a functor to adapt a pointer to a member variable. */
+template <typename Arg, typename Result>
+MemVar<Arg, Result> mem_var(Result Arg::* p)
+{
+ return MemVar<Arg, Result>(p);
+}
+
+/** A functor, f1(f2(x)). */
+template <typename F1, typename F2>
+struct unary_compose : std::unary_function <
+ typename F2::argument_type, typename F1::result_type>
+{
+ unary_compose(const F1& f1, const F2& f2) : f1(f1), f2(f2) { }
+ typename F1::result_type operator()(
+ const typename F2::argument_type& x) const
+ {
+ return f1(f2(x));
+ }
+ private:
+ F1 f1;
+ F2 f2;
+};
+
+/** Return a functor, f1(f2(x)). */
+template <typename F1, typename F2>
+unary_compose<F1, F2> compose1(const F1& f1, const F2& f2)
+{
+ return unary_compose<F1, F2>(f1, f2);
+}
+
+/** A functor, f(g1(x), g2(x)). */
+template <typename F, typename G1, typename G2>
+struct binary_compose : std::unary_function <
+ typename G1::argument_type, typename F::result_type>
+{
+ binary_compose(const F& f, const G1& g1, const G2& g2)
+ : f(f), g1(g1), g2(g2) { }
+ typename G1::result_type operator()(
+ const typename G1::argument_type& x) const
+ {
+ return f(g1(x), g2(x));
+ }
+ private:
+ F f;
+ G1 g1;
+ G2 g2;
+};
+
+/** Return a functor, f(g1(x), g2(x)). */
+template <typename F, typename G1, typename G2>
+binary_compose<F, G1, G2> compose2(
+ const F& f, const G1& g1, const G2& g2)
+{
+ return binary_compose<F, G1, G2>(f, g1, g2);
+}
+
+#endif
diff --git a/Common/HashFunction.h b/Common/HashFunction.h
new file mode 100644
index 0000000..dae96fc
--- /dev/null
+++ b/Common/HashFunction.h
@@ -0,0 +1,13 @@
+#ifndef HASHFUNCTION_H
+#define HASHFUNCTION_H 1
+
+#include "city.h"
+#include <stddef.h>
+#include <stdint.h>
+
+static inline uint64_t hashmem(const void *p, size_t n)
+{
+ return CityHash64(static_cast<const char*>(p), n);
+}
+
+#endif
diff --git a/Common/Histogram.cpp b/Common/Histogram.cpp
new file mode 100644
index 0000000..f37756b
--- /dev/null
+++ b/Common/Histogram.cpp
@@ -0,0 +1,102 @@
+#include "Histogram.h"
+#include <algorithm>
+#include <cstdlib>
+#include <sstream>
+#include <string>
+
+using namespace std;
+
+/** Remove samples less than the specified threshold. */
+Histogram Histogram::trimLow(T threshold) const
+{
+ Histogram h;
+ for (Histogram::Map::const_iterator it = m_map.begin();
+ it != m_map.end(); it++)
+ if (it->first >= threshold)
+ h.insert(it->first, it->second);
+ return h;
+}
+
+/** Trim off the bottom fraction/2 and top fraction/2 data points.
+ * At least (1 - fraction) of the data will remain.
+ */
+Histogram Histogram::trimFraction(double fraction) const
+{
+ double low_cutoff = fraction/2;
+ double high_cutoff = 1.0f - fraction/2;
+ size_type n = size();
+
+ double cumulative = 0;
+ Histogram newHist;
+ for (Histogram::Map::const_iterator it = m_map.begin();
+ it != m_map.end(); it++) {
+ double temp_total = cumulative + (double)it->second / n;
+ if (temp_total > low_cutoff && cumulative < high_cutoff)
+ newHist.insert(it->first, it->second);
+ cumulative = temp_total;
+ }
+
+ return newHist;
+}
+
+/** Bin these elements into n buckets. The number of buckets returned
+ * may be smaller than n.
+ */
+Histogram::Bins Histogram::bin(unsigned n) const
+{
+ Histogram::Bins bins;
+ bins.reserve(n);
+ T nperbucket = (T)ceilf((float)(maximum() - minimum()) / n);
+ T next = minimum() + nperbucket;
+ Histogram::Bins::value_type count = 0;
+ for (Histogram::Map::const_iterator it = m_map.begin();
+ it != m_map.end(); it++) {
+ if (it->first >= next) {
+ bins.push_back(count);
+ count = 0;
+ next += nperbucket;
+ }
+ count += it->second;
+ }
+ if (count > 0)
+ bins.push_back(count);
+ return bins;
+}
+
+/** Return a unicode bar plot.
+ * @param n number of buckets
+ */
+string Histogram::barplot(unsigned nbins) const
+{
+ /** Unicode bar characters. */
+ static const char* bars[10] = {
+ " ", "_",
+ "\342\226\201", // 9601
+ "\342\226\202", // 9602
+ "\342\226\203", // 9603
+ "\342\226\204", // 9604
+ "\342\226\205", // 9605
+ "\342\226\206", // 9606
+ "\342\226\207", // 9607
+ "\342\226\210", // 9608
+ };
+
+ Histogram::Bins bins = bin(nbins);
+ ostringstream ss;
+ Histogram::Bins::value_type max
+ = 1 + *max_element(bins.begin(), bins.end());
+ for (Histogram::Bins::const_iterator it = bins.begin();
+ it != bins.end(); ++it)
+ ss << bars[10 * *it / max];
+ string s(ss.str());
+ while (!s.empty() && *s.rbegin() == ' ')
+ s.erase(s.size() - 1);
+ return s;
+}
+
+/** Return a unicode bar plot. */
+string Histogram::barplot() const
+{
+ const char *columns = getenv("COLUMNS");
+ return barplot(columns == NULL ? 80 : strtoul(columns, NULL, 0));
+}
diff --git a/Common/Histogram.h b/Common/Histogram.h
new file mode 100644
index 0000000..da61a6f
--- /dev/null
+++ b/Common/Histogram.h
@@ -0,0 +1,327 @@
+#ifndef HISTOGRAM_H
+#define HISTOGRAM_H 1
+
+#include "StringUtil.h" // for toEng
+#include <cassert>
+#include <climits> // for INT_MAX
+#include <cmath>
+#include <istream>
+#include <map>
+#include <ostream>
+#include <string>
+#include <vector>
+
+/** A histogram of type T, which is int be default.
+ * A histogram may be implemented as a multiset. This class aims
+ * to provide a similar interface to a multiset.
+ */
+class Histogram
+{
+ typedef int T;
+ typedef size_t size_type;
+ typedef std::map<T, size_type> Map;
+ typedef long long unsigned accumulator;
+
+ public:
+ typedef Map::const_iterator const_iterator;
+
+ Histogram() { }
+
+ /** Construct a histogram of the specified elements. */
+ template <class InputIterator>
+ Histogram(InputIterator first, InputIterator last)
+ {
+ for (InputIterator it = first; it != last; ++it)
+ insert(*it);
+ }
+
+ /** Construct a histogram from a vector, where the index into the
+ * vector is the sample, and the value at that index is the number
+ * of times that sample was observed.
+ */
+ explicit Histogram(std::vector<size_type> v)
+ {
+ for (T i = 0; i < (T)v.size(); i++)
+ if (v[i] > 0)
+ m_map.insert(std::make_pair(i, v[i]));
+ }
+
+ void insert(T value) { m_map[value]++; }
+
+ void insert(T value, size_type count) { m_map[value] += count; }
+
+ size_type count(T value) const
+ {
+ Map::const_iterator iter = m_map.find(value);
+ return iter == m_map.end() ? 0 : iter->second;
+ }
+
+ /** Return the number of elements in the range [lo,hi]. */
+ size_type count(T lo, T hi) const
+ {
+ assert(lo <= hi);
+ size_type n = 0;
+ Map::const_iterator last = m_map.upper_bound(hi);
+ for (Map::const_iterator it = m_map.lower_bound(lo);
+ it != last; ++it)
+ n += it->second;
+ return n;
+ }
+
+ T minimum() const
+ {
+ return empty() ? 0 : m_map.begin()->first;
+ }
+
+ T maximum() const
+ {
+ return empty() ? 0 : m_map.rbegin()->first;
+ }
+
+ bool empty() const { return m_map.empty(); }
+
+ size_type size() const
+ {
+ size_type n = 0;
+ for (Map::const_iterator it = m_map.begin();
+ it != m_map.end(); ++it)
+ n += it->second;
+ return n;
+ }
+
+ /** Return the sum. */
+ accumulator sum() const
+ {
+ accumulator total = 0;
+ for (Map::const_iterator it = m_map.begin();
+ it != m_map.end(); ++it)
+ total += (accumulator)it->first * it->second;
+ return total;
+ }
+
+ /** Return the mean. */
+ double mean() const
+ {
+ accumulator n = 0, total = 0;
+ for (Map::const_iterator it = m_map.begin();
+ it != m_map.end(); ++it) {
+ n += it->second;
+ total += (accumulator)it->first * it->second;
+ }
+ return (double)total / n;
+ }
+
+ double variance() const
+ {
+ accumulator n = 0, total = 0, squares = 0;
+ for (Map::const_iterator it = m_map.begin();
+ it != m_map.end(); ++it) {
+ n += it->second;
+ total += (accumulator)it->first * it->second;
+ squares += (accumulator)it->first * it->first
+ * it->second;
+ }
+ return (squares - (double)total * total / n) / n;
+ }
+
+ double sd() const
+ {
+ return sqrt(variance());
+ }
+
+ /** Return the specified percentile. */
+ T percentile(float p) const
+ {
+ size_type x = (size_type)ceil(p * size());
+ size_type n = 0;
+ for (Map::const_iterator it = m_map.begin();
+ it != m_map.end(); ++it) {
+ n += it->second;
+ if (n >= x)
+ return it->first;
+ }
+ return maximum();
+ }
+
+ /** Return the median. */
+ T median() const
+ {
+ return percentile(0.5);
+ }
+
+ /** Return the specified weighted percentile. */
+ T weightedPercentile(float p) const
+ {
+ accumulator x = (accumulator)ceil(p * sum());
+ accumulator total = 0;
+ for (Map::const_iterator it = m_map.begin();
+ it != m_map.end(); ++it) {
+ total += (accumulator)it->first * it->second;
+ if (total >= x)
+ return it->first;
+ }
+ return maximum();
+ }
+
+ /** Return the N50. */
+ T n50() const { return weightedPercentile(0.5); }
+
+ /** Return the first local minimum or zero if a minimum is not
+ * found. */
+ T firstLocalMinimum() const
+ {
+ const unsigned SMOOTHING = 4;
+ assert(!empty());
+ Map::const_iterator minimum = m_map.begin();
+ size_type count = 0;
+ for (Map::const_iterator it = m_map.begin();
+ it != m_map.end(); ++it) {
+ if (it->second <= minimum->second) {
+ minimum = it;
+ count = 0;
+ } else if (++count >= SMOOTHING)
+ break;
+ }
+ if (minimum->first == maximum())
+ return 0;
+ return minimum->first;
+ }
+
+ void eraseNegative()
+ {
+ for (Map::iterator it = m_map.begin(); it != m_map.end();)
+ if (it->first < 0)
+ m_map.erase(it++);
+ else
+ ++it;
+ }
+
+ /** Remove noise from the histogram. Noise is defined as a
+ * sample x where h[x-1] == 0 && h[x+1] == 0.
+ */
+ void removeNoise()
+ {
+ for (Map::iterator it = m_map.begin(); it != m_map.end();) {
+ if (m_map.count(it->first - 1) == 0
+ && m_map.count(it->first + 1) == 0)
+ m_map.erase(it++);
+ else
+ ++it;
+ }
+ }
+
+ /** Remove outliers from the histogram. A sample is an outlier
+ * if it is outside the range [Q1 - k*(Q3-Q1), Q3 + k*(Q3-Q1)]
+ * where k = 20.
+ */
+ void removeOutliers()
+ {
+ T q1 = percentile(0.25);
+ T q3 = percentile(0.75);
+ T l = q1 - 20 * (q3 - q1);
+ T u = q3 + 20 * (q3 - q1);
+ for (Map::iterator it = m_map.begin(); it != m_map.end();) {
+ if (it->first < l || it->first > u)
+ m_map.erase(it++);
+ else
+ ++it;
+ }
+ }
+
+ /** Negate each element of this histogram. */
+ Histogram negate() const
+ {
+ Histogram h;
+ for (Map::const_iterator it = m_map.begin();
+ it != m_map.end(); ++it)
+ h.m_map.insert(std::make_pair(-it->first, it->second));
+ return h;
+ }
+
+ Histogram trimFraction(double fraction) const;
+ Histogram trimLow(T threshold) const;
+
+ typedef std::vector<accumulator> Bins;
+ Bins bin(unsigned n) const;
+ std::string barplot() const;
+ std::string barplot(unsigned nbins) const;
+
+ const_iterator begin() const { return m_map.begin(); }
+ const_iterator end() const { return m_map.end(); }
+
+ /** Return a vector representing this histogram. */
+ std::vector<size_type> toVector() const
+ {
+ assert(minimum() >= 0);
+#if 0
+ std::vector<size_type> v(maximum()+1);
+#else
+ // CommLayer::reduce requires the arrays have the same size.
+ std::vector<size_type> v(65536);
+ assert(maximum() < (T)v.size());
+#endif
+ for (Map::const_iterator it = m_map.begin();
+ it != m_map.end(); ++it)
+ v[it->first] = it->second;
+ return v;
+ }
+
+ friend std::ostream& operator<<(std::ostream& o,
+ const Histogram& h)
+ {
+ for (Map::const_iterator it = h.m_map.begin();
+ it != h.m_map.end(); ++it)
+ o << it->first << '\t' << it->second << '\n';
+ return o;
+ }
+
+ friend std::istream& operator>>(std::istream& in, Histogram& h)
+ {
+ Histogram::T value;
+ size_type count;
+ while (in >> value >> count)
+ h.insert(value, count);
+ assert(in.eof());
+ return in;
+ }
+
+ private:
+ Map m_map;
+};
+
+namespace std {
+ template<>
+ inline void swap(Histogram&, Histogram&) { assert(false); }
+}
+
+/** Print assembly contiguity statistics. */
+static inline std::ostream& printContiguityStats(
+ std::ostream& out, const Histogram& h0,
+ unsigned minSize, bool printHeader = true,
+ const std::string& sep = "\t")
+{
+ Histogram h = h0.trimLow(minSize);
+ unsigned n50 = h.n50();
+ if (printHeader)
+ out << "n" << sep
+ << "n:" << minSize << sep
+ << "n:N50" << sep
+ << "min" << sep
+ << "N80" << sep
+ << "N50" << sep
+ << "N20" << sep
+ << "max" << sep
+ << "sum\n";
+ return out
+ << toEng(h0.size()) << sep
+ << toEng(h.size()) << sep
+ << toEng(h.count(n50, INT_MAX)) << sep
+ << toEng(h.minimum()) << sep
+ << toEng(h.weightedPercentile(1 - 0.8)) << sep
+ << toEng(n50) << sep
+ << toEng(h.weightedPercentile(1 - 0.2)) << sep
+ << toEng(h.maximum()) << sep
+ << toEng(h.sum());
+}
+
+#endif
diff --git a/Common/IOUtil.h b/Common/IOUtil.h
new file mode 100644
index 0000000..c836723
--- /dev/null
+++ b/Common/IOUtil.h
@@ -0,0 +1,109 @@
+#ifndef IOUTIL_H
+#define IOUTIL_H 1
+
+#include <cassert>
+#include <cerrno>
+#include <cstdlib>
+#include <cstring> // for strerror
+#include <fstream>
+#include <iostream>
+#include <limits> // for numeric_limits
+#include <string>
+
+/** Print an error message and exit if stream is not good. */
+static inline void assert_good(const std::ios& stream,
+ const std::string& path)
+{
+ if (!stream.good()) {
+ std::cerr << "error: `" << path << "': "
+ << strerror(errno) << std::endl;
+ exit(EXIT_FAILURE);
+ }
+}
+
+/** Print an error message and exit if stream is not eof. */
+static inline void assert_eof(std::istream& in,
+ const std::string& path)
+{
+ if (!in.eof()) {
+ in.clear();
+ std::string s;
+ std::getline(in, s);
+ std::cerr << "error: `" << path << "': "
+ "Expected end-of-file and saw `" << s << "'\n";
+ exit(EXIT_FAILURE);
+ }
+}
+
+/** This input stream manipulator skips the specified string. */
+struct expect {
+ const char* s;
+ expect(const char* s) : s(s) { }
+};
+
+static inline std::istream& operator>>(std::istream& in, expect o)
+{
+ for (const char* p = o.s; *p != '\0'; ++p) {
+ if (*p == ' ') {
+ in >> std::ws;
+ } else {
+ char c = in.get();
+ if (!in || c != *p) {
+ std::cerr << "error: Expected `" << p
+ << "' and saw ";
+ if (in)
+ std::cerr << '`' << c << "'\n";
+ else if (in.eof())
+ std::cerr << "end-of-file\n";
+ else
+ std::cerr << "I/O error\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+ }
+ return in;
+}
+
+/** This input stream manipulator discards characters until reaching
+ * the delimeter. */
+struct Ignore {
+ const char delim;
+ size_t n;
+ Ignore(const char delim,
+ size_t n = std::numeric_limits<std::streamsize>::max())
+ : delim(delim), n(n) { }
+};
+
+static inline std::istream& operator>>(std::istream& in, Ignore o)
+{
+ return in.ignore(o.n, o.delim);
+}
+
+/** Read a file and store it in the specified vector. */
+template <typename Vector>
+static inline void readFile(const char* path, Vector& s)
+{
+ std::ifstream in(path);
+ assert_good(in, path);
+ in.seekg(0, std::ios::end);
+ ssize_t n = in.tellg();
+ assert(n > 0);
+ s.resize(n);
+ in.seekg(0, std::ios::beg);
+ assert_good(in, path);
+ char *p = reinterpret_cast<char*>(&s[0]);
+#if __MACH__
+ // Read 1 GB at a time. Reads of 2 GB or more fail.
+ const ssize_t N = 1024 * 1024 * 1024;
+ for (; n > N; n -= N, p += N) {
+ in.read(p, N);
+ assert_good(in, path);
+ assert(in.gcount() == N);
+ }
+#endif
+ in.read(p, n);
+ assert_good(in, path);
+ assert(in.gcount() == n);
+}
+
+#endif
diff --git a/Common/Iterator.h b/Common/Iterator.h
new file mode 100644
index 0000000..b9d4979
--- /dev/null
+++ b/Common/Iterator.h
@@ -0,0 +1,115 @@
+#ifndef ITERATOR_H
+#define ITERATOR_H 1
+
+#include <iterator>
+
+/** A counting output iterator. */
+class CountingOutputIterator
+{
+ public:
+ explicit CountingOutputIterator(size_t& count) : m_count(count)
+ {
+ m_count = 0;
+ }
+
+ CountingOutputIterator& operator++()
+ {
+ ++m_count;
+ return *this;
+ }
+
+ CountingOutputIterator& operator*()
+ {
+ return *this;
+ }
+
+ template<typename T>
+ CountingOutputIterator& operator=(const T&)
+ {
+ return *this;
+ }
+
+ private:
+ size_t& m_count;
+};
+
+/** An output stream iterator, like ostream_iterator, that outputs the
+ * a delimiter before and after the item.
+ */
+template <class T,
+ class charT = char,
+ class traits = std::char_traits<charT> >
+
+class affix_ostream_iterator :
+ public std::iterator<std::output_iterator_tag,
+ void, void, void, void>
+{
+public:
+ typedef charT char_type;
+ typedef traits traits_type;
+ typedef std::basic_ostream<charT, traits> ostream_type;
+ typedef void value_type;
+
+ affix_ostream_iterator(ostream_type& s,
+ charT const *prefix, charT const *suffix = NULL)
+ : os(&s), prefix(prefix), suffix(suffix)
+ {}
+
+ affix_ostream_iterator<T, charT,
+ traits>& operator =(T const &item)
+ {
+ if (prefix != NULL)
+ *os << prefix;
+ *os << item;
+ if (suffix != NULL)
+ *os << suffix;
+ return *this;
+ }
+
+ affix_ostream_iterator<T, charT, traits> &operator*() {
+ return *this;
+ }
+ affix_ostream_iterator<T, charT, traits> &operator++() {
+ return *this;
+ }
+ affix_ostream_iterator<T, charT, traits> &operator++(int) {
+ return *this;
+ }
+
+private:
+ std::basic_ostream<charT, traits> *os;
+ charT const* prefix;
+ charT const* suffix;
+};
+
+/** Traits of an output iterator. */
+template<class OutputIterator>
+struct output_iterator_traits {
+ typedef typename OutputIterator::value_type value_type;
+};
+
+/** Traits of a back_insert_iterator. */
+template<class Container>
+struct output_iterator_traits<
+ std::back_insert_iterator<Container> >
+{
+ typedef typename Container::value_type value_type;
+};
+
+/** Traits of an ostream_iterator. */
+template<class T, class charT, class traits>
+struct output_iterator_traits<
+ std::ostream_iterator<T, charT, traits> >
+{
+ typedef T value_type;
+};
+
+/** Traits of an affix_ostream_iterator. */
+template<class T, class charT, class traits>
+struct output_iterator_traits<
+ affix_ostream_iterator<T, charT, traits> >
+{
+ typedef T value_type;
+};
+
+#endif
diff --git a/Common/Kmer.cpp b/Common/Kmer.cpp
new file mode 100644
index 0000000..c86efa4
--- /dev/null
+++ b/Common/Kmer.cpp
@@ -0,0 +1,455 @@
+#include "config.h"
+#include "Kmer.h"
+#include "Common/Options.h"
+#include "HashFunction.h"
+#include <algorithm>
+#include <cstring>
+
+using namespace std;
+
+/** The size of a k-mer. This variable is static and is shared by all
+ * instances. */
+unsigned Kmer::s_length;
+
+/** The size of a k-mer in bytes. */
+unsigned Kmer::s_bytes;
+
+static unsigned seqIndexToByteNumber(unsigned seqIndex);
+static unsigned seqIndexToBaseIndex(unsigned seqIndex);
+static uint8_t getBaseCode(const char* pSeq,
+ unsigned byteNum, unsigned index);
+static void setBaseCode(char* pSeq,
+ unsigned byteNum, unsigned index, uint8_t base);
+
+/** Construct a k-mer from a string. */
+Kmer::Kmer(const Sequence& seq)
+{
+ assert(seq.length() == s_length);
+ memset(m_seq, 0, NUM_BYTES);
+ const char* p = seq.data();
+ for (unsigned i = 0; i < s_length; i++)
+ set(i, baseToCode(*p++));
+}
+
+/** Compare two k-mer. */
+int Kmer::compare(const Kmer& other) const
+{
+ return memcmp(m_seq, other.m_seq, bytes());
+}
+
+/** Compute a hash-like value of the packed sequence over the first 16
+ * bases and the reverse complement of the last 16 bases
+ * The reverse complement of the last 16 bases is used so that a
+ * sequence and its reverse complement will hash to the same value.
+ * @todo make this faster
+ */
+unsigned Kmer::getCode() const
+{
+ /* At k=19, this hash function always returns an even number due
+ * to the sequence and its reverse complement overlapping when the
+ * xor is calculated. A more general solution is needed. */
+ const unsigned NUM_BYTES = s_length < 20 ? s_length/8 : 4;
+ Kmer rc = *this;
+ rc.reverseComplement();
+
+ const unsigned prime = 101;
+ unsigned sum = 0;
+ for (unsigned i = 0; i < NUM_BYTES; i++)
+ sum = prime * sum + (m_seq[i] ^ rc.m_seq[i]);
+ return sum;
+}
+
+size_t Kmer::getHashCode() const
+{
+ // Hash numbytes - 1 to avoid getting different hash values for
+ // the same sequence for n % 4 != 0 sequences.
+ return hashmem(m_seq, bytes() - 1);
+}
+
+/** Return the string representation of this sequence. */
+Sequence Kmer::str() const
+{
+ Sequence s;
+ s.reserve(s_length);
+ for (unsigned i = 0; i < s_length; i++)
+ s.push_back(codeToBase(at(i)));
+ return s;
+}
+
+/** Swap the positions of four bases. */
+static const uint8_t swapBases[256] = {
+ 0x00, 0x40, 0x80, 0xc0, 0x10, 0x50, 0x90, 0xd0,
+ 0x20, 0x60, 0xa0, 0xe0, 0x30, 0x70, 0xb0, 0xf0,
+ 0x04, 0x44, 0x84, 0xc4, 0x14, 0x54, 0x94, 0xd4,
+ 0x24, 0x64, 0xa4, 0xe4, 0x34, 0x74, 0xb4, 0xf4,
+ 0x08, 0x48, 0x88, 0xc8, 0x18, 0x58, 0x98, 0xd8,
+ 0x28, 0x68, 0xa8, 0xe8, 0x38, 0x78, 0xb8, 0xf8,
+ 0x0c, 0x4c, 0x8c, 0xcc, 0x1c, 0x5c, 0x9c, 0xdc,
+ 0x2c, 0x6c, 0xac, 0xec, 0x3c, 0x7c, 0xbc, 0xfc,
+ 0x01, 0x41, 0x81, 0xc1, 0x11, 0x51, 0x91, 0xd1,
+ 0x21, 0x61, 0xa1, 0xe1, 0x31, 0x71, 0xb1, 0xf1,
+ 0x05, 0x45, 0x85, 0xc5, 0x15, 0x55, 0x95, 0xd5,
+ 0x25, 0x65, 0xa5, 0xe5, 0x35, 0x75, 0xb5, 0xf5,
+ 0x09, 0x49, 0x89, 0xc9, 0x19, 0x59, 0x99, 0xd9,
+ 0x29, 0x69, 0xa9, 0xe9, 0x39, 0x79, 0xb9, 0xf9,
+ 0x0d, 0x4d, 0x8d, 0xcd, 0x1d, 0x5d, 0x9d, 0xdd,
+ 0x2d, 0x6d, 0xad, 0xed, 0x3d, 0x7d, 0xbd, 0xfd,
+ 0x02, 0x42, 0x82, 0xc2, 0x12, 0x52, 0x92, 0xd2,
+ 0x22, 0x62, 0xa2, 0xe2, 0x32, 0x72, 0xb2, 0xf2,
+ 0x06, 0x46, 0x86, 0xc6, 0x16, 0x56, 0x96, 0xd6,
+ 0x26, 0x66, 0xa6, 0xe6, 0x36, 0x76, 0xb6, 0xf6,
+ 0x0a, 0x4a, 0x8a, 0xca, 0x1a, 0x5a, 0x9a, 0xda,
+ 0x2a, 0x6a, 0xaa, 0xea, 0x3a, 0x7a, 0xba, 0xfa,
+ 0x0e, 0x4e, 0x8e, 0xce, 0x1e, 0x5e, 0x9e, 0xde,
+ 0x2e, 0x6e, 0xae, 0xee, 0x3e, 0x7e, 0xbe, 0xfe,
+ 0x03, 0x43, 0x83, 0xc3, 0x13, 0x53, 0x93, 0xd3,
+ 0x23, 0x63, 0xa3, 0xe3, 0x33, 0x73, 0xb3, 0xf3,
+ 0x07, 0x47, 0x87, 0xc7, 0x17, 0x57, 0x97, 0xd7,
+ 0x27, 0x67, 0xa7, 0xe7, 0x37, 0x77, 0xb7, 0xf7,
+ 0x0b, 0x4b, 0x8b, 0xcb, 0x1b, 0x5b, 0x9b, 0xdb,
+ 0x2b, 0x6b, 0xab, 0xeb, 0x3b, 0x7b, 0xbb, 0xfb,
+ 0x0f, 0x4f, 0x8f, 0xcf, 0x1f, 0x5f, 0x9f, 0xdf,
+ 0x2f, 0x6f, 0xaf, 0xef, 0x3f, 0x7f, 0xbf, 0xff
+};
+
+#if MAX_KMER > 96
+# include <bitset>
+typedef bitset<2 * MAX_KMER> Seq;
+#else
+# define SEQ_WORDS ((Kmer::NUM_BYTES + 7)/8)
+# define SEQ_BITS (64 * SEQ_WORDS)
+# define SEQ_FULL_WORDS ((int)Kmer::NUM_BYTES/8)
+# define SEQ_ODD_BYTES (Kmer::NUM_BYTES - 8*SEQ_FULL_WORDS)
+
+/** A sequence of bits of length SEQ_BITS. */
+struct Seq {
+ uint64_t x[SEQ_WORDS];
+
+ /** Return the number of bits in this sequence. */
+ static unsigned size() { return SEQ_BITS; }
+
+ /** Flip all the bits. */
+ void flip()
+ {
+ for (unsigned i = 0; i < SEQ_WORDS; i++)
+ x[i] = ~x[i];
+ }
+
+ /** Shift right by the specified number of bits. */
+ void operator>>=(uint8_t n)
+ {
+ if (n == 0)
+ return;
+#if MAX_KMER <= 32
+ x[0] >>= n;
+#elif MAX_KMER <= 64
+ uint64_t x0 = x[0], x1 = x[1];
+ if (n < 64) {
+ x[0] = x0 >> n;
+ x[1] = x1 >> n | x0 << (64 - n);
+ } else {
+ x[0] = 0;
+ x[1] = x0 >> (n - 64);
+ }
+#elif MAX_KMER <= 96
+ uint64_t x0 = x[0], x1 = x[1], x2 = x[2];
+ if (n < 64) {
+ x[0] = x0 >> n;
+ x[1] = x1 >> n | x0 << (64 - n);
+ x[2] = x2 >> n | x1 << (64 - n);
+ } else if (n == 64) {
+ x[0] = 0;
+ x[1] = x0;
+ x[2] = x1;
+ } else if (n < 128) {
+ n -= 64;
+ x[0] = 0;
+ x[1] = x0 >> n;
+ x[2] = x1 >> n | x0 << (64 - n);
+ } else {
+ n -= 128;
+ x[0] = 0;
+ x[1] = 0;
+ x[2] = x0 >> n;
+ }
+#else
+# error
+#endif
+ }
+};
+#endif
+
+/** Load with appropriate endianness for shifting. */
+static Seq load(const uint8_t *src)
+{
+ Seq seq;
+#if MAX_KMER > 96
+# if WORDS_BIGENDIAN
+ const uint64_t *s = reinterpret_cast<const uint64_t*>(src);
+ uint64_t *d = reinterpret_cast<uint64_t*>(&seq + 1);
+ copy(s, s + SEQ_WORDS, reverse_iterator<uint64_t*>(d));
+# else
+ uint8_t *d = reinterpret_cast<uint8_t*>(&seq);
+ memcpy(d, src, sizeof seq);
+ reverse(d, d + sizeof seq);
+# endif
+#else
+ uint64_t *px = seq.x;
+ const uint8_t *p = src;
+ for (int i = 0; i < SEQ_FULL_WORDS; i++) {
+ *px++ = (uint64_t)p[0] << 56
+ | (uint64_t)p[1] << 48
+ | (uint64_t)p[2] << 40
+ | (uint64_t)p[3] << 32
+ | (uint64_t)p[4] << 24
+ | (uint64_t)p[5] << 16
+ | (uint64_t)p[6] << 8
+ | (uint64_t)p[7] << 0;
+ p += 8;
+ }
+ if (SEQ_ODD_BYTES > 0) {
+ uint64_t x = 0;
+ if (SEQ_ODD_BYTES > 0) x |= (uint64_t)p[0] << 56;
+ if (SEQ_ODD_BYTES > 1) x |= (uint64_t)p[1] << 48;
+ if (SEQ_ODD_BYTES > 2) x |= (uint64_t)p[2] << 40;
+ if (SEQ_ODD_BYTES > 3) x |= (uint64_t)p[3] << 32;
+ if (SEQ_ODD_BYTES > 4) x |= (uint64_t)p[4] << 24;
+ if (SEQ_ODD_BYTES > 5) x |= (uint64_t)p[5] << 16;
+ if (SEQ_ODD_BYTES > 6) x |= (uint64_t)p[6] << 8;
+ if (SEQ_ODD_BYTES > 7) x |= (uint64_t)p[7] << 0;
+ *px = x;
+ }
+#endif
+ return seq;
+}
+
+/**
+ * Reverse the bytes by storing them in the reverse order of
+ * loading, and reverse the words in the same fashion.
+ */
+static void storeReverse(uint8_t *dest, const Seq seq)
+{
+#if MAX_KMER > 96
+# if WORDS_BIGENDIAN
+ const uint64_t *s = reinterpret_cast<const uint64_t*>(&seq);
+ uint64_t *d = reinterpret_cast<uint64_t*>(dest);
+ copy(s, s + SEQ_WORDS,
+ reverse_iterator<uint64_t*>(d + SEQ_WORDS));
+ reverse(dest, dest + Kmer::NUM_BYTES);
+# else
+ memcpy(dest, &seq, Kmer::NUM_BYTES);
+# endif
+#else
+ const uint64_t *px = &seq.x[SEQ_WORDS-1];
+# if WORDS_BIGENDIAN
+ for (int i = 0; i < SEQ_FULL_WORDS; i++) {
+ dest[0] = *px >> 0;
+ dest[1] = *px >> 8;
+ dest[2] = *px >> 16;
+ dest[3] = *px >> 24;
+ dest[4] = *px >> 32;
+ dest[5] = *px >> 40;
+ dest[6] = *px >> 48;
+ dest[7] = *px >> 56;
+ dest += 8;
+ px--;
+ }
+# else
+ uint64_t *d = (uint64_t*)dest;
+ for (int i = 0; i < SEQ_FULL_WORDS; i++)
+ *d++ = *px--;
+ dest = (uint8_t*)d;
+# endif
+ if (SEQ_ODD_BYTES > 0) dest[0] = *px >> 0;
+ if (SEQ_ODD_BYTES > 1) dest[1] = *px >> 8;
+ if (SEQ_ODD_BYTES > 2) dest[2] = *px >> 16;
+ if (SEQ_ODD_BYTES > 3) dest[3] = *px >> 24;
+ if (SEQ_ODD_BYTES > 4) dest[4] = *px >> 32;
+ if (SEQ_ODD_BYTES > 5) dest[5] = *px >> 40;
+ if (SEQ_ODD_BYTES > 6) dest[6] = *px >> 48;
+ if (SEQ_ODD_BYTES > 7) dest[7] = *px >> 56;
+#endif
+}
+
+/** Reverse-complement this sequence. */
+void Kmer::reverseComplement()
+{
+ Seq seq = load((uint8_t*)m_seq);
+
+ // Complement the bits.
+ if (!opt::colourSpace)
+ seq.flip();
+
+ // Shift the bits flush to the right of the double word.
+ seq >>= seq.size() - 2*s_length;
+
+ storeReverse((uint8_t*)m_seq, seq);
+
+ // Reverse the pairs of bits withing a byte.
+ unsigned numBytes = bytes();
+ for (unsigned i = 0; i < numBytes; i++)
+ m_seq[i] = swapBases[(uint8_t)m_seq[i]];
+}
+
+void Kmer::setLastBase(extDirection dir, uint8_t base)
+{
+ set(dir == SENSE ? s_length - 1 : 0, base);
+}
+
+/** Shift the sequence left and append a new base to the end.
+ * @return the base shifted out
+ */
+uint8_t Kmer::shiftAppend(uint8_t base)
+{
+ unsigned numBytes = bytes();
+ uint8_t shiftIn = base;
+ for(int i = numBytes - 1; i >= 0; i--)
+ {
+ unsigned index = (unsigned)i == numBytes - 1
+ ? seqIndexToBaseIndex(s_length - 1) : 3;
+ shiftIn = leftShiftByte(m_seq, i, index, shiftIn);
+ }
+ return shiftIn;
+}
+
+/** Shift the sequence right and prepend a new base at the front.
+ * @return the base shifted out
+ */
+uint8_t Kmer::shiftPrepend(uint8_t base)
+{
+ unsigned numBytes = bytes();
+
+ unsigned lastBaseByte = seqIndexToByteNumber(s_length - 1);
+ unsigned lastBaseIndex = seqIndexToBaseIndex(s_length - 1);
+
+ // save the last base (which gets shifted out)
+ uint8_t lastBase = getBaseCode(m_seq,
+ lastBaseByte, lastBaseIndex);
+ // Zero the last base, which is required by compare.
+ setBaseCode(m_seq, lastBaseByte, lastBaseIndex, 0);
+
+ uint8_t shiftIn = base;
+ for(unsigned i = 0; i <= numBytes - 1; i++)
+ {
+ // index is always zero
+ unsigned index = 0;
+ shiftIn = rightShiftByte(m_seq, i, index, shiftIn);
+ }
+ return lastBase;
+}
+
+uint8_t Kmer::leftShiftByte(char* pSeq,
+ unsigned byteNum, unsigned index, uint8_t base)
+{
+ // save the first base
+ uint8_t outBase = (pSeq[byteNum] >> 6) & 0x3;
+
+ // shift left one position
+ pSeq[byteNum] <<= 2;
+
+ // Set the new base
+ setBaseCode(pSeq, byteNum, index, base);
+
+ return outBase;
+}
+
+uint8_t Kmer::rightShiftByte(char* pSeq,
+ unsigned byteNum, unsigned index, uint8_t base)
+{
+ // save the last base
+ uint8_t outBase = pSeq[byteNum] & 0x3;
+
+ // shift right one position
+ pSeq[byteNum] >>= 2;
+
+ // add the new base
+ setBaseCode(pSeq, byteNum, index, base);
+
+ return outBase;
+}
+
+//Set a base by byte number/ sub index
+// beware, this does not check for out of bounds access
+static void setBaseCode(char* pSeq,
+ unsigned byteNum, unsigned index, uint8_t base)
+{
+ // shift the value into position
+ unsigned shiftValue = 2*(3 - index);
+ base <<= shiftValue;
+
+ // clear the value
+ uint8_t mask = 0x3;
+ mask <<= shiftValue;
+ mask = ~mask;
+ pSeq[byteNum] &= mask;
+
+ // set the appropriate value with an OR
+ pSeq[byteNum] |= base;
+}
+
+/** Return the base at the specified index. */
+uint8_t Kmer::at(unsigned i) const
+{
+ assert(i < s_length);
+ return getBaseCode(m_seq,
+ seqIndexToByteNumber(i), seqIndexToBaseIndex(i));
+}
+
+/** Set the base at the specified index. */
+void Kmer::set(unsigned i, uint8_t base)
+{
+ assert(i < s_length);
+ setBaseCode(m_seq,
+ seqIndexToByteNumber(i), seqIndexToBaseIndex(i), base);
+}
+
+uint8_t Kmer::getLastBaseChar() const
+{
+ return codeToBase(at(s_length - 1));
+}
+
+// get a base code by the byte number and sub index
+static uint8_t getBaseCode(const char* pSeq,
+ unsigned byteNum, unsigned index)
+{
+ unsigned shiftLen = 2 * (3 - index);
+ return (pSeq[byteNum] >> shiftLen) & 0x3;
+}
+
+static unsigned seqIndexToByteNumber(unsigned seqIndex)
+{
+ return seqIndex / 4;
+}
+
+static unsigned seqIndexToBaseIndex(unsigned seqIndex)
+{
+ return seqIndex % 4;
+}
+
+/** Return true if this sequence is a palindrome. */
+bool Kmer::isPalindrome() const
+{
+ return s_length % 2 == 1 && !opt::colourSpace ? false
+ : *this == ::reverseComplement(*this);
+}
+
+/** Return true if the length k-1 subsequence is a palindrome. */
+bool Kmer::isPalindrome(extDirection dir) const
+{
+ if (s_length % 2 == 0 && !opt::colourSpace)
+ return false;
+ Kmer seq(*this);
+ if (dir == SENSE)
+ seq.shiftAppend(0);
+ else
+ seq.setLastBase(SENSE, 0);
+
+ Kmer rc(*this);
+ rc.reverseComplement();
+ if (dir == SENSE)
+ rc.setLastBase(SENSE, 0);
+ else
+ rc.shiftAppend(0);
+
+ return seq == rc;
+}
diff --git a/Common/Kmer.h b/Common/Kmer.h
new file mode 100644
index 0000000..6dcedba
--- /dev/null
+++ b/Common/Kmer.h
@@ -0,0 +1,130 @@
+#ifndef Kmer_H
+#define Kmer_H 1
+
+#include "config.h"
+#include "Sense.h"
+#include "Sequence.h"
+#include <cassert>
+#include <cstring> // for memcpy
+#include <stdint.h>
+#include <ostream>
+
+/** A k-mer. */
+class Kmer
+{
+ public:
+ Kmer() { }
+ explicit Kmer(const Sequence& seq);
+
+ int compare(const Kmer& other) const;
+
+ bool operator==(const Kmer& other) const
+ {
+ return compare(other) == 0;
+ }
+
+ bool operator!=(const Kmer& other) const
+ {
+ return compare(other) != 0;
+ }
+
+ bool operator<(const Kmer& other) const
+ {
+ return compare(other) < 0;
+ }
+
+ Sequence str() const;
+
+ unsigned getCode() const;
+ size_t getHashCode() const;
+
+ static unsigned length() { return s_length; }
+
+ /** Set the length of a k-mer.
+ * This value is shared by all instances.
+ */
+ static void setLength(unsigned length)
+ {
+ assert(length <= MAX_KMER);
+ s_length = length;
+ s_bytes = (length + 3) / 4;
+ }
+
+ void reverseComplement();
+
+ bool isPalindrome() const;
+ bool isPalindrome(extDirection dir) const;
+ void setLastBase(extDirection dir, uint8_t base);
+ uint8_t getLastBaseChar() const;
+
+ uint8_t shift(extDirection dir, uint8_t base = 0)
+ {
+ return dir == SENSE ? shiftAppend(base) : shiftPrepend(base);
+ }
+
+ /** Return the number of bytes needed. */
+ static unsigned bytes() { return s_bytes; }
+ static unsigned serialSize() { return NUM_BYTES; }
+
+ size_t serialize(void* dest) const
+ {
+ memcpy(dest, m_seq, sizeof m_seq);
+ return sizeof m_seq;
+ }
+
+ size_t unserialize(const void* src)
+ {
+ memcpy(m_seq, src, sizeof m_seq);
+ return sizeof m_seq;
+ }
+
+ friend std::ostream& operator<<(std::ostream& out, const Kmer& o)
+ {
+ return out << o.str();
+ }
+
+ private:
+ uint8_t shiftAppend(uint8_t base);
+ uint8_t shiftPrepend(uint8_t base);
+
+ uint8_t at(unsigned i) const;
+ void set(unsigned i, uint8_t base);
+
+ static uint8_t leftShiftByte(char* pSeq,
+ unsigned byteNum, unsigned index, uint8_t base);
+ static uint8_t rightShiftByte(char* pSeq,
+ unsigned byteNum, unsigned index, uint8_t base);
+
+ public:
+#if MAX_KMER > 96
+# if MAX_KMER % 32 != 0
+# error MAX_KMER must be a multiple of 32.
+# endif
+#else
+# if MAX_KMER % 4 != 0
+# error MAX_KMER must be a multiple of 4.
+# endif
+#endif
+ static const unsigned NUM_BYTES = MAX_KMER / 4;
+
+ protected:
+ static unsigned s_length;
+ static unsigned s_bytes;
+
+ char m_seq[NUM_BYTES];
+};
+
+/** Return the reverse complement of the specified k-mer. */
+static inline Kmer reverseComplement(const Kmer& seq)
+{
+ Kmer rc(seq);
+ rc.reverseComplement();
+ return rc;
+}
+
+struct hashKmer
+{
+ size_t operator()(const Kmer& o) const { return o.getHashCode(); }
+};
+
+#endif
diff --git a/Common/Log.cpp b/Common/Log.cpp
new file mode 100644
index 0000000..697e57f
--- /dev/null
+++ b/Common/Log.cpp
@@ -0,0 +1,19 @@
+#include "Log.h"
+#include "Common/Options.h"
+#include <iostream>
+
+using namespace std;
+
+/** Print a log message if the verbosity level is at least the
+ * specified level.
+ */
+ostream& logger(int level)
+{
+ if (opt::verbose < level) {
+ static ostream bitBucket(NULL);
+ return bitBucket;
+ }
+ if (opt::rank >= 0)
+ cout << opt::rank << ": ";
+ return cout;
+}
diff --git a/Common/Log.h b/Common/Log.h
new file mode 100644
index 0000000..50d5368
--- /dev/null
+++ b/Common/Log.h
@@ -0,0 +1,8 @@
+#ifndef LOG_H
+#define LOG_H 1
+
+#include <ostream>
+
+std::ostream& logger(int level);
+
+#endif
diff --git a/Common/Makefile.am b/Common/Makefile.am
new file mode 100644
index 0000000..08e409d
--- /dev/null
+++ b/Common/Makefile.am
@@ -0,0 +1,38 @@
+noinst_LIBRARIES = libcommon.a
+
+libcommon_a_CPPFLAGS = -I$(top_srcdir)
+
+libcommon_a_SOURCES = \
+ Algorithms.h \
+ Alignment.h \
+ BitUtil.h \
+ ConstString.h \
+ ContigID.h ContigID.cpp \
+ ContigNode.h \
+ ContigPath.h \
+ ContigProperties.h \
+ Dictionary.h \
+ Estimate.h \
+ Fcontrol.cpp Fcontrol.h \
+ Functional.h \
+ HashFunction.h \
+ Histogram.cpp Histogram.h \
+ IOUtil.h \
+ Iterator.h \
+ Kmer.cpp Kmer.h \
+ Log.cpp Log.h \
+ MemoryUtil.h \
+ Options.cpp Options.h \
+ PMF.h \
+ SAM.h \
+ Sense.h \
+ SeqExt.cpp SeqExt.h \
+ Sequence.cpp Sequence.h \
+ SignalHandler.cpp SignalHandler.h \
+ StringUtil.h \
+ SuffixArray.h \
+ Timer.cpp Timer.h \
+ Uncompress.cpp Uncompress.h \
+ UnorderedMap.h \
+ cholesky.hpp \
+ city.cc city.h
diff --git a/Common/Makefile.in b/Common/Makefile.in
new file mode 100644
index 0000000..0925a35
--- /dev/null
+++ b/Common/Makefile.in
@@ -0,0 +1,706 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = Common
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libcommon_a_AR = $(AR) $(ARFLAGS)
+libcommon_a_LIBADD =
+am_libcommon_a_OBJECTS = libcommon_a-ContigID.$(OBJEXT) \
+ libcommon_a-Fcontrol.$(OBJEXT) libcommon_a-Histogram.$(OBJEXT) \
+ libcommon_a-Kmer.$(OBJEXT) libcommon_a-Log.$(OBJEXT) \
+ libcommon_a-Options.$(OBJEXT) libcommon_a-SeqExt.$(OBJEXT) \
+ libcommon_a-Sequence.$(OBJEXT) \
+ libcommon_a-SignalHandler.$(OBJEXT) \
+ libcommon_a-Timer.$(OBJEXT) libcommon_a-Uncompress.$(OBJEXT) \
+ libcommon_a-city.$(OBJEXT)
+libcommon_a_OBJECTS = $(am_libcommon_a_OBJECTS)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libcommon_a_SOURCES)
+DIST_SOURCES = $(libcommon_a_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LIBRARIES = libcommon.a
+libcommon_a_CPPFLAGS = -I$(top_srcdir)
+libcommon_a_SOURCES = \
+ Algorithms.h \
+ Alignment.h \
+ BitUtil.h \
+ ConstString.h \
+ ContigID.h ContigID.cpp \
+ ContigNode.h \
+ ContigPath.h \
+ ContigProperties.h \
+ Dictionary.h \
+ Estimate.h \
+ Fcontrol.cpp Fcontrol.h \
+ Functional.h \
+ HashFunction.h \
+ Histogram.cpp Histogram.h \
+ IOUtil.h \
+ Iterator.h \
+ Kmer.cpp Kmer.h \
+ Log.cpp Log.h \
+ MemoryUtil.h \
+ Options.cpp Options.h \
+ PMF.h \
+ SAM.h \
+ Sense.h \
+ SeqExt.cpp SeqExt.h \
+ Sequence.cpp Sequence.h \
+ SignalHandler.cpp SignalHandler.h \
+ StringUtil.h \
+ SuffixArray.h \
+ Timer.cpp Timer.h \
+ Uncompress.cpp Uncompress.h \
+ UnorderedMap.h \
+ cholesky.hpp \
+ city.cc city.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Common/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Common/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libcommon.a: $(libcommon_a_OBJECTS) $(libcommon_a_DEPENDENCIES) $(EXTRA_libcommon_a_DEPENDENCIES)
+ -rm -f libcommon.a
+ $(libcommon_a_AR) libcommon.a $(libcommon_a_OBJECTS) $(libcommon_a_LIBADD)
+ $(RANLIB) libcommon.a
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-ContigID.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-Fcontrol.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-Histogram.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-Kmer.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-Log.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-Options.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-SeqExt.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-Sequence.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-SignalHandler.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-Timer.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-Uncompress.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libcommon_a-city.Po at am__quote@
+
+.cc.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+libcommon_a-ContigID.o: ContigID.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-ContigID.o -MD -MP -MF $(DEPDIR)/libcommon_a-ContigID.Tpo -c -o libcommon_a-ContigID.o `test -f 'ContigID.cpp' || echo '$(srcdir)/'`ContigID.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-ContigID.Tpo $(DEPDIR)/libcommon_a-ContigID.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ContigID.cpp' object='libcommon_a-ContigID.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-ContigID.o `test -f 'ContigID.cpp' || echo '$(srcdir)/'`ContigID.cpp
+
+libcommon_a-ContigID.obj: ContigID.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-ContigID.obj -MD -MP -MF $(DEPDIR)/libcommon_a-ContigID.Tpo -c -o libcommon_a-ContigID.obj `if test -f 'ContigID.cpp'; then $(CYGPATH_W) 'ContigID.cpp'; else $(CYGPATH_W) '$(srcdir)/ContigID.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-ContigID.Tpo $(DEPDIR)/libcommon_a-ContigID.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ContigID.cpp' object='libcommon_a-ContigID.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-ContigID.obj `if test -f 'ContigID.cpp'; then $(CYGPATH_W) 'ContigID.cpp'; else $(CYGPATH_W) '$(srcdir)/ContigID.cpp'; fi`
+
+libcommon_a-Fcontrol.o: Fcontrol.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Fcontrol.o -MD -MP -MF $(DEPDIR)/libcommon_a-Fcontrol.Tpo -c -o libcommon_a-Fcontrol.o `test -f 'Fcontrol.cpp' || echo '$(srcdir)/'`Fcontrol.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Fcontrol.Tpo $(DEPDIR)/libcommon_a-Fcontrol.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Fcontrol.cpp' object='libcommon_a-Fcontrol.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Fcontrol.o `test -f 'Fcontrol.cpp' || echo '$(srcdir)/'`Fcontrol.cpp
+
+libcommon_a-Fcontrol.obj: Fcontrol.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Fcontrol.obj -MD -MP -MF $(DEPDIR)/libcommon_a-Fcontrol.Tpo -c -o libcommon_a-Fcontrol.obj `if test -f 'Fcontrol.cpp'; then $(CYGPATH_W) 'Fcontrol.cpp'; else $(CYGPATH_W) '$(srcdir)/Fcontrol.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Fcontrol.Tpo $(DEPDIR)/libcommon_a-Fcontrol.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Fcontrol.cpp' object='libcommon_a-Fcontrol.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Fcontrol.obj `if test -f 'Fcontrol.cpp'; then $(CYGPATH_W) 'Fcontrol.cpp'; else $(CYGPATH_W) '$(srcdir)/Fcontrol.cpp'; fi`
+
+libcommon_a-Histogram.o: Histogram.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Histogram.o -MD -MP -MF $(DEPDIR)/libcommon_a-Histogram.Tpo -c -o libcommon_a-Histogram.o `test -f 'Histogram.cpp' || echo '$(srcdir)/'`Histogram.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Histogram.Tpo $(DEPDIR)/libcommon_a-Histogram.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Histogram.cpp' object='libcommon_a-Histogram.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Histogram.o `test -f 'Histogram.cpp' || echo '$(srcdir)/'`Histogram.cpp
+
+libcommon_a-Histogram.obj: Histogram.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Histogram.obj -MD -MP -MF $(DEPDIR)/libcommon_a-Histogram.Tpo -c -o libcommon_a-Histogram.obj `if test -f 'Histogram.cpp'; then $(CYGPATH_W) 'Histogram.cpp'; else $(CYGPATH_W) '$(srcdir)/Histogram.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Histogram.Tpo $(DEPDIR)/libcommon_a-Histogram.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Histogram.cpp' object='libcommon_a-Histogram.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Histogram.obj `if test -f 'Histogram.cpp'; then $(CYGPATH_W) 'Histogram.cpp'; else $(CYGPATH_W) '$(srcdir)/Histogram.cpp'; fi`
+
+libcommon_a-Kmer.o: Kmer.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Kmer.o -MD -MP -MF $(DEPDIR)/libcommon_a-Kmer.Tpo -c -o libcommon_a-Kmer.o `test -f 'Kmer.cpp' || echo '$(srcdir)/'`Kmer.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Kmer.Tpo $(DEPDIR)/libcommon_a-Kmer.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Kmer.cpp' object='libcommon_a-Kmer.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Kmer.o `test -f 'Kmer.cpp' || echo '$(srcdir)/'`Kmer.cpp
+
+libcommon_a-Kmer.obj: Kmer.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Kmer.obj -MD -MP -MF $(DEPDIR)/libcommon_a-Kmer.Tpo -c -o libcommon_a-Kmer.obj `if test -f 'Kmer.cpp'; then $(CYGPATH_W) 'Kmer.cpp'; else $(CYGPATH_W) '$(srcdir)/Kmer.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Kmer.Tpo $(DEPDIR)/libcommon_a-Kmer.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Kmer.cpp' object='libcommon_a-Kmer.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Kmer.obj `if test -f 'Kmer.cpp'; then $(CYGPATH_W) 'Kmer.cpp'; else $(CYGPATH_W) '$(srcdir)/Kmer.cpp'; fi`
+
+libcommon_a-Log.o: Log.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Log.o -MD -MP -MF $(DEPDIR)/libcommon_a-Log.Tpo -c -o libcommon_a-Log.o `test -f 'Log.cpp' || echo '$(srcdir)/'`Log.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Log.Tpo $(DEPDIR)/libcommon_a-Log.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Log.cpp' object='libcommon_a-Log.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Log.o `test -f 'Log.cpp' || echo '$(srcdir)/'`Log.cpp
+
+libcommon_a-Log.obj: Log.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Log.obj -MD -MP -MF $(DEPDIR)/libcommon_a-Log.Tpo -c -o libcommon_a-Log.obj `if test -f 'Log.cpp'; then $(CYGPATH_W) 'Log.cpp'; else $(CYGPATH_W) '$(srcdir)/Log.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Log.Tpo $(DEPDIR)/libcommon_a-Log.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Log.cpp' object='libcommon_a-Log.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Log.obj `if test -f 'Log.cpp'; then $(CYGPATH_W) 'Log.cpp'; else $(CYGPATH_W) '$(srcdir)/Log.cpp'; fi`
+
+libcommon_a-Options.o: Options.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Options.o -MD -MP -MF $(DEPDIR)/libcommon_a-Options.Tpo -c -o libcommon_a-Options.o `test -f 'Options.cpp' || echo '$(srcdir)/'`Options.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Options.Tpo $(DEPDIR)/libcommon_a-Options.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Options.cpp' object='libcommon_a-Options.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Options.o `test -f 'Options.cpp' || echo '$(srcdir)/'`Options.cpp
+
+libcommon_a-Options.obj: Options.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Options.obj -MD -MP -MF $(DEPDIR)/libcommon_a-Options.Tpo -c -o libcommon_a-Options.obj `if test -f 'Options.cpp'; then $(CYGPATH_W) 'Options.cpp'; else $(CYGPATH_W) '$(srcdir)/Options.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Options.Tpo $(DEPDIR)/libcommon_a-Options.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Options.cpp' object='libcommon_a-Options.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Options.obj `if test -f 'Options.cpp'; then $(CYGPATH_W) 'Options.cpp'; else $(CYGPATH_W) '$(srcdir)/Options.cpp'; fi`
+
+libcommon_a-SeqExt.o: SeqExt.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-SeqExt.o -MD -MP -MF $(DEPDIR)/libcommon_a-SeqExt.Tpo -c -o libcommon_a-SeqExt.o `test -f 'SeqExt.cpp' || echo '$(srcdir)/'`SeqExt.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-SeqExt.Tpo $(DEPDIR)/libcommon_a-SeqExt.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SeqExt.cpp' object='libcommon_a-SeqExt.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-SeqExt.o `test -f 'SeqExt.cpp' || echo '$(srcdir)/'`SeqExt.cpp
+
+libcommon_a-SeqExt.obj: SeqExt.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-SeqExt.obj -MD -MP -MF $(DEPDIR)/libcommon_a-SeqExt.Tpo -c -o libcommon_a-SeqExt.obj `if test -f 'SeqExt.cpp'; then $(CYGPATH_W) 'SeqExt.cpp'; else $(CYGPATH_W) '$(srcdir)/SeqExt.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-SeqExt.Tpo $(DEPDIR)/libcommon_a-SeqExt.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SeqExt.cpp' object='libcommon_a-SeqExt.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-SeqExt.obj `if test -f 'SeqExt.cpp'; then $(CYGPATH_W) 'SeqExt.cpp'; else $(CYGPATH_W) '$(srcdir)/SeqExt.cpp'; fi`
+
+libcommon_a-Sequence.o: Sequence.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Sequence.o -MD -MP -MF $(DEPDIR)/libcommon_a-Sequence.Tpo -c -o libcommon_a-Sequence.o `test -f 'Sequence.cpp' || echo '$(srcdir)/'`Sequence.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Sequence.Tpo $(DEPDIR)/libcommon_a-Sequence.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Sequence.cpp' object='libcommon_a-Sequence.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Sequence.o `test -f 'Sequence.cpp' || echo '$(srcdir)/'`Sequence.cpp
+
+libcommon_a-Sequence.obj: Sequence.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Sequence.obj -MD -MP -MF $(DEPDIR)/libcommon_a-Sequence.Tpo -c -o libcommon_a-Sequence.obj `if test -f 'Sequence.cpp'; then $(CYGPATH_W) 'Sequence.cpp'; else $(CYGPATH_W) '$(srcdir)/Sequence.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Sequence.Tpo $(DEPDIR)/libcommon_a-Sequence.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Sequence.cpp' object='libcommon_a-Sequence.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Sequence.obj `if test -f 'Sequence.cpp'; then $(CYGPATH_W) 'Sequence.cpp'; else $(CYGPATH_W) '$(srcdir)/Sequence.cpp'; fi`
+
+libcommon_a-SignalHandler.o: SignalHandler.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-SignalHandler.o -MD -MP -MF $(DEPDIR)/libcommon_a-SignalHandler.Tpo -c -o libcommon_a-SignalHandler.o `test -f 'SignalHandler.cpp' || echo '$(srcdir)/'`SignalHandler.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-SignalHandler.Tpo $(DEPDIR)/libcommon_a-SignalHandler.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SignalHandler.cpp' object='libcommon_a-SignalHandler.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-SignalHandler.o `test -f 'SignalHandler.cpp' || echo '$(srcdir)/'`SignalHandler.cpp
+
+libcommon_a-SignalHandler.obj: SignalHandler.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-SignalHandler.obj -MD -MP -MF $(DEPDIR)/libcommon_a-SignalHandler.Tpo -c -o libcommon_a-SignalHandler.obj `if test -f 'SignalHandler.cpp'; then $(CYGPATH_W) 'SignalHandler.cpp'; else $(CYGPATH_W) '$(srcdir)/SignalHandler.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-SignalHandler.Tpo $(DEPDIR)/libcommon_a-SignalHandler.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SignalHandler.cpp' object='libcommon_a-SignalHandler.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-SignalHandler.obj `if test -f 'SignalHandler.cpp'; then $(CYGPATH_W) 'SignalHandler.cpp'; else $(CYGPATH_W) '$(srcdir)/SignalHandler.cpp'; fi`
+
+libcommon_a-Timer.o: Timer.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Timer.o -MD -MP -MF $(DEPDIR)/libcommon_a-Timer.Tpo -c -o libcommon_a-Timer.o `test -f 'Timer.cpp' || echo '$(srcdir)/'`Timer.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Timer.Tpo $(DEPDIR)/libcommon_a-Timer.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Timer.cpp' object='libcommon_a-Timer.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Timer.o `test -f 'Timer.cpp' || echo '$(srcdir)/'`Timer.cpp
+
+libcommon_a-Timer.obj: Timer.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Timer.obj -MD -MP -MF $(DEPDIR)/libcommon_a-Timer.Tpo -c -o libcommon_a-Timer.obj `if test -f 'Timer.cpp'; then $(CYGPATH_W) 'Timer.cpp'; else $(CYGPATH_W) '$(srcdir)/Timer.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Timer.Tpo $(DEPDIR)/libcommon_a-Timer.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Timer.cpp' object='libcommon_a-Timer.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Timer.obj `if test -f 'Timer.cpp'; then $(CYGPATH_W) 'Timer.cpp'; else $(CYGPATH_W) '$(srcdir)/Timer.cpp'; fi`
+
+libcommon_a-Uncompress.o: Uncompress.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Uncompress.o -MD -MP -MF $(DEPDIR)/libcommon_a-Uncompress.Tpo -c -o libcommon_a-Uncompress.o `test -f 'Uncompress.cpp' || echo '$(srcdir)/'`Uncompress.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Uncompress.Tpo $(DEPDIR)/libcommon_a-Uncompress.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Uncompress.cpp' object='libcommon_a-Uncompress.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Uncompress.o `test -f 'Uncompress.cpp' || echo '$(srcdir)/'`Uncompress.cpp
+
+libcommon_a-Uncompress.obj: Uncompress.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-Uncompress.obj -MD -MP -MF $(DEPDIR)/libcommon_a-Uncompress.Tpo -c -o libcommon_a-Uncompress.obj `if test -f 'Uncompress.cpp'; then $(CYGPATH_W) 'Uncompress.cpp'; else $(CYGPATH_W) '$(srcdir)/Uncompress.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-Uncompress.Tpo $(DEPDIR)/libcommon_a-Uncompress.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Uncompress.cpp' object='libcommon_a-Uncompress.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-Uncompress.obj `if test -f 'Uncompress.cpp'; then $(CYGPATH_W) 'Uncompress.cpp'; else $(CYGPATH_W) '$(srcdir)/Uncompress.cpp'; fi`
+
+libcommon_a-city.o: city.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-city.o -MD -MP -MF $(DEPDIR)/libcommon_a-city.Tpo -c -o libcommon_a-city.o `test -f 'city.cc' || echo '$(srcdir)/'`city.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-city.Tpo $(DEPDIR)/libcommon_a-city.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='city.cc' object='libcommon_a-city.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-city.o `test -f 'city.cc' || echo '$(srcdir)/'`city.cc
+
+libcommon_a-city.obj: city.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libcommon_a-city.obj -MD -MP -MF $(DEPDIR)/libcommon_a-city.Tpo -c -o libcommon_a-city.obj `if test -f 'city.cc'; then $(CYGPATH_W) 'city.cc'; else $(CYGPATH_W) '$(srcdir)/city.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libcommon_a-city.Tpo $(DEPDIR)/libcommon_a-city.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='city.cc' object='libcommon_a-city.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libcommon_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libcommon_a-city.obj `if test -f 'city.cc'; then $(CYGPATH_W) 'city.cc'; else $(CYGPATH_W) '$(srcdir)/city.cc'; fi`
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES cscopelist ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Common/MemoryUtil.h b/Common/MemoryUtil.h
new file mode 100644
index 0000000..a2480f3
--- /dev/null
+++ b/Common/MemoryUtil.h
@@ -0,0 +1,38 @@
+#ifndef MEMORYUTIL_H
+#define MEMORYUTIL_H 1
+
+#include "config.h"
+#include <cassert>
+#include <fstream>
+#include <unistd.h> // for sbrk
+
+#if __MACH__
+# include <mach/mach.h> // for mach_task_self
+# include <mach/task.h> // for task_info
+#endif
+
+/** Return the number of bytes used by the data and stack segments.
+ * @return -1 on error
+ */
+static inline ssize_t getMemoryUsage()
+{
+#if __MACH__
+ struct task_basic_info t_info;
+ mach_msg_type_number_t t_info_count = TASK_BASIC_INFO_COUNT;
+ int status = task_info(mach_task_self(),
+ TASK_BASIC_INFO, (task_info_t)&t_info, &t_info_count);
+ assert(status == KERN_SUCCESS);
+ return status == KERN_SUCCESS ? (ssize_t)t_info.virtual_size : -1;
+#elif HAVE_GETPAGESIZE
+ std::ifstream in("/proc/self/statm");
+ size_t size, resident, share, text, lib, data;
+ return in >> size >> resident >> share >> text >> lib >> data
+ ? ssize_t(data * getpagesize()) : -1;
+#else
+ /** Start of the data segment. */
+ static intptr_t sbrk0 = reinterpret_cast<intptr_t>(sbrk(0));
+ return reinterpret_cast<intptr_t>(sbrk(0)) - sbrk0;
+#endif
+}
+
+#endif
diff --git a/Common/Options.cpp b/Common/Options.cpp
new file mode 100644
index 0000000..f0a2d2d
--- /dev/null
+++ b/Common/Options.cpp
@@ -0,0 +1,15 @@
+#include "Common/Options.h"
+
+namespace opt {
+ /** Colour space sequences */
+ bool colourSpace;
+
+ /** MPI rank */
+ int rank = -1;
+
+ /** Number of MPI processes */
+ int numProc = 1;
+
+ /** Verbose output */
+ int verbose;
+}
diff --git a/Common/Options.h b/Common/Options.h
new file mode 100644
index 0000000..ccca43e
--- /dev/null
+++ b/Common/Options.h
@@ -0,0 +1,15 @@
+#ifndef COMMON_OPTIONS_H
+#define COMMON_OPTIONS_H 1
+
+/**
+ * Global variables that are mostly constant for the duration of the
+ * execution of the program.
+ */
+namespace opt {
+ extern bool colourSpace;
+ extern int numProc;
+ extern int rank;
+ extern int verbose;
+}
+
+#endif
diff --git a/Common/PMF.h b/Common/PMF.h
new file mode 100644
index 0000000..b497af7
--- /dev/null
+++ b/Common/PMF.h
@@ -0,0 +1,69 @@
+#ifndef PMF_H
+#define PMF_H 1
+
+#include "Histogram.h"
+#include <cassert>
+#include <cmath>
+#include <vector>
+
+class Histogram;
+
+/** Probability mass function */
+class PMF
+{
+ public:
+ /** Construct a PMF from a histogram. */
+ PMF(const Histogram& h)
+ : m_dist(h.maximum() + 1), m_mean(h.mean()), m_stdDev(h.sd())
+ {
+ unsigned count = h.size();
+ m_minp = (double)1 / count;
+ for (size_t i = 0; i < m_dist.size(); i++) {
+ unsigned n = h.count(i);
+ m_dist[i] = n > 0 ? (double)n / count : m_minp;
+ }
+ }
+
+ /** Return the probability of x. */
+ double operator[](size_t x) const
+ {
+ return x < m_dist.size() ? m_dist[x] : m_minp;
+ }
+
+ /** Return the minimum probability. */
+ double minProbability() const { return m_minp; }
+
+ /** Return the minimum value. */
+ size_t minValue() const { return 0; }
+
+ /** Return the maximum value. */
+ size_t maxValue() const
+ {
+ assert(!m_dist.empty());
+ return m_dist.size() - 1;
+ }
+
+ /** Return the mean of this distribution. */
+ double mean() const { return m_mean; }
+
+ /** Return the standard deviation of the sampled mean
+ * of n observations.
+ */
+ double getSampleStdDev(unsigned n) const
+ {
+ return m_stdDev / sqrt(n);
+ }
+
+ private:
+ std::vector<double> m_dist;
+ double m_mean;
+ double m_stdDev;
+ double m_minp;
+};
+
+namespace std {
+ template<>
+ inline void swap(PMF&, PMF&) { assert(false); }
+}
+
+#endif
diff --git a/Common/SAM.h b/Common/SAM.h
new file mode 100644
index 0000000..f13d0e1
--- /dev/null
+++ b/Common/SAM.h
@@ -0,0 +1,347 @@
+#ifndef SAM_H
+#define SAM_H 1
+
+#include "config.h" // for SAM_SEQ_QUAL
+#include "Alignment.h"
+#include <algorithm> // for swap
+#include <cstdlib> // for exit
+#include <iostream>
+#include <limits> // for numeric_limits
+#include <sstream>
+#include <string>
+
+/** A SAM alignment of a single query. */
+struct SAMAlignment {
+ std::string rname;
+ int pos;
+ unsigned short flag;
+ unsigned short mapq;
+ std::string cigar;
+
+ /** Flag */
+ enum {
+ /** the read is paired in sequencing, no matter whether it is
+ * mapped in a pair */
+ FPAIRED = 1,
+ /** the read is mapped in a proper pair */
+ FPROPER_PAIR = 2,
+ /** the read itself is unmapped; conflictive with FPROPER_PAIR
+ */
+ FUNMAP = 4,
+ /** the mate is unmapped */
+ FMUNMAP = 8,
+ /** the read is mapped to the reverse strand */
+ FREVERSE = 16,
+ /** the mate is mapped to the reverse strand */
+ FMREVERSE = 32,
+ /** this is read1 */
+ FREAD1 = 64,
+ /** this is read2 */
+ FREAD2 = 128,
+ /** not primary alignment */
+ FSECONDARY = 256,
+ /** QC failure */
+ FQCFAIL = 512,
+ /** optical or PCR duplicate */
+ FDUP = 1024,
+ };
+
+ SAMAlignment() { }
+
+ /** Consturct a single-end alignment. */
+ SAMAlignment(const Alignment& a) :
+ rname(a.contig),
+ pos(a.contig_start_pos),
+ flag(a.isRC ? FREVERSE : 0),
+ mapq(255)
+ {
+ unsigned qend = a.read_start_pos + a.align_length;
+ int clip0 = a.read_start_pos;
+ int clip1 = a.read_length - qend;
+ assert(clip1 >= 0);
+ if (a.isRC)
+ std::swap(clip0, clip1);
+ std::ostringstream s;
+ if (clip0 > 0)
+ s << clip0 << 'S';
+ s << a.align_length << 'M';
+ if (clip1 > 0)
+ s << clip1 << 'S';
+ cigar = s.str();
+ }
+
+ bool isPaired() const { return flag & FPAIRED; }
+ bool isUnmapped() const { return flag & FUNMAP; }
+ bool isMateUnmapped() const { return flag & FMUNMAP; }
+ bool isReverse() const { return flag & FREVERSE; }
+ bool isMateReverse() const { return flag & FMREVERSE; }
+ bool isRead1() const { return flag & FREAD1; }
+ bool isRead2() const { return flag & FREAD2; }
+
+ /** The alignment coordinates of a gapped alignment. */
+ struct CigarCoord {
+ /** The length of the query sequence. */
+ unsigned qlen;
+ /** The start of the alignment on the query. */
+ unsigned qstart;
+ /** The length of the alignment on the query. */
+ unsigned qspan;
+ /** The length of the alignment on the target. */
+ unsigned tspan;
+
+ /** Parse the specified CIGAR string. */
+ CigarCoord(const std::string& cigar)
+ : qlen(0), qstart(0), qspan(0), tspan(0)
+ {
+ std::istringstream in(cigar);
+ bool first = true;
+ unsigned len;
+ char type;
+ while (in >> len >> type) {
+ switch (type) {
+ case 'H': case 'S':
+ if (first)
+ qstart = len;
+ qlen += len;
+ break;
+ case 'M': case 'X': case '=':
+ qlen += len;
+ qspan += len;
+ tspan += len;
+ break;
+ case 'I':
+ qlen += len;
+ qspan += len;
+ break;
+ case 'D': case 'N': case 'P':
+ tspan += len;
+ break;
+ default:
+ std::cerr << "error: invalid CIGAR: `"
+ << cigar << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ first = false;
+ }
+ assert(in.eof());
+ }
+ };
+
+ /**
+ * Return the position of the first base of the query on the
+ * target extrapolated from the start of the alignment.
+ */
+ int targetAtQueryStart() const
+ {
+ CigarCoord a(cigar);
+ assert(a.qstart + a.qspan <= a.qlen);
+ return isReverse()
+ ? pos + a.tspan + (a.qlen - a.qspan - a.qstart)
+ : pos - a.qstart;
+ }
+
+ /** Parse the specified CIGAR string.
+ * @return an alignment setting the fields read_start_pos,
+ * align_length, and read_length. The other fields will be
+ * uninitialized.
+ */
+ static Alignment parseCigar(const std::string& cigar, bool isRC) {
+ Alignment a;
+ std::istringstream in(cigar);
+ unsigned len;
+ char type;
+ in >> len >> type;
+ assert(in.good());
+ unsigned clip0 = 0;
+ switch (type) {
+ case 'H': case 'S':
+ clip0 = len;
+ in >> len >> type;
+ assert(in.good());
+ if (type != 'M') {
+ // Ignore a malformatted CIGAR string whose first
+ // non-clipping operation is not M.
+ std::cerr << "warning: malformatted CIGAR: "
+ << cigar << std::endl;
+ in >> len >> type;
+ assert(in.good());
+ }
+ assert(type == 'M');
+ a.align_length = len;
+ break;
+ case 'M':
+ a.align_length = len;
+ break;
+ default:
+ std::cerr << "error: invalid CIGAR: `"
+ << cigar << "'\n";
+ exit(EXIT_FAILURE);
+ }
+
+ unsigned qlen = clip0 + a.align_length;
+ unsigned clip1 = 0;
+ while (in >> len >> type) {
+ switch (type) {
+ case 'H': case 'S':
+ case 'I': case 'M': case 'X': case '=':
+ qlen += len;
+ clip1 += len;
+ break;
+ case 'D': case 'N': case 'P':
+ break;
+ default:
+ std::cerr << "error: invalid CIGAR: `"
+ << cigar << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+ a.read_start_pos = isRC ? clip1 : clip0;
+ a.read_length = qlen;
+ assert(in.eof());
+ return a;
+ }
+
+ operator Alignment() const {
+ assert(~flag & FUNMAP);
+ bool isRC = flag & FREVERSE; // strand of the query
+ Alignment a = parseCigar(cigar, isRC);
+ a.contig = rname;
+ a.contig_start_pos = pos;
+ a.isRC = isRC;
+ return a;
+ }
+};
+
+/** A SAM alignment of a query and its mate. */
+struct SAMRecord : SAMAlignment {
+ std::string qname;
+ std::string mrnm;
+ int mpos;
+ int isize;
+#if SAM_SEQ_QUAL
+ std::string seq;
+ std::string qual;
+#endif
+
+ SAMRecord() { }
+
+ /** Consturct a single-end alignment. */
+ explicit SAMRecord(const SAMAlignment& a,
+ const std::string& qname = "*",
+#if SAM_SEQ_QUAL
+ const std::string& seq = "*",
+ const std::string& qual = "*"
+#else
+ const std::string& /*seq*/ = "*",
+ const std::string& /*qual*/ = "*"
+#endif
+ ) :
+ SAMAlignment(a),
+ qname(qname),
+ mrnm("*"),
+ mpos(-1),
+ isize(0)
+#if SAM_SEQ_QUAL
+ ,
+ seq(seq),
+ qual(qual)
+#endif
+ {
+ }
+
+ /** Construct a paired-end alignment. */
+ SAMRecord(const Alignment& a0, const Alignment& a1)
+ {
+ *this = SAMRecord(a0);
+ flag |= FPAIRED;
+ if (a1.isRC)
+ flag |= FMREVERSE;
+ mrnm = a1.contig;
+ mpos = a1.contig_start_pos;
+ isize = a1.targetAtQueryStart() - a0.targetAtQueryStart();
+ }
+
+ /** Set the mate mapping fields. */
+ void fixMate(const SAMAlignment& o)
+ {
+ flag &= ~(FPROPER_PAIR | FMUNMAP | FMREVERSE);
+ flag |= FPAIRED;
+ if (o.isUnmapped())
+ flag |= FMUNMAP;
+ if (o.isReverse())
+ flag |= FMREVERSE;
+ mrnm = o.rname;
+ mpos = o.pos;
+ isize = isMateUnmapped() ? 0
+ : o.targetAtQueryStart() - targetAtQueryStart();
+ }
+
+ /**
+ * Return the position of the first base of the mate query on the
+ * target extrapolated from the start of the alignment.
+ */
+ int mateTargetAtQueryStart() const
+ {
+ return targetAtQueryStart() + isize;
+ }
+
+ friend std::ostream& operator <<(std::ostream& out,
+ const SAMRecord& o)
+ {
+ return out << o.qname
+ << '\t' << o.flag
+ << '\t' << o.rname
+ << '\t' << (1 + o.pos)
+ << '\t' << o.mapq
+ << '\t' << o.cigar
+ << '\t' << (o.mrnm == o.rname ? "=" : o.mrnm)
+ << '\t' << (1 + o.mpos)
+ << '\t' << o.isize
+#if SAM_SEQ_QUAL
+ << '\t' << o.seq
+ << '\t' << o.qual;
+#else
+ << "\t*\t*";
+#endif
+ }
+
+ friend std::istream& operator >>(std::istream& in, SAMRecord& o)
+ {
+ in >> o.qname
+ >> o.flag >> o.rname >> o.pos >> o.mapq
+ >> o.cigar >> o.mrnm >> o.mpos >> o.isize;
+#if SAM_SEQ_QUAL
+ in >> o.seq >> o.qual;
+#endif
+ in.ignore(std::numeric_limits<std::streamsize>::max(), '\n');
+ if (!in)
+ return in;
+ o.pos--;
+ o.mpos--;
+ if (o.mrnm == "=")
+ o.mrnm = o.rname;
+
+ // Set the paired flags if qname ends in /1 or /2.
+ unsigned l = o.qname.length();
+ if (l >= 2 && o.qname[l-2] == '/') {
+ switch (o.qname[l-1]) {
+ case '1': o.flag |= FPAIRED | FREAD1; break;
+ case '2':
+ case '3': o.flag |= FPAIRED | FREAD2; break;
+ default: return in;
+ }
+ o.qname.resize(l - 2);
+ assert(!o.qname.empty());
+ }
+ return in;
+ }
+};
+
+/** Set the mate mapping fields of a0 and a1. */
+static inline void fixMate(SAMRecord& a0, SAMRecord& a1)
+{
+ a0.fixMate(a1);
+ a1.fixMate(a0);
+}
+
+#endif
diff --git a/Common/Sense.h b/Common/Sense.h
new file mode 100644
index 0000000..d3b000c
--- /dev/null
+++ b/Common/Sense.h
@@ -0,0 +1,24 @@
+#ifndef SENSE_H
+#define SENSE_H 1
+
+#include <cassert>
+
+enum extDirection
+{
+ SENSE = 0,
+ ANTISENSE = 1,
+ NUM_DIRECTIONS
+};
+
+static inline extDirection operator !(extDirection dir)
+{
+ return dir == SENSE ? ANTISENSE : SENSE;
+}
+
+static inline extDirection& operator ++(extDirection& dir)
+{
+ assert(dir == SENSE || dir == ANTISENSE);
+ return dir = extDirection(dir + 1);
+}
+
+#endif
diff --git a/Common/SeqExt.cpp b/Common/SeqExt.cpp
new file mode 100644
index 0000000..6e92b80
--- /dev/null
+++ b/Common/SeqExt.cpp
@@ -0,0 +1,16 @@
+#include "SeqExt.h"
+#include "Common/Options.h"
+#include <cassert>
+
+/** Return the complementary adjacency.
+ * If the assembly is in colour space, this is a no-op.
+ */
+SeqExt SeqExt::complement() const
+{
+ static const uint8_t complements[16] = {
+ 0x0, 0x8, 0x4, 0xc, 0x2, 0xa, 0x6, 0xe,
+ 0x1, 0x9, 0x5, 0xd, 0x3, 0xb, 0x7, 0xf
+ };
+ assert(m_record < 1<<NUM_BASES);
+ return opt::colourSpace ? *this : mask(complements[m_record]);
+}
diff --git a/Common/SeqExt.h b/Common/SeqExt.h
new file mode 100644
index 0000000..5990496
--- /dev/null
+++ b/Common/SeqExt.h
@@ -0,0 +1,98 @@
+#ifndef SEQEXT_H
+#define SEQEXT_H 1
+
+#include <cassert>
+#include <ostream>
+#include <stdint.h>
+
+static const unsigned NUM_BASES = 4;
+
+/** The adjacent vertices of a Kmer. */
+class SeqExt
+{
+ public:
+ SeqExt() : m_record(0) { };
+ explicit SeqExt(uint8_t base) : m_record(1<<base) { };
+
+ /** Return a SeqExt with the specified bits set. */
+ static SeqExt mask(uint8_t bits)
+ {
+ SeqExt ext;
+ ext.m_record = bits;
+ return ext;
+ }
+
+ /** Return the out degree. */
+ unsigned outDegree()
+ {
+ assert(m_record < 16);
+ static const uint8_t popcount[16] = {
+ 0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4
+ };
+ return popcount[m_record];
+ }
+
+ /** Set the specified adjacency. */
+ void setBase(uint8_t base)
+ {
+ m_record |= 1 << base;
+ }
+
+ /** Clear the specified adjacency. */
+ void clearBase(uint8_t base)
+ {
+ m_record &= ~(1 << base);
+ }
+
+ /** Remove the specified edges. */
+ void clear(SeqExt ext)
+ {
+ m_record &= ~ext.m_record;
+ }
+
+ /** Return wheter the specified base is adjacent. */
+ bool checkBase(uint8_t base) const
+ {
+ return m_record & (1 << base);
+ }
+
+ /** Clear all adjacency. */
+ void clear()
+ {
+ m_record = 0;
+ }
+
+ /** Return whether this kmer has any adjacent kmer. */
+ bool hasExtension() const
+ {
+ return m_record > 0;
+ }
+
+ /** Return whether this kmer has more than one adjacent kmer.
+ */
+ bool isAmbiguous() const
+ {
+ bool powerOfTwo = (m_record & (m_record - 1)) > 0;
+ return m_record > 0 && powerOfTwo;
+ }
+
+ /** Return the complementary adjacency. */
+ SeqExt complement() const;
+ SeqExt operator ~() const { return complement(); }
+
+ friend std::ostream& operator <<(std::ostream& out,
+ const SeqExt& o)
+ {
+ assert(o.m_record < 1<<NUM_BASES);
+ return out
+ << (o.checkBase(0) ? 'A' : '-')
+ << (o.checkBase(1) ? 'C' : '-')
+ << (o.checkBase(2) ? 'G' : '-')
+ << (o.checkBase(3) ? 'T' : '-');
+ }
+
+ private:
+ uint8_t m_record;
+};
+
+#endif
diff --git a/Common/Sequence.cpp b/Common/Sequence.cpp
new file mode 100644
index 0000000..6b19824
--- /dev/null
+++ b/Common/Sequence.cpp
@@ -0,0 +1,171 @@
+#include "Sequence.h"
+#include "Common/Options.h"
+#include <algorithm>
+#include <cassert>
+#include <cctype>
+#include <cstdlib> // for abort
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+enum { A, C, G, T };
+static const int cstont[4][4] = {
+ { A, C, G, T },
+ { C, A, T, G },
+ { G, T, A, C },
+ { T, G, C, A }
+};
+
+/** Return the complement of the specified nucleotide. */
+char complementBaseChar(char c)
+{
+ char rc;
+ switch (toupper(c)) {
+ case 'A': rc = 'T'; break;
+ case 'C': rc = 'G'; break;
+ case 'G': rc = 'C'; break;
+ case 'T': rc = 'A'; break;
+ case 'N': rc = 'N'; break;
+ case '.': rc = '.'; break;
+ case 'M': rc = 'K'; break; // A or C
+ case 'R': rc = 'Y'; break; // A or G
+ case 'W': rc = 'W'; break; // A or T
+ case 'S': rc = 'S'; break; // C or G
+ case 'Y': rc = 'R'; break; // C or T
+ case 'K': rc = 'M'; break; // G or T
+ case 'V': rc = 'B'; break; // A or C or G
+ case 'H': rc = 'D'; break; // A or C or T
+ case 'D': rc = 'H'; break; // A or G or T
+ case 'B': rc = 'V'; break; // C or G or T
+ default:
+ cerr << "error: unexpected character: `" << c << "'\n";
+ assert(false);
+ abort();
+ }
+ return islower(c) ? tolower(rc) : rc;
+}
+
+/** Return the reverse complement of the specified sequence. */
+Sequence reverseComplement(const Sequence& s)
+{
+ Sequence rc(s);
+ reverse(rc.begin(), rc.end());
+ if (!opt::colourSpace)
+ transform(rc.begin(), rc.end(), rc.begin(),
+ complementBaseChar);
+ return rc;
+}
+
+/** Return the base enumeration for the specified character. */
+uint8_t baseToCode(char base)
+{
+ switch (base) {
+ case 'A': case '0': return 0;
+ case 'C': case '1': return 1;
+ case 'G': case '2': return 2;
+ case 'T': case '3': return 3;
+ }
+ cerr << "error: unexpected character: `" << base << "'\n";
+ assert(false);
+ abort();
+}
+
+char codeToBase(uint8_t code)
+{
+ assert(code < 4);
+ return (opt::colourSpace ? "0123" : "ACGT")[code];
+}
+
+char colourToNucleotideSpace(char anchor, char cs)
+{
+ return cs == '.' ? 'N'
+ : "ACGT"[cstont[baseToCode(anchor)][baseToCode(cs)]];
+}
+
+Sequence colourToNucleotideSpace(char anchor, const Sequence& seq)
+{
+ int seed = baseToCode(anchor);
+
+ ostringstream s;
+ s << anchor;
+ for (string::const_iterator it = seq.begin();
+ it != seq.end(); ++it) {
+ seed = cstont[seed][baseToCode(*it)];
+ s << codeToBase(seed);
+ }
+ return s.str();
+}
+
+char nucleotideToColourSpace(char a, char b)
+{
+ if (toupper(a) == 'N' || toupper(b) == 'N')
+ return islower(a) || islower(b) ? 'n' : 'N';
+ return "0123"[cstont[baseToCode(a)][baseToCode(b)]];
+}
+
+/** Convert the specified ambiguity code to a bitmask. */
+unsigned ambiguityToBitmask(char c)
+{
+ if (isdigit(c)) // colour space
+ return 1 << baseToCode(c);
+
+ static const unsigned ambiguityToBitmaskTable[26] = {
+ 0x1, // 'A' ---A
+ 0xe, // 'B' TGC-
+ 0x2, // 'C' --C-
+ 0xd, // 'D' TG-A
+ 0x0, // 'E'
+ 0x0, // 'F'
+ 0x4, // 'G' -G--
+ 0xb, // 'H' T-CA
+ 0x0, // 'I'
+ 0x0, // 'J'
+ 0xc, // 'K' TG--
+ 0x0, // 'L'
+ 0x3, // 'M' --CA
+ 0xf, // 'N' ACGT
+ 0x0, // 'O'
+ 0x0, // 'P'
+ 0x0, // 'Q'
+ 0x5, // 'R' -G-A
+ 0x6, // 'S' -GC-
+ 0x8, // 'T' T---
+ 0x0, // 'U'
+ 0x7, // 'V' -GCA
+ 0x9, // 'W' T--A
+ 0x0, // 'X'
+ 0xa, // 'Y' T-C-
+ 0x0, // 'Z'
+ };
+ unsigned i = toupper(c) - 'A';
+ assert(i < 26);
+ unsigned x = ambiguityToBitmaskTable[i];
+ assert(x > 0);
+ return x;
+}
+
+/** Convert the specified bitmask to an ambiguity code. */
+unsigned bitmaskToAmbiguity(unsigned x)
+{
+ static const char bitmaskToAmbiguityTable[16] = {
+ 'N', //----
+ 'A', //---A
+ 'C', //--C-
+ 'M', //--CA
+ 'G', //-G--
+ 'R', //-G-A
+ 'S', //-GC-
+ 'V', //-GCA
+ 'T', //T---
+ 'W', //T--A
+ 'Y', //T-C-
+ 'H', //T-CA
+ 'K', //TG--
+ 'D', //TG-A
+ 'B', //TGC-
+ 'N', //TGCA
+ };
+ assert(x < 16);
+ return bitmaskToAmbiguityTable[x];
+}
diff --git a/Common/Sequence.h b/Common/Sequence.h
new file mode 100644
index 0000000..c104695
--- /dev/null
+++ b/Common/Sequence.h
@@ -0,0 +1,51 @@
+#ifndef SEQUENCE_H
+#define SEQUENCE_H 1
+
+#include <stdint.h>
+#include <string>
+
+typedef std::string Sequence;
+
+Sequence reverseComplement(const Sequence& s);
+Sequence colourToNucleotideSpace(char anchor, const Sequence& seq);
+char colourToNucleotideSpace(char anchor, char cs);
+char nucleotideToColourSpace(char a, char b);
+
+uint8_t baseToCode(char base);
+char codeToBase(uint8_t code);
+
+/** Return true if c is one of [ACGTacgt]. */
+static inline bool isACGT(char c)
+{
+ return c == 'A' || c == 'C' || c == 'G' || c == 'T'
+ || c == 'a' || c == 'c' || c == 'g' || c == 't';
+}
+
+unsigned ambiguityToBitmask(char c);
+unsigned bitmaskToAmbiguity(unsigned x);
+
+/** Return the bitwise-and of the specified ambiguity codes. */
+static inline char ambiguityAnd(char ca, char cb)
+{
+ char c = bitmaskToAmbiguity(
+ ambiguityToBitmask(ca) & ambiguityToBitmask(cb));
+ return islower(ca) && islower(cb) ? tolower(c) : c;
+}
+
+/** Return the bitwise-or of the specified ambiguity codes. */
+static inline char ambiguityOr(char ca, char cb)
+{
+ char c = bitmaskToAmbiguity(
+ ambiguityToBitmask(ca) | ambiguityToBitmask(cb));
+ return islower(ca) || islower(cb) ? tolower(c) : c;
+}
+
+/** Return whether one ambiguity code is a subset of the other.
+ */
+static inline bool ambiguityIsSubset(char a, char b)
+{
+ char intersection = ambiguityAnd(a, b);
+ return intersection == a || intersection == b;
+}
+
+#endif
diff --git a/Common/SignalHandler.cpp b/Common/SignalHandler.cpp
new file mode 100644
index 0000000..b804600
--- /dev/null
+++ b/Common/SignalHandler.cpp
@@ -0,0 +1,62 @@
+/**
+ * Signal handling code, particularly SIGCHLD.
+ */
+
+#include "SignalHandler.h"
+#include <cassert>
+#include <cerrno>
+#include <cstdio> // for perror
+#include <cstdlib>
+#include <iostream>
+#include <signal.h>
+#include <sys/wait.h>
+
+using namespace std;
+
+/** Print the specified exit status. */
+static void printStatus(pid_t pid, int status)
+{
+ if (WIFEXITED(status))
+ cerr << "PID " << pid << " exited with status "
+ << WEXITSTATUS(status) << endl;
+ else if (WIFSIGNALED(status))
+ cerr << "PID " << pid << " killed by signal "
+ << WTERMSIG(status) << endl;
+ else
+ cerr << "PID " << pid << " exited with code "
+ << status << endl;
+}
+
+/** SIGCHLD handler. Reap child processes and report an error if any
+ * fail. */
+static void sigchldHandler(int sig)
+{
+ assert(sig == SIGCHLD);
+ (void)sig;
+
+ pid_t pid;
+ int status;
+ while ((pid = waitpid(-1, &status, WNOHANG)) > 0) {
+ // Writing to cerr in a signal handler is not allowed, but
+ // we're about to exit and an error message would be really
+ // helpful.
+ if (status != 0) {
+ printStatus(pid, status);
+ exit(EXIT_FAILURE);
+ }
+ }
+ if (pid == -1 && errno != ECHILD) {
+ perror("waitpid");
+ exit(EXIT_FAILURE);
+ }
+}
+
+/** Install a handler for SIGCHLD. */
+void signalInit()
+{
+ struct sigaction action;
+ action.sa_handler = sigchldHandler;
+ sigemptyset(&action.sa_mask);
+ action.sa_flags = SA_RESTART;
+ sigaction(SIGCHLD, &action, NULL);
+}
diff --git a/Common/SignalHandler.h b/Common/SignalHandler.h
new file mode 100644
index 0000000..970d524
--- /dev/null
+++ b/Common/SignalHandler.h
@@ -0,0 +1,6 @@
+#ifndef SIGNALHANDLER_H
+#define SIGNALHANDLER_H 1
+
+void signalInit();
+
+#endif
diff --git a/Common/StringUtil.h b/Common/StringUtil.h
new file mode 100644
index 0000000..1e4d78b
--- /dev/null
+++ b/Common/StringUtil.h
@@ -0,0 +1,90 @@
+#ifndef STRINGUTIL_H
+#define STRINGUTIL_H 1
+
+#include <cassert>
+#include <iomanip>
+#include <sstream>
+#include <string>
+
+/** Return the last character of s and remove it. */
+static inline char chop(std::string& s)
+{
+ assert(s.length() > 1);
+ unsigned back = s.length() - 1;
+ char c = s[back];
+ s.erase(back);
+ return c;
+}
+
+/** If the last character of s is c, remove it and return true. */
+static inline bool chomp(std::string& s, char c = '\n')
+{
+ unsigned back = s.length() - 1;
+ if (!s.empty() && s[back] == c) {
+ s.erase(back);
+ return true;
+ } else
+ return false;
+}
+
+/** Return the SI representation of n. */
+static inline std::string toSI(double n)
+{
+ std::ostringstream s;
+ s << std::setprecision(3);
+ if (n < 1e3)
+ s << n << ' ';
+ else if (n < 1e6)
+ s << n/1e3 << " k";
+ else if (n < 1e9)
+ s << n/1e6 << " M";
+ else if (n < 1e12)
+ s << n/1e9 << " G";
+ else
+ s << n/1e12 << " T";
+ return s.str();
+}
+
+/** Return the engineering string representation of n. */
+template <typename T>
+static inline std::string toEng(T n)
+{
+ std::ostringstream s;
+ s << std::setprecision(4);
+ if (n < 10000000)
+ s << n;
+ else if (n < 1e9)
+ s << n/1e6 << "e6";
+ else if (n < 1e12)
+ s << n/1e9 << "e9";
+ else
+ s << n/1e12 << "e12";
+ return s.str();
+}
+
+/** Return true if the second string is a prefix of the string s. */
+template <size_t N>
+bool startsWith(const std::string& s, const char (&prefix)[N])
+{
+ size_t n = N - 1;
+ return s.size() > n && equal(s.begin(), s.begin() + n, prefix);
+}
+
+/** Return true if the second string is a suffix of the string s. */
+template <size_t N>
+bool endsWith(const std::string& s, const char (&suffix)[N])
+{
+ size_t n = N - 1;
+ return s.size() > n && equal(s.end() - n, s.end(), suffix);
+}
+
+/** Return true if the second string is a suffix of the string s. */
+static inline
+bool endsWith(const std::string& s, const std::string& suffix)
+{
+ size_t n = suffix.size();
+ return s.size() > n && equal(s.end() - n, s.end(),
+ suffix.begin());
+}
+
+#endif
diff --git a/Common/SuffixArray.h b/Common/SuffixArray.h
new file mode 100644
index 0000000..3fd37c8
--- /dev/null
+++ b/Common/SuffixArray.h
@@ -0,0 +1,85 @@
+#ifndef SUFFIXARRAY_H
+#define SUFFIXARRAY_H 1
+
+#include "ConstString.h"
+#include "ContigNode.h"
+#include <algorithm>
+#include <cassert>
+#include <utility>
+#include <vector>
+
+/** A suffix array augmented with a mapped value type. */
+class SuffixArray {
+ public:
+ typedef cstring key_type;
+ typedef ContigNode mapped_type;
+ typedef std::pair<key_type, mapped_type> value_type;
+ typedef std::vector<value_type>::const_iterator const_iterator;
+
+ /** Construct an empty suffix array. */
+ SuffixArray(unsigned minOverlap)
+ : m_minOverlap(minOverlap), m_dirty(false) { }
+
+ /** Insert the specified sequence into this suffix array. */
+ template <typename T>
+ void insert(const T& seq, const mapped_type& data)
+ {
+ m_dirty = true;
+ typedef typename T::const_pointer It;
+ It last = &seq[seq.size() - m_minOverlap + 1];
+ for (It it = &seq[1]; it < last; ++it)
+ m_data.push_back(value_type(it, data));
+ }
+
+ /** Insert the specified sequence into this suffix array. */
+ template <typename T>
+ void insert(const std::pair<T, mapped_type>& x)
+ {
+ insert(x.first, x.second);
+ }
+
+ /** Construct the suffix array. */
+ void construct()
+ {
+ if (m_dirty)
+ sort(m_data.begin(), m_data.end());
+ m_dirty = false;
+ }
+
+ /** Find all the elements whose suffix matches the prefix of the
+ * specified query sequence.
+ * @return the range of matches as a pair of iterators
+ */
+ template <typename T>
+ std::pair<const_iterator, const_iterator> equal_range(
+ const T& seq) const
+ {
+ assert(!m_dirty);
+ return std::equal_range(m_data.begin(), m_data.end(),
+ key_type(&seq[0]), Compare());
+ }
+
+ size_t size() const { return m_data.size(); }
+ const_iterator begin() const { return m_data.begin(); }
+ const_iterator end() const { return m_data.end(); }
+
+ private:
+ /** Comparison functor. */
+ struct Compare {
+ bool operator()(const value_type& a, const key_type& b) const
+ {
+ return a.first < b;
+ }
+
+ bool operator()(const key_type& a, const value_type& b) const
+ {
+ return a < b.first;
+ }
+ };
+
+ unsigned m_minOverlap;
+ bool m_dirty;
+ std::vector<value_type> m_data;
+};
+
+#endif
diff --git a/Common/Timer.cpp b/Common/Timer.cpp
new file mode 100644
index 0000000..a3f3f8d
--- /dev/null
+++ b/Common/Timer.cpp
@@ -0,0 +1,18 @@
+#include "Timer.h"
+#include "Log.h"
+#include <iomanip>
+
+using namespace std;
+
+// Constructor starts the timer
+Timer::Timer(string funcString)
+ : m_funcStr(funcString), m_start(clock())
+{
+}
+
+// Destructor stops it and prints
+Timer::~Timer()
+{
+ logger(2) << m_funcStr << ": " << setprecision(3)
+ << (double)(clock() - m_start) / CLOCKS_PER_SEC << " s\n";
+}
diff --git a/Common/Timer.h b/Common/Timer.h
new file mode 100644
index 0000000..2e3b459
--- /dev/null
+++ b/Common/Timer.h
@@ -0,0 +1,20 @@
+#ifndef TIMER_H
+#define TIMER_H 1
+
+#include <string>
+
+/**
+ * Time the duration between the construction and destruction of this
+ * timer object and log that duration.
+ */
+class Timer
+{
+ public:
+ Timer(std::string funcString);
+ ~Timer();
+ private:
+ std::string m_funcStr;
+ clock_t m_start;
+};
+
+#endif
diff --git a/Common/Uncompress.cpp b/Common/Uncompress.cpp
new file mode 100644
index 0000000..fcbc4ed
--- /dev/null
+++ b/Common/Uncompress.cpp
@@ -0,0 +1,179 @@
+/** Uncompress input files using pipes.
+ * Hook the standard file opening functions, open, fopen and fopen64.
+ * If the extension of the file being opened indicates the file is
+ * compressed (.gz, .bz2, .xz), open a pipe to a program that
+ * decompresses that file (gunzip, bunzip2 or xzdec) and return a
+ * handle to the open pipe.
+ * @author Shaun Jackman <sjackman at bcgsc.ca>
+ */
+
+#include "config.h"
+#if HAVE_LIBDL
+
+#include "Fcontrol.h"
+#include "SignalHandler.h"
+#include "StringUtil.h"
+#include <cassert>
+#include <cstdio> // for perror
+#include <cstdlib>
+#include <dlfcn.h>
+#include <string>
+#include <unistd.h>
+
+using namespace std;
+
+static const char* zcatExec(const string& path)
+{
+ return
+ startsWith(path, "http://") ? "wget -O-" :
+ startsWith(path, "https://") ? "wget -O-" :
+ startsWith(path, "ftp://") ? "wget -O-" :
+ endsWith(path, ".ar") ? "ar -p" :
+ endsWith(path, ".tar") ? "tar -xOf" :
+ endsWith(path, ".tar.Z") ? "tar -zxOf" :
+ endsWith(path, ".tar.gz") ? "tar -zxOf" :
+ endsWith(path, ".tar.bz2") ? "tar -jxOf" :
+ endsWith(path, ".tar.xz") ?
+ "tar --use-compress-program=xzdec -xOf" :
+ endsWith(path, ".Z") ? "gunzip -c" :
+ endsWith(path, ".gz") ? "gunzip -c" :
+ endsWith(path, ".bz2") ? "bunzip2 -c" :
+ endsWith(path, ".xz") ? "xzdec -c" :
+ endsWith(path, ".zip") ? "unzip -p" :
+ endsWith(path, ".bam") ? "samtools view -h" :
+ endsWith(path, ".jf") ? "jellyfish dump" :
+ endsWith(path, ".jfq") ? "jellyfish qdump" :
+ endsWith(path, ".sra") ? "fastq-dump -Z --split-spot" :
+ endsWith(path, ".url") ? "wget -O- -i" :
+ NULL;
+}
+
+extern "C" {
+
+/** Open a pipe to uncompress the specified file.
+ * Not thread safe.
+ * @return a file descriptor
+ */
+static int uncompress(const char *path)
+{
+ const char *zcat = zcatExec(path);
+ assert(zcat != NULL);
+
+ int fd[2];
+ if (pipe(fd) == -1)
+ return -1;
+ int err = setCloexec(fd[0]);
+ assert(err == 0);
+ (void)err;
+
+ char arg0[16], arg1[16], arg2[16];
+ int n = sscanf(zcat, "%s %s %s", arg0, arg1, arg2);
+ assert(n == 2 || n == 3);
+
+ /* It would be more portable to use fork than vfork, but fork can
+ * fail with ENOMEM when the process calling fork is using a lot
+ * of memory. A workaround for this problem is to set
+ * sysctl vm.overcommit_memory=1
+ */
+#if HAVE_WORKING_VFORK
+ pid_t pid = vfork();
+#else
+ pid_t pid = fork();
+#endif
+ if (pid == -1)
+ return -1;
+
+ if (pid == 0) {
+ dup2(fd[1], STDOUT_FILENO);
+ close(fd[1]);
+ if (n == 2)
+ execlp(arg0, arg0, arg1, path, NULL);
+ else
+ execlp(arg0, arg0, arg1, arg2, path, NULL);
+ // Calling perror after vfork is not allowed, but we're about
+ // to exit and an error message would be really helpful.
+ perror(arg0);
+ _exit(EXIT_FAILURE);
+ } else {
+ close(fd[1]);
+ return fd[0];
+ }
+}
+
+/** Open a pipe to uncompress the specified file.
+ * @return a FILE pointer
+ */
+static FILE* funcompress(const char* path)
+{
+ int fd = uncompress(path);
+ if (fd == -1) {
+ perror(path);
+ exit(EXIT_FAILURE);
+ }
+ return fdopen(fd, "r");
+}
+
+typedef FILE* (*fopen_t)(const char *path, const char *mode);
+
+/** If the specified file is compressed, return a pipe that
+ * uncompresses it.
+ */
+FILE *fopen(const char *path, const char *mode)
+{
+ static fopen_t real_fopen;
+ if (real_fopen == NULL)
+ real_fopen = (fopen_t)dlsym(RTLD_NEXT, "fopen");
+ if (real_fopen == NULL) {
+ fprintf(stderr, "error: dlsym fopen: %s\n", dlerror());
+ exit(EXIT_FAILURE);
+ }
+ return zcatExec(path) == NULL ? real_fopen(path, mode)
+ : funcompress(path);
+}
+
+/** If the specified file is compressed, return a pipe that
+ * uncompresses it.
+ */
+FILE *fopen64(const char *path, const char *mode)
+{
+ static fopen_t real_fopen64;
+ if (real_fopen64 == NULL)
+ real_fopen64 = (fopen_t)dlsym(RTLD_NEXT, "fopen64");
+ if (real_fopen64 == NULL) {
+ fprintf(stderr, "error: dlsym fopen64: %s\n", dlerror());
+ exit(EXIT_FAILURE);
+ }
+ return zcatExec(path) == NULL ? real_fopen64(path, mode)
+ : funcompress(path);
+}
+
+typedef int (*open_t)(const char *path, int flags, mode_t mode);
+
+/** If the specified file is compressed, return a pipe that
+ * uncompresses it.
+ */
+int open(const char *path, int flags, mode_t mode)
+{
+ static open_t real_open;
+ if (real_open == NULL)
+ real_open = (open_t)dlsym(RTLD_NEXT, "open");
+ if (real_open == NULL) {
+ fprintf(stderr, "error: dlsym open: %s\n", dlerror());
+ exit(EXIT_FAILURE);
+ }
+ return zcatExec(path) == NULL ? real_open(path, flags, mode)
+ : uncompress(path);
+}
+
+} // extern "C"
+
+#endif // HAVE_LIBDL
+
+/** Initialize the uncompress module. */
+bool uncompress_init()
+{
+#if HAVE_LIBDL
+ signalInit();
+#endif
+ return HAVE_LIBDL;
+}
diff --git a/Common/Uncompress.h b/Common/Uncompress.h
new file mode 100644
index 0000000..3080b7a
--- /dev/null
+++ b/Common/Uncompress.h
@@ -0,0 +1,12 @@
+#ifndef UNCOMPRESS_H
+#define UNCOMPRESS_H 1
+
+bool uncompress_init();
+
+namespace {
+const bool uncompressInitialized = uncompress_init();
+bool getUncompressInitialized() __attribute__((unused));
+bool getUncompressInitialized() { return uncompressInitialized; }
+}
+
+#endif
diff --git a/Common/UnorderedMap.h b/Common/UnorderedMap.h
new file mode 100644
index 0000000..22bb58c
--- /dev/null
+++ b/Common/UnorderedMap.h
@@ -0,0 +1,20 @@
+#ifndef UNORDEREDMAP_H
+#define UNORDEREDMAP_H 1
+
+#include "config.h"
+
+#if HAVE_UNORDERED_MAP
+# include <unordered_map>
+using std::unordered_map;
+using std::unordered_multimap;
+#elif HAVE_TR1_UNORDERED_MAP
+# include <tr1/unordered_map>
+using std::tr1::unordered_map;
+using std::tr1::unordered_multimap;
+#else
+# include <boost/unordered_map.hpp>
+using boost::unordered_map;
+using boost::unordered_multimap;
+#endif
+
+#endif
diff --git a/Common/cholesky.hpp b/Common/cholesky.hpp
new file mode 100644
index 0000000..c7c0c6d
--- /dev/null
+++ b/Common/cholesky.hpp
@@ -0,0 +1,230 @@
+/** -*- c++ -*- \file cholesky.hpp \brief cholesky decomposition */
+/*
+ - begin : 2005-08-24
+ - copyright : (C) 2005 by Gunter Winkler, Konstantin Kutzkow
+ - email : guwi17 at gmx.de
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+*/
+
+#ifndef _H_CHOLESKY_HPP_
+#define _H_CHOLESKY_HPP_
+
+
+#include <cassert>
+
+#include <boost/numeric/ublas/vector.hpp>
+#include <boost/numeric/ublas/vector_proxy.hpp>
+
+#include <boost/numeric/ublas/matrix.hpp>
+#include <boost/numeric/ublas/matrix_proxy.hpp>
+
+#include <boost/numeric/ublas/vector_expression.hpp>
+#include <boost/numeric/ublas/matrix_expression.hpp>
+
+#include <boost/numeric/ublas/triangular.hpp>
+
+namespace ublas = boost::numeric::ublas;
+
+
+/** \brief decompose the symmetric positive definit matrix A into product L L^T.
+ *
+ * \param MATRIX type of input matrix
+ * \param TRIA type of lower triangular output matrix
+ * \param A square symmetric positive definite input matrix (only the lower triangle is accessed)
+ * \param L lower triangular output matrix
+ * \return nonzero if decompositon fails (the value ist 1 + the numer of the failing row)
+ */
+template < class MATRIX, class TRIA >
+size_t cholesky_decompose(const MATRIX& A, TRIA& L)
+{
+ using namespace ublas;
+
+ typedef typename MATRIX::value_type T;
+
+ assert( A.size1() == A.size2() );
+ assert( A.size1() == L.size1() );
+ assert( A.size2() == L.size2() );
+
+ const size_t n = A.size1();
+
+ for (size_t k=0 ; k < n; k++) {
+
+ double qL_kk = A(k,k) - inner_prod( project( row(L, k), range(0, k) ),
+ project( row(L, k), range(0, k) ) );
+
+ if (qL_kk <= 0) {
+ return 1 + k;
+ } else {
+ double L_kk = sqrt( qL_kk );
+ L(k,k) = L_kk;
+
+ matrix_column<TRIA> cLk(L, k);
+ project( cLk, range(k+1, n) )
+ = ( project( column(A, k), range(k+1, n) )
+ - prod( project(L, range(k+1, n), range(0, k)),
+ project(row(L, k), range(0, k) ) ) ) / L_kk;
+ }
+ }
+ return 0;
+}
+
+
+/** \brief decompose the symmetric positive definit matrix A into product L L^T.
+ *
+ * \param MATRIX type of matrix A
+ * \param A input: square symmetric positive definite matrix (only the lower triangle is accessed)
+ * \param A output: the lower triangle of A is replaced by the cholesky factor
+ * \return nonzero if decompositon fails (the value ist 1 + the numer of the failing row)
+ */
+template < class MATRIX >
+size_t cholesky_decompose(MATRIX& A)
+{
+ using namespace ublas;
+
+ typedef typename MATRIX::value_type T;
+
+ const MATRIX& A_c(A);
+
+ const size_t n = A.size1();
+
+ for (size_t k=0 ; k < n; k++) {
+
+ double qL_kk = A_c(k,k) - inner_prod( project( row(A_c, k), range(0, k) ),
+ project( row(A_c, k), range(0, k) ) );
+
+ if (qL_kk <= 0) {
+ return 1 + k;
+ } else {
+ double L_kk = sqrt( qL_kk );
+
+ matrix_column<MATRIX> cLk(A, k);
+ project( cLk, range(k+1, n) )
+ = ( project( column(A_c, k), range(k+1, n) )
+ - prod( project(A_c, range(k+1, n), range(0, k)),
+ project(row(A_c, k), range(0, k) ) ) ) / L_kk;
+ A(k,k) = L_kk;
+ }
+ }
+ return 0;
+}
+
+#if 0
+ using namespace ublas;
+
+ // Operations:
+ // n * (n - 1) / 2 + n = n * (n + 1) / 2 multiplications,
+ // n * (n - 1) / 2 additions
+
+ // Dense (proxy) case
+ template<class E1, class E2>
+ void inplace_solve (const matrix_expression<E1> &e1, vector_expression<E2> &e2,
+ lower_tag, column_major_tag) {
+ std::cout << " is_lc ";
+ typedef typename E2::size_type size_type;
+ typedef typename E2::difference_type difference_type;
+ typedef typename E2::value_type value_type;
+
+ BOOST_UBLAS_CHECK (e1 ().size1 () == e1 ().size2 (), bad_size ());
+ BOOST_UBLAS_CHECK (e1 ().size2 () == e2 ().size (), bad_size ());
+ size_type size = e2 ().size ();
+ for (size_type n = 0; n < size; ++ n) {
+#ifndef BOOST_UBLAS_SINGULAR_CHECK
+ BOOST_UBLAS_CHECK (e1 () (n, n) != value_type/*zero*/(), singular ());
+#else
+ if (e1 () (n, n) == value_type/*zero*/())
+ singular ().raise ();
+#endif
+ value_type t = e2 () (n) / e1 () (n, n);
+ e2 () (n) = t;
+ if (t != value_type/*zero*/()) {
+ project( e2 (), range(n+1, size) )
+ .minus_assign( t * project( column( e1 (), n), range(n+1, size) ) );
+ }
+ }
+ }
+#endif
+
+
+
+
+
+/** \brief decompose the symmetric positive definit matrix A into product L L^T.
+ *
+ * \param MATRIX type of matrix A
+ * \param A input: square symmetric positive definite matrix (only the lower triangle is accessed)
+ * \param A output: the lower triangle of A is replaced by the cholesky factor
+ * \return nonzero if decompositon fails (the value ist 1 + the numer of the failing row)
+ */
+template < class MATRIX >
+size_t incomplete_cholesky_decompose(MATRIX& A)
+{
+ using namespace ublas;
+
+ typedef typename MATRIX::value_type T;
+
+ // read access to a const matrix is faster
+ const MATRIX& A_c(A);
+
+ const size_t n = A.size1();
+
+ for (size_t k=0 ; k < n; k++) {
+
+ double qL_kk = A_c(k,k) - inner_prod( project( row( A_c, k ), range(0, k) ),
+ project( row( A_c, k ), range(0, k) ) );
+
+ if (qL_kk <= 0) {
+ return 1 + k;
+ } else {
+ double L_kk = sqrt( qL_kk );
+
+ // aktualisieren
+ for (size_t i = k+1; i < A.size1(); ++i) {
+ T* Aik = A.find_element(i, k);
+
+ if (Aik != 0) {
+ *Aik = ( *Aik - inner_prod( project( row( A_c, k ), range(0, k) ),
+ project( row( A_c, i ), range(0, k) ) ) ) / L_kk;
+ }
+ }
+
+ A(k,k) = L_kk;
+ }
+ }
+
+ return 0;
+}
+
+
+
+
+/** \brief solve system L L^T x = b inplace
+ *
+ * \param L a triangular matrix
+ * \param x input: right hand side b; output: solution x
+ */
+template < class TRIA, class VEC >
+void
+cholesky_solve(const TRIA& L, VEC& x, ublas::lower)
+{
+ using namespace ublas;
+// ::inplace_solve(L, x, lower_tag(), typename TRIA::orientation_category () );
+ inplace_solve(L, x, lower_tag() );
+ inplace_solve(trans(L), x, upper_tag());
+}
+
+
+#endif
diff --git a/Common/city.cc b/Common/city.cc
new file mode 100644
index 0000000..b5fd2d2
--- /dev/null
+++ b/Common/city.cc
@@ -0,0 +1,467 @@
+// Copyright (c) 2011 Google, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+// CityHash, by Geoff Pike and Jyrki Alakuijala
+//
+// This file provides CityHash64() and related functions.
+//
+// It's probably possible to create even faster hash functions by
+// writing a program that systematically explores some of the space of
+// possible hash functions, by using SIMD instructions, or by
+// compromising on hash quality.
+
+#include "config.h"
+#include <city.h>
+
+#include <algorithm>
+#include <string.h> // for memcpy and memset
+
+using namespace std;
+
+static uint64 UNALIGNED_LOAD64(const char *p) {
+ uint64 result;
+ memcpy(&result, p, sizeof(result));
+ return result;
+}
+
+static uint32 UNALIGNED_LOAD32(const char *p) {
+ uint32 result;
+ memcpy(&result, p, sizeof(result));
+ return result;
+}
+
+#if !defined(WORDS_BIGENDIAN)
+
+#define uint32_in_expected_order(x) (x)
+#define uint64_in_expected_order(x) (x)
+
+#else
+
+#ifdef _MSC_VER
+#include <stdlib.h>
+#define bswap_32(x) _byteswap_ulong(x)
+#define bswap_64(x) _byteswap_uint64(x)
+
+#elif defined(__APPLE__)
+// Mac OS X / Darwin features
+#include <libkern/OSByteOrder.h>
+#define bswap_32(x) OSSwapInt32(x)
+#define bswap_64(x) OSSwapInt64(x)
+
+#else
+#include <byteswap.h>
+#endif
+
+#define uint32_in_expected_order(x) (bswap_32(x))
+#define uint64_in_expected_order(x) (bswap_64(x))
+
+#endif // WORDS_BIGENDIAN
+
+#if !defined(LIKELY)
+#if HAVE_BUILTIN_EXPECT
+#define LIKELY(x) (__builtin_expect(!!(x), 1))
+#else
+#define LIKELY(x) (x)
+#endif
+#endif
+
+static uint64 Fetch64(const char *p) {
+ return uint64_in_expected_order(UNALIGNED_LOAD64(p));
+}
+
+static uint32 Fetch32(const char *p) {
+ return uint32_in_expected_order(UNALIGNED_LOAD32(p));
+}
+
+// Some primes between 2^63 and 2^64 for various uses.
+static const uint64 k0 = 0xc3a5c85c97cb3127ULL;
+static const uint64 k1 = 0xb492b66fbe98f273ULL;
+static const uint64 k2 = 0x9ae16a3b2f90404fULL;
+static const uint64 k3 = 0xc949d7c7509e6557ULL;
+
+// Bitwise right rotate. Normally this will compile to a single
+// instruction, especially if the shift is a manifest constant.
+static uint64 Rotate(uint64 val, int shift) {
+ // Avoid shifting by 64: doing so yields an undefined result.
+ return shift == 0 ? val : ((val >> shift) | (val << (64 - shift)));
+}
+
+// Equivalent to Rotate(), but requires the second arg to be non-zero.
+// On x86-64, and probably others, it's possible for this to compile
+// to a single instruction if both args are already in registers.
+static uint64 RotateByAtLeast1(uint64 val, int shift) {
+ return (val >> shift) | (val << (64 - shift));
+}
+
+static uint64 ShiftMix(uint64 val) {
+ return val ^ (val >> 47);
+}
+
+static uint64 HashLen16(uint64 u, uint64 v) {
+ return Hash128to64(uint128(u, v));
+}
+
+static uint64 HashLen0to16(const char *s, size_t len) {
+ if (len > 8) {
+ uint64 a = Fetch64(s);
+ uint64 b = Fetch64(s + len - 8);
+ return HashLen16(a, RotateByAtLeast1(b + len, len)) ^ b;
+ }
+ if (len >= 4) {
+ uint64 a = Fetch32(s);
+ return HashLen16(len + (a << 3), Fetch32(s + len - 4));
+ }
+ if (len > 0) {
+ uint8 a = s[0];
+ uint8 b = s[len >> 1];
+ uint8 c = s[len - 1];
+ uint32 y = static_cast<uint32>(a) + (static_cast<uint32>(b) << 8);
+ uint32 z = len + (static_cast<uint32>(c) << 2);
+ return ShiftMix(y * k2 ^ z * k3) * k2;
+ }
+ return k2;
+}
+
+// This probably works well for 16-byte strings as well, but it may be overkill
+// in that case.
+static uint64 HashLen17to32(const char *s, size_t len) {
+ uint64 a = Fetch64(s) * k1;
+ uint64 b = Fetch64(s + 8);
+ uint64 c = Fetch64(s + len - 8) * k2;
+ uint64 d = Fetch64(s + len - 16) * k0;
+ return HashLen16(Rotate(a - b, 43) + Rotate(c, 30) + d,
+ a + Rotate(b ^ k3, 20) - c + len);
+}
+
+// Return a 16-byte hash for 48 bytes. Quick and dirty.
+// Callers do best to use "random-looking" values for a and b.
+static pair<uint64, uint64> WeakHashLen32WithSeeds(
+ uint64 w, uint64 x, uint64 y, uint64 z, uint64 a, uint64 b) {
+ a += w;
+ b = Rotate(b + a + z, 21);
+ uint64 c = a;
+ a += x;
+ a += y;
+ b += Rotate(a, 44);
+ return make_pair(a + z, b + c);
+}
+
+// Return a 16-byte hash for s[0] ... s[31], a, and b. Quick and dirty.
+static pair<uint64, uint64> WeakHashLen32WithSeeds(
+ const char* s, uint64 a, uint64 b) {
+ return WeakHashLen32WithSeeds(Fetch64(s),
+ Fetch64(s + 8),
+ Fetch64(s + 16),
+ Fetch64(s + 24),
+ a,
+ b);
+}
+
+// Return an 8-byte hash for 33 to 64 bytes.
+static uint64 HashLen33to64(const char *s, size_t len) {
+ uint64 z = Fetch64(s + 24);
+ uint64 a = Fetch64(s) + (len + Fetch64(s + len - 16)) * k0;
+ uint64 b = Rotate(a + z, 52);
+ uint64 c = Rotate(a, 37);
+ a += Fetch64(s + 8);
+ c += Rotate(a, 7);
+ a += Fetch64(s + 16);
+ uint64 vf = a + z;
+ uint64 vs = b + Rotate(a, 31) + c;
+ a = Fetch64(s + 16) + Fetch64(s + len - 32);
+ z = Fetch64(s + len - 8);
+ b = Rotate(a + z, 52);
+ c = Rotate(a, 37);
+ a += Fetch64(s + len - 24);
+ c += Rotate(a, 7);
+ a += Fetch64(s + len - 16);
+ uint64 wf = a + z;
+ uint64 ws = b + Rotate(a, 31) + c;
+ uint64 r = ShiftMix((vf + ws) * k2 + (wf + vs) * k0);
+ return ShiftMix(r * k0 + vs) * k2;
+}
+
+uint64 CityHash64(const char *s, size_t len) {
+ if (len <= 32) {
+ if (len <= 16) {
+ return HashLen0to16(s, len);
+ } else {
+ return HashLen17to32(s, len);
+ }
+ } else if (len <= 64) {
+ return HashLen33to64(s, len);
+ }
+
+ // For strings over 64 bytes we hash the end first, and then as we
+ // loop we keep 56 bytes of state: v, w, x, y, and z.
+ uint64 x = Fetch64(s + len - 40);
+ uint64 y = Fetch64(s + len - 16) + Fetch64(s + len - 56);
+ uint64 z = HashLen16(Fetch64(s + len - 48) + len, Fetch64(s + len - 24));
+ pair<uint64, uint64> v = WeakHashLen32WithSeeds(s + len - 64, len, z);
+ pair<uint64, uint64> w = WeakHashLen32WithSeeds(s + len - 32, y + k1, x);
+ x = x * k1 + Fetch64(s);
+
+ // Decrease len to the nearest multiple of 64, and operate on 64-byte chunks.
+ len = (len - 1) & ~static_cast<size_t>(63);
+ do {
+ x = Rotate(x + y + v.first + Fetch64(s + 8), 37) * k1;
+ y = Rotate(y + v.second + Fetch64(s + 48), 42) * k1;
+ x ^= w.second;
+ y += v.first + Fetch64(s + 40);
+ z = Rotate(z + w.first, 33) * k1;
+ v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first);
+ w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch64(s + 16));
+ std::swap(z, x);
+ s += 64;
+ len -= 64;
+ } while (len != 0);
+ return HashLen16(HashLen16(v.first, w.first) + ShiftMix(y) * k1 + z,
+ HashLen16(v.second, w.second) + x);
+}
+
+uint64 CityHash64WithSeed(const char *s, size_t len, uint64 seed) {
+ return CityHash64WithSeeds(s, len, k2, seed);
+}
+
+uint64 CityHash64WithSeeds(const char *s, size_t len,
+ uint64 seed0, uint64 seed1) {
+ return HashLen16(CityHash64(s, len) - seed0, seed1);
+}
+
+// A subroutine for CityHash128(). Returns a decent 128-bit hash for strings
+// of any length representable in signed long. Based on City and Murmur.
+static uint128 CityMurmur(const char *s, size_t len, uint128 seed) {
+ uint64 a = Uint128Low64(seed);
+ uint64 b = Uint128High64(seed);
+ uint64 c = 0;
+ uint64 d = 0;
+ signed long l = len - 16;
+ if (l <= 0) { // len <= 16
+ a = ShiftMix(a * k1) * k1;
+ c = b * k1 + HashLen0to16(s, len);
+ d = ShiftMix(a + (len >= 8 ? Fetch64(s) : c));
+ } else { // len > 16
+ c = HashLen16(Fetch64(s + len - 8) + k1, a);
+ d = HashLen16(b + len, c + Fetch64(s + len - 16));
+ a += d;
+ do {
+ a ^= ShiftMix(Fetch64(s) * k1) * k1;
+ a *= k1;
+ b ^= a;
+ c ^= ShiftMix(Fetch64(s + 8) * k1) * k1;
+ c *= k1;
+ d ^= c;
+ s += 16;
+ l -= 16;
+ } while (l > 0);
+ }
+ a = HashLen16(a, c);
+ b = HashLen16(d, b);
+ return uint128(a ^ b, HashLen16(b, a));
+}
+
+uint128 CityHash128WithSeed(const char *s, size_t len, uint128 seed) {
+ if (len < 128) {
+ return CityMurmur(s, len, seed);
+ }
+
+ // We expect len >= 128 to be the common case. Keep 56 bytes of state:
+ // v, w, x, y, and z.
+ pair<uint64, uint64> v, w;
+ uint64 x = Uint128Low64(seed);
+ uint64 y = Uint128High64(seed);
+ uint64 z = len * k1;
+ v.first = Rotate(y ^ k1, 49) * k1 + Fetch64(s);
+ v.second = Rotate(v.first, 42) * k1 + Fetch64(s + 8);
+ w.first = Rotate(y + z, 35) * k1 + x;
+ w.second = Rotate(x + Fetch64(s + 88), 53) * k1;
+
+ // This is the same inner loop as CityHash64(), manually unrolled.
+ do {
+ x = Rotate(x + y + v.first + Fetch64(s + 8), 37) * k1;
+ y = Rotate(y + v.second + Fetch64(s + 48), 42) * k1;
+ x ^= w.second;
+ y += v.first + Fetch64(s + 40);
+ z = Rotate(z + w.first, 33) * k1;
+ v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first);
+ w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch64(s + 16));
+ std::swap(z, x);
+ s += 64;
+ x = Rotate(x + y + v.first + Fetch64(s + 8), 37) * k1;
+ y = Rotate(y + v.second + Fetch64(s + 48), 42) * k1;
+ x ^= w.second;
+ y += v.first + Fetch64(s + 40);
+ z = Rotate(z + w.first, 33) * k1;
+ v = WeakHashLen32WithSeeds(s, v.second * k1, x + w.first);
+ w = WeakHashLen32WithSeeds(s + 32, z + w.second, y + Fetch64(s + 16));
+ std::swap(z, x);
+ s += 64;
+ len -= 128;
+ } while (LIKELY(len >= 128));
+ x += Rotate(v.first + z, 49) * k0;
+ z += Rotate(w.first, 37) * k0;
+ // If 0 < len < 128, hash up to 4 chunks of 32 bytes each from the end of s.
+ for (size_t tail_done = 0; tail_done < len; ) {
+ tail_done += 32;
+ y = Rotate(x + y, 42) * k0 + v.second;
+ w.first += Fetch64(s + len - tail_done + 16);
+ x = x * k0 + w.first;
+ z += w.second + Fetch64(s + len - tail_done);
+ w.second += v.first;
+ v = WeakHashLen32WithSeeds(s + len - tail_done, v.first + z, v.second);
+ }
+ // At this point our 56 bytes of state should contain more than
+ // enough information for a strong 128-bit hash. We use two
+ // different 56-byte-to-8-byte hashes to get a 16-byte final result.
+ x = HashLen16(x, v.first);
+ y = HashLen16(y + z, w.first);
+ return uint128(HashLen16(x + v.second, w.second) + y,
+ HashLen16(x + w.second, y + v.second));
+}
+
+uint128 CityHash128(const char *s, size_t len) {
+ if (len >= 16) {
+ return CityHash128WithSeed(s + 16,
+ len - 16,
+ uint128(Fetch64(s) ^ k3,
+ Fetch64(s + 8)));
+ } else if (len >= 8) {
+ return CityHash128WithSeed(NULL,
+ 0,
+ uint128(Fetch64(s) ^ (len * k0),
+ Fetch64(s + len - 8) ^ k1));
+ } else {
+ return CityHash128WithSeed(s, len, uint128(k0, k1));
+ }
+}
+
+#if 0 // #ifdef __SSE4_2__
+#include <citycrc.h>
+#include <nmmintrin.h>
+
+// Requires len >= 240.
+static void CityHashCrc256Long(const char *s, size_t len,
+ uint32 seed, uint64 *result) {
+ uint64 a = Fetch64(s + 56) + k0;
+ uint64 b = Fetch64(s + 96) + k0;
+ uint64 c = result[0] = HashLen16(b, len);
+ uint64 d = result[1] = Fetch64(s + 120) * k0 + len;
+ uint64 e = Fetch64(s + 184) + seed;
+ uint64 f = seed;
+ uint64 g = 0;
+ uint64 h = 0;
+ uint64 i = 0;
+ uint64 j = 0;
+ uint64 t = c + d;
+
+ // 240 bytes of input per iter.
+ size_t iters = len / 240;
+ len -= iters * 240;
+ do {
+#define CHUNK(multiplier, z) \
+ { \
+ uint64 old_a = a; \
+ a = Rotate(b, 41 ^ z) * multiplier + Fetch64(s); \
+ b = Rotate(c, 27 ^ z) * multiplier + Fetch64(s + 8); \
+ c = Rotate(d, 41 ^ z) * multiplier + Fetch64(s + 16); \
+ d = Rotate(e, 33 ^ z) * multiplier + Fetch64(s + 24); \
+ e = Rotate(t, 25 ^ z) * multiplier + Fetch64(s + 32); \
+ t = old_a; \
+ } \
+ f = _mm_crc32_u64(f, a); \
+ g = _mm_crc32_u64(g, b); \
+ h = _mm_crc32_u64(h, c); \
+ i = _mm_crc32_u64(i, d); \
+ j = _mm_crc32_u64(j, e); \
+ s += 40
+
+ CHUNK(1, 1); CHUNK(k0, 0);
+ CHUNK(1, 1); CHUNK(k0, 0);
+ CHUNK(1, 1); CHUNK(k0, 0);
+ } while (--iters > 0);
+
+ while (len >= 40) {
+ CHUNK(k0, 0);
+ len -= 40;
+ }
+ if (len > 0) {
+ s = s + len - 40;
+ CHUNK(k0, 0);
+ }
+ j += i << 32;
+ a = HashLen16(a, j);
+ h += g << 32;
+ b += h;
+ c = HashLen16(c, f) + i;
+ d = HashLen16(d, e + result[0]);
+ j += e;
+ i += HashLen16(h, t);
+ e = HashLen16(a, d) + j;
+ f = HashLen16(b, c) + a;
+ g = HashLen16(j, i) + c;
+ result[0] = e + f + g + h;
+ a = ShiftMix((a + g) * k0) * k0 + b;
+ result[1] += a + result[0];
+ a = ShiftMix(a * k0) * k0 + c;
+ result[2] = a + result[1];
+ a = ShiftMix((a + e) * k0) * k0;
+ result[3] = a + result[2];
+}
+
+// Requires len < 240.
+static void CityHashCrc256Short(const char *s, size_t len, uint64 *result) {
+ char buf[240];
+ memcpy(buf, s, len);
+ memset(buf + len, 0, 240 - len);
+ CityHashCrc256Long(buf, 240, ~static_cast<uint32>(len), result);
+}
+
+void CityHashCrc256(const char *s, size_t len, uint64 *result) {
+ if (LIKELY(len >= 240)) {
+ CityHashCrc256Long(s, len, 0, result);
+ } else {
+ CityHashCrc256Short(s, len, result);
+ }
+}
+
+uint128 CityHashCrc128WithSeed(const char *s, size_t len, uint128 seed) {
+ if (len <= 900) {
+ return CityHash128WithSeed(s, len, seed);
+ } else {
+ uint64 result[4];
+ CityHashCrc256(s, len, result);
+ uint64 u = Uint128High64(seed) + result[0];
+ uint64 v = Uint128Low64(seed) + result[1];
+ return uint128(HashLen16(u, v + result[2]),
+ HashLen16(Rotate(v, 32), u * k0 + result[3]));
+ }
+}
+
+uint128 CityHashCrc128(const char *s, size_t len) {
+ if (len <= 900) {
+ return CityHash128(s, len);
+ } else {
+ uint64 result[4];
+ CityHashCrc256(s, len, result);
+ return uint128(result[2], result[3]);
+ }
+}
+
+#endif
diff --git a/Common/city.h b/Common/city.h
new file mode 100644
index 0000000..c2ab352
--- /dev/null
+++ b/Common/city.h
@@ -0,0 +1,90 @@
+// Copyright (c) 2011 Google, Inc.
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+// CityHash, by Geoff Pike and Jyrki Alakuijala
+//
+// This file provides a few functions for hashing strings. On x86-64
+// hardware in 2011, CityHash64() is faster than other high-quality
+// hash functions, such as Murmur. This is largely due to higher
+// instruction-level parallelism. CityHash64() and CityHash128() also perform
+// well on hash-quality tests.
+//
+// CityHash128() is optimized for relatively long strings and returns
+// a 128-bit hash. For strings more than about 2000 bytes it can be
+// faster than CityHash64().
+//
+// Functions in the CityHash family are not suitable for cryptography.
+//
+// WARNING: This code has not been tested on big-endian platforms!
+// It is known to work well on little-endian platforms that have a small penalty
+// for unaligned reads, such as current Intel and AMD moderate-to-high-end CPUs.
+//
+// By the way, for some hash functions, given strings a and b, the hash
+// of a+b is easily derived from the hashes of a and b. This property
+// doesn't hold for any hash functions in this file.
+
+#ifndef CITY_HASH_H_
+#define CITY_HASH_H_
+
+#include <stdlib.h> // for size_t.
+#include <stdint.h>
+#include <utility>
+
+typedef uint8_t uint8;
+typedef uint32_t uint32;
+typedef uint64_t uint64;
+typedef std::pair<uint64, uint64> uint128;
+
+inline uint64 Uint128Low64(const uint128& x) { return x.first; }
+inline uint64 Uint128High64(const uint128& x) { return x.second; }
+
+// Hash function for a byte array.
+uint64 CityHash64(const char *buf, size_t len);
+
+// Hash function for a byte array. For convenience, a 64-bit seed is also
+// hashed into the result.
+uint64 CityHash64WithSeed(const char *buf, size_t len, uint64 seed);
+
+// Hash function for a byte array. For convenience, two seeds are also
+// hashed into the result.
+uint64 CityHash64WithSeeds(const char *buf, size_t len,
+ uint64 seed0, uint64 seed1);
+
+// Hash function for a byte array.
+uint128 CityHash128(const char *s, size_t len);
+
+// Hash function for a byte array. For convenience, a 128-bit seed is also
+// hashed into the result.
+uint128 CityHash128WithSeed(const char *s, size_t len, uint128 seed);
+
+// Hash 128 input bits down to 64 bits of output.
+// This is intended to be a reasonably good hash function.
+inline uint64 Hash128to64(const uint128& x) {
+ // Murmur-inspired hashing.
+ const uint64 kMul = 0x9ddfea08eb382d69ULL;
+ uint64 a = (Uint128Low64(x) ^ Uint128High64(x)) * kMul;
+ a ^= (a >> 47);
+ uint64 b = (Uint128High64(x) ^ a) * kMul;
+ b ^= (b >> 47);
+ b *= kMul;
+ return b;
+}
+
+#endif // CITY_HASH_H_
diff --git a/Consensus/Consensus.cpp b/Consensus/Consensus.cpp
new file mode 100644
index 0000000..a714528
--- /dev/null
+++ b/Consensus/Consensus.cpp
@@ -0,0 +1,503 @@
+#include "Alignment.h"
+#include "Common/Options.h"
+#include "ContigID.h"
+#include "FastaReader.h"
+#include "IOUtil.h"
+#include "Uncompress.h"
+#include "UnorderedMap.h"
+#include <cctype>
+#include <cmath>
+#include <cstdlib>
+#include <getopt.h>
+#include <iostream>
+#include <numeric>
+#include <sstream>
+#include <string>
+
+using namespace std;
+
+#define PROGRAM "Consensus"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Tony Raymond and Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... CONTIG\n"
+"\n"
+"Read alignments from KAligner from standard input.\n"
+"Ensure that the --seq option was used when running KAligner.\n"
+"Call a consensus at each position of each contig and write the\n"
+"consensus in FASTA format to OUTPUT.\n"
+" CONTIG contigs in FASTA format\n"
+"\n"
+" -o, --out=OUTPUT write the output FASTA file to OUTPUT\n"
+" -p, --pileup=PILEUP write the pileup to PILEUP\n"
+" --nt output nucleotide contigs [default]\n"
+" --cs output colour-space contigs\n"
+" -V, --variants print only variants in the pileup\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ static string outPath;
+ static string pileupPath;
+ static bool csToNt;
+ static int outputCS;
+ static int onlyVariants;
+}
+
+static const char shortopts[] = "o:p:vV";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "verbose", no_argument, NULL, 'v' },
+ { "out", required_argument, NULL, 'o' },
+ { "pileup", required_argument, NULL, 'p' },
+ { "variants", no_argument, &opt::onlyVariants, 1 },
+ { "nt", no_argument, &opt::outputCS, 0 },
+ { "cs", no_argument, &opt::outputCS, 1 },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+struct BaseCount {
+ unsigned count[4];
+ BaseCount() { fill(count, count + 4, 0); }
+
+ /** Return the number of reads at this position. */
+ unsigned sum() const { return accumulate(count, count+4, 0); }
+
+ friend ostream& operator <<(ostream& out, const BaseCount& base)
+ {
+ out << base.count[0];
+ for (int x = 1; x < 4; x++)
+ out << '\t' << base.count[x];
+ return out;
+ }
+};
+
+typedef vector<BaseCount> BaseCounts;
+
+struct ContigCount {
+ Sequence seq;
+ unsigned coverage;
+ string comment;
+ BaseCounts counts;
+};
+
+/** A map of contigs. The alignments reference the contig by name. */
+typedef unordered_map<string, ContigCount> ContigMap;
+static ContigMap g_contigs;
+
+/** Read all contigs in and store the contigs in g_contigs and make a
+ * g_baseCounts, to store pile-up for each base. */
+static void readContigs(const string& contigsPath)
+{
+ FastaReader contigsFile(contigsPath.c_str(),
+ FastaReader::NO_FOLD_CASE);
+ int count = 0;
+ for (FastaRecord rec; contigsFile >> rec;) {
+ const Sequence& seq = rec.seq;
+ ContigCount& contig = g_contigs[rec.id];
+ contig.seq = seq;
+
+ istringstream ss(rec.comment);
+ unsigned length;
+ contig.coverage = 0;
+ ss >> length >> contig.coverage >> ws;
+ getline(ss, contig.comment);
+
+ if (count == 0) {
+ // Detect colour-space contigs.
+ opt::colourSpace = isdigit(seq[0]);
+ if (!opt::outputCS)
+ opt::csToNt = opt::colourSpace;
+ else if (!opt::colourSpace) {
+ cerr << "error: Cannot convert nucleotide data to "
+ "colour space.\n";
+ exit(EXIT_FAILURE);
+ }
+ } else {
+ if (opt::colourSpace)
+ assert(isdigit(seq[0]));
+ else
+ assert(isalpha(seq[0]));
+ }
+
+ contig.counts = BaseCounts(contig.seq.length()
+ + (opt::csToNt ? 1 : 0));
+
+ count++;
+ }
+ cerr << "Read " << count << " contigs\n";
+ assert(contigsFile.eof());
+ assert(count > 0);
+}
+
+typedef vector<Alignment> AlignmentVector;
+
+static void readAlignment(string& line, string& readID,
+ Sequence& seq, AlignmentVector& alignments)
+{
+ char anchor;
+ istringstream s(line);
+
+ if (opt::colourSpace || opt::csToNt)
+ s >> readID >> anchor >> seq;
+ else
+ s >> readID >> seq;
+
+ Alignment alignment;
+ while (s >> alignment)
+ alignments.push_back(alignment);
+
+ if (!alignments.empty() && opt::csToNt
+ && seq.find_first_not_of("0123") == string::npos)
+ seq = colourToNucleotideSpace(anchor, seq);
+}
+
+/** Builds the pile up of all reads based on the alignments and
+ * read sequence */
+static void buildBaseQuality()
+{
+ if (opt::csToNt)
+ opt::colourSpace = false;
+
+ // for each read and/or set of alignments.
+ for (string line; getline(cin, line);) {
+ string readID;
+ Sequence seq;
+ AlignmentVector alignments;
+
+ readAlignment(line, readID, seq, alignments);
+
+ // If converting to NT space, check that at least one of the
+ // alignments starts at read location 0. Otherwise, it is
+ // likely to introduce a frameshift or erroneous sequence in
+ // the final consensus.
+ if (opt::csToNt) {
+ bool good = false;
+ for (AlignmentVector::const_iterator
+ alignIter = alignments.begin();
+ alignIter != alignments.end(); ++alignIter) {
+ if (alignIter->read_start_pos == 0) {
+ good = true;
+ break;
+ }
+ }
+ if (!good)
+ continue;
+ }
+
+ // For each alignment for the read.
+ for (AlignmentVector::const_iterator
+ alignIter = alignments.begin();
+ alignIter != alignments.end(); ++alignIter) {
+ string seqrc;
+ Alignment a;
+ if (alignIter->isRC) {
+ seqrc = reverseComplement(seq);
+ a = alignIter->flipQuery();
+ } else {
+ seqrc = seq;
+ a = *alignIter;
+ }
+ const char* s = seqrc.c_str();
+
+ ContigMap::iterator contigIt = g_contigs.find(a.contig);
+ if (contigIt == g_contigs.end()) {
+ cerr << "error: unexpected contig ID: `" << a.contig
+ << "'\n";
+ exit(EXIT_FAILURE);
+ }
+
+ BaseCounts& countsVec = contigIt->second.counts;
+
+ int read_min;
+ int read_max;
+ if (!opt::csToNt) {
+ read_min = a.read_start_pos - a.contig_start_pos;
+ read_min = read_min > 0 ? read_min : 0;
+
+ read_max = a.read_start_pos + countsVec.size() -
+ a.contig_start_pos;
+ read_max = read_max < a.read_length
+ ? read_max : a.read_length;
+ } else {
+ read_min = a.read_start_pos;
+ read_max = read_min + a.align_length + 1;
+ }
+
+ if ((int)countsVec.size() < a.contig_start_pos
+ - a.read_start_pos + read_max - 1)
+ cerr << countsVec.size() << '\n';
+
+ // Assertions to make sure alignment math was done right.
+ assert((int)countsVec.size() >= a.contig_start_pos
+ - a.read_start_pos + read_max - 1);
+ assert(read_max <= (int)seq.length());
+ assert(read_min >= 0);
+
+ // Pile-up every base in the read to the contig.
+ for (int x = read_min; x < read_max; x++) {
+ char c = toupper(s[x]);
+ switch (c) {
+ case 'A': case 'C': case 'G': case 'T':
+ case '0': case '1': case '2': case '3':
+ unsigned pos
+ = a.contig_start_pos - a.read_start_pos + x;
+ assert(pos < countsVec.size());
+ countsVec[pos].count[baseToCode(c)]++;
+ }
+ }
+ }
+ }
+}
+
+/** Returns the most likely base found by the pile up count. */
+static char selectBase(const BaseCount& count, unsigned& sumBest,
+ unsigned& sumSecond)
+{
+ int bestBase = -1;
+ unsigned bestCount = 0;
+ unsigned secondCount = 0;
+ for (int x = 0; x < 4; x++) {
+ if (count.count[x] > bestCount) {
+ bestBase = x;
+ secondCount = bestCount;
+ bestCount = count.count[x];
+ }
+ }
+
+ sumBest += bestCount;
+ sumSecond += secondCount;
+
+ if (bestBase == -1)
+ return 'N';
+ return codeToBase(bestBase);
+}
+
+/** Convert all 'N' bases to nt's based on local information. */
+static void fixUnknown(Sequence& ntSeq, const Sequence& csSeq )
+{
+ size_t index = ntSeq.find_first_of('N');
+ size_t rindex = ntSeq.find_last_of('N');
+ char base;
+#if 0
+ if (index == 0) {
+#if 0
+ for (index = ntSeq.find_first_of("ACGT"); index > 0; index--)
+#endif
+ index = ntSeq.find_first_of("ACGT");
+ while (index != 0) {
+ base = colourToNucleotideSpace(ntSeq.at(index),
+ csSeq.at(index - 1));
+ ntSeq.replace(index - 1, 1, 1, base);
+ //ntSeq[index-1] = base;
+ index = ntSeq.find_first_of("ACGT");
+ }
+ index = ntSeq.find_first_of('N');
+ }
+#endif
+
+ if (index == 0 || rindex == ntSeq.length() - 1) {
+ ntSeq = ntSeq.substr(ntSeq.find_first_of("ACGT"),
+ ntSeq.find_last_of("ACGT") -
+ ntSeq.find_first_of("ACGT") + 1);
+ index = ntSeq.find_first_of('N');
+ }
+
+ while (index != string::npos) {
+ // If the base isn't the first or last base in the seq...
+ base = colourToNucleotideSpace(ntSeq.at(index - 1),
+ csSeq.at(index - 1));
+ ntSeq.replace(index, 1, 1, base);
+ index = ntSeq.find_first_of('N');
+ }
+}
+
+static void writePileup(ostream& out,
+ const string &id, unsigned pos,
+ char refc, char genotype,
+ const BaseCount& counts)
+{
+ char foldrefc = toupper(refc);
+ if (opt::onlyVariants && foldrefc == genotype)
+ return;
+ out << id << '\t' // reference sequence name
+ << 1 + pos << '\t' // reference coordinate
+ << refc << '\t' // reference base
+ << genotype << '\t' // genotype
+ << "25\t" // P(genotype is wrong)
+ << "25\t" // P(genotype is the same as the reference)
+ << "25\t" // RMS mapping quality
+ << counts.sum() << '\t'; // number of reads
+ switch (foldrefc) {
+ case 'A': case 'C': case 'G': case 'T':
+ case '0': case '1': case '2': case '3': {
+ uint8_t ref = baseToCode(foldrefc);
+ for (int i = 0; i < 4; i++)
+ if (i != ref)
+ out << string(counts.count[i], codeToBase(i));
+ out << string(counts.count[ref], '.');
+ break;
+ }
+ default:
+ for (int i = 0; i < 4; i++)
+ out << string(counts.count[i], codeToBase(i));
+ }
+ out << '\n';
+ assert(out.good());
+}
+
+/** Forms contigs based on the consensus of each base and outputs them
+ * to the file specified by the -o option. */
+static void consensus(const string& outPath, const string& pileupPath)
+{
+ ofstream outFile(outPath.c_str());
+ assert_good(outFile, outPath);
+
+ ofstream pileupFile;
+ ostream& pileupOut
+ = pileupPath.empty() || pileupPath == "-" ? cout
+ : (pileupFile.open(pileupPath.c_str()), pileupFile);
+ assert_good(pileupOut, pileupPath);
+
+ unsigned numIgnored = 0;
+ for (ContigMap::const_iterator it = g_contigs.begin();
+ it != g_contigs.end(); ++it) {
+ const ContigCount& contig = it->second;
+ unsigned seqLength = it->second.counts.size();
+
+ Sequence outSeq(seqLength, 'N');
+ unsigned sumBest = 0;
+ unsigned sumSecond = 0;
+ for (unsigned x = 0; x < seqLength; x++) {
+ char c = selectBase(
+ it->second.counts[x], sumBest, sumSecond);
+ outSeq[x] = islower(contig.seq[x]) ? tolower(c) : c;
+ }
+
+ if (outSeq.find_first_of("ACGT") != string::npos) {
+ // Check that the average percent agreement was enough to
+ // write the contig to file.
+ float percentAgreement
+ = sumBest / (float)(sumBest + sumSecond);
+ if (isnan(percentAgreement) || percentAgreement < .9) {
+ numIgnored++;
+ if (opt::csToNt) {
+ if (opt::verbose > 0)
+ cerr << "warning: Contig " << it->first
+ << " has less than 90% agreement "
+ "and will not be converted.\n";
+ } else
+ continue;
+ } else {
+ if (opt::csToNt)
+ fixUnknown(outSeq, contig.seq);
+ ostringstream comment;
+ comment << outSeq.length() << ' ' << contig.coverage;
+ if (!contig.comment.empty())
+ comment << ' ' << contig.comment;
+ outFile << FastaRecord(
+ it->first, comment.str(), outSeq);
+ assert(outFile.good());
+ }
+
+ if (opt::verbose > 1) {
+ // ID pos reference genotype A C G T
+ if (opt::csToNt)
+ for (unsigned i = 0; i < seqLength - 1; i++)
+ cout << it->first << '\t' << 1+i
+ << '\t' << contig.seq[i]
+ << '\t' << nucleotideToColourSpace(
+ outSeq[i], outSeq[i + 1])
+ << '\t' << contig.counts[i].sum()
+ << '\t' << contig.counts[i] << '\n';
+ else
+ for (unsigned i = 0; i < seqLength; i++)
+ cout << it->first << '\t' << 1+i
+ << '\t' << contig.seq[i]
+ << '\t' << outSeq[i]
+ << '\t' << contig.counts[i].sum()
+ << '\t' << contig.counts[i] << '\n';
+ }
+
+ if (!pileupPath.empty()) {
+ if (opt::csToNt)
+ for (unsigned i = 0; i < seqLength-1; i++)
+ writePileup(pileupOut, it->first, i,
+ contig.seq[i],
+ nucleotideToColourSpace(
+ outSeq[i], outSeq[i+1]),
+ contig.counts[i]);
+ else
+ for (unsigned i = 0; i < seqLength; i++)
+ writePileup(pileupOut, it->first, i,
+ contig.seq[i], outSeq[i],
+ contig.counts[i]);
+ }
+ } else if (opt::verbose > 0) {
+ cerr << "warning: Contig " << it->first
+ << " was not supported by a complete read "
+ "and was ommited.\n";
+ }
+ }
+}
+
+int main(int argc, char** argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'v': opt::verbose++; break;
+ case 'o': arg >> opt::outPath; break;
+ case 'p': arg >> opt::pileupPath; break;
+ case 'V': opt::onlyVariants = true; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::outPath.empty() && opt::pileupPath.empty()) {
+ cerr << PROGRAM ": " << "missing -o,--out option\n";
+ die = true;
+ }
+
+ if (argc - optind < 1) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ } else if (argc - optind > 1) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ readContigs(argv[optind++]);
+ buildBaseQuality();
+ consensus(opt::outPath, opt::pileupPath);
+}
diff --git a/Consensus/Makefile.am b/Consensus/Makefile.am
new file mode 100644
index 0000000..fa2dba2
--- /dev/null
+++ b/Consensus/Makefile.am
@@ -0,0 +1,12 @@
+bin_PROGRAMS = Consensus
+
+Consensus_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+Consensus_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+Consensus_SOURCES = \
+ Consensus.cpp
diff --git a/Consensus/Makefile.in b/Consensus/Makefile.in
new file mode 100644
index 0000000..38e8732
--- /dev/null
+++ b/Consensus/Makefile.in
@@ -0,0 +1,529 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = Consensus$(EXEEXT)
+subdir = Consensus
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_Consensus_OBJECTS = Consensus-Consensus.$(OBJEXT)
+Consensus_OBJECTS = $(am_Consensus_OBJECTS)
+Consensus_DEPENDENCIES = $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(Consensus_SOURCES)
+DIST_SOURCES = $(Consensus_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+Consensus_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+Consensus_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+Consensus_SOURCES = \
+ Consensus.cpp
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Consensus/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Consensus/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+Consensus$(EXEEXT): $(Consensus_OBJECTS) $(Consensus_DEPENDENCIES) $(EXTRA_Consensus_DEPENDENCIES)
+ @rm -f Consensus$(EXEEXT)
+ $(CXXLINK) $(Consensus_OBJECTS) $(Consensus_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Consensus-Consensus.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+Consensus-Consensus.o: Consensus.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(Consensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Consensus-Consensus.o -MD -MP -MF $(DEPDIR)/Consensus-Consensus.Tpo -c -o Consensus-Consensus.o `test -f 'Consensus.cpp' || echo '$(srcdir)/'`Consensus.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/Consensus-Consensus.Tpo $(DEPDIR)/Consensus-Consensus.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Consensus.cpp' object='Consensus-Consensus.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(Consensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Consensus-Consensus.o `test -f 'Consensus.cpp' || echo '$(srcdir)/'`Consensus.cpp
+
+Consensus-Consensus.obj: Consensus.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(Consensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Consensus-Consensus.obj -MD -MP -MF $(DEPDIR)/Consensus-Consensus.Tpo -c -o Consensus-Consensus.obj `if test -f 'Consensus.cpp'; then $(CYGPATH_W) 'Consensus.cpp'; else $(CYGPATH_W) '$(srcdir)/Consensus.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/Consensus-Consensus.Tpo $(DEPDIR)/Consensus-Consensus.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Consensus.cpp' object='Consensus-Consensus.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(Consensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Consensus-Consensus.obj `if test -f 'Consensus.cpp'; then $(CYGPATH_W) 'Consensus.cpp'; else $(CYGPATH_W) '$(srcdir)/Consensus.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/DAssembler/DAssembler.cpp b/DAssembler/DAssembler.cpp
new file mode 100644
index 0000000..0ab0786
--- /dev/null
+++ b/DAssembler/DAssembler.cpp
@@ -0,0 +1,550 @@
+#include "config.h"
+#include "Uncompress.h"
+#include "UnorderedMap.h"
+#include <algorithm>
+#include <getopt.h>
+#include <iostream>
+#include <map>
+#include <numeric>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "FastaReader.h"
+#include "Rotation.h"
+#include "RotatedRead.h"
+
+using namespace std;
+
+#define PROGRAM "DAssembler"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Rod Docking.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+namespace opt {
+ static unsigned max_overlap = 10;
+ static unsigned max_mismatch = 2;
+ static unsigned min_coverage = 2;
+ static unsigned read_length = 50;
+ static int verbose = 0;
+}
+
+static const char shortopts[] = "o:m:c:r:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "max_overlap", required_argument, NULL, 'o' },
+ { "max_mismatch", required_argument, NULL, 'm' },
+ { "min_coverage", required_argument, NULL, 'c' },
+ { "read_length", required_argument, NULL, 'r' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... [READS]\n"
+"Assemble a single contig from reads in a single orientation.\n"
+" READS fasta-formatted reads file: the first read is used as the seed.\n"
+"\n"
+" -o, --max_overlap=INT maximum tier overlap for consensus calling"
+" [10]\n"
+" -m, --max_mismatch=INT maximum mismatches allowed for consensus"
+" calling [2]\n"
+" -c, --min_coverage=INT minimum coverage to call a consensus base"
+" [2]\n"
+" -r, --read_length=INT read length\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+"\n";
+
+/* A small struct for holding overlap information:
+ just a sequence and offset from the focal read */
+struct Overlap{
+ string seq;
+ unsigned offset;
+ Overlap(const string& seq, unsigned offset)
+ : seq(seq), offset(offset) { }
+};
+
+/* Additional sort of Overlap objects used for pretty-printing alignments*/
+static bool offset_sort(const Overlap& x, const Overlap& y)
+{
+ return x.offset < y.offset;
+}
+
+/* Calculate the tier overlap between two rotated reads */
+static int tier_overlap(const string& seq1, const string& seq2,
+ bool allow_mismatch = false);
+
+/* From a rotated read, return the original sequence */
+static string original_read_from_rotated_read(
+ const string& rotated_read)
+{
+ size_t dollar_pos = rotated_read.find('$');
+ string orig_seq = rotated_read.substr(
+ dollar_pos+1,rotated_read.size()-dollar_pos) +
+ rotated_read.substr(0,dollar_pos);
+
+ return orig_seq;
+}
+
+/* Struct for holding base counts at a given position */
+struct BaseCount {
+ unsigned x[4];
+ BaseCount() { fill(x, x + 4, 0); }
+
+ /** Return the number of reads at this position. */
+ unsigned sum() const { return accumulate(x, x+4, 0); }
+
+ friend ostream& operator <<(ostream& out, const BaseCount& base)
+ {
+ out << base.x[0];
+ for (int x = 1; x < 4; x++)
+ out << '\t' << base.x[x];
+ return out;
+ }
+};
+
+/* Call a consensus base */
+static char call_consensus_base(BaseCount counts, char orig_base)
+{
+ unsigned coverage = accumulate(counts.x, counts.x+4, 0);
+
+ /*If we're below minimum coverage but have an already-called base
+ (i.e., for the first few bases)*/
+ if (coverage < opt::min_coverage)
+ return orig_base;
+
+ // Call a consensus base
+ unsigned *maxIt = max_element(counts.x, counts.x+4);
+
+ // Very verbose debugging output
+ // char base_to_return = float(*maxIt) <= float(coverage)*0.60 ? orig_base : codeToBase(maxIt - counts.x);
+ // char new_base_to_return = *maxIt < opt::min_coverage ? orig_base : codeToBase(maxIt - counts.x);
+ // float call_threshold = float(coverage)*0.60;
+ // float max_base_percent = float(*maxIt) / float(coverage);
+ // cerr << "Coverage: " << coverage << "\tOriginal: " << orig_base <<
+ // "\tReturning: " << base_to_return << "\tBases: " << counts <<
+ // "\tCall threshold: " << call_threshold <<
+ // "\tMax base percent: " << max_base_percent <<
+ // "\tNew base to return: " << new_base_to_return << endl;
+
+ // Original version with hard-coded coverage frequency of 60%
+ // return float(*maxIt) <= float(coverage)*0.60 ? orig_base
+ // : codeToBase(maxIt - counts.x);
+
+ // Return the most-frequent base, so long as that base has
+ // coverage >= min_coverage
+ return *maxIt < opt::min_coverage ? orig_base
+ : codeToBase(maxIt - counts.x);
+
+}
+
+/* Return the frequency of the most-common base*/
+static float most_common_base_frequency(BaseCount counts)
+{
+ // Calculate coverage as before
+ unsigned coverage = accumulate(counts.x, counts.x+4, 0);
+
+ // Call a consensus base
+ unsigned *maxIt = max_element(counts.x, counts.x+4);
+
+ // Return the frequency of the most-common base
+ return float(*maxIt) / float(coverage);
+
+}
+
+typedef vector<Rotation> Rotations;
+
+// Find all overlaps with the given focal read and call a consensus sequence
+static string find_complex_overlap(const RotatedRead& f,
+ const Rotations& r,
+ vector<RotatedRead>& rl)
+{
+ // A vector for tracking all the overlaps, seeded with the initial read
+ vector<Overlap> o;
+ o.push_back(Overlap(f.seq, 0));
+
+ // The pre-pended string to use to seed the search
+ const string& seq1 = '$' + f.seq;
+
+ //Find it in the sorted list - NOTE: if the flank read doesn't correspond
+ // to a real read, this iterator will not be used
+ Rotations::const_iterator rt = lower_bound(r.begin(), r.end(), seq1);
+
+ /*
+ Continue down the sorted list, checking for other matches
+ - for real reads (seq1 == rt->seq), continue from the position
+ of seq1 in the list
+ - otherwise, just start at the beginning
+ */
+ for(Rotations::const_iterator st = (seq1 == rt->seq) ? rt+1 : r.begin();
+ st != r.end(); ++st)
+ {
+ // Check for an overlap between the two sequences,
+ // allowing for mismatches
+ const string& seq2 = st->seq;
+ unsigned new_overlap = tier_overlap(seq1, seq2, true);
+
+ // Continue if there's no match
+ if (new_overlap == 0
+ || new_overlap > opt::max_overlap)
+ continue;
+
+ // Add a new overlap object for each appropriate overlap found
+ o.push_back(Overlap(
+ original_read_from_rotated_read(seq2), new_overlap));
+ }
+
+ // Counters for calculating coverage
+ // Vector size should be something like "read_length + maximum tier"
+ // THIS WILL BREAK WITH LONGER READS
+ vector<BaseCount> counts(300);
+
+ // Pretty-print the alignment for verbose only
+ if(opt::verbose){
+ cerr << endl;
+ sort(o.begin(), o.end(), offset_sort);
+ }
+
+ // Go through each overlap to count bases offset by the appropriate amount
+ for(vector<Overlap>::const_iterator ot = o.begin();
+ ot != o.end(); ++ot){
+
+ // Pretty-print each found read aligned with the focal read
+ if (opt::verbose)
+ cerr << string(ot->offset, ' ') << ot->seq << " t:" << ot->offset;
+
+ // Retrieve the original RotatedRead object to get the
+ // count for each read
+ vector<RotatedRead>::const_iterator rt = lower_bound(
+ rl.begin(), rl.end(), ot->seq);
+ if(opt::verbose){cerr << " x" << rt->count <<
+ " used: " << rt->used << endl;}
+
+ // Continue if we've marked this read as used already
+ if(rt->used == true){
+ continue;
+ }
+
+ // Increment the coverage lists appropriately
+ for (size_t i = 0; i < opt::read_length; ++i){
+ if ((ot->seq[i] == 'X') || (ot->seq[i] == 'N')){
+ continue;
+ }
+ counts[i+ot->offset].x[baseToCode(ot->seq[i])]
+ += rt->count;
+ }
+ }
+
+ // Call consensus bases until we run out of coverage
+ ostringstream new_contig;
+ char new_base = '*';
+ float current_consensus_freq = 1.0;
+ float next_consensus_freq = 1.0;
+ for (unsigned i = 0; new_base != 'X'; i++) {
+
+ // Retrieve the original base, or 'X' if we're past the end
+ // of the original flank
+ char orig_base = i < opt::read_length ? f.seq[i] : 'X';
+
+ // Call a new consensus base if possible
+ new_base = call_consensus_base(counts[i], orig_base);
+
+ // Check the frequency of the most-common base
+ current_consensus_freq = most_common_base_frequency(counts[i]);
+ next_consensus_freq = most_common_base_frequency(counts[i+1]);
+ //cerr << "Current: " << current_consensus_freq << " Next: " << next_consensus_freq << endl;
+
+ // Bail out if we encounter two SNPs in a row
+ // Set the current base to 'X' and trim the last one
+ if ((current_consensus_freq <= 0.8) && (next_consensus_freq <= 0.8))
+ new_base = 'X';
+
+ // If we've found a new base, add it to the growing consensus
+ if (new_base != 'X')
+ new_contig << new_base;
+
+ }
+ if (opt::verbose)
+ cerr << new_contig.str() << " (consensus) " << endl;
+
+ // Mark reads that shouldn't be used again
+ unsigned growth = new_contig.str().size() - opt::read_length;
+ for(vector<Overlap>::const_iterator ot = o.begin();
+ ot != o.end(); ++ot){
+ // Reads are used if they don't extend to the end of the consensus
+ if (ot->offset <= (growth-1)){
+ //Find the correct RotatedRead object and mark it as used
+ vector<RotatedRead>::iterator rt = lower_bound(
+ rl.begin(), rl.end(), ot->seq);
+ if(rt->seq == ot->seq)
+ rt->used = true;
+ }
+ }
+
+ /*The sequence returned here contains the original focal
+ read plus any extension
+ The main routine is responsible for trimming back the growing contig */
+ return new_contig.str();
+}
+
+// Calculate the tier overlap between two reads
+static int tier_overlap(const string& seq1, const string& seq2,
+ bool allow_mismatch)
+{
+ assert(seq1 != seq2);
+
+ //Find the position of the '$' character in both reads
+ unsigned first_dollar_pos = seq1.find('$');
+ unsigned second_dollar_pos = seq2.find('$');
+ unsigned earliest_dollar_pos = first_dollar_pos <= second_dollar_pos ?
+ first_dollar_pos : second_dollar_pos;
+ unsigned latest_dollar_pos = first_dollar_pos > second_dollar_pos ?
+ first_dollar_pos : second_dollar_pos;
+
+ //If the two strings are equal outside the dollar signs,
+ // return the tier - this is a no-mismatch overlap
+ if( (seq1.substr(0, earliest_dollar_pos) ==
+ seq2.substr(0, earliest_dollar_pos)) &&
+ (seq1.substr(latest_dollar_pos+1,
+ (opt::read_length+1)-latest_dollar_pos+1) ==
+ seq2.substr(latest_dollar_pos+1,
+ (opt::read_length+1)-latest_dollar_pos+1)) ){
+ return latest_dollar_pos - earliest_dollar_pos;
+ }
+
+ //Otherwise, if mismatches are allowed, calculate that overlap
+ if (allow_mismatch){
+ unsigned num_mismatch = 0;
+
+ for(unsigned i = 0; i < (opt::read_length+1); ++i)
+ {
+ if ((i >= earliest_dollar_pos) && (i <= latest_dollar_pos)){
+ continue;
+ }else if (seq1[i] != seq2[i]){
+ num_mismatch++;
+ }
+ }
+
+ //NOTE: this is also checking that the second read is
+ // DOWNSTREAM from the first
+ if ((num_mismatch <= opt::max_mismatch) &&
+ (second_dollar_pos > first_dollar_pos)){
+ return latest_dollar_pos - earliest_dollar_pos;
+ }
+ }
+
+ //Otherwise...
+ // NOTE: we're currently defining both "no overlap"
+ // and "no offset but mismatches" as "0"
+ // ==> This could probably be changed
+ return 0;
+}
+
+// From a sorted list of RotatedRead objects, generate a sorted
+// vector of Rotation objects
+// This function generates the main vector we traverse when looking
+// for simple extensions
+static Rotations generate_rotations_list(
+ const vector<RotatedRead>& read_list)
+{
+ // Each rotation has a sequence (string) and overlap (int)
+ // The overlap refers to the overlap between the current sequence
+ // and the next sequence in the list
+ Rotations s;
+
+ // For each distinct read, add all the rotations to the overlap list
+ for (vector<RotatedRead>::const_iterator it = read_list.begin();
+ it != read_list.end(); ++it)
+ for(vector<string>::size_type i = 0; i != (*it).rotations.size(); ++i)
+ // Initialize object with sequence
+ s.push_back(Rotation((*it).rotations[i]));
+
+ // Sort the list of rotated reads
+ sort(s.begin(), s.end());
+
+ // Find the 0-mismatch tier overlap between each pair of reads
+ // in the sorted list
+ for (Rotations::iterator rt = s.begin(); rt != s.end()-1; ++rt)
+ rt->overlap = tier_overlap(rt->seq, rt[1].seq);
+
+ // Define last entry in the list as 0
+ s[s.size()-1].overlap = 0;
+
+ return s;
+}
+
+// Main control flow function
+int main(int argc, char** argv)
+{
+ // Parse command-line options
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'o': arg >> opt::max_overlap; break;
+ case 'm': arg >> opt::max_mismatch; break;
+ case 'c': arg >> opt::min_coverage; break;
+ case 'r': arg >> opt::read_length; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ }
+
+ if (argc - optind < 1) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ } else if (argc - optind > 1) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ } else if (opt::max_overlap > (opt::read_length-1)){
+ cerr << PROGRAM ": max_overlap cannot be larger than (read_length-1)\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(1);
+ }
+
+ const char* fasta_file = argv[optind++];
+
+ if(opt::verbose){
+ cerr << PROGRAM <<
+ "\n max_overlap: " << opt::max_overlap <<
+ "\n max_mismatch: " << opt::max_mismatch <<
+ "\n min_coverage: " << opt::min_coverage <<
+ "\n read_length: " << opt::read_length << endl;
+ }
+
+ // Use the ABySS FastaReader class to read in a fasta file of reads
+ // Assume the first read in the file is the seed for the assembly
+ if(opt::verbose){cerr << "Reading `" << fasta_file << "'... ";}
+
+ typedef unordered_map<string, unsigned> ReadMap;
+ ReadMap read_map;
+
+ bool first_read = true;
+ string contig;
+
+ FastaReader in(fasta_file,
+ FastaReader::FOLD_CASE);
+ for (FastaRecord rec; in >> rec;) {
+
+ string read_seq = rec.seq;
+
+ if (first_read){
+ contig = read_seq;
+ first_read = false;
+ }
+ // Count the reads as we collect them here...
+ read_map[read_seq]++;
+ }
+
+ vector<RotatedRead> read_list;
+ // ... Then put them into the vector of RotatedRead objects
+ for (ReadMap::iterator i = read_map.begin();
+ i != read_map.end(); ++i)
+ read_list.push_back(RotatedRead(i->first, i->second));
+ read_map.clear();
+ sort(read_list.begin(), read_list.end());
+
+ if(opt::verbose){cerr << "finished reading fasta file with " <<
+ read_list.size() << " distinct reads.\n\n" << endl;}
+
+ // Generate the sorted lists
+ Rotations rotation_list = generate_rotations_list(read_list);
+
+ // Main assembly loop
+ if(opt::verbose){cerr << contig << " (seed)" << endl;}
+ bool time_to_die = false;
+ int hard_cap = 0;
+
+ while(! time_to_die){
+
+ // Temporary hard-cap to prevent runaway execution
+ hard_cap++;
+ if (hard_cap >= 500){
+ time_to_die = true;
+ //cerr << "Hard cap hit - I give up!" << endl;
+ //cerr << contig.size();
+ // cout << ">contig (" << contig.size() << "bp)" << endl
+ // << contig << endl;
+ //cout << contig.size();
+ cout << contig << endl;
+ exit(1);
+ }
+
+ // Another break if the contig grows too long
+ if (contig.size() >= 1500){
+ //cerr << contig.size();
+ cout << contig << endl;
+ exit(1);
+ }
+
+ // Extract the flanking sequence and fetch rotations of that read
+ string flank = contig.substr(contig.size()-opt::read_length);
+
+ // Retrieve the flanking read
+ vector<RotatedRead>::iterator low = lower_bound(
+ read_list.begin(), read_list.end(), flank);
+
+ //TODO - This search sometimes causes a segfault at higher -o values
+ // Figure out why!
+ RotatedRead flank_read = (*low);
+
+ // If the flank sequence doesn't correspond to a real read:
+ // - generate a temporary RotatedRead object for the complex search
+ if (flank != flank_read.seq){
+ if (opt::verbose) cerr <<
+ "Flank doesn't correspond to a real read" << endl;
+ flank_read = RotatedRead(flank, 1);
+ }
+
+ bool found_complex_overlap = false;
+ string read_to_add;
+
+ string extension_seq = find_complex_overlap(
+ flank_read, rotation_list, read_list);
+
+ if (! (extension_seq == flank_read.seq)){
+ found_complex_overlap = true;
+ // The new contig = old contig - flank read + extension sequence
+ // (the extension sequence contains the flank read)
+ contig = contig.substr(0, contig.size()-opt::read_length) +
+ extension_seq;
+
+ // This is very verbose - prints out a fasta sequence for each
+ // step of the assembly process
+ if(opt::verbose){
+ cout << ">p" << opt::max_overlap << "_" <<
+ contig.size() << "bp_complex\n" << contig << endl;
+ }
+ }
+
+ // If the search fails, stop extension
+ if (! found_complex_overlap){
+ time_to_die = true;
+ }
+ }
+
+ // Output the final contig
+ cout << contig << endl;
+
+ return 0;
+}
diff --git a/DAssembler/Makefile.am b/DAssembler/Makefile.am
new file mode 100644
index 0000000..e7d9519
--- /dev/null
+++ b/DAssembler/Makefile.am
@@ -0,0 +1,13 @@
+bin_PROGRAMS = DAssembler
+
+DAssembler_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+DAssembler_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+DAssembler_SOURCES = DAssembler.cpp \
+ RotatedRead.cpp RotatedRead.h \
+ Rotation.h
diff --git a/DAssembler/Makefile.in b/DAssembler/Makefile.in
new file mode 100644
index 0000000..9d1fd6c
--- /dev/null
+++ b/DAssembler/Makefile.in
@@ -0,0 +1,550 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = DAssembler$(EXEEXT)
+subdir = DAssembler
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_DAssembler_OBJECTS = DAssembler-DAssembler.$(OBJEXT) \
+ DAssembler-RotatedRead.$(OBJEXT)
+DAssembler_OBJECTS = $(am_DAssembler_OBJECTS)
+DAssembler_DEPENDENCIES = $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(DAssembler_SOURCES)
+DIST_SOURCES = $(DAssembler_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+DAssembler_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+DAssembler_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+DAssembler_SOURCES = DAssembler.cpp \
+ RotatedRead.cpp RotatedRead.h \
+ Rotation.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign DAssembler/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign DAssembler/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+DAssembler$(EXEEXT): $(DAssembler_OBJECTS) $(DAssembler_DEPENDENCIES) $(EXTRA_DAssembler_DEPENDENCIES)
+ @rm -f DAssembler$(EXEEXT)
+ $(CXXLINK) $(DAssembler_OBJECTS) $(DAssembler_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/DAssembler-DAssembler.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/DAssembler-RotatedRead.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+DAssembler-DAssembler.o: DAssembler.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DAssembler_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT DAssembler-DAssembler.o -MD -MP -MF $(DEPDIR)/DAssembler-DAssembler.Tpo -c -o DAssembler-DAssembler.o `test -f 'DAssembler.cpp' || echo '$(srcdir)/'`DAssembler.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/DAssembler-DAssembler.Tpo $(DEPDIR)/DAssembler-DAssembler.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DAssembler.cpp' object='DAssembler-DAssembler.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DAssembler_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DAssembler-DAssembler.o `test -f 'DAssembler.cpp' || echo '$(srcdir)/'`DAssembler.cpp
+
+DAssembler-DAssembler.obj: DAssembler.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DAssembler_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT DAssembler-DAssembler.obj -MD -MP -MF $(DEPDIR)/DAssembler-DAssembler.Tpo -c -o DAssembler-DAssembler.obj `if test -f 'DAssembler.cpp'; then $(CYGPATH_W) 'DAssembler.cpp'; else $(CYGPATH_W) '$(srcdir)/DAssembler.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/DAssembler-DAssembler.Tpo $(DEPDIR)/DAssembler-DAssembler.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DAssembler.cpp' object='DAssembler-DAssembler.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DAssembler_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DAssembler-DAssembler.obj `if test -f 'DAssembler.cpp'; then $(CYGPATH_W) 'DAssembler.cpp'; else $(CYGPATH_W) '$(srcdir)/DAssembler.cpp'; fi`
+
+DAssembler-RotatedRead.o: RotatedRead.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DAssembler_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT DAssembler-RotatedRead.o -MD -MP -MF $(DEPDIR)/DAssembler-RotatedRead.Tpo -c -o DAssembler-RotatedRead.o `test -f 'RotatedRead.cpp' || echo '$(srcdir)/'`RotatedRead.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/DAssembler-RotatedRead.Tpo $(DEPDIR)/DAssembler-RotatedRead.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='RotatedRead.cpp' object='DAssembler-RotatedRead.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DAssembler_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DAssembler-RotatedRead.o `test -f 'RotatedRead.cpp' || echo '$(srcdir)/'`RotatedRead.cpp
+
+DAssembler-RotatedRead.obj: RotatedRead.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DAssembler_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT DAssembler-RotatedRead.obj -MD -MP -MF $(DEPDIR)/DAssembler-RotatedRead.Tpo -c -o DAssembler-RotatedRead.obj `if test -f 'RotatedRead.cpp'; then $(CYGPATH_W) 'RotatedRead.cpp'; else $(CYGPATH_W) '$(srcdir)/RotatedRead.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/DAssembler-RotatedRead.Tpo $(DEPDIR)/DAssembler-RotatedRead.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='RotatedRead.cpp' object='DAssembler-RotatedRead.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DAssembler_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o DAssembler-RotatedRead.obj `if test -f 'RotatedRead.cpp'; then $(CYGPATH_W) 'RotatedRead.cpp'; else $(CYGPATH_W) '$(srcdir)/RotatedRead.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/DAssembler/RotatedRead.cpp b/DAssembler/RotatedRead.cpp
new file mode 100644
index 0000000..e943151
--- /dev/null
+++ b/DAssembler/RotatedRead.cpp
@@ -0,0 +1,21 @@
+#include <iostream>
+#include "RotatedRead.h"
+#include "Sequence.h"
+
+using namespace std;
+
+//Constructor
+RotatedRead::RotatedRead(const string& orig_seq, unsigned count)
+ : seq(orig_seq), count(count)
+{
+ // Add all rotations of the read to the object
+ string appended_seq = orig_seq + '$';
+ used = false;
+ for(unsigned int i = 0; i < appended_seq.size(); ++i)
+ {
+ string rotated_read = appended_seq.substr(i,(appended_seq.size()-i)) +
+ appended_seq.substr(0,i);
+ rotations.push_back(rotated_read);
+ }
+
+}
diff --git a/DAssembler/RotatedRead.h b/DAssembler/RotatedRead.h
new file mode 100644
index 0000000..81ffdb6
--- /dev/null
+++ b/DAssembler/RotatedRead.h
@@ -0,0 +1,26 @@
+#ifndef ROTATEDREAD_H
+#define ROTATEDREAD_H 1
+
+#include <string>
+#include <vector>
+
+class RotatedRead{
+ public:
+ RotatedRead(const std::string& orig_seq, unsigned count = 1);
+
+ bool operator <(const RotatedRead& x) const
+ {
+ return seq < x.seq;
+ }
+ bool operator ==(const RotatedRead& x) const
+ {
+ return seq == x.seq;
+ }
+
+ std::string seq;
+ std::vector<std::string> rotations;
+ unsigned count;
+ bool used;
+};
+
+#endif //ROTATEDREAD_H
diff --git a/DAssembler/Rotation.h b/DAssembler/Rotation.h
new file mode 100644
index 0000000..9dc2acf
--- /dev/null
+++ b/DAssembler/Rotation.h
@@ -0,0 +1,29 @@
+#ifndef ROTATION_H
+#define ROTATION_H 1
+
+#include <string>
+#include <vector>
+
+using namespace std;
+
+class Rotation {
+
+ public:
+ Rotation(const string& orig_seq)
+ : seq(orig_seq), overlap(0) { }
+
+ bool operator <(const Rotation& x) const
+ {
+ return seq < x.seq;
+ }
+ bool operator ==(const Rotation& x) const
+ {
+ return seq == x.seq;
+ }
+
+ string seq;
+ unsigned overlap;
+};
+
+
+#endif //ROTATION_H
diff --git a/DataLayer/FastaIndex.h b/DataLayer/FastaIndex.h
new file mode 100644
index 0000000..d64d707
--- /dev/null
+++ b/DataLayer/FastaIndex.h
@@ -0,0 +1,181 @@
+#ifndef FASTA_INDEX_H
+#define FASTA_INDEX_H 1
+
+#include "IOUtil.h"
+#include <boost/tuple/tuple.hpp>
+#include <algorithm>
+#include <cassert>
+#include <fstream>
+#include <iterator> // for ostream_iterator
+#include <string>
+#include <vector>
+
+/** A record of an indexed FASTA file. */
+struct FAIRecord
+{
+ size_t offset;
+ size_t size;
+ std::string id;
+
+ FAIRecord() : offset(0), size(0) { }
+ FAIRecord(size_t offset, size_t size, const std::string& id)
+ : offset(offset), size(size), id(id) { }
+
+ friend std::ostream& operator<<(std::ostream& out,
+ const FAIRecord& o)
+ {
+ return out << o.id << '\t' << o.size << '\t' << o.offset
+ << '\t' << o.size << '\t' << o.size + 1;
+ }
+
+ friend std::istream& operator>>(std::istream& in,
+ FAIRecord& o)
+ {
+ size_t lineLen, lineBinLen;
+ in >> o.id >> o.size >> o.offset >> lineLen >> lineBinLen;
+ if (!in)
+ return in;
+ assert(o.size == lineLen || lineLen == lineBinLen);
+ return in >> Ignore('\n');
+ }
+};
+
+/** An indexed FASTA (fai) file. */
+class FastaIndex
+{
+ typedef std::vector<FAIRecord> Data;
+
+ struct CompareOffset
+ {
+ /** Used with upper_bound. */
+ bool operator()(size_t a, const FAIRecord& b) const
+ {
+ return a < b.offset;
+ }
+ };
+
+ public:
+ typedef boost::tuple<const FAIRecord&, size_t> SeqPos;
+
+ /** Return the number of contigs. */
+ size_t size() { return m_data.size(); }
+
+ /** Return the size of the FASTA file. */
+ size_t fileSize() const
+ {
+ assert(!m_data.empty());
+ return m_data.back().offset + m_data.back().size + 1;
+ }
+
+ typedef Data::const_iterator const_iterator;
+ const_iterator begin() const { return m_data.begin(); }
+ const_iterator end() const { return m_data.end(); }
+
+ /** Index the specified FASTA file. */
+ void index(const std::string& path)
+ {
+ m_data.clear();
+ std::ifstream in(path.c_str());
+ assert_good(in, path);
+ char c;
+ for (std::string id;
+ in >> c && in >> id && in >> Ignore('\n');) {
+ assert(c == '>');
+ assert(!id.empty());
+ std::streampos offset = in.tellg();
+ assert(offset > 0);
+ in >> Ignore('\n');
+ size_t n = in.gcount();
+ assert(n > 0);
+ m_data.push_back(FAIRecord(offset, n - 1, id));
+ }
+ assert(in.eof());
+ }
+
+ /** Translate a file offset to a sequence:position coordinate. */
+ SeqPos operator[](size_t offset) const
+ {
+ Data::const_iterator it = std::upper_bound(
+ m_data.begin(), m_data.end(),
+ offset, CompareOffset());
+ assert(it != m_data.begin());
+ --it;
+ assert(it != m_data.end());
+ assert(it->offset <= offset);
+ assert(offset < it->offset + it->size);
+ return SeqPos(*it, offset - it->offset);
+ }
+
+ /** Write FASTA headers to the specified seekable stream. */
+ void writeFASTAHeaders(std::ostream& out) const
+ {
+ assert(out);
+ if (!out.seekp(0))
+ return;
+ for (Data::const_iterator it = m_data.begin();
+ it != m_data.end(); ++it) {
+ out << '>' << it->id << ' ';
+ assert(it->offset > 0);
+ if (!out.seekp(it->offset - 1))
+ break;
+ out << '\n';
+ if (!out.seekp(it->offset + it->size))
+ break;
+ out << '\n';
+ }
+ }
+
+ /** Write this index to a stream in SAM format. */
+ void writeSAMHeader(std::ostream& out) const
+ {
+ for (Data::const_iterator it = m_data.begin();
+ it != m_data.end(); ++it)
+ out << "@SQ\tSN:" << it->id
+ << "\tLN:" << it->size << '\n';
+ }
+
+ /** Write this index to a stream. */
+ friend std::ostream& operator<<(std::ostream& out,
+ const FastaIndex& o)
+ {
+ std::copy(o.m_data.begin(), o.m_data.end(),
+ std::ostream_iterator<FAIRecord>(out, "\n"));
+ return out;
+ }
+
+ /** Read a FASTA index from a stream. */
+ friend std::istream& operator>>(std::istream& in,
+ FastaIndex& o)
+ {
+ assert(in.good());
+ o.m_data.clear();
+
+ // Count the number of records.
+ if (in.seekg(0, std::ios::beg)) {
+ size_t n = 0;
+ while (in)
+ if (in.get() == '\n')
+ n++;
+ o.m_data.reserve(n);
+ in.clear();
+ in.seekg(0, std::ios::beg);
+ assert(in.good());
+ } else
+ in.clear();
+
+ // Read the records.
+ for (FAIRecord rec; in >> rec;) {
+ if (!o.m_data.empty())
+ assert(rec.offset > o.m_data.back().offset);
+ o.m_data.push_back(rec);
+ }
+ assert(in.eof());
+ assert(!o.m_data.empty());
+ return in;
+ }
+
+ private:
+ Data m_data;
+};
+
+#endif
diff --git a/DataLayer/FastaInterleave.h b/DataLayer/FastaInterleave.h
new file mode 100644
index 0000000..44c07e3
--- /dev/null
+++ b/DataLayer/FastaInterleave.h
@@ -0,0 +1,76 @@
+#ifndef FASTAINTERLEAVE_H
+#define FASTAINTERLEAVE_H 1
+
+#include "FastaReader.h"
+#include <cassert>
+#include <vector>
+
+class FastaInterleave {
+ typedef FastaReader Stream;
+ typedef std::vector<Stream*> Streams;
+
+ public:
+ FastaInterleave(char** first, char** last, int flags)
+ : m_it(m_streams.begin()), m_fail(false)
+ {
+ assert(first != last);
+ m_streams.reserve(last - first);
+ for (char** p = first; p < last; ++p)
+ m_streams.push_back(new Stream(*p, flags));
+ m_it = m_streams.begin();
+ }
+
+ ~FastaInterleave()
+ {
+ for (Streams::iterator it = m_streams.begin();
+ it != m_streams.end(); ++it)
+ delete *it;
+ }
+
+ /** Return true if all the streams are eof. */
+ bool eof() const
+ {
+ for (Streams::const_iterator it = m_streams.begin();
+ it != m_streams.end(); ++it)
+ if (!(*it)->eof())
+ return false;
+ return true;
+ }
+
+ /** Return true if any of the streams are good. */
+ operator void*() const
+ {
+ return m_fail ? NULL : const_cast<FastaInterleave*>(this);
+ }
+
+ /** Extract one record from the next stream. */
+ template <typename Record>
+ friend FastaInterleave& operator>>(
+ FastaInterleave& in, Record& o)
+ {
+ for (unsigned i = 0; i < in.m_streams.size(); ++i) {
+ assert(in.m_it != in.m_streams.end());
+ bool good = **in.m_it >> o;
+ if (++in.m_it == in.m_streams.end())
+ in.m_it = in.m_streams.begin();
+ if (good) {
+ in.m_fail = false;
+ return in;
+ }
+ }
+ in.m_fail = true;
+ return in;
+ }
+
+ private:
+ /** The streams. */
+ Streams m_streams;
+
+ /** The next stream from which to read. */
+ Streams::iterator m_it;
+
+ /** True when all streams have failed. */
+ bool m_fail;
+};
+
+#endif
diff --git a/DataLayer/FastaReader.cpp b/DataLayer/FastaReader.cpp
new file mode 100644
index 0000000..da11ef0
--- /dev/null
+++ b/DataLayer/FastaReader.cpp
@@ -0,0 +1,361 @@
+#include "FastaReader.h"
+#include "DataLayer/Options.h"
+#include "IOUtil.h"
+#include <algorithm>
+#include <cassert>
+#include <cctype>
+#include <cstdlib>
+#include <iostream>
+#include <sstream>
+#include <vector>
+
+using namespace std;
+
+namespace opt {
+ /** Discard reads that failed the chastity filter. */
+ int chastityFilter = 1;
+
+ /** Trim masked (lower case) characters from the ends of
+ * sequences.
+ */
+ int trimMasked = 1;
+
+ /** minimum quality threshold */
+ int qualityThreshold;
+
+ /** quality offset, usually 33 or 64 */
+ int qualityOffset;
+}
+
+/** Output an error message. */
+ostream& FastaReader::die()
+{
+ return cerr << m_path << ':' << m_line << ": error: ";
+}
+
+FastaReader::FastaReader(const char* path, int flags)
+ : m_path(path), m_fin(path),
+ m_in(strcmp(path, "-") == 0 ? cin : m_fin),
+ m_flags(flags), m_line(0), m_unchaste(0),
+ m_end(numeric_limits<streamsize>::max())
+{
+ if (strcmp(path, "-") != 0)
+ assert_good(m_fin, path);
+ if (m_in.peek() == EOF)
+ cerr << m_path << ':' << m_line << ": warning: "
+ "file is empty\n";
+}
+
+/** Split the fasta file into nsections and seek to the start
+ * of section. */
+void FastaReader::split(unsigned section, unsigned nsections)
+{
+ assert(nsections >= section);
+ assert(section > 0);
+ assert(strcmp(m_path, "-") != 0);
+ if (nsections == 1)
+ return;
+ // Move the get pointer to the first entry in this section and
+ // update the m_end if there is more than one section.
+ m_in.seekg(0, ios::end);
+ streampos length = m_in.tellg();
+ assert(length > 0);
+ streampos start = length * (section - 1) / nsections;
+ streampos end = length * section / nsections;
+ assert(end > 0);
+ if (end < length) {
+ m_in.seekg(end);
+ if (m_in.peek() == '>')
+ end += 1;
+ }
+ m_end = end;
+ m_in.seekg(start);
+ if (start > 0) {
+ m_in.ignore(numeric_limits<streamsize>::max(), '\n');
+ m_in.ignore(numeric_limits<streamsize>::max(), '>');
+ if (m_in.peek() == EOF)
+ cerr << m_path << ':' << section << ": warning: "
+ "there are no contigs in this section\n";
+ m_in.putback('>');
+ }
+ assert(m_end > 0);
+ assert(m_in.good());
+}
+
+/** Return whether this read passed the chastity filter. */
+bool FastaReader::isChaste(const string& s, const string& line)
+{
+ if (s == "1" || s == "Y") {
+ return true;
+ } else if (s == "0" || s == "N") {
+ return false;
+ } else {
+ die() << "chastity filter should be one of 0, 1, N or Y\n"
+ "and saw `" << s << "' near\n" << line << endl;
+ exit(EXIT_FAILURE);
+ }
+}
+
+/** Check that the seqeuence and quality agree in length. */
+void FastaReader::checkSeqQual(const string& s, const string& q)
+{
+ if (s.length() != q.length()) {
+ die() << "sequence and quality must be the same length near\n"
+ << s << '\n' << q << endl;
+ exit(EXIT_FAILURE);
+ }
+}
+
+/** Return whether the read seq is in colour space. */
+static bool isColourSpace(const string& seq)
+{
+ assert(!seq.empty());
+ size_t i = seq.find_first_of("ACGTacgt0123", 1);
+ return i != string::npos && isdigit(seq[i]);
+}
+
+/** Read a single record. */
+Sequence FastaReader::read(string& id, string& comment,
+ char& anchor, string& q)
+{
+next_record:
+ // Discard comments.
+ while (m_in.peek() == '#')
+ ignoreLines(1);
+
+ signed char recordType = m_in.peek();
+ Sequence s;
+
+ unsigned qualityOffset = 0;
+ if (recordType == EOF || m_in.tellg() >= m_end) {
+ m_in.seekg(0, ios::end);
+ m_in.clear(std::ios::eofbit | std::ios::failbit);
+ return s;
+ } else if (recordType == '>' || recordType == '@') {
+ // Read the header.
+ string header;
+ getline(header);
+ istringstream headerStream(header);
+ headerStream >> recordType >> id >> ws;
+ std::getline(headerStream, comment);
+
+ // Ignore SAM headers.
+ if (id.length() == 2 && isupper(id[0]) && isupper(id[1])
+ && comment.length() > 2 && comment[2] == ':')
+ goto next_record;
+
+ // Casava FASTQ format
+ if (comment.size() > 3
+ && comment[1] == ':' && comment[3] == ':') {
+ // read, chastity, flags, index: 1:Y:0:AAAAAA
+ if (opt::chastityFilter && comment[2] == 'Y') {
+ m_unchaste++;
+ ignoreLines(recordType == '@' ? 3 : 1);
+ goto next_record;
+ }
+ if (id.size() > 2 && id.rbegin()[1] != '/') {
+ // Add the read number to the ID.
+ id += '/';
+ id += comment[0];
+ }
+ }
+
+ getline(s);
+ if (recordType == '>') {
+ // Read a multi-line FASTA record.
+ string line;
+ while (m_in.peek() != '>' && m_in.peek() != '#'
+ && getline(line))
+ s += line;
+ if (m_in.eof())
+ m_in.clear();
+ }
+
+ if (recordType == '@') {
+ char c = m_in.get();
+ if (c != '+') {
+ string line;
+ getline(line);
+ die() << "expected `+' and saw ";
+ if (m_in.eof())
+ cerr << "end-of-file\n";
+ else
+ cerr << "`" << c << "' near\n"
+ << c << line << "\n";
+ exit(EXIT_FAILURE);
+ }
+ ignoreLines(1);
+ getline(q);
+ } else
+ q.clear();
+
+ if (s.empty()) {
+ die() << "sequence with ID `" << id << "' is empty\n";
+ exit(EXIT_FAILURE);
+ }
+
+ bool colourSpace = isColourSpace(s);
+ if (colourSpace && !isdigit(s[0])) {
+ // The first character is the primer base. The second
+ // character is the dibase read of the primer and the
+ // first base of the sample, which is not part of the
+ // assembly.
+ assert(s.length() > 2);
+ anchor = colourToNucleotideSpace(s[0], s[1]);
+ s.erase(0, 2);
+ q.erase(0, 1);
+ }
+
+ if (!q.empty())
+ checkSeqQual(s, q);
+
+ if (opt::trimMasked && !colourSpace) {
+ // Removed masked (lower case) sequence at the beginning
+ // and end of the read.
+ size_t trimFront = s.find_first_not_of("acgtn");
+ size_t trimBack = s.find_last_not_of("acgtn") + 1;
+ s.erase(trimBack);
+ s.erase(0, trimFront);
+ if (!q.empty()) {
+ q.erase(trimBack);
+ q.erase(0, trimFront);
+ }
+ }
+ if (flagFoldCase())
+ transform(s.begin(), s.end(), s.begin(), ::toupper);
+
+ qualityOffset = 33;
+ } else {
+ string line;
+ vector<string> fields;
+ fields.reserve(22);
+ getline(line);
+ istringstream in(line);
+ string field;
+ while (std::getline(in, field, '\t'))
+ fields.push_back(field);
+
+ if (fields.size() >= 11
+ && (fields[9].length() == fields[10].length()
+ || fields[10] == "*")) {
+ // SAM
+ unsigned flags = strtoul(fields[1].c_str(), NULL, 0);
+ if (flags & 0x100) // FSECONDARY
+ goto next_record;
+ if (opt::chastityFilter && (flags & 0x200)) { // FQCFAIL
+ m_unchaste++;
+ goto next_record;
+ }
+ id = fields[0];
+ switch (flags & 0xc1) { // FPAIRED|FREAD1|FREAD2
+ case 0: case 1: // FPAIRED
+ comment = "0:";
+ break;
+ case 0x41: // FPAIRED|FREAD1
+ id += "/1";
+ comment = "1:";
+ break;
+ case 0x81: // FPAIRED|FREAD2
+ id += "/2";
+ comment = "2:";
+ break;
+ default:
+ die() << "invalid flags: `" << id << "' near"
+ << line << endl;
+ exit(EXIT_FAILURE);
+ }
+ comment += flags & 0x200 ? "Y:0:" : "N:0:"; // FQCFAIL
+
+ s = fields[9];
+ q = fields[10];
+ if (s == "*")
+ s.clear();
+ if (q == "*")
+ q.clear();
+ if (flags & 0x10) { // FREVERSE
+ s = reverseComplement(s);
+ reverse(q.begin(), q.end());
+ }
+ qualityOffset = 33;
+ if (!q.empty())
+ checkSeqQual(s, q);
+ } else if (fields.size() == 11 || fields.size() == 22) {
+ // qseq or export
+ if (opt::chastityFilter
+ && !isChaste(fields.back(), line)) {
+ m_unchaste++;
+ goto next_record;
+ }
+
+ ostringstream o;
+ o << fields[0];
+ for (int i = 1; i < 6; i++)
+ if (!fields[i].empty())
+ o << ':' << fields[i];
+ if (!fields[6].empty() && fields[6] != "0")
+ o << '#' << fields[6];
+ // The reverse read is typically the second read, but is
+ // the third read of an indexed run.
+ o << '/' << (fields[7] == "3" ? "2" : fields[7]);
+ id = o.str();
+ comment = fields[7];
+ comment += isChaste(fields.back(), line)
+ ? ":N:0:" : ":Y:0:";
+ s = fields[8];
+ q = fields[9];
+ qualityOffset = 64;
+ checkSeqQual(s, q);
+ } else {
+ die() << "Expected either `>' or `@' or 11 fields\n"
+ "and saw `" << recordType << "' and "
+ << fields.size() << " fields near\n"
+ << line << endl;
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::qualityOffset > 0)
+ qualityOffset = opt::qualityOffset;
+
+ if (opt::qualityThreshold > 0 && !q.empty()) {
+ assert(s.length() == q.length());
+ static const char ASCII[] =
+ " !\"#$%&'()*+,-./0123456789:;<=>?"
+ "@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
+ "`abcdefghijklmnopqrstuvwxyz{|}~";
+ assert(qualityOffset > (unsigned)ASCII[0]);
+ const char* goodQual = ASCII + (qualityOffset - ASCII[0])
+ + opt::qualityThreshold;
+
+ size_t trimFront = q.find_first_of(goodQual);
+ size_t trimBack = q.find_last_of(goodQual) + 1;
+ if (trimFront >= trimBack) {
+ // The entire read is poor quality.
+ s.erase(1);
+ q.erase(1);
+ } else if (trimFront > 0 || trimBack < q.length()) {
+ s.erase(trimBack);
+ s.erase(0, trimFront);
+ q.erase(trimBack);
+ q.erase(0, trimFront);
+ }
+ }
+
+ assert(qualityOffset >= 33);
+ if (flagConvertQual() && qualityOffset != 33) {
+ // Convert to standard quality (ASCII 33).
+ for (string::iterator it = q.begin(); it != q.end(); ++it) {
+ int x = *it - qualityOffset;
+ if (x < -5 || x > 41) {
+ die() << "quality " << x
+ << " is out of range -5 <= q <= 41 near\n"
+ << q << '\n'
+ << string(it - q.begin(), ' ') << "^\n";
+ exit(EXIT_FAILURE);
+ }
+ *it = 33 + max(0, x);
+ }
+ }
+
+ return s;
+}
diff --git a/DataLayer/FastaReader.h b/DataLayer/FastaReader.h
new file mode 100644
index 0000000..782d41a
--- /dev/null
+++ b/DataLayer/FastaReader.h
@@ -0,0 +1,183 @@
+#ifndef FASTAREADER_H
+#define FASTAREADER_H 1
+
+#include "Sequence.h"
+#include "StringUtil.h" // for chomp
+#include <cassert>
+#include <cstdlib> // for exit
+#include <fstream>
+#include <istream>
+#include <limits> // for numeric_limits
+#include <ostream>
+
+/** Read a FASTA, FASTQ, export, qseq or SAM file. */
+class FastaReader {
+ public:
+ enum {
+ /** Fold lower-case characters to upper-case. */
+ FOLD_CASE = 0, NO_FOLD_CASE = 1,
+ /** Convert to standard quality. */
+ NO_CONVERT_QUALITY = 0, CONVERT_QUALITY = 2,
+ };
+ bool flagFoldCase() { return ~m_flags & NO_FOLD_CASE; }
+ bool flagConvertQual() { return m_flags & CONVERT_QUALITY; }
+
+ FastaReader(const char* path, int flags);
+
+ ~FastaReader()
+ {
+ if (!m_in.eof()) {
+ std::string line;
+ getline(line);
+ die() << "expected end-of-file near\n"
+ << line << '\n';
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ Sequence read(std::string& id, std::string& comment,
+ char& anchor, std::string& qual);
+
+ /** Split the fasta file into nsections and seek to the start
+ * of section. */
+ void split(unsigned section, unsigned nsections);
+
+ /** Return whether this stream is at end-of-file. */
+ bool eof() const { return m_in.eof(); };
+
+ /** Return whether this stream is good. */
+ operator void*() const { return m_in; }
+
+ /** Return the next character of this stream. */
+ int peek() { return m_in.peek(); }
+
+ /** Interface for manipulators. */
+ FastaReader& operator>>(std::istream& (*f)(std::istream&))
+ {
+ f(m_in);
+ return *this;
+ }
+
+ /** Returns the number of unchaste reads. */
+ unsigned unchaste() const { return m_unchaste; }
+
+ FastaReader& operator >>(Sequence& seq)
+ {
+ std::string id, comment, qual;
+ char anchor;
+ seq = this->read(id, comment, anchor, qual);
+ return *this;
+ }
+
+ private:
+ /** Read a single line. */
+ std::istream& getline(std::string& s)
+ {
+ if (std::getline(m_in, s)) {
+ chomp(s, '\r');
+ m_line++;
+ }
+ return m_in;
+ }
+
+ /** Ignore the specified number of lines. */
+ std::istream& ignoreLines(unsigned n)
+ {
+ for (unsigned i = 0; i < n; ++i) {
+ if (m_in.ignore(
+ std::numeric_limits<std::streamsize>::max(),
+ '\n'))
+ m_line++;
+ }
+ return m_in;
+ }
+
+ std::ostream& die();
+ bool isChaste(const std::string& s, const std::string& line);
+ void checkSeqQual(const std::string& s, const std::string& q);
+
+ const char* m_path;
+ std::ifstream m_fin;
+ std::istream& m_in;
+
+ /** Flags indicating parsing options. */
+ int m_flags;
+
+ /** Number of lines read. */
+ unsigned m_line;
+
+ /** Count of unchaste reads. */
+ unsigned m_unchaste;
+
+ /** Position of the end of the current section. */
+ std::streampos m_end;
+};
+
+/** A FASTA record. */
+struct FastaRecord
+{
+ /** Identifier */
+ std::string id;
+ /** Comment following the first white-space of the header */
+ std::string comment;
+ /** Anchor base for a colour-space sequence */
+ char anchor;
+ /** The sequence */
+ Sequence seq;
+
+ FastaRecord() { }
+ FastaRecord(const std::string& id, const std::string& comment,
+ const Sequence& seq)
+ : id(id), comment(comment), anchor(0), seq(seq) { }
+
+ friend FastaReader& operator >>(FastaReader& in, FastaRecord& o)
+ {
+ std::string q;
+ o.seq = in.read(o.id, o.comment, o.anchor, q);
+ return in;
+ }
+
+ friend std::ostream& operator <<(std::ostream& out,
+ const FastaRecord& o)
+ {
+ out << '>' << o.id;
+ if (!o.comment.empty())
+ out << ' ' << o.comment;
+ return out << '\n' << o.seq << '\n';
+ }
+};
+
+/** A FASTQ record. */
+struct FastqRecord : FastaRecord
+{
+ /** Quality */
+ std::string qual;
+
+ FastqRecord() { }
+ FastqRecord(const std::string& id, const std::string& comment,
+ const Sequence& seq, const std::string& qual)
+ : FastaRecord(id, comment, seq), qual(qual)
+ {
+ assert(seq.length() == qual.length());
+ }
+
+ friend FastaReader& operator >>(FastaReader& in, FastqRecord& o)
+ {
+ o.seq = in.read(o.id, o.comment, o.anchor, o.qual);
+ return in;
+ }
+
+ friend std::ostream& operator <<(std::ostream& out,
+ const FastqRecord& o)
+ {
+ if (o.qual.empty())
+ return out << static_cast<const FastaRecord&>(o);
+ out << '@' << o.id;
+ if (!o.comment.empty())
+ out << ' ' << o.comment;
+ return out << '\n' << o.seq << "\n"
+ "+\n" << o.qual << '\n';
+ }
+};
+
+#endif //FASTAREADER_H
diff --git a/DataLayer/FastaWriter.cpp b/DataLayer/FastaWriter.cpp
new file mode 100644
index 0000000..6082c59
--- /dev/null
+++ b/DataLayer/FastaWriter.cpp
@@ -0,0 +1,57 @@
+#include "FastaWriter.h"
+#include "Common/Options.h"
+#include <cassert>
+#include <cerrno>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring> // for strerror
+#include <iostream>
+#include <unistd.h> // for fsync
+
+using namespace std;
+
+static inline void die(const string& s)
+{
+ cerr << "error: writing to `" << s << "': "
+ << strerror(errno) << endl;
+ exit(EXIT_FAILURE);
+}
+
+FastaWriter::FastaWriter(const char* path, bool append)
+ : m_path(path), m_fileHandle(fopen(path, append ? "a" : "w"))
+{
+ if (m_fileHandle == NULL)
+ die(m_path);
+}
+
+FastaWriter::~FastaWriter()
+{
+ int n = fsync(fileno(m_fileHandle));
+ if (n < 0)
+ die(m_path);
+ n = fclose(m_fileHandle);
+ if (n < 0)
+ die(m_path);
+ m_fileHandle = NULL;
+}
+
+void FastaWriter::WriteSequence(const Sequence& seq, unsigned id,
+ unsigned multiplicity, const string& comment)
+{
+ assert(m_fileHandle != NULL);
+ const char *sep = comment.empty() ? "" : " ";
+ int n = opt::rank < 0
+ ? fprintf(m_fileHandle, ">%llu %zu %u%s%s\n%s\n",
+ (long long unsigned)id,
+ seq.length(), multiplicity,
+ sep, comment.c_str(),
+ seq.c_str())
+ : fprintf(m_fileHandle, ">%u:%llu %zu %u%s%s\n%s\n",
+ opt::rank,
+ (long long unsigned)id,
+ seq.length(), multiplicity,
+ sep, comment.c_str(),
+ seq.c_str());
+ if (n < 0)
+ die(m_path);
+}
diff --git a/DataLayer/FastaWriter.h b/DataLayer/FastaWriter.h
new file mode 100644
index 0000000..139e659
--- /dev/null
+++ b/DataLayer/FastaWriter.h
@@ -0,0 +1,32 @@
+#ifndef FASTAWRITER_H
+#define FASTAWRITER_H 1
+
+#include "Sequence.h"
+#include <cstdio>
+
+/** Output a FASTA file. */
+class FastaWriter {
+ public:
+ // Constructor opens file
+ FastaWriter(const char* path, bool append = false);
+
+ // Destructor closes it
+ ~FastaWriter();
+
+ /** Write a sequence with a comment. */
+ void WriteSequence(const Sequence& seq, unsigned id,
+ unsigned multiplicity, const std::string& comment);
+
+ /** Write a sequence. */
+ void WriteSequence(const Sequence& seq, unsigned id,
+ unsigned multiplicity)
+ {
+ WriteSequence(seq, id, multiplicity, "");
+ }
+
+ private:
+ const char *m_path;
+ FILE* m_fileHandle;
+};
+
+#endif
diff --git a/DataLayer/Makefile.am b/DataLayer/Makefile.am
new file mode 100644
index 0000000..7ff7ead
--- /dev/null
+++ b/DataLayer/Makefile.am
@@ -0,0 +1,28 @@
+bin_PROGRAMS = abyss-fac abyss-tofastq
+noinst_LIBRARIES = libdatalayer.a
+
+abyss_fac_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_fac_LDADD = libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_fac_SOURCES = fac.cc
+
+abyss_tofastq_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_tofastq_LDADD = libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_tofastq_SOURCES = abyss-tofastq.cc
+
+libdatalayer_a_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+libdatalayer_a_SOURCES = \
+ FastaIndex.h \
+ FastaInterleave.h \
+ FastaReader.cpp FastaReader.h \
+ FastaWriter.cpp FastaWriter.h \
+ Options.h
diff --git a/DataLayer/Makefile.in b/DataLayer/Makefile.in
new file mode 100644
index 0000000..9cf895e
--- /dev/null
+++ b/DataLayer/Makefile.in
@@ -0,0 +1,632 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = abyss-fac$(EXEEXT) abyss-tofastq$(EXEEXT)
+subdir = DataLayer
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libdatalayer_a_AR = $(AR) $(ARFLAGS)
+libdatalayer_a_LIBADD =
+am_libdatalayer_a_OBJECTS = libdatalayer_a-FastaReader.$(OBJEXT) \
+ libdatalayer_a-FastaWriter.$(OBJEXT)
+libdatalayer_a_OBJECTS = $(am_libdatalayer_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_abyss_fac_OBJECTS = abyss_fac-fac.$(OBJEXT)
+abyss_fac_OBJECTS = $(am_abyss_fac_OBJECTS)
+abyss_fac_DEPENDENCIES = libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+am_abyss_tofastq_OBJECTS = abyss_tofastq-abyss-tofastq.$(OBJEXT)
+abyss_tofastq_OBJECTS = $(am_abyss_tofastq_OBJECTS)
+abyss_tofastq_DEPENDENCIES = libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libdatalayer_a_SOURCES) $(abyss_fac_SOURCES) \
+ $(abyss_tofastq_SOURCES)
+DIST_SOURCES = $(libdatalayer_a_SOURCES) $(abyss_fac_SOURCES) \
+ $(abyss_tofastq_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LIBRARIES = libdatalayer.a
+abyss_fac_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_fac_LDADD = libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_fac_SOURCES = fac.cc
+abyss_tofastq_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_tofastq_LDADD = libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_tofastq_SOURCES = abyss-tofastq.cc
+libdatalayer_a_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+libdatalayer_a_SOURCES = \
+ FastaIndex.h \
+ FastaInterleave.h \
+ FastaReader.cpp FastaReader.h \
+ FastaWriter.cpp FastaWriter.h \
+ Options.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign DataLayer/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign DataLayer/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libdatalayer.a: $(libdatalayer_a_OBJECTS) $(libdatalayer_a_DEPENDENCIES) $(EXTRA_libdatalayer_a_DEPENDENCIES)
+ -rm -f libdatalayer.a
+ $(libdatalayer_a_AR) libdatalayer.a $(libdatalayer_a_OBJECTS) $(libdatalayer_a_LIBADD)
+ $(RANLIB) libdatalayer.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+abyss-fac$(EXEEXT): $(abyss_fac_OBJECTS) $(abyss_fac_DEPENDENCIES) $(EXTRA_abyss_fac_DEPENDENCIES)
+ @rm -f abyss-fac$(EXEEXT)
+ $(CXXLINK) $(abyss_fac_OBJECTS) $(abyss_fac_LDADD) $(LIBS)
+abyss-tofastq$(EXEEXT): $(abyss_tofastq_OBJECTS) $(abyss_tofastq_DEPENDENCIES) $(EXTRA_abyss_tofastq_DEPENDENCIES)
+ @rm -f abyss-tofastq$(EXEEXT)
+ $(CXXLINK) $(abyss_tofastq_OBJECTS) $(abyss_tofastq_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_fac-fac.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_tofastq-abyss-tofastq.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdatalayer_a-FastaReader.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libdatalayer_a-FastaWriter.Po at am__quote@
+
+.cc.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+libdatalayer_a-FastaReader.o: FastaReader.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdatalayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdatalayer_a-FastaReader.o -MD -MP -MF $(DEPDIR)/libdatalayer_a-FastaReader.Tpo -c -o libdatalayer_a-FastaReader.o `test -f 'FastaReader.cpp' || echo '$(srcdir)/'`FastaReader.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libdatalayer_a-FastaReader.Tpo $(DEPDIR)/libdatalayer_a-FastaReader.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='FastaReader.cpp' object='libdatalayer_a-FastaReader.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdatalayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdatalayer_a-FastaReader.o `test -f 'FastaReader.cpp' || echo '$(srcdir)/'`FastaReader.cpp
+
+libdatalayer_a-FastaReader.obj: FastaReader.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdatalayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdatalayer_a-FastaReader.obj -MD -MP -MF $(DEPDIR)/libdatalayer_a-FastaReader.Tpo -c -o libdatalayer_a-FastaReader.obj `if test -f 'FastaReader.cpp'; then $(CYGPATH_W) 'FastaReader.cpp'; else $(CYGPATH_W) '$(srcdir)/FastaReader.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libdatalayer_a-FastaReader.Tpo $(DEPDIR)/libdatalayer_a-FastaReader.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='FastaReader.cpp' object='libdatalayer_a-FastaReader.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdatalayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdatalayer_a-FastaReader.obj `if test -f 'FastaReader.cpp'; then $(CYGPATH_W) 'FastaReader.cpp'; else $(CYGPATH_W) '$(srcdir)/FastaReader.cpp'; fi`
+
+libdatalayer_a-FastaWriter.o: FastaWriter.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdatalayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdatalayer_a-FastaWriter.o -MD -MP -MF $(DEPDIR)/libdatalayer_a-FastaWriter.Tpo -c -o libdatalayer_a-FastaWriter.o `test -f 'FastaWriter.cpp' || echo '$(srcdir)/'`FastaWriter.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libdatalayer_a-FastaWriter.Tpo $(DEPDIR)/libdatalayer_a-FastaWriter.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='FastaWriter.cpp' object='libdatalayer_a-FastaWriter.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdatalayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdatalayer_a-FastaWriter.o `test -f 'FastaWriter.cpp' || echo '$(srcdir)/'`FastaWriter.cpp
+
+libdatalayer_a-FastaWriter.obj: FastaWriter.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdatalayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libdatalayer_a-FastaWriter.obj -MD -MP -MF $(DEPDIR)/libdatalayer_a-FastaWriter.Tpo -c -o libdatalayer_a-FastaWriter.obj `if test -f 'FastaWriter.cpp'; then $(CYGPATH_W) 'FastaWriter.cpp'; else $(CYGPATH_W) '$(srcdir)/FastaWriter.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libdatalayer_a-FastaWriter.Tpo $(DEPDIR)/libdatalayer_a-FastaWriter.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='FastaWriter.cpp' object='libdatalayer_a-FastaWriter.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libdatalayer_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libdatalayer_a-FastaWriter.obj `if test -f 'FastaWriter.cpp'; then $(CYGPATH_W) 'FastaWriter.cpp'; else $(CYGPATH_W) '$(srcdir)/FastaWriter.cpp'; fi`
+
+abyss_fac-fac.o: fac.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_fac_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_fac-fac.o -MD -MP -MF $(DEPDIR)/abyss_fac-fac.Tpo -c -o abyss_fac-fac.o `test -f 'fac.cc' || echo '$(srcdir)/'`fac.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_fac-fac.Tpo $(DEPDIR)/abyss_fac-fac.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fac.cc' object='abyss_fac-fac.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_fac_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_fac-fac.o `test -f 'fac.cc' || echo '$(srcdir)/'`fac.cc
+
+abyss_fac-fac.obj: fac.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_fac_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_fac-fac.obj -MD -MP -MF $(DEPDIR)/abyss_fac-fac.Tpo -c -o abyss_fac-fac.obj `if test -f 'fac.cc'; then $(CYGPATH_W) 'fac.cc'; else $(CYGPATH_W) '$(srcdir)/fac.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_fac-fac.Tpo $(DEPDIR)/abyss_fac-fac.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='fac.cc' object='abyss_fac-fac.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_fac_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_fac-fac.obj `if test -f 'fac.cc'; then $(CYGPATH_W) 'fac.cc'; else $(CYGPATH_W) '$(srcdir)/fac.cc'; fi`
+
+abyss_tofastq-abyss-tofastq.o: abyss-tofastq.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_tofastq_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_tofastq-abyss-tofastq.o -MD -MP -MF $(DEPDIR)/abyss_tofastq-abyss-tofastq.Tpo -c -o abyss_tofastq-abyss-tofastq.o `test -f 'abyss-tofastq.cc' || echo '$(srcdir)/'`abyss-tofastq.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_tofastq-abyss-tofastq.Tpo $(DEPDIR)/abyss_tofastq-abyss-tofastq.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='abyss-tofastq.cc' object='abyss_tofastq-abyss-tofastq.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_tofastq_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_tofastq-abyss-tofastq.o `test -f 'abyss-tofastq.cc' || echo '$(srcdir)/'`abyss-tofastq.cc
+
+abyss_tofastq-abyss-tofastq.obj: abyss-tofastq.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_tofastq_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_tofastq-abyss-tofastq.obj -MD -MP -MF $(DEPDIR)/abyss_tofastq-abyss-tofastq.Tpo -c -o abyss_tofastq-abyss-tofastq.obj `if test -f 'abyss-tofastq.cc'; then $(CYGPATH_W) 'abyss-tofastq.cc'; else $(CYGPATH_W) '$(srcdir)/abyss-tofastq.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_tofastq-abyss-tofastq.Tpo $(DEPDIR)/abyss_tofastq-abyss-tofastq.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='abyss-tofastq.cc' object='abyss_tofastq-abyss-tofastq.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_tofastq_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_tofastq-abyss-tofastq.obj `if test -f 'abyss-tofastq.cc'; then $(CYGPATH_W) 'abyss-tofastq.cc'; else $(CYGPATH_W) '$(srcdir)/abyss-tofastq.cc'; fi`
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-noinstLIBRARIES cscopelist ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/DataLayer/Options.h b/DataLayer/Options.h
new file mode 100644
index 0000000..625fc07
--- /dev/null
+++ b/DataLayer/Options.h
@@ -0,0 +1,11 @@
+#ifndef DATALAYER_OPTIONS
+#define DATALAYER_OPTIONS 1
+
+namespace opt {
+ extern int chastityFilter;
+ extern int trimMasked;
+ extern int qualityOffset;
+ extern int qualityThreshold;
+}
+
+#endif
diff --git a/DataLayer/abyss-tofastq.cc b/DataLayer/abyss-tofastq.cc
new file mode 100644
index 0000000..4fb161b
--- /dev/null
+++ b/DataLayer/abyss-tofastq.cc
@@ -0,0 +1,201 @@
+/** Convert various file formats to FASTQ format.
+ * Written by Shaun Jackman <sjackman at bcgsc.ca>.
+ */
+#include "config.h"
+#include "DataLayer/Options.h"
+#include "FastaInterleave.h"
+#include "FastaReader.h"
+#include "IOUtil.h"
+#include "Uncompress.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdlib>
+#include <getopt.h>
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+#define PROGRAM "abyss-tofastq"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... [FILE]...\n"
+"Convert to FASTQ format. The input format may be FASTA, FASTQ,\n"
+"qseq, export, SAM or BAM format and compressed with gz, bz2 or xz\n"
+"and may be tarred.\n"
+"\n"
+" --cat concatenate the records [default]\n"
+" -i, --interleave interleave the records\n"
+" --fastq ouput FASTQ format [default]\n"
+" --fasta ouput FASTA format\n"
+" --chastity discard unchaste reads [default]\n"
+" --no-chastity do not discard unchaste reads\n"
+" --trim-masked trim masked bases from the ends of reads\n"
+" --no-trim-masked do not trim masked bases from the ends\n"
+" of reads [default]\n"
+" -q, --trim-quality=N trim bases from the ends of reads whose\n"
+" quality is less than the threshold\n"
+" --standard-quality zero quality is `!' (33)\n"
+" default for FASTQ and SAM files\n"
+" --illumina-quality zero quality is `@' (64)\n"
+" default for qseq and export files\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ /** Interleave the lines of each file. */
+ static int interleave;
+
+ static int toFASTQ = 1;
+ static int verbose;
+}
+
+static const char shortopts[] = "iq:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "cat", no_argument, &opt::interleave, 0 },
+ { "interleave", no_argument, &opt::interleave, 1 },
+ { "fasta", no_argument, &opt::toFASTQ, 0 },
+ { "fastq", no_argument, &opt::toFASTQ, 1 },
+ { "chastity", no_argument, &opt::chastityFilter, 1 },
+ { "no-chastity", no_argument, &opt::chastityFilter, 0 },
+ { "trim-masked", no_argument, &opt::trimMasked, 1 },
+ { "no-trim-masked", no_argument, &opt::trimMasked, 0 },
+ { "trim-quality", required_argument, NULL, 'q' },
+ { "standard-quality", no_argument, &opt::qualityOffset, 33 },
+ { "illumina-quality", no_argument, &opt::qualityOffset, 64 },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** FastaReader flags. */
+static const int FASTAREADER_FLAGS
+ = FastaReader::NO_FOLD_CASE | FastaReader::CONVERT_QUALITY;
+
+/** Total count. */
+static struct {
+ unsigned records;
+ unsigned characters;
+} g_total;
+
+template <class Record>
+static void convert(const char* path)
+{
+ FastaReader in(path, FASTAREADER_FLAGS);
+ unsigned records = 0, characters = 0;
+ for (Record record; in >> record;) {
+ cout << record;
+ assert_good(cout, "stdout");
+ records++;
+ characters += record.seq.size();
+ }
+ assert(in.eof());
+
+ g_total.records += records;
+ g_total.characters += characters;
+ if (opt::verbose)
+ cerr << records << '\t'
+ << characters << '\t'
+ << path << '\n';
+}
+
+/** Interleave the records. */
+template <typename Record>
+static void interleave(char** first, char** last)
+{
+ FastaInterleave in(first, last, FASTAREADER_FLAGS);
+ unsigned records = 0, characters = 0;
+ for (Record record; in >> record;) {
+ cout << record;
+ assert_good(cout, "stdout");
+ records++;
+ characters += record.seq.size();
+ }
+ assert(in.eof());
+
+ g_total.records += records;
+ g_total.characters += characters;
+}
+
+int main(int argc, char** argv)
+{
+ opt::trimMasked = false;
+
+ if (string(argv[0]).find("tofasta") != string::npos)
+ opt::toFASTQ = false;
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?':
+ die = true;
+ break;
+ case 'i':
+ opt::interleave = true;
+ break;
+ case 'q':
+ arg >> opt::qualityThreshold;
+ break;
+ case 'v':
+ opt::verbose++;
+ break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ typedef void (*F)(const char*);
+ F convertFasta = convert<FastaRecord>;
+ F convertFastq = convert<FastqRecord>;
+ F f = opt::toFASTQ ? convertFastq : convertFasta;
+
+ if (optind == argc) {
+ f("-");
+ } else if (!opt::interleave || argc - optind == 1) {
+ // Concatenate.
+ for_each(argv + optind, argv + argc, f);
+ } else {
+ // Interleave.
+ if (opt::toFASTQ)
+ interleave<FastqRecord>(argv + optind, argv + argc);
+ else
+ interleave<FastaRecord>(argv + optind, argv + argc);
+ }
+
+ if (opt::verbose && argc - optind > 1)
+ cerr << g_total.records << '\t'
+ << g_total.characters << '\t'
+ << "total\n";
+
+ cout.flush();
+ assert_good(cout, "stdout");
+ return 0;
+}
diff --git a/DataLayer/fac.cc b/DataLayer/fac.cc
new file mode 100644
index 0000000..472f667
--- /dev/null
+++ b/DataLayer/fac.cc
@@ -0,0 +1,201 @@
+/** Calculate assembly contiguity statistics.
+ * Written by Shaun Jackman <sjackman at bcgsc.ca>.
+ */
+#include "config.h"
+#include "Common/Histogram.h"
+#include "Common/IOUtil.h"
+#include "Common/Sequence.h" // for isACGT
+#include "DataLayer/FastaReader.h"
+#include "DataLayer/Options.h"
+#include <algorithm>
+#include <getopt.h>
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+#define PROGRAM "abyss-fac"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... [FILE]...\n"
+"Calculate assembly contiguity statistics.\n"
+"\n"
+" -s, -t, --min-length=N ignore sequences shorter than N bp [200]\n"
+" -d, --delimiter=S use S for the field delimiter [\\t]\n"
+" -j, --jira output JIRA format\n"
+" -m, --mmd output MultiMarkdown format\n"
+" --chastity discard unchaste sequences [default]\n"
+" --no-chastity do not discard unchaste sequences\n"
+" --trim-masked trim masked bases from the end\n"
+" --no-trim-masked do not trim masked bases from the ends\n"
+" of sequences [default]\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ static unsigned minLength = 200;
+ static string delimiter = "\t";
+ static int format;
+ static int verbose;
+}
+enum { TAB, JIRA, MMD };
+
+static const char shortopts[] = "d:jms:t:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "min-length", no_argument, NULL, 's' },
+ { "delimiter", required_argument, NULL, 'd' },
+ { "jira", no_argument, NULL, 'j' },
+ { "mmd", no_argument, NULL, 'm' },
+ { "chastity", no_argument, &opt::chastityFilter, 1 },
+ { "no-chastity", no_argument, &opt::chastityFilter, 0 },
+ { "trim-masked", no_argument, &opt::trimMasked, 1 },
+ { "no-trim-masked", no_argument, &opt::trimMasked, 0 },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** FastaReader flags. */
+static const int FASTAREADER_FLAGS = FastaReader::NO_FOLD_CASE;
+
+/** Print contiguity statistics. */
+static void printContiguityStatistics(const char* path)
+{
+ static bool printHeader = true;
+ if (string(path) == "---") {
+ if (printHeader == false)
+ cout << '\n';
+ printHeader = true;
+ return;
+ }
+
+ // Read the sequences and count the lengths.
+ Histogram h;
+ FastaReader in(path, FASTAREADER_FLAGS);
+ for (string s; in >> s;)
+ h.insert(count_if(s.begin(), s.end(), isACGT));
+ assert(in.eof());
+
+ // Print the table header.
+ if (opt::format == JIRA && printHeader) {
+ printHeader = false;
+ const char* sep = "\t||";
+ cout << "||"
+ << "n" << sep
+ << "n:" << opt::minLength << sep
+ << "n:N50" << sep
+ << "min" << sep
+ << "N80" << sep
+ << "N50" << sep
+ << "N20" << sep
+ << "max" << sep
+ << "sum" << sep
+ << "name" << sep << '\n';
+ } else if (opt::format == MMD && printHeader) {
+ printHeader = false;
+ const char* sep = "\t|";
+ cout << "n" << sep
+ << "n:" << opt::minLength << sep
+ << "n:N50" << sep
+ << "min" << sep
+ << "N80" << sep
+ << "N50" << sep
+ << "N20" << sep
+ << "max" << sep
+ << "sum" << sep
+ << "name" << '\n'
+ << "------" << sep
+ << "------" << sep
+ << "------" << sep
+ << "------" << sep
+ << "------" << sep
+ << "------" << sep
+ << "------" << sep
+ << "------" << sep
+ << "------" << sep
+ << "------" << '\n';
+ }
+
+ // Print the table.
+ if (opt::format == JIRA)
+ cout << '|';
+ printContiguityStats(cout, h, opt::minLength,
+ printHeader, opt::delimiter)
+ << opt::delimiter << path;
+ if (opt::format == JIRA)
+ cout << opt::delimiter;
+ cout << endl;
+ printHeader = false;
+}
+
+int main(int argc, char** argv)
+{
+ opt::trimMasked = false;
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?':
+ die = true;
+ break;
+ case 'd':
+ opt::delimiter = arg.str();
+ arg.clear(ios::eofbit);
+ break;
+ case 'j':
+ opt::delimiter = "\t|";
+ opt::format = JIRA;
+ break;
+ case 'm':
+ opt::delimiter = "\t|";
+ opt::format = MMD;
+ break;
+ case 's': case 't':
+ arg >> opt::minLength;
+ break;
+ case 'v':
+ opt::verbose++;
+ break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ if (optind == argc)
+ printContiguityStatistics("-");
+ else
+ for_each(argv + optind, argv + argc,
+ printContiguityStatistics);
+
+ cout.flush();
+ assert_good(cout, "stdout");
+ return 0;
+}
diff --git a/DistanceEst/DistanceEst.cpp b/DistanceEst/DistanceEst.cpp
new file mode 100644
index 0000000..1c3c9ea
--- /dev/null
+++ b/DistanceEst/DistanceEst.cpp
@@ -0,0 +1,549 @@
+#include "Estimate.h"
+#include "Histogram.h"
+#include "IOUtil.h"
+#include "MLE.h"
+#include "PMF.h"
+#include "SAM.h"
+#include "Uncompress.h"
+#include "Graph/Options.h" // for opt::k
+#include <algorithm>
+#include <cassert>
+#include <climits>
+#include <cstdlib>
+#include <fstream>
+#include <getopt.h>
+#include <iomanip>
+#include <iostream>
+#include <iterator> // for istream_iterator
+#include <limits> // for numeric_limits
+#include <sstream>
+#include <string>
+#include <vector>
+#if _OPENMP
+# include <omp.h>
+#endif
+
+using namespace std;
+
+#define PROGRAM "DistanceEst"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Jared Simpson and Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... HIST [PAIR]\n"
+"Estimate distances between contigs using paired-end alignments.\n"
+" HIST distribution of fragments size\n"
+" PAIR alignments between contigs\n"
+"\n"
+" --mind=N minimum distance between contigs [-(k-1)]\n"
+" --maxd=N maximum distance between contigs\n"
+" --fr force the orientation to forward-reverse\n"
+" --rf force the orientation to reverse-forward\n"
+" -k, --kmer=N set --mind to -(k-1) bp\n"
+" -l, --min-align=N the minimal alignment size [1]\n"
+" -n, --npairs=NPAIRS minimum number of pairs\n"
+" -s, --seed-length=L minimum length of the seed contigs\n"
+" -q, --min-mapq=N ignore alignments with mapping quality\n"
+" less than this threshold [10]\n"
+" -o, --out=FILE write result to FILE\n"
+" --mle use the MLE [default]\n"
+" (maximum likelihood estimator)\n"
+" --mean use the difference of the population mean\n"
+" and the sample mean\n"
+" --dist output graph in dist format [default]\n"
+" --dot output graph in dot format\n"
+" -j, --threads=N use N parallel threads [1]\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+/** Which estimator to use. See opt::method. */
+enum { MLE, MEAN };
+
+namespace opt {
+ unsigned k; // used by Estimate.h
+
+ /** Output graph format. */
+ int format = DIST;
+
+ /** The minimal alignment size. */
+ static int minAlign = 1;
+
+ /** Minimum distance between contigs. */
+ static int minDist = numeric_limits<int>::min();
+
+ /** Maximum distance between contigs. */
+ static int maxDist = numeric_limits<int>::max();
+
+ static unsigned seedLen;
+ static unsigned npairs;
+ static unsigned minMapQ = 10;
+
+ /** Reverse-forward mate pair orientation. */
+ static int rf = -1;
+
+ /** Which estimator to use. */
+ static int method = MLE;
+
+ static int verbose;
+ static string out;
+ static int threads = 1;
+}
+
+static const char shortopts[] = "j:k:l:n:o:q:s:v";
+
+enum { OPT_HELP = 1, OPT_VERSION,
+ OPT_MIND, OPT_MAXD, OPT_FR, OPT_RF
+};
+
+static const struct option longopts[] = {
+ { "dist", no_argument, &opt::format, DIST, },
+ { "dot", no_argument, &opt::format, DOT, },
+ { "fr", no_argument, &opt::rf, false },
+ { "rf", no_argument, &opt::rf, true },
+ { "min-align", required_argument, NULL, 'l' },
+ { "mind", required_argument, NULL, OPT_MIND },
+ { "maxd", required_argument, NULL, OPT_MAXD },
+ { "mle", no_argument, &opt::method, MLE },
+ { "mean", no_argument, &opt::method, MEAN },
+ { "kmer", required_argument, NULL, 'k' },
+ { "npairs", required_argument, NULL, 'n' },
+ { "out", required_argument, NULL, 'o' },
+ { "min-mapq", required_argument, NULL, 'q' },
+ { "seed-length", required_argument, NULL, 's' },
+ { "threads", required_argument, NULL, 'j' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** A collection of aligned read pairs. */
+typedef vector<SAMRecord> Pairs;
+
+/** Estimate the distance between two contigs using the difference of
+ * the population mean and the sample mean.
+ * @param numPairs [out] the number of pairs that agree with the
+ * expected distribution
+ * @return the estimated distance
+ */
+static int estimateDistanceUsingMean(
+ const std::vector<int>& samples, const PMF& pmf,
+ unsigned& numPairs)
+{
+ Histogram h(samples.begin(), samples.end());
+ int d = pmf.mean() - h.mean();
+
+ // Count the number of samples that agree with the distribution.
+ unsigned n = 0;
+ for (Histogram::const_iterator it = h.begin();
+ it != h.end(); ++it)
+ if (pmf[it->first + d] > pmf.minProbability())
+ n += it->second;
+
+ numPairs = n;
+ return d;
+}
+
+/** Estimate the distance between two contigs.
+ * @param numPairs [out] the number of pairs that agree with the
+ * expected distribution
+ * @return the estimated distance
+ */
+static int estimateDistance(unsigned len0, unsigned len1,
+ const Pairs& pairs, const PMF& pmf,
+ unsigned& numPairs)
+{
+ // The provisional fragment sizes are calculated as if the contigs
+ // were perfectly adjacent with no overlap or gap.
+ typedef vector<pair<int, int> > Fragments;
+ Fragments fragments;
+ fragments.reserve(pairs.size());
+ for (Pairs::const_iterator it = pairs.begin();
+ it != pairs.end(); ++it) {
+ int a0 = it->targetAtQueryStart();
+ int a1 = it->mateTargetAtQueryStart();
+ if (it->isReverse())
+ a0 = len0 - a0;
+ if (!it->isMateReverse())
+ a1 = len1 - a1;
+ fragments.push_back(opt::rf
+ ? make_pair(a1, len1 + a0)
+ : make_pair(a0, len0 + a1));
+ }
+
+ // Remove duplicate fragments.
+ sort(fragments.begin(), fragments.end());
+ fragments.erase(unique(fragments.begin(), fragments.end()),
+ fragments.end());
+ numPairs = fragments.size();
+ if (numPairs < opt::npairs)
+ return INT_MIN;
+
+ vector<int> fragmentSizes;
+ fragmentSizes.reserve(fragments.size());
+ for (Fragments::const_iterator it = fragments.begin();
+ it != fragments.end(); ++it) {
+ int x = it->second - it->first;
+ if (!opt::rf && x <= 2 * int(opt::minAlign - 1)) {
+ cerr << PROGRAM ": error: The observed fragment of size "
+ << x << " bp is shorter than 2*l "
+ "(l=" << opt::minAlign << "). "
+ "Decrease l to " << x / 2 << ".\n";
+ exit(EXIT_FAILURE);
+ }
+ fragmentSizes.push_back(x);
+ }
+
+ switch (opt::method) {
+ case MLE:
+ // Use the maximum likelihood estimator.
+ return maximumLikelihoodEstimate(opt::minAlign,
+ opt::minDist, opt::maxDist,
+ fragmentSizes, pmf, len0, len1, opt::rf, numPairs);
+ case MEAN:
+ // Use the difference of the population mean
+ // and the sample mean.
+ return estimateDistanceUsingMean(
+ fragmentSizes, pmf, numPairs);
+ default:
+ assert(false);
+ abort();
+ }
+}
+
+static void writeEstimate(ostream& out,
+ const ContigNode& id0, const ContigNode& id1,
+ unsigned len0, unsigned len1,
+ const Pairs& pairs, const PMF& pmf)
+{
+ if (pairs.size() < opt::npairs)
+ return;
+
+ DistanceEst est;
+ est.distance = estimateDistance(len0, len1,
+ pairs, pmf, est.numPairs);
+ est.stdDev = pmf.getSampleStdDev(est.numPairs);
+
+ std::pair<ContigNode, ContigNode> e(id0, id1 ^ id0.sense());
+ if (est.numPairs >= opt::npairs) {
+ if (opt::format == DOT) {
+#pragma omp critical(out)
+ out << get(g_contigNames, e) << " [" << est << "]\n";
+ } else
+ out << ' ' << get(g_contigNames, id1) << ',' << est;
+ } else if (opt::verbose > 1) {
+#pragma omp critical(cerr)
+ cerr << "warning: " << get(g_contigNames, e)
+ << " [d=" << est.distance << "] "
+ << est.numPairs << " of " << pairs.size()
+ << " pairs fit the expected distribution\n";
+ }
+}
+
+/** Generate distance estimates for the specified alignments. */
+static void writeEstimates(ostream& out,
+ const vector<SAMRecord>& pairs,
+ const vector<unsigned>& lengthVec, const PMF& pmf)
+{
+ assert(!pairs.empty());
+ ContigID id0(get(g_contigNames, pairs.front().rname));
+ assert(id0 < lengthVec.size());
+ unsigned len0 = lengthVec[id0];
+ if (len0 < opt::seedLen)
+ return; // Skip contigs shorter than the seed length.
+
+ ostringstream ss;
+ if (opt::format == DIST)
+ ss << pairs.front().rname;
+
+ typedef map<ContigNode, Pairs> PairsMap;
+ PairsMap dataMap[2];
+ for (Pairs::const_iterator it = pairs.begin();
+ it != pairs.end(); ++it)
+ dataMap[it->isReverse()][find_vertex(
+ it->mrnm, it->isReverse() == it->isMateReverse(),
+ g_contigNames)]
+ .push_back(*it);
+
+ for (int sense0 = false; sense0 <= true; sense0++) {
+ if (opt::format == DIST && sense0)
+ ss << " ;";
+ const PairsMap& x = dataMap[sense0 ^ opt::rf];
+ for (PairsMap::const_iterator it = x.begin();
+ it != x.end(); ++it)
+ writeEstimate(opt::format == DOT ? out : ss,
+ ContigNode(id0, sense0), it->first,
+ len0, lengthVec[it->first.id()],
+ it->second, pmf);
+ }
+ if (opt::format == DIST)
+#pragma omp critical(out)
+ out << ss.str() << '\n';
+ assert(out.good());
+}
+
+/** Load a histogram from the specified file. */
+static Histogram loadHist(const string& path)
+{
+ ifstream in(path.c_str());
+ assert_good(in, path);
+
+ Histogram hist;
+ in >> hist;
+ assert(in.eof());
+
+ if (hist.empty()) {
+ cerr << "error: the histogram `" << path << "' is empty\n";
+ exit(EXIT_FAILURE);
+ }
+ return hist;
+}
+
+/** Read contig lengths from SAM headers. */
+static void readContigLengths(istream& in, vector<unsigned>& lengths)
+{
+ assert(in);
+ assert(lengths.empty());
+ assert(g_contigNames.empty());
+ for (string line; in.peek() == '@' && getline(in, line);) {
+ istringstream ss(line);
+ string type;
+ ss >> type;
+ if (type != "@SQ")
+ continue;
+
+ string s;
+ unsigned len;
+ ss >> expect(" SN:") >> s >> expect(" LN:") >> len;
+ assert(ss);
+
+ put(g_contigNames, lengths.size(), s);
+ lengths.push_back(len);
+ }
+ if (lengths.empty()) {
+ cerr << PROGRAM ": error: no @SQ records in the SAM header\n";
+ exit(EXIT_FAILURE);
+ }
+}
+
+/** Copy records from [it, last) to out and stop before alignments to
+ * the next target sequence.
+ * @param[in,out] it an input iterator
+ */
+template<typename It>
+static void readPairs(It& it, const It& last, vector<SAMRecord>& out)
+{
+ assert(out.empty());
+ for (; it != last; ++it) {
+ if (it->isUnmapped() || it->isMateUnmapped()
+ || !it->isPaired() || it->rname == it->mrnm
+ || it->mapq < opt::minMapQ)
+ continue;
+ if (!out.empty() && out.back().rname != it->rname)
+ break;
+
+ out.push_back(*it);
+ SAMRecord& sam = out.back();
+ // Clear unused fields.
+ sam.qname.clear();
+#if SAM_SEQ_QUAL
+ sam.seq.clear();
+ sam.qual.clear();
+#endif
+ }
+
+ // Check that the input is sorted.
+ if (it != last && !out.empty()
+ && get(g_contigNames, it->rname)
+ < get(g_contigNames, out.front().rname)) {
+ cerr << "error: input must be sorted: saw `"
+ << out.front().rname << "' before `"
+ << it->rname << "'\n";
+ exit(EXIT_FAILURE);
+ }
+}
+
+int main(int argc, char** argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case OPT_MIND:
+ arg >> opt::minDist;
+ break;
+ case OPT_MAXD:
+ arg >> opt::maxDist;
+ break;
+ case 'l':
+ arg >> opt::minAlign;
+ break;
+ case 'j': arg >> opt::threads; break;
+ case 'k': arg >> opt::k; break;
+ case 'n': arg >> opt::npairs; break;
+ case 'o': arg >> opt::out; break;
+ case 'q': arg >> opt::minMapQ; break;
+ case 's': arg >> opt::seedLen; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (opt::seedLen <= 0) {
+ cerr << PROGRAM ": missing -s,--seed-length option\n";
+ die = true;
+ }
+
+ if (opt::npairs <= 0) {
+ cerr << PROGRAM ": missing -n,--npairs option\n";
+ die = true;
+ }
+
+ if (argc - optind < 1) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ } else if (argc - optind > 2) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ if (opt::seedLen < 2*opt::k)
+ cerr << "warning: the seed-length should be at least twice k:"
+ " k=" << opt::k << ", s=" << opt::seedLen << '\n';
+
+ assert(opt::minAlign > 0);
+
+#if _OPENMP
+ if (opt::threads > 0)
+ omp_set_num_threads(opt::threads);
+#endif
+
+ string distanceCountFile(argv[optind++]);
+ string alignFile(argv[optind] == NULL ? "-" : argv[optind++]);
+
+ ifstream inFile(alignFile.c_str());
+ istream& in(strcmp(alignFile.c_str(), "-") == 0 ? cin : inFile);
+
+ if (strcmp(alignFile.c_str(), "-") != 0)
+ assert_good(inFile, alignFile);
+
+ ofstream outFile;
+ if (!opt::out.empty()) {
+ outFile.open(opt::out.c_str());
+ assert(outFile.is_open());
+ }
+ ostream& out = opt::out.empty() ? cout : outFile;
+
+ if (opt::format == DOT)
+ out << "digraph dist {\ngraph ["
+ "k=" << opt::k << " "
+ "s=" << opt::seedLen << " "
+ "n=" << opt::npairs << "]\n";
+
+ // The fragment size histogram may not be written out until after
+ // the alignments complete. Wait for the alignments to complete.
+ in.peek();
+
+ // Read the fragment size distribution.
+ Histogram distanceHist = loadHist(distanceCountFile);
+ unsigned numRF = distanceHist.count(INT_MIN, 0);
+ unsigned numFR = distanceHist.count(1, INT_MAX);
+ unsigned numTotal = distanceHist.size();
+ bool libRF = numFR < numRF;
+ if (opt::verbose > 0) {
+ cerr << "Mate orientation FR: " << numFR << setprecision(3)
+ << " (" << (float)100*numFR/numTotal << "%)"
+ << " RF: " << numRF << setprecision(3)
+ << " (" << (float)100*numRF/numTotal << "%)\n"
+ << "The library " << distanceCountFile << " is oriented "
+ << (libRF
+ ? "reverse-forward (RF)" : "forward-reverse (FR)")
+ << ".\n";
+ }
+
+ // Determine the orientation of the library.
+ if (opt::rf == -1)
+ opt::rf = libRF;
+ if (opt::rf)
+ distanceHist = distanceHist.negate();
+ if (opt::rf != libRF)
+ cerr << "warning: The orientation is forced to "
+ << (opt::rf
+ ? "reverse-forward (RF)" : "forward-reverse (FR)")
+ << " which differs from the detected orientation.\n";
+
+ distanceHist.eraseNegative();
+ distanceHist.removeNoise();
+ distanceHist.removeOutliers();
+ Histogram h = distanceHist.trimFraction(0.0001);
+ if (opt::verbose > 0)
+ cerr << "Stats mean: " << setprecision(4) << h.mean() << " "
+ "median: " << setprecision(4) << h.median() << " "
+ "sd: " << setprecision(4) << h.sd() << " "
+ "n: " << h.size() << " "
+ "min: " << h.minimum() << " max: " << h.maximum() << '\n'
+ << h.barplot() << endl;
+ PMF pmf(h);
+
+ if (opt::minDist == numeric_limits<int>::min())
+ opt::minDist = -opt::k + 1;
+ if (opt::maxDist == numeric_limits<int>::max())
+ opt::maxDist = pmf.maxValue();
+ if (opt::verbose > 0)
+ cerr << "Minimum and maximum distance are set to "
+ << opt::minDist << " and " << opt::maxDist << " bp.\n";
+ assert(opt::minDist < opt::maxDist);
+
+ // Read the contig lengths.
+ vector<unsigned> contigLens;
+ readContigLengths(in, contigLens);
+ g_contigNames.lock();
+
+ // Estimate the distances between contigs.
+ istream_iterator<SAMRecord> it(in), last;
+ assert(in);
+#pragma omp parallel
+ for (vector<SAMRecord> records;;) {
+ records.clear();
+#pragma omp critical(in)
+ readPairs(it, last, records);
+ if (records.empty())
+ break;
+ writeEstimates(out, records, contigLens, pmf);
+ }
+ assert(in.eof());
+
+ if (opt::format == DOT)
+ out << "}\n";
+ return 0;
+}
diff --git a/DistanceEst/MLE.cpp b/DistanceEst/MLE.cpp
new file mode 100644
index 0000000..d91e259
--- /dev/null
+++ b/DistanceEst/MLE.cpp
@@ -0,0 +1,157 @@
+#include "MLE.h"
+#include "PMF.h"
+#include <boost/tuple/tuple.hpp>
+#include <algorithm> // for swap
+#include <cassert>
+#include <limits> // for numeric_limits
+#include <utility>
+
+using namespace std;
+using boost::tie;
+
+/** This window function is a triangle with a flat top, or a rectangle
+ * with sloped sides.
+ */
+class WindowFunction {
+ public:
+ WindowFunction(int len0, int len1)
+ : x1(len0), x2(len1), x3(len0 + len1)
+ {
+ assert(len0 > 0);
+ assert(len1 > 0);
+ assert(len0 <= len1);
+ }
+
+ /** Return this window function evaluated at x. */
+ double operator()(int x) const
+ {
+ return (x <= 0 ? 1
+ : x < x1 ? x
+ : x < x2 ? x1
+ : x < x3 ? x3 - x
+ : 1) / (double)x1;
+ }
+
+ private:
+ /** Parameters of this window function. */
+ int x1, x2, x3;
+};
+
+/** Compute the log likelihood that these samples came from the
+ * specified distribution shifted by the parameter theta.
+ * @param theta the parameter of the PMF, f_theta(x)
+ * @param samples the samples
+ * @param pmf the probability mass function
+ * @return the log likelihood
+ */
+static pair<double, unsigned>
+computeLikelihood(int theta, const Histogram& samples, const PMF& pmf)
+{
+ double likelihood = 0;
+ unsigned nsamples = 0;
+ for (Histogram::const_iterator it = samples.begin();
+ it != samples.end(); ++it) {
+ double p = pmf[it->first + theta];
+ unsigned n = it->second;
+ likelihood += n * log(p);
+ if (p > pmf.minProbability())
+ nsamples += n;
+ }
+ return make_pair(likelihood, nsamples);
+}
+
+/** Return the most likely distance between two contigs and the number
+ * of pairs that support that estimate. */
+static pair<int, unsigned>
+maximumLikelihoodEstimate(int first, int last,
+ const Histogram& samples,
+ const PMF& pmf,
+ unsigned len0, unsigned len1)
+{
+ first = max(first, (int)pmf.minValue() - samples.maximum());
+ last = min(last, (int)pmf.maxValue() - samples.minimum());
+
+ /* When randomly selecting fragments that span a given point,
+ * longer fragments are more likely to be selected than
+ * shorter fragments.
+ */
+ WindowFunction window(len0, len1);
+
+ unsigned nsamples = samples.size();
+ double bestLikelihood = -numeric_limits<double>::max();
+ int bestTheta = first;
+ unsigned bestn = 0;
+ for (int theta = first; theta <= last; theta++) {
+ // Calculate the normalizing constant of the PMF, f_theta(x).
+ double c = 0;
+ for (int i = pmf.minValue(); i <= (int)pmf.maxValue(); ++i)
+ c += pmf[i] * window(i - theta);
+
+ double likelihood;
+ unsigned n;
+ tie(likelihood, n) = computeLikelihood(theta, samples, pmf);
+ likelihood -= nsamples * log(c);
+ if (n > 0 && likelihood > bestLikelihood) {
+ bestLikelihood = likelihood;
+ bestTheta = theta;
+ bestn = n;
+ }
+ }
+ return make_pair(bestTheta, bestn);
+}
+
+/** Return the most likely distance between two contigs and the number
+ * of pairs that support that distance estimate.
+ * @param len0 the length of the first contig in bp
+ * @param len1 the length of the second contig in bp
+ * @param rf whether the fragment library is oriented reverse-forward
+ * @param[out] n the number of samples with a non-zero probability
+ */
+int maximumLikelihoodEstimate(unsigned l,
+ int first, int last,
+ const vector<int>& samples, const PMF& pmf,
+ unsigned len0, unsigned len1, bool rf,
+ unsigned& n)
+{
+ assert(first < last);
+ assert(!samples.empty());
+
+ // The aligner is unable to map reads to the ends of the sequence.
+ // Correct for this lack of sensitivity by subtracting l-1 bp from
+ // the length of each sequence, where the aligner requires a match
+ // of at least l bp. When the fragment library is oriented
+ // forward-reverse, subtract 2*(l-1) from each sample.
+ assert(l > 0);
+ assert(len0 >= l);
+ assert(len1 >= l);
+ len0 -= l - 1;
+ len1 -= l - 1;
+
+ if (len0 > len1)
+ swap(len0, len1);
+
+ if (rf) {
+ // This library is oriented reverse-forward.
+ Histogram h(samples.begin(), samples.end());
+ int d;
+ tie(d, n) = maximumLikelihoodEstimate(
+ first, last, h,
+ pmf, len0, len1);
+ return d;
+ } else {
+ // This library is oriented forward-reverse.
+ // Subtract 2*(l-1) from each sample.
+ Histogram h;
+ typedef vector<int> Samples;
+ for (Samples::const_iterator it = samples.begin();
+ it != samples.end(); ++it) {
+ assert(*it > 2 * (int)(l - 1));
+ h.insert(*it - 2 * (l - 1));
+ }
+ int d;
+ tie(d, n) = maximumLikelihoodEstimate(
+ 0, last, h,
+ pmf, len0, len1);
+ return max(first, d - 2 * (int)(l - 1));
+ }
+}
diff --git a/DistanceEst/MLE.h b/DistanceEst/MLE.h
new file mode 100644
index 0000000..1588565
--- /dev/null
+++ b/DistanceEst/MLE.h
@@ -0,0 +1,13 @@
+#ifndef MLE_H
+#define MLE_H 1
+
+#include <vector>
+
+class PMF;
+
+int maximumLikelihoodEstimate(unsigned k,
+ int first, int last,
+ const std::vector<int>& samples, const PMF& pmf,
+ unsigned len0, unsigned len1, bool rf, unsigned& n);
+
+#endif
diff --git a/DistanceEst/Makefile.am b/DistanceEst/Makefile.am
new file mode 100644
index 0000000..f192324
--- /dev/null
+++ b/DistanceEst/Makefile.am
@@ -0,0 +1,11 @@
+bin_PROGRAMS = DistanceEst
+
+DistanceEst_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+DistanceEst_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+
+DistanceEst_LDADD = \
+ $(top_builddir)/Common/libcommon.a
+
+DistanceEst_SOURCES = DistanceEst.cpp MLE.cpp MLE.h
diff --git a/DistanceEst/Makefile.in b/DistanceEst/Makefile.in
new file mode 100644
index 0000000..7807ed6
--- /dev/null
+++ b/DistanceEst/Makefile.in
@@ -0,0 +1,547 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = DistanceEst$(EXEEXT)
+subdir = DistanceEst
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_DistanceEst_OBJECTS = DistanceEst-DistanceEst.$(OBJEXT) \
+ DistanceEst-MLE.$(OBJEXT)
+DistanceEst_OBJECTS = $(am_DistanceEst_OBJECTS)
+DistanceEst_DEPENDENCIES = $(top_builddir)/Common/libcommon.a
+DistanceEst_LINK = $(CXXLD) $(DistanceEst_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(DistanceEst_SOURCES)
+DIST_SOURCES = $(DistanceEst_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+DistanceEst_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+DistanceEst_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+DistanceEst_LDADD = \
+ $(top_builddir)/Common/libcommon.a
+
+DistanceEst_SOURCES = DistanceEst.cpp MLE.cpp MLE.h
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign DistanceEst/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign DistanceEst/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+DistanceEst$(EXEEXT): $(DistanceEst_OBJECTS) $(DistanceEst_DEPENDENCIES) $(EXTRA_DistanceEst_DEPENDENCIES)
+ @rm -f DistanceEst$(EXEEXT)
+ $(DistanceEst_LINK) $(DistanceEst_OBJECTS) $(DistanceEst_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/DistanceEst-DistanceEst.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/DistanceEst-MLE.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+DistanceEst-DistanceEst.o: DistanceEst.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DistanceEst_CPPFLAGS) $(CPPFLAGS) $(DistanceEst_CXXFLAGS) $(CXXFLAGS) -MT DistanceEst-DistanceEst.o -MD -MP -MF $(DEPDIR)/DistanceEst-DistanceEst.Tpo -c -o DistanceEst-DistanceEst.o `test -f 'DistanceEst.cpp' || echo '$(srcdir)/'`DistanceEst.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/DistanceEst-DistanceEst.Tpo $(DEPDIR)/DistanceEst-DistanceEst.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DistanceEst.cpp' object='DistanceEst-DistanceEst.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DistanceEst_CPPFLAGS) $(CPPFLAGS) $(DistanceEst_CXXFLAGS) $(CXXFLAGS) -c -o DistanceEst-DistanceEst.o `test -f 'DistanceEst.cpp' || echo '$(srcdir)/'`DistanceEst.cpp
+
+DistanceEst-DistanceEst.obj: DistanceEst.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DistanceEst_CPPFLAGS) $(CPPFLAGS) $(DistanceEst_CXXFLAGS) $(CXXFLAGS) -MT DistanceEst-DistanceEst.obj -MD -MP -MF $(DEPDIR)/DistanceEst-DistanceEst.Tpo -c -o DistanceEst-DistanceEst.obj `if test -f 'DistanceEst.cpp'; then $(CYGPATH_W) 'DistanceEst.cpp'; else $(CYGPATH_W) '$(srcdir)/DistanceEst.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/DistanceEst-DistanceEst.Tpo $(DEPDIR)/DistanceEst-DistanceEst.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='DistanceEst.cpp' object='DistanceEst-DistanceEst.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DistanceEst_CPPFLAGS) $(CPPFLAGS) $(DistanceEst_CXXFLAGS) $(CXXFLAGS) -c -o DistanceEst-DistanceEst.obj `if test -f 'DistanceEst.cpp'; then $(CYGPATH_W) 'DistanceEst.cpp'; else $(CYGPATH_W) '$(srcdir)/DistanceEst.cpp'; fi`
+
+DistanceEst-MLE.o: MLE.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DistanceEst_CPPFLAGS) $(CPPFLAGS) $(DistanceEst_CXXFLAGS) $(CXXFLAGS) -MT DistanceEst-MLE.o -MD -MP -MF $(DEPDIR)/DistanceEst-MLE.Tpo -c -o DistanceEst-MLE.o `test -f 'MLE.cpp' || echo '$(srcdir)/'`MLE.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/DistanceEst-MLE.Tpo $(DEPDIR)/DistanceEst-MLE.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MLE.cpp' object='DistanceEst-MLE.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DistanceEst_CPPFLAGS) $(CPPFLAGS) $(DistanceEst_CXXFLAGS) $(CXXFLAGS) -c -o DistanceEst-MLE.o `test -f 'MLE.cpp' || echo '$(srcdir)/'`MLE.cpp
+
+DistanceEst-MLE.obj: MLE.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DistanceEst_CPPFLAGS) $(CPPFLAGS) $(DistanceEst_CXXFLAGS) $(CXXFLAGS) -MT DistanceEst-MLE.obj -MD -MP -MF $(DEPDIR)/DistanceEst-MLE.Tpo -c -o DistanceEst-MLE.obj `if test -f 'MLE.cpp'; then $(CYGPATH_W) 'MLE.cpp'; else $(CYGPATH_W) '$(srcdir)/MLE.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/DistanceEst-MLE.Tpo $(DEPDIR)/DistanceEst-MLE.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MLE.cpp' object='DistanceEst-MLE.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(DistanceEst_CPPFLAGS) $(CPPFLAGS) $(DistanceEst_CXXFLAGS) $(CXXFLAGS) -c -o DistanceEst-MLE.obj `if test -f 'MLE.cpp'; then $(CYGPATH_W) 'MLE.cpp'; else $(CYGPATH_W) '$(srcdir)/MLE.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/FMIndex/BitArrays.h b/FMIndex/BitArrays.h
new file mode 100644
index 0000000..113e037
--- /dev/null
+++ b/FMIndex/BitArrays.h
@@ -0,0 +1,120 @@
+#ifndef BITARRAYS_H
+#define BITARRAYS_H 1
+
+#include "bit_array.h"
+#include <algorithm>
+#include <cassert>
+#include <functional>
+#include <istream>
+#include <limits> // for numeric_limits
+#include <ostream>
+#include <stdint.h>
+#include <vector>
+
+/** Store a string of symbols from a small alphabet using a vector of
+ * BitArray.
+ */
+class BitArrays
+{
+ /** A symbol. */
+ typedef uint8_t T;
+
+ /** The sentinel symbol. */
+ static T SENTINEL() { return std::numeric_limits<T>::max(); }
+
+ public:
+
+/** Count the occurrences of the symbols of [first, last). */
+template<typename It>
+void assign(It first, It last)
+{
+ assert(first < last);
+ m_data.clear();
+
+ // Determine the size of the alphabet ignoring the sentinel.
+ T n = 0;
+ for (It it = first; it != last; ++it)
+ if (*it != SENTINEL())
+ n = std::max(n, *it);
+ n++;
+
+ assert(n < std::numeric_limits<T>::max());
+ m_data.resize(n, wat_array::BitArray(last - first));
+
+ size_t i = 0;
+ for (It it = first; it != last; ++it, ++i) {
+ T c = *it;
+ if (c == SENTINEL())
+ continue;
+ assert(c < m_data.size());
+ m_data[c].SetBit(1, i);
+ }
+
+ std::for_each(m_data.begin(), m_data.end(),
+ std::mem_fun_ref(&wat_array::BitArray::Build));
+}
+
+/** Return the size of the string. */
+size_t size() const
+{
+ assert(!m_data.empty());
+ return m_data.front().length();
+}
+
+/** Return the number of occurrences of the specified symbol. */
+size_t count(T c) const
+{
+ return m_data[c].one_num();
+}
+
+/** Return the count of symbol c in s[0, i). */
+size_t rank(T c, size_t i) const
+{
+ return m_data[c].Rank(1, i);
+}
+
+/** Return the symbol at the specified position. */
+T at(size_t i) const
+{
+ assert(!m_data.empty());
+ assert(i < m_data.front().length());
+ for (Data::const_iterator it = m_data.begin();
+ it != m_data.end(); ++it)
+ if (it->Lookup(i))
+ return it - m_data.begin();
+ return std::numeric_limits<T>::max();
+}
+
+/** Store this data structure. */
+friend std::ostream& operator<<(std::ostream& out, const BitArrays& o)
+{
+ uint32_t n = o.m_data.size();
+ out.write(reinterpret_cast<char*>(&n), sizeof n);
+ for (Data::const_iterator it = o.m_data.begin();
+ it != o.m_data.end(); ++it)
+ it->Save(out);
+ return out;
+}
+
+/** Load this data structure. */
+friend std::istream& operator>>(std::istream& in, BitArrays& o)
+{
+ o.m_data.clear();
+ uint32_t n = 0;
+ if (!in.read(reinterpret_cast<char*>(&n), sizeof n))
+ return in;
+ assert(n > 0);
+ assert(n < std::numeric_limits<T>::max());
+ o.m_data.resize(n);
+ for (Data::iterator it = o.m_data.begin();
+ it != o.m_data.end(); ++it)
+ it->Load(in);
+ return in;
+}
+
+ private:
+ typedef std::vector<wat_array::BitArray> Data;
+ Data m_data;
+};
+
+#endif
diff --git a/FMIndex/DAWG.h b/FMIndex/DAWG.h
new file mode 100644
index 0000000..89edd2e
--- /dev/null
+++ b/FMIndex/DAWG.h
@@ -0,0 +1,176 @@
+/* Directed acyclic word graph. */
+#ifndef DAWG_H
+#define DAWG_H 1
+
+#include "FMIndex.h"
+#include <boost/graph/graph_traits.hpp>
+#include <boost/graph/properties.hpp>
+#include <algorithm> // for distance
+#include <cassert>
+#include <utility>
+
+using boost::graph_traits;
+
+/** An FM-index is a representation of a DAWG. */
+typedef FMIndex DAWG;
+
+// Graph
+
+namespace boost {
+
+template <>
+struct graph_traits<DAWG> {
+ typedef DAWG::size_type size_type;
+
+ // Graph
+ typedef std::pair<size_type, size_type> vertex_descriptor;
+ typedef boost::directed_tag directed_category;
+ struct traversal_category : boost::incidence_graph_tag { };
+ typedef boost::disallow_parallel_edge_tag edge_parallel_category;
+
+ // IncidenceGraph
+ typedef std::pair<vertex_descriptor, vertex_descriptor>
+ edge_descriptor;
+ typedef unsigned degree_size_type;
+
+// VertexListGraph
+
+/** Vertex iterator. */
+struct vertex_iterator : public vertex_descriptor {
+ vertex_iterator() : vertex_descriptor(0, 0) { }
+ vertex_iterator(size_type l, size_type u)
+ : vertex_descriptor(l, u) { }
+ vertex_descriptor operator*() const { return *this; };
+};
+
+// IncidenceGraph
+
+/** Out edge iterator. */
+class out_edge_iterator
+ : public std::iterator<std::input_iterator_tag, edge_descriptor>
+{
+ public:
+ out_edge_iterator() : m_g(NULL), m_u(), m_v(), m_i(0) { }
+
+ out_edge_iterator(const DAWG& g, vertex_descriptor u,
+ degree_size_type i)
+ : m_g(&g), m_u(u), m_v(), m_i(i)
+ {
+ next();
+ }
+
+ edge_descriptor operator*() const
+ {
+ return edge_descriptor(m_u, m_v);
+ }
+
+ bool operator==(const out_edge_iterator& it) const
+ {
+ return m_g == it.m_g && m_u == it.m_u && m_i == it.m_i;
+ }
+
+ bool operator!=(const out_edge_iterator& it) const
+ {
+ return !(*this == it);
+ }
+
+ out_edge_iterator& operator++()
+ {
+ assert(m_i < m_g->alphabetSize());
+ ++m_i;
+ next();
+ return *this;
+ }
+
+ out_edge_iterator operator++(int)
+ {
+ out_edge_iterator it = *this;
+ ++*this;
+ return it;
+ }
+
+ private:
+ /** Skip to the next edge that is present. */
+ void next()
+ {
+ for (; m_i < m_g->alphabetSize(); m_i++) {
+ m_v = vertex_descriptor(
+ m_g->update(m_u.first, m_i),
+ m_g->update(m_u.second, m_i));
+ if (m_v.first < m_v.second)
+ break;
+ }
+ }
+
+ const DAWG* m_g;
+ vertex_descriptor m_u;
+ vertex_descriptor m_v;
+ degree_size_type m_i;
+}; // out_edge_iterator
+
+}; // graph_traits<DAWG>
+
+} // namespace boost
+
+// IncidenceGraph
+
+static inline
+std::pair<
+ graph_traits<DAWG>::out_edge_iterator,
+ graph_traits<DAWG>::out_edge_iterator>
+out_edges(
+ graph_traits<DAWG>::vertex_descriptor u,
+ const DAWG& g)
+{
+ typedef graph_traits<DAWG>::out_edge_iterator Eit;
+ return std::pair<Eit, Eit>(
+ Eit(g, u, 0),
+ Eit(g, u, g.alphabetSize()));
+}
+
+static inline
+graph_traits<DAWG>::degree_size_type
+out_degree(
+ graph_traits<DAWG>::vertex_descriptor u,
+ const DAWG& g)
+{
+ typedef graph_traits<DAWG>::out_edge_iterator Eit;
+ std::pair<Eit, Eit> it = out_edges(u, g);
+ return std::distance(it.first, it.second);
+}
+
+// VertexListGraph
+
+static inline
+std::pair<graph_traits<DAWG>::vertex_iterator,
+ graph_traits<DAWG>::vertex_iterator>
+vertices(const DAWG& g)
+{
+ typedef graph_traits<DAWG>::vertex_iterator Vit;
+ return std::pair<Vit, Vit>(Vit(0, g.size() + 1), Vit());
+}
+
+// PropertyGraph
+
+static inline
+DAWG::value_type
+get(boost::vertex_name_t,
+ const DAWG& g,
+ graph_traits<DAWG>::vertex_descriptor u)
+{
+ assert(u.first < u.second);
+ return u.first == 0 ? '$' : g.symbolAt(u.first);
+}
+
+static inline
+DAWG::value_type
+get(boost::edge_name_t,
+ const DAWG& g,
+ graph_traits<DAWG>::edge_descriptor e)
+{
+ graph_traits<DAWG>::vertex_descriptor v = target(e, g);
+ assert(v.first < v.second);
+ return g.symbolAt(v.first);
+}
+
+#endif
diff --git a/FMIndex/FMIndex.h b/FMIndex/FMIndex.h
new file mode 100644
index 0000000..2334c76
--- /dev/null
+++ b/FMIndex/FMIndex.h
@@ -0,0 +1,583 @@
+#ifndef FMINDEX_H
+#define FMINDEX_H 1
+
+#include "config.h"
+#include "BitArrays.h"
+#include "IOUtil.h"
+#include "sais.hxx"
+#include <boost/integer.hpp>
+#include <algorithm>
+#include <cassert>
+#include <cstdlib> // for exit
+#include <iostream>
+#include <iterator>
+#include <limits> // for numeric_limits
+#include <stdint.h>
+#include <string>
+#include <vector>
+
+/** An FM index. */
+class FMIndex
+{
+ /** A symbol. */
+ typedef uint8_t T;
+
+ /** The sentinel symbol. */
+ static T SENTINEL() { return std::numeric_limits<T>::max(); }
+
+ public:
+ /** An index. */
+ typedef boost::uint_t<FMBITS>::least size_type;
+
+ /** An index for SAIS, which must be signed. */
+ typedef boost::int_t<FMBITS>::least sais_size_type;
+
+ /** The type of a symbol. */
+ typedef T value_type;
+
+/** A suffix array interval. */
+struct SAInterval
+{
+ size_type l, u;
+ SAInterval(size_type l, size_type u) : l(l), u(u) { }
+ SAInterval(const FMIndex& fm) : l(1), u(fm.m_occ.size()) { }
+ bool empty() const { return l >= u; }
+ bool operator==(const SAInterval& x) const
+ {
+ return x.l == l && x.u == u;
+ }
+
+ size_type size() const
+ {
+ assert(l <= u);
+ return u - l;
+ }
+};
+
+/** A match of a substring of a query sequence to an FM index. */
+struct Match : public SAInterval
+{
+ unsigned qstart, qend;
+
+ Match(size_type l, size_type u, unsigned qstart, unsigned qend)
+ : SAInterval(l, u), qstart(qstart), qend(qend) { }
+
+ unsigned qspan() const
+ {
+ assert(qstart <= qend);
+ return qend - qstart;
+ }
+};
+
+FMIndex() : m_sampleSA(1) { }
+
+/** Return the size of the string not counting the sentinel. */
+size_t size() const { return m_occ.size() - 1; }
+
+/** The size of the alphabet. */
+unsigned alphabetSize() const { return m_alphabet.size(); }
+
+/** Encode the alphabet of [first, last). */
+template <typename It>
+void encode(It first, It last) const
+{
+ assert(first < last);
+ assert(!m_alphabet.empty());
+ std::transform(first, last, first, Translate(*this));
+}
+
+/** Decode the alphabet of [first, last). */
+template <typename It>
+void decode(It first, It last) const
+{
+ assert(first < last);
+ assert(!m_alphabet.empty());
+ for (It it = first; it < last; ++it)
+ *it = m_alphabet[*it];
+}
+
+/** Build the BWT of [first, last).
+ * The BWT including the sentinel is stored in [first, last].
+ * @return the position of the sentinel
+ */
+template<typename It>
+size_type buildBWT(It first, It last) const
+{
+ assert(first < last);
+ assert(size_t(last - first)
+ < std::numeric_limits<size_type>::max());
+ encode(first, last);
+ std::replace(first, last, SENTINEL(), T(0));
+
+ std::cerr << "Building the Burrows-Wheeler transform...\n";
+ size_t n = last - first;
+ std::vector<sais_size_type> sa(n);
+ assert(sizeof (size_type) == sizeof (sais_size_type));
+ sais_size_type sentinel = saisxx_bwt(first, first,
+ &sa[0],
+ (sais_size_type)n,
+ (sais_size_type)m_alphabet.size());
+ assert(sentinel >= 0);
+ if (sentinel < 0)
+ abort();
+ // Insert the sentinel.
+ std::copy_backward(first + sentinel, last, last + 1);
+ first[sentinel] = SENTINEL();
+ return sentinel;
+}
+
+/** Set the specified element of the sampled suffix array. */
+void setSA(size_t sai, size_t pos)
+{
+ if (sai % m_sampleSA == 0) {
+ size_t i = sai / m_sampleSA;
+ assert(i < m_sa.size());
+ m_sa[i] = pos;
+ }
+}
+
+/** Construct the suffix array from the FM index. */
+void constructSuffixArray()
+{
+ // The length of the original string.
+ size_t n = m_occ.size() - 1;
+ assert(n > 0);
+ assert(m_sampleSA > 0);
+ m_sa.resize(n / m_sampleSA + 1);
+ size_t sai = 0;
+ for (size_t i = n; i > 0; i--) {
+ setSA(sai, i);
+ T c = m_occ.at(sai);
+ assert(c != SENTINEL());
+ sai = m_cf[c] + m_occ.rank(c, sai);
+ assert(sai > 0);
+ }
+ setSA(sai, 0);
+}
+
+/** Build an FM-index of the specified BWT. */
+template<typename It>
+void assignBWT(It first, It last)
+{
+ assert(last - first > 1);
+ assert(size_t(last - first)
+ < std::numeric_limits<size_type>::max());
+
+ std::cerr << "Building the character occurrence table...\n";
+ m_occ.assign(first, last);
+ countOccurrences();
+
+ // Construct the suffix array from the FM index.
+ std::cerr << "Building the suffix array...\n";
+ constructSuffixArray();
+}
+
+/** Build an FM-index of the specified data. */
+template<typename It>
+void assign(It first, It last)
+{
+ assert(first < last);
+ assert(size_t(last - first)
+ < std::numeric_limits<size_type>::max());
+
+ encode(first, last);
+ std::replace(first, last, SENTINEL(), T(0));
+
+ // Construct the suffix array.
+ std::cerr << "Building the suffix array...\n";
+ size_t n = last - first;
+ m_sampleSA = 1;
+ m_sa.resize(n + 1);
+ m_sa[0] = n;
+
+ assert(sizeof (size_type) == sizeof (sais_size_type));
+ int status = saisxx(first,
+ reinterpret_cast<sais_size_type*>(&m_sa[1]),
+ (sais_size_type)n,
+ (sais_size_type)m_alphabet.size());
+ assert(status == 0);
+ if (status != 0)
+ abort();
+
+ // Construct the Burrows-Wheeler transform.
+ std::vector<T> bwt;
+ std::cerr << "Building the Burrows-Wheeler transform...\n";
+ bwt.resize(m_sa.size());
+ for (size_t i = 0; i < m_sa.size(); i++)
+ bwt[i] = m_sa[i] == 0 ? SENTINEL() : first[m_sa[i] - 1];
+
+ std::cerr << "Building the character occurrence table...\n";
+ m_occ.assign(bwt.begin(), bwt.end());
+ countOccurrences();
+}
+
+/** Sample the suffix array. */
+void sampleSA(unsigned period)
+{
+ assert(period > 0);
+ if (period == m_sampleSA)
+ return;
+ assert(m_sampleSA == 1);
+ m_sampleSA = period;
+ if (m_sampleSA == 1 || m_sa.empty())
+ return;
+ std::vector<size_type>::iterator out = m_sa.begin();
+ for (size_t i = 0; i < m_sa.size(); i += m_sampleSA)
+ *out++ = m_sa[i];
+ m_sa.erase(out, m_sa.end());
+ assert(!m_sa.empty());
+}
+
+/** Return the specified element of the suffix array. */
+size_t at(size_t i) const
+{
+ assert(i < m_occ.size());
+ size_t n = 0;
+ while (i % m_sampleSA != 0) {
+ T c = m_occ.at(i);
+ i = c == SENTINEL() ? 0 : m_cf[c] + m_occ.rank(c, i);
+ n++;
+ }
+ assert(i / m_sampleSA < m_sa.size());
+ size_t pos = m_sa[i / m_sampleSA] + n;
+ return pos < m_occ.size() ? pos : pos - m_occ.size();
+}
+
+/** Return the specified element of the suffix array. */
+size_t operator[](size_t i) const
+{
+ return at(i);
+}
+
+/** Return the symbol at the specifed position of the BWT. */
+T bwtAt(size_t i) const
+{
+ assert(i < m_occ.size());
+ T c = m_occ.at(i);
+ assert(c != SENTINEL());
+ assert(c < m_alphabet.size());
+ return m_alphabet[c];
+}
+
+/** Return the first symbol of the specified suffix. */
+T symbolAt(size_t i) const
+{
+ assert(i < m_occ.size());
+ std::vector<size_type>::const_iterator it
+ = std::upper_bound(m_cf.begin(), m_cf.end(), i);
+ assert(it != m_cf.begin());
+ T c = it - m_cf.begin() - 1;
+ assert(c < m_alphabet.size());
+ return m_alphabet[c];
+}
+
+/** Decompress the index. */
+template <typename It>
+void decompress(It out)
+{
+ // Construct the original string.
+ std::vector<T> s;
+ for (size_t i = 0;;) {
+ assert(i < m_occ.size());
+ T c = m_occ.at(i);
+ if (c == SENTINEL())
+ break;
+ s.push_back(c);
+ i = m_cf[c] + m_occ.rank(c, i);
+ assert(i > 0);
+ }
+
+ // Translate the character set and output the result.
+ for (std::vector<T>::reverse_iterator it = s.rbegin();
+ it != s.rend(); ++it) {
+ T c = *it;
+ assert(c < m_alphabet.size());
+ *out++ = m_alphabet[c];
+ }
+}
+
+/** Extend a suffix array coordinate by one character to the left. */
+size_type update(size_type i, T c) const
+{
+ assert(c < m_cf.size());
+ return m_cf[c] + m_occ.rank(c, i);
+}
+
+/** Extend a suffix array interval by one character to the left. */
+SAInterval update(SAInterval sai, T c) const
+{
+ return SAInterval(update(sai.l, c), update(sai.u, c));
+}
+
+/** Search for an exact match. */
+template <typename It>
+SAInterval findExact(It first, It last, SAInterval sai) const
+{
+ assert(first < last);
+ for (It it = last - 1; it >= first && !sai.empty(); --it) {
+ T c = *it;
+ if (c == SENTINEL())
+ return SAInterval(0, 0);
+ sai = update(sai, c);
+ }
+ return sai;
+}
+
+/** Search for an exact match. */
+template <typename String>
+SAInterval findExact(const String& q) const
+{
+ String s(q.size());
+ std::transform(q.begin(), q.end(), s.begin(), Translate(*this));
+ return findExact(s.begin(), s.end());
+}
+
+/** Search for a suffix of the query that matches a prefix of the
+ * target.
+ */
+template <typename It, typename OutIt>
+OutIt findOverlapSuffix(It first, It last, OutIt out,
+ unsigned minOverlap) const
+{
+ assert(first < last);
+
+ SAInterval sai(*this);
+ for (It it = last - 1; it >= first && !sai.empty(); --it) {
+ T c = *it;
+ if (c == SENTINEL())
+ break;
+ sai = update(sai, c);
+ if (sai.empty())
+ break;
+
+ if (unsigned(last - it) < minOverlap)
+ continue;
+
+ SAInterval sai1 = update(sai, 0);
+ if (!sai1.empty())
+ *out++ = Match(sai1.l, sai1.u,
+ it - first, last - first);
+ }
+ return out;
+}
+
+/** Search for a suffix of the query that matches a prefix of the
+ * target.
+ */
+template <typename OutIt>
+OutIt findOverlapSuffix(const std::string& q, OutIt out,
+ unsigned minOverlap) const
+{
+ std::string s = q;
+ std::transform(s.begin(), s.end(), s.begin(), Translate(*this));
+ return findOverlapSuffix(s.begin(), s.end(), out, minOverlap);
+}
+
+/** Search for a prefix of the query that matches a suffix of the
+ * target.
+ */
+template <typename OutIt>
+OutIt findOverlapPrefix(const std::string& q, OutIt out,
+ unsigned minOverlap) const
+{
+ std::string s = q;
+ std::transform(s.begin(), s.end(), s.begin(), Translate(*this));
+ typedef std::string::const_iterator It;
+ It first = s.begin();
+ for (It it = first + minOverlap; it <= s.end(); ++it) {
+ SAInterval sai = findExact(first, it,
+ update(SAInterval(*this), 0));
+ if (!sai.empty())
+ *out++ = Match(sai.l, sai.u, 0, it - first);
+ }
+ return out;
+}
+
+/** Search for a matching suffix of the query. */
+template <typename It, typename MemoIt>
+Match findSuffix(It first, It last, MemoIt memoIt) const
+{
+ assert(first < last);
+
+ SAInterval sai(*this);
+ It it;
+ for (it = last - 1; it >= first && !sai.empty(); --it) {
+ T c = *it;
+ if (c == SENTINEL())
+ break;
+ SAInterval sai1 = update(sai, c);
+ if (sai1.empty())
+ break;
+ sai = sai1;
+
+ if (*memoIt == sai) {
+ // This vertex of the prefix DAWG has been visited.
+ break;
+ }
+ *memoIt++ = sai;
+ }
+ return Match(sai.l, sai.u, it - first + 1, last - first);
+}
+
+/** Search for a matching substring of the query at least k long.
+ * @return the longest match
+ */
+template <typename It>
+Match findSubstring(It first, It last, unsigned k) const
+{
+ assert(first < last);
+ Match best(0, 0, 0, k > 0 ? k - 1 : 0);
+
+ // Record which vertices of the prefix DAWG have been visited.
+ std::vector<SAInterval> memo(last - first, SAInterval(0, 0));
+ SAInterval* memoIt = &memo[0];
+ for (It it = last; it > first; --it) {
+ if (unsigned(it - first) < best.qspan())
+ return best;
+ Match interval = findSuffix(first, it, memoIt++);
+ if (interval.qspan() > best.qspan())
+ best = interval;
+ }
+ return best;
+}
+
+/** Translate from ASCII to the indexed alphabet. */
+struct Translate {
+ Translate(const FMIndex& fmIndex) : m_fmIndex(fmIndex) { }
+ T operator()(unsigned char c) const
+ {
+ return c < m_fmIndex.m_mapping.size()
+ ? m_fmIndex.m_mapping[c] : SENTINEL();
+ }
+ private:
+ const FMIndex& m_fmIndex;
+};
+
+/** Search for a matching substring of the query at least k long.
+ * @return the longest match and the number of matches
+ */
+Match find(const std::string& q, unsigned k) const
+{
+ std::string s = q;
+ std::transform(s.begin(), s.end(), s.begin(), Translate(*this));
+ return findSubstring(s.begin(), s.end(), k);
+}
+
+/** Set the alphabet to [first, last).
+ * The character '\0' is treated specially and not included in the
+ * alphabet.
+ */
+template <typename It>
+void setAlphabet(It first, It last)
+{
+ assert(first < last);
+ std::vector<bool> mask(std::numeric_limits<T>::max());
+ for (It it = first; it < last; ++it) {
+ assert((size_t)*it < mask.size());
+ mask[*it] = true;
+ }
+
+ // Remove the character '\0' from the alphabet.
+ mask[0] = false;
+
+ m_alphabet.clear();
+ m_mapping.clear();
+ for (unsigned c = 0; c < mask.size(); ++c) {
+ if (!mask[c])
+ continue;
+ m_mapping.resize(c + 1, std::numeric_limits<T>::max());
+ m_mapping[c] = m_alphabet.size();
+ m_alphabet.push_back(c);
+ }
+ assert(!m_alphabet.empty());
+}
+
+/** Set the alphabet to the characters of s. */
+void setAlphabet(const std::string& s)
+{
+ assert(!s.empty());
+ setAlphabet(s.begin(), s.end());
+}
+
+#define STRINGIFY(X) #X
+#define FM_VERSION_BITS(BITS) "FM " STRINGIFY(BITS) " 1"
+#define FM_VERSION FM_VERSION_BITS(FMBITS)
+
+/** Store an index. */
+friend std::ostream& operator<<(std::ostream& out, const FMIndex& o)
+{
+ out << FM_VERSION << '\n'
+ << o.m_sampleSA << '\n';
+
+ out << o.m_alphabet.size() << '\n';
+ out.write(reinterpret_cast<const char*>(&o.m_alphabet[0]),
+ o.m_alphabet.size() * sizeof o.m_alphabet[0]);
+
+ out << o.m_sa.size() << '\n';
+ out.write(reinterpret_cast<const char*>(&o.m_sa[0]),
+ o.m_sa.size() * sizeof o.m_sa[0]);
+
+ return out << o.m_occ;
+}
+
+/** Load an index. */
+friend std::istream& operator>>(std::istream& in, FMIndex& o)
+{
+ std::string version;
+ std::getline(in, version);
+ assert(in);
+ if (version != FM_VERSION) {
+ std::cerr << "error: the version of this FM-index, `"
+ << version << "', does not match the version required "
+ "by this program, `" FM_VERSION "'.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ in >> o.m_sampleSA;
+ assert(in);
+
+ size_t n;
+ in >> n >> expect("\n");
+ assert(in);
+ assert(n < std::numeric_limits<size_type>::max());
+ o.m_alphabet.resize(n);
+ in.read(reinterpret_cast<char*>(&o.m_alphabet[0]),
+ n * sizeof o.m_alphabet[0]);
+ o.setAlphabet(o.m_alphabet.begin(), o.m_alphabet.end());
+
+ in >> n >> expect("\n");
+ assert(in);
+ assert(n < std::numeric_limits<size_type>::max());
+ o.m_sa.resize(n);
+ in.read(reinterpret_cast<char*>(&o.m_sa[0]),
+ n * sizeof o.m_sa[0]);
+
+ in >> o.m_occ;
+ assert(in);
+ o.countOccurrences();
+
+ return in;
+}
+
+private:
+
+/** Build the cumulative frequency table m_cf from m_occ. */
+void countOccurrences()
+{
+ assert(!m_alphabet.empty());
+ m_cf.resize(m_alphabet.size());
+ // The sentinel character occurs once.
+ m_cf[0] = 1;
+ for (unsigned i = 0; i < m_cf.size() - 1; ++i)
+ m_cf[i + 1] = m_cf[i] + m_occ.count(i);
+}
+
+ unsigned m_sampleSA;
+ std::vector<T> m_alphabet;
+ std::vector<T> m_mapping;
+ std::vector<size_type> m_cf;
+ std::vector<size_type> m_sa;
+ BitArrays m_occ;
+};
+
+#endif
diff --git a/FMIndex/Makefile.am b/FMIndex/Makefile.am
new file mode 100644
index 0000000..c0ac26c
--- /dev/null
+++ b/FMIndex/Makefile.am
@@ -0,0 +1,23 @@
+noinst_LIBRARIES = libfmindex.a
+noinst_PROGRAMS = abyss-count abyss-dawg
+
+libfmindex_a_CPPFLAGS = -I$(top_srcdir)/Common
+
+libfmindex_a_SOURCES = \
+ BitArrays.h \
+ bit_array.cc bit_array.h \
+ DAWG.h \
+ FMIndex.h \
+ sais.hxx
+
+abyss_dawg_SOURCES = abyss-dawg.cc
+abyss_dawg_LDADD = libfmindex.a \
+ $(top_builddir)/Common/libcommon.a
+abyss_dawg_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_count_SOURCES = count.cc
+abyss_count_LDADD = libfmindex.a \
+ $(top_builddir)/Common/libcommon.a
+abyss_count_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
diff --git a/FMIndex/Makefile.in b/FMIndex/Makefile.in
new file mode 100644
index 0000000..bdd222e
--- /dev/null
+++ b/FMIndex/Makefile.in
@@ -0,0 +1,559 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+noinst_PROGRAMS = abyss-count$(EXEEXT) abyss-dawg$(EXEEXT)
+subdir = FMIndex
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libfmindex_a_AR = $(AR) $(ARFLAGS)
+libfmindex_a_LIBADD =
+am_libfmindex_a_OBJECTS = libfmindex_a-bit_array.$(OBJEXT)
+libfmindex_a_OBJECTS = $(am_libfmindex_a_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_abyss_count_OBJECTS = abyss_count-count.$(OBJEXT)
+abyss_count_OBJECTS = $(am_abyss_count_OBJECTS)
+abyss_count_DEPENDENCIES = libfmindex.a \
+ $(top_builddir)/Common/libcommon.a
+am_abyss_dawg_OBJECTS = abyss_dawg-abyss-dawg.$(OBJEXT)
+abyss_dawg_OBJECTS = $(am_abyss_dawg_OBJECTS)
+abyss_dawg_DEPENDENCIES = libfmindex.a \
+ $(top_builddir)/Common/libcommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libfmindex_a_SOURCES) $(abyss_count_SOURCES) \
+ $(abyss_dawg_SOURCES)
+DIST_SOURCES = $(libfmindex_a_SOURCES) $(abyss_count_SOURCES) \
+ $(abyss_dawg_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LIBRARIES = libfmindex.a
+libfmindex_a_CPPFLAGS = -I$(top_srcdir)/Common
+libfmindex_a_SOURCES = \
+ BitArrays.h \
+ bit_array.cc bit_array.h \
+ DAWG.h \
+ FMIndex.h \
+ sais.hxx
+
+abyss_dawg_SOURCES = abyss-dawg.cc
+abyss_dawg_LDADD = libfmindex.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_dawg_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_count_SOURCES = count.cc
+abyss_count_LDADD = libfmindex.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_count_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign FMIndex/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign FMIndex/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libfmindex.a: $(libfmindex_a_OBJECTS) $(libfmindex_a_DEPENDENCIES) $(EXTRA_libfmindex_a_DEPENDENCIES)
+ -rm -f libfmindex.a
+ $(libfmindex_a_AR) libfmindex.a $(libfmindex_a_OBJECTS) $(libfmindex_a_LIBADD)
+ $(RANLIB) libfmindex.a
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+abyss-count$(EXEEXT): $(abyss_count_OBJECTS) $(abyss_count_DEPENDENCIES) $(EXTRA_abyss_count_DEPENDENCIES)
+ @rm -f abyss-count$(EXEEXT)
+ $(CXXLINK) $(abyss_count_OBJECTS) $(abyss_count_LDADD) $(LIBS)
+abyss-dawg$(EXEEXT): $(abyss_dawg_OBJECTS) $(abyss_dawg_DEPENDENCIES) $(EXTRA_abyss_dawg_DEPENDENCIES)
+ @rm -f abyss-dawg$(EXEEXT)
+ $(CXXLINK) $(abyss_dawg_OBJECTS) $(abyss_dawg_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_count-count.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_dawg-abyss-dawg.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libfmindex_a-bit_array.Po at am__quote@
+
+.cc.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+libfmindex_a-bit_array.o: bit_array.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfmindex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libfmindex_a-bit_array.o -MD -MP -MF $(DEPDIR)/libfmindex_a-bit_array.Tpo -c -o libfmindex_a-bit_array.o `test -f 'bit_array.cc' || echo '$(srcdir)/'`bit_array.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfmindex_a-bit_array.Tpo $(DEPDIR)/libfmindex_a-bit_array.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='bit_array.cc' object='libfmindex_a-bit_array.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfmindex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libfmindex_a-bit_array.o `test -f 'bit_array.cc' || echo '$(srcdir)/'`bit_array.cc
+
+libfmindex_a-bit_array.obj: bit_array.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfmindex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libfmindex_a-bit_array.obj -MD -MP -MF $(DEPDIR)/libfmindex_a-bit_array.Tpo -c -o libfmindex_a-bit_array.obj `if test -f 'bit_array.cc'; then $(CYGPATH_W) 'bit_array.cc'; else $(CYGPATH_W) '$(srcdir)/bit_array.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libfmindex_a-bit_array.Tpo $(DEPDIR)/libfmindex_a-bit_array.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='bit_array.cc' object='libfmindex_a-bit_array.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfmindex_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libfmindex_a-bit_array.obj `if test -f 'bit_array.cc'; then $(CYGPATH_W) 'bit_array.cc'; else $(CYGPATH_W) '$(srcdir)/bit_array.cc'; fi`
+
+abyss_count-count.o: count.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_count_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_count-count.o -MD -MP -MF $(DEPDIR)/abyss_count-count.Tpo -c -o abyss_count-count.o `test -f 'count.cc' || echo '$(srcdir)/'`count.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_count-count.Tpo $(DEPDIR)/abyss_count-count.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='count.cc' object='abyss_count-count.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_count_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_count-count.o `test -f 'count.cc' || echo '$(srcdir)/'`count.cc
+
+abyss_count-count.obj: count.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_count_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_count-count.obj -MD -MP -MF $(DEPDIR)/abyss_count-count.Tpo -c -o abyss_count-count.obj `if test -f 'count.cc'; then $(CYGPATH_W) 'count.cc'; else $(CYGPATH_W) '$(srcdir)/count.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_count-count.Tpo $(DEPDIR)/abyss_count-count.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='count.cc' object='abyss_count-count.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_count_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_count-count.obj `if test -f 'count.cc'; then $(CYGPATH_W) 'count.cc'; else $(CYGPATH_W) '$(srcdir)/count.cc'; fi`
+
+abyss_dawg-abyss-dawg.o: abyss-dawg.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_dawg_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_dawg-abyss-dawg.o -MD -MP -MF $(DEPDIR)/abyss_dawg-abyss-dawg.Tpo -c -o abyss_dawg-abyss-dawg.o `test -f 'abyss-dawg.cc' || echo '$(srcdir)/'`abyss-dawg.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_dawg-abyss-dawg.Tpo $(DEPDIR)/abyss_dawg-abyss-dawg.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='abyss-dawg.cc' object='abyss_dawg-abyss-dawg.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_dawg_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_dawg-abyss-dawg.o `test -f 'abyss-dawg.cc' || echo '$(srcdir)/'`abyss-dawg.cc
+
+abyss_dawg-abyss-dawg.obj: abyss-dawg.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_dawg_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_dawg-abyss-dawg.obj -MD -MP -MF $(DEPDIR)/abyss_dawg-abyss-dawg.Tpo -c -o abyss_dawg-abyss-dawg.obj `if test -f 'abyss-dawg.cc'; then $(CYGPATH_W) 'abyss-dawg.cc'; else $(CYGPATH_W) '$(srcdir)/abyss-dawg.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_dawg-abyss-dawg.Tpo $(DEPDIR)/abyss_dawg-abyss-dawg.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='abyss-dawg.cc' object='abyss_dawg-abyss-dawg.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_dawg_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_dawg-abyss-dawg.obj `if test -f 'abyss-dawg.cc'; then $(CYGPATH_W) 'abyss-dawg.cc'; else $(CYGPATH_W) '$(srcdir)/abyss-dawg.cc'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES clean-noinstPROGRAMS cscopelist ctags \
+ distclean distclean-compile distclean-generic distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/FMIndex/abyss-dawg.cc b/FMIndex/abyss-dawg.cc
new file mode 100644
index 0000000..e8403b1
--- /dev/null
+++ b/FMIndex/abyss-dawg.cc
@@ -0,0 +1,173 @@
+#include "BitUtil.h"
+#include "DAWG.h"
+#include "Uncompress.h"
+#include <algorithm>
+#include <boost/graph/depth_first_search.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <cassert>
+#include <cctype>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <string>
+#include <map>
+#include <vector>
+
+using namespace std;
+
+using boost::default_dfs_visitor;
+
+#define PROGRAM "abyss-dawg"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... [FASTA]\n"
+"Output a directed acyclic word graph (DAWG) of the specified file.\n"
+"The index file TARGET.fm will be used if present.\n"
+"\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ /** Verbose output. */
+ static int verbose;
+};
+
+static const char shortopts[] = "v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** A directed acyclic word graph. */
+typedef DAWG Graph;
+
+/** DAWG visitor. */
+struct DAWGVisitor : public default_dfs_visitor
+{
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ void examine_edge(E e, const Graph& g)
+ {
+ using boost::edge_name;
+ V u = source(e, g);
+ V v = target(e, g);
+ char c = get(edge_name, g, e);
+ cout << '"'
+ << u.first << ',' << u.second << "\" -> \""
+ << v.first << ',' << v.second << "\""
+ " [label=\"";
+ if (isprint(c))
+ cout << c;
+ else
+ cout << "0x" << hex << (unsigned)c << dec;
+ cout << "\"]\n";
+ }
+};
+
+/** Read an FM index. */
+static void readFMIndex(FMIndex& g, const string& faPath)
+{
+ string fmPath = faPath + ".fm";
+ ifstream in(fmPath.c_str());
+ if (in) {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << fmPath << "'...\n";
+ assert_good(in, fmPath);
+ in >> g;
+ assert_good(in, fmPath);
+ in.close();
+ return;
+ }
+
+ // Build the FM index.
+ std::vector<FMIndex::value_type> s;
+ if (string(faPath) == "-") {
+ if (opt::verbose > 0)
+ std::cerr << "Reading stdin...\n";
+ copy(istreambuf_iterator<char>(cin),
+ istreambuf_iterator<char>(),
+ back_inserter(s));
+ assert_good(cin, "stdin");
+ } else {
+ if (opt::verbose > 0)
+ std::cerr << "Reading `" << faPath << "'...\n";
+ readFile(faPath.c_str(), s);
+ }
+ g.assign(s.begin(), s.end());
+}
+
+int main(int argc, char** argv)
+{
+ checkPopcnt();
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case 'v':
+ opt::verbose++;
+ break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (argc - optind > 1) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ string faPath(optind < argc ? argv[optind] : "-");
+
+ using boost::default_color_type;
+ using boost::depth_first_visit;
+ using boost::make_assoc_property_map;
+
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ // Read the FM index.
+ Graph g;
+ readFMIndex(g, faPath);
+
+ cout << "digraph dawg {\n";
+
+ map<V, default_color_type> colorMap;
+ depth_first_visit(g, *vertices(g).first,
+ DAWGVisitor(), make_assoc_property_map(colorMap));
+
+ cout << "}\n" << flush;
+ assert_good(cout, "stdout");
+
+ return 0;
+}
diff --git a/FMIndex/bit_array.cc b/FMIndex/bit_array.cc
new file mode 100644
index 0000000..52a2388
--- /dev/null
+++ b/FMIndex/bit_array.cc
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2010 Daisuke Okanohara
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above Copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above Copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the authors nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ */
+
+#include "bit_array.h"
+#include "BitUtil.h" // for popcount
+#include <cassert>
+
+namespace wat_array {
+
+BitArray::BitArray() : length_(0), one_num_(0){
+}
+
+BitArray::BitArray(uint64_t length){
+ Init(length);
+}
+
+BitArray::~BitArray(){
+}
+
+uint64_t BitArray::length() const {
+ return length_;
+}
+
+uint64_t BitArray::one_num() const{
+ return one_num_;
+}
+
+void BitArray::Init(uint64_t length){
+ length_ = length;
+ one_num_ = 0;
+ uint64_t block_num = (length + BLOCK_BITNUM - 1) / BLOCK_BITNUM;
+ bit_blocks_.resize(block_num);
+}
+
+void BitArray::Clear(){
+ std::vector<uint64_t>().swap(bit_blocks_);
+ std::vector<uint64_t>().swap(rank_tables_);
+ length_ = 0;
+ one_num_ = 0;
+}
+
+void BitArray::Build() {
+ one_num_ = 0;
+ uint64_t table_num = ((bit_blocks_.size() + TABLE_INTERVAL - 1) / TABLE_INTERVAL) + 1;
+ rank_tables_.resize(table_num);
+ for (size_t i = 0; i < bit_blocks_.size(); ++i){
+ if ((i % TABLE_INTERVAL) == 0){
+ rank_tables_[i/TABLE_INTERVAL] = one_num_;
+ }
+ one_num_ += PopCount(bit_blocks_[i]);
+ }
+ rank_tables_.back() = one_num_;
+}
+
+void BitArray::SetBit(uint64_t bit, uint64_t pos) {
+ if (!bit) return;
+ bit_blocks_[pos / BLOCK_BITNUM] |= (1LLU << (pos % BLOCK_BITNUM));
+}
+
+uint64_t BitArray::Rank(uint64_t bit, uint64_t pos) const {
+ if (pos > length_) return NOTFOUND;
+ if (bit) return RankOne(pos);
+ else return pos - RankOne(pos);
+}
+
+uint64_t BitArray::Select(uint64_t bit, uint64_t rank) const {
+ if (bit){
+ if (rank > one_num_) return NOTFOUND;
+ } else {
+ if (rank > length_ - one_num_) return NOTFOUND;
+ }
+
+ uint64_t block_pos = SelectOutBlock(bit, rank);
+ uint64_t block = (bit) ? bit_blocks_[block_pos] : ~bit_blocks_[block_pos];
+ return block_pos * BLOCK_BITNUM + SelectInBlock(block, rank);
+}
+
+uint64_t BitArray::SelectOutBlock(uint64_t bit, uint64_t& rank) const {
+ // binary search over tables
+ uint64_t left = 0;
+ uint64_t right = rank_tables_.size();
+ while (left < right){
+ uint64_t mid = (left + right) / 2;
+ uint64_t length = BLOCK_BITNUM * TABLE_INTERVAL * mid;
+ if (GetBitNum(rank_tables_[mid], length, bit) < rank) {
+ left = mid+1;
+ } else {
+ right = mid;
+ }
+ }
+
+ uint64_t table_ind = (left != 0) ? left - 1: 0;
+ uint64_t block_pos = table_ind * TABLE_INTERVAL;
+ rank -= GetBitNum(rank_tables_[table_ind],
+ block_pos * BLOCK_BITNUM,
+ bit);
+
+ // sequential search over blocks
+ for ( ; block_pos < bit_blocks_.size(); ++block_pos){
+ uint64_t rank_next= GetBitNum(PopCount(bit_blocks_[block_pos]), BLOCK_BITNUM, bit);
+ if (rank <= rank_next){
+ break;
+ }
+ rank -= rank_next;
+ }
+ return block_pos;
+}
+
+uint64_t BitArray::SelectInBlock(uint64_t x, uint64_t rank) {
+ uint64_t x1 = x - ((x & 0xAAAAAAAAAAAAAAAALLU) >> 1);
+ uint64_t x2 = (x1 & 0x3333333333333333LLU) + ((x1 >> 2) & 0x3333333333333333LLU);
+ uint64_t x3 = (x2 + (x2 >> 4)) & 0x0F0F0F0F0F0F0F0FLLU;
+
+ uint64_t pos = 0;
+ for (;; pos += 8){
+ uint64_t rank_next = (x3 >> pos) & 0xFFLLU;
+ if (rank <= rank_next) break;
+ rank -= rank_next;
+ }
+
+ uint64_t v2 = (x2 >> pos) & 0xFLLU;
+ if (rank > v2) {
+ rank -= v2;
+ pos += 4;
+ }
+
+ uint64_t v1 = (x1 >> pos) & 0x3LLU;
+ if (rank > v1){
+ rank -= v1;
+ pos += 2;
+ }
+
+ uint64_t v0 = (x >> pos) & 0x1LLU;
+ if (v0 < rank){
+ rank -= v0;
+ pos += 1;
+ }
+
+ return pos;
+}
+
+uint64_t BitArray::Lookup(uint64_t pos) const {
+ return (bit_blocks_[pos / BLOCK_BITNUM] >> (pos % BLOCK_BITNUM)) & 1LLU;
+}
+
+
+uint64_t BitArray::RankOne(uint64_t pos) const {
+ uint64_t block_ind = pos / BLOCK_BITNUM;
+ uint64_t table_ind = block_ind / TABLE_INTERVAL;
+ assert(table_ind < rank_tables_.size());
+
+ uint64_t rank = rank_tables_[table_ind];
+ for (uint64_t i = table_ind * TABLE_INTERVAL; i < block_ind; ++i){
+ rank += PopCount(bit_blocks_[i]);
+ }
+ rank += PopCountMask(bit_blocks_[block_ind], pos % BLOCK_BITNUM);
+ return rank;
+}
+
+/** Return the Hamming weight of x. */
+uint64_t BitArray::PopCount(uint64_t x)
+{
+ return popcount(x);
+}
+
+uint64_t BitArray::PopCountMask(uint64_t x, uint64_t offset) {
+ if (offset == 0) return 0;
+ return PopCount(x & ((1LLU << offset) - 1));
+}
+
+uint64_t BitArray::GetBitNum(uint64_t one_num, uint64_t num, uint64_t bit) {
+ if (bit) return one_num;
+ else return num - one_num;
+}
+
+void BitArray::PrintForDebug(std::ostream& os) const {
+ for (uint64_t i = 0; i < length_; ++i){
+ if (Lookup(i)) os << "1";
+ else os << "0";
+ if (((i+1) % 8) == 0) {
+ os << " ";
+ }
+ }
+}
+
+void BitArray::Save(std::ostream& os) const{
+ os.write((const char*)(&length_), sizeof(length_));
+ os.write((const char*)(&bit_blocks_[0]), sizeof(bit_blocks_[0]) * bit_blocks_.size());
+}
+
+void BitArray::Load(std::istream& is){
+ Clear();
+ is.read((char*)(&length_), sizeof(length_));
+ Init(length_);
+ is.read((char*)(&bit_blocks_[0]), sizeof(bit_blocks_[0]) * bit_blocks_.size());
+ Build();
+}
+
+
+}
diff --git a/FMIndex/bit_array.h b/FMIndex/bit_array.h
new file mode 100644
index 0000000..e9889ed
--- /dev/null
+++ b/FMIndex/bit_array.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2010 Daisuke Okanohara
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above Copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above Copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the authors nor the names of its contributors
+ * may be used to endorse or promote products derived from this
+ * software without specific prior written permission.
+ */
+
+#ifndef WAT_ARRAY_BIT_ARRAY_HPP_
+#define WAT_ARRAY_BIT_ARRAY_HPP_
+
+#include <stdint.h>
+#include <vector>
+#include <iostream>
+
+namespace wat_array {
+
+enum {
+ NOTFOUND = 0xFFFFFFFFFFFFFFFFLLU
+};
+
+class BitArray {
+
+private:
+enum {
+ BLOCK_BITNUM = 64,
+ TABLE_INTERVAL = 4
+};
+
+public:
+ BitArray();
+ ~BitArray();
+ BitArray(uint64_t size);
+ uint64_t length() const;
+ uint64_t one_num() const;
+
+ void Init(uint64_t size);
+ void Clear();
+ void SetBit(uint64_t bit, uint64_t pos);
+ void Build();
+ uint64_t Rank(uint64_t bit, uint64_t pos) const;
+ uint64_t Select(uint64_t bit, uint64_t rank) const;
+ uint64_t Lookup(uint64_t pos) const;
+
+ static uint64_t PopCount(uint64_t x);
+ static uint64_t PopCountMask(uint64_t x, uint64_t offset);
+ static uint64_t SelectInBlock(uint64_t x, uint64_t rank);
+ static uint64_t GetBitNum(uint64_t one_num, uint64_t num, uint64_t bit);
+ void PrintForDebug(std::ostream& os) const;
+
+ void Save(std::ostream& os) const;
+ void Load(std::istream& is);
+
+private:
+ uint64_t RankOne(uint64_t pos) const;
+ uint64_t SelectOutBlock(uint64_t bit, uint64_t& rank) const;
+
+private:
+ std::vector<uint64_t> bit_blocks_;
+ std::vector<uint64_t> rank_tables_;
+ uint64_t length_;
+ uint64_t one_num_;
+};
+
+}
+
+#endif // WAT_ARRAY_BIT_ARRAY_HPP_
diff --git a/FMIndex/count.cc b/FMIndex/count.cc
new file mode 100644
index 0000000..7be2384
--- /dev/null
+++ b/FMIndex/count.cc
@@ -0,0 +1,216 @@
+#include "BitUtil.h"
+#include "DAWG.h"
+#include "Uncompress.h"
+#include <algorithm>
+#include <boost/graph/depth_first_search.hpp>
+#include <boost/property_map/property_map.hpp>
+#include <cassert>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <string>
+#include <vector>
+
+using namespace std;
+
+using boost::default_color_type;
+
+#define PROGRAM "abyss-count"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... [FASTA]\n"
+"Count k-mer of the specified file.\n"
+"The index file TARGET.fm will be used if present.\n"
+"\n"
+" -k, --kmer the size of a k-mer\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ /** The size of a k-mer. */
+ static unsigned k;
+
+ /** Verbose output. */
+ static int verbose;
+};
+
+static const char shortopts[] = "k:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "kmer", no_argument, NULL, 'k' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** A directed acyclic word graph. */
+typedef DAWG Graph;
+
+/** A color map that always returns white. */
+struct WhiteMap
+{
+ typedef graph_traits<Graph>::vertex_descriptor key_type;
+ typedef default_color_type value_type;
+ typedef value_type& reference;
+ typedef boost::lvalue_property_map_tag category;
+};
+
+default_color_type get(const WhiteMap&,
+ graph_traits<Graph>::vertex_descriptor)
+{
+ return boost::white_color;
+}
+
+void put(WhiteMap&,
+ graph_traits<Graph>::vertex_descriptor, default_color_type)
+{
+}
+
+/** Count k-mer. */
+class CountKmerVisitor : public boost::default_dfs_visitor
+{
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ public:
+ CountKmerVisitor(vector<char>& s) : m_s(s)
+ {
+ assert(m_s.empty());
+ m_s.reserve(opt::k);
+ }
+
+ bool operator()(V u, const Graph& g) const
+ {
+ assert(m_s.size() < opt::k);
+ if (u.first == 0)
+ return false;
+ char c = get(boost::vertex_name, g, u);
+ m_s.push_back(c);
+ if (c == '-')
+ return true;
+ if (m_s.size() < opt::k)
+ return false;
+ assert(m_s.size() == opt::k);
+ unsigned count = u.second - u.first;
+ copy(m_s.rbegin(), m_s.rend(),
+ ostream_iterator<char>(cout));
+ cout << '\t' << count << '\n';
+ return true;
+ }
+
+ void finish_vertex(V u, const Graph&)
+ {
+ if (m_s.empty()) {
+ assert(u.first == 0);
+ (void)u;
+ } else
+ m_s.pop_back();
+ }
+
+ private:
+ vector<char>& m_s;
+}; // CountKmerVisitor
+
+/** Read an FM index. */
+static void readFMIndex(FMIndex& g, const string& faPath)
+{
+ string fmPath = faPath + ".fm";
+ ifstream in(fmPath.c_str());
+ if (in) {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << fmPath << "'...\n";
+ assert_good(in, fmPath);
+ in >> g;
+ assert_good(in, fmPath);
+ in.close();
+ return;
+ }
+
+ // Build the FM index.
+ std::vector<FMIndex::value_type> s;
+ if (string(faPath) == "-") {
+ if (opt::verbose > 0)
+ std::cerr << "Reading stdin...\n";
+ copy(istreambuf_iterator<char>(cin),
+ istreambuf_iterator<char>(),
+ back_inserter(s));
+ assert_good(cin, "stdin");
+ } else {
+ if (opt::verbose > 0)
+ std::cerr << "Reading `" << faPath << "'...\n";
+ readFile(faPath.c_str(), s);
+ }
+ g.assign(s.begin(), s.end());
+}
+
+int main(int argc, char** argv)
+{
+ checkPopcnt();
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case 'k':
+ arg >> opt::k;
+ break;
+ case 'v':
+ opt::verbose++;
+ break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": " << "missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (argc - optind > 1) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ string faPath(optind < argc ? argv[optind] : "-");
+
+ // Read the FM index.
+ Graph g;
+ readFMIndex(g, faPath);
+
+ // Count k-mer.
+ vector<char> s;
+ boost::depth_first_visit(g, *vertices(g).first,
+ CountKmerVisitor(s), WhiteMap(), CountKmerVisitor(s));
+ assert_good(cout, "stdout");
+
+ return 0;
+}
diff --git a/FMIndex/sais.hxx b/FMIndex/sais.hxx
new file mode 100644
index 0000000..7daea1d
--- /dev/null
+++ b/FMIndex/sais.hxx
@@ -0,0 +1,600 @@
+/*
+ * sais.hxx for sais
+ * Copyright (c) 2008-2010 Yuta Mori All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+#ifndef _SAIS_HXX
+#define _SAIS_HXX 1
+#ifdef __cplusplus
+
+#include <cassert>
+#include <iterator>
+#include <limits>
+
+#ifdef __INTEL_COMPILER
+#pragma warning(disable : 383 981 1418)
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4365)
+#endif
+
+namespace saisxx_private {
+
+/* find the start or end of each bucket */
+template<typename string_type, typename bucket_type, typename index_type>
+void
+getCounts(const string_type T, bucket_type C, index_type n, index_type k) {
+ index_type i;
+ for(i = 0; i < k; ++i) { C[i] = 0; }
+ for(i = 0; i < n; ++i) { ++C[T[i]]; }
+}
+template<typename bucketC_type, typename bucketB_type, typename index_type>
+void
+getBuckets(const bucketC_type C, bucketB_type B, index_type k, bool end) {
+ index_type i, sum = 0;
+ if(end != false) { for(i = 0; i < k; ++i) { sum += C[i]; B[i] = sum; } }
+ else { for(i = 0; i < k; ++i) { sum += C[i]; B[i] = sum - C[i]; } }
+}
+
+template<typename string_type, typename sarray_type,
+ typename bucketC_type, typename bucketB_type, typename index_type>
+void
+LMSsort1(string_type T, sarray_type SA,
+ bucketC_type C, bucketB_type B,
+ index_type n, index_type k, bool recount) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ sarray_type b;
+ index_type i, j;
+ char_type c0, c1;
+
+ /* compute SAl */
+ if(recount != false) { getCounts(T, C, n, k); }
+ getBuckets(C, B, k, false); /* find starts of buckets */
+ j = n - 1;
+ b = SA + B[c1 = T[j]];
+ --j;
+ *b++ = (T[j] < c1) ? ~j : j;
+ for(i = 0; i < n; ++i) {
+ if(0 < (j = SA[i])) {
+ assert(T[j] >= T[j + 1]);
+ if((c0 = T[j]) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ assert(i < (b - SA));
+ --j;
+ *b++ = (T[j] < c1) ? ~j : j;
+ SA[i] = 0;
+ } else if(j < 0) {
+ SA[i] = ~j;
+ }
+ }
+ /* compute SAs */
+ if(recount != false) { getCounts(T, C, n, k); }
+ getBuckets(C, B, k, true); /* find ends of buckets */
+ for(i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) {
+ if(0 < (j = SA[i])) {
+ assert(T[j] <= T[j + 1]);
+ if((c0 = T[j]) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ assert((b - SA) <= i);
+ --j;
+ *--b = (T[j] > c1) ? ~(j + 1) : j;
+ SA[i] = 0;
+ }
+ }
+}
+template<typename string_type, typename sarray_type, typename index_type>
+index_type
+LMSpostproc1(string_type T, sarray_type SA, index_type n, index_type m) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ index_type i, j, p, q, plen, qlen, name;
+ char_type c0, c1;
+ bool diff;
+
+ /* compact all the sorted substrings into the first m items of SA
+ 2*m must be not larger than n (proveable) */
+ assert(0 < n);
+ for(i = 0; (p = SA[i]) < 0; ++i) { SA[i] = ~p; assert((i + 1) < n); }
+ if(i < m) {
+ for(j = i, ++i;; ++i) {
+ assert(i < n);
+ if((p = SA[i]) < 0) {
+ SA[j++] = ~p; SA[i] = 0;
+ if(j == m) { break; }
+ }
+ }
+ }
+
+ /* store the length of all substrings */
+ i = n - 1; j = n - 1; c0 = T[n - 1];
+ do { c1 = c0; } while((0 <= --i) && ((c0 = T[i]) >= c1));
+ for(; 0 <= i;) {
+ do { c1 = c0; } while((0 <= --i) && ((c0 = T[i]) <= c1));
+ if(0 <= i) {
+ SA[m + ((i + 1) >> 1)] = j - i; j = i + 1;
+ do { c1 = c0; } while((0 <= --i) && ((c0 = T[i]) >= c1));
+ }
+ }
+
+ /* find the lexicographic names of all substrings */
+ for(i = 0, name = 0, q = n, qlen = 0; i < m; ++i) {
+ p = SA[i], plen = SA[m + (p >> 1)], diff = true;
+ if((plen == qlen) && ((q + plen) < n)) {
+ for(j = 0; (j < plen) && (T[p + j] == T[q + j]); ++j) { }
+ if(j == plen) { diff = false; }
+ }
+ if(diff != false) { ++name, q = p, qlen = plen; }
+ SA[m + (p >> 1)] = name;
+ }
+
+ return name;
+}
+template<typename string_type, typename sarray_type,
+ typename bucketC_type, typename bucketB_type, typename bucketD_type,
+ typename index_type>
+void
+LMSsort2(string_type T, sarray_type SA,
+ bucketC_type C, bucketB_type B, bucketD_type D,
+ index_type n, index_type k) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ sarray_type b;
+ index_type i, j, t, d;
+ char_type c0, c1;
+
+ /* compute SAl */
+ getBuckets(C, B, k, false); /* find starts of buckets */
+ j = n - 1;
+ b = SA + B[c1 = T[j]];
+ --j;
+ t = (T[j] < c1);
+ j += n;
+ *b++ = (t & 1) ? ~j : j;
+ for(i = 0, d = 0; i < n; ++i) {
+ if(0 < (j = SA[i])) {
+ if(n <= j) { d += 1; j -= n; }
+ assert(T[j] >= T[j + 1]);
+ if((c0 = T[j]) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ assert(i < (b - SA));
+ --j;
+ t = c0; t = (t << 1) | (T[j] < c1);
+ if(D[t] != d) { j += n; D[t] = d; }
+ *b++ = (t & 1) ? ~j : j;
+ SA[i] = 0;
+ } else if(j < 0) {
+ SA[i] = ~j;
+ }
+ }
+ for(i = n - 1; 0 <= i; --i) {
+ if(0 < SA[i]) {
+ if(SA[i] < n) {
+ SA[i] += n;
+ for(j = i - 1; SA[j] < n; --j) { }
+ SA[j] -= n;
+ i = j;
+ }
+ }
+ }
+
+ /* compute SAs */
+ getBuckets(C, B, k, true); /* find ends of buckets */
+ for(i = n - 1, d += 1, b = SA + B[c1 = 0]; 0 <= i; --i) {
+ if(0 < (j = SA[i])) {
+ if(n <= j) { d += 1; j -= n; }
+ assert(T[j] <= T[j + 1]);
+ if((c0 = T[j]) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ assert((b - SA) <= i);
+ --j;
+ t = c0; t = (t << 1) | (T[j] > c1);
+ if(D[t] != d) { j += n; D[t] = d; }
+ *--b = (t & 1) ? ~(j + 1) : j;
+ SA[i] = 0;
+ }
+ }
+}
+template<typename sarray_type, typename index_type>
+index_type
+LMSpostproc2(sarray_type SA, index_type n, index_type m) {
+ index_type i, j, d, name;
+
+ /* compact all the sorted LMS substrings into the first m items of SA */
+ assert(0 < n);
+ for(i = 0, name = 0; (j = SA[i]) < 0; ++i) {
+ j = ~j;
+ if(n <= j) { name += 1; }
+ SA[i] = j;
+ assert((i + 1) < n);
+ }
+ if(i < m) {
+ for(d = i, ++i;; ++i) {
+ assert(i < n);
+ if((j = SA[i]) < 0) {
+ j = ~j;
+ if(n <= j) { name += 1; }
+ SA[d++] = j; SA[i] = 0;
+ if(d == m) { break; }
+ }
+ }
+ }
+ if(name < m) {
+ /* store the lexicographic names */
+ for(i = m - 1, d = name + 1; 0 <= i; --i) {
+ if(n <= (j = SA[i])) { j -= n; --d; }
+ SA[m + (j >> 1)] = d;
+ }
+ } else {
+ /* unset flags */
+ for(i = 0; i < m; ++i) {
+ if(n <= (j = SA[i])) { j -= n; SA[i] = j; }
+ }
+ }
+
+ return name;
+}
+
+/* compute SA and BWT */
+template<typename string_type, typename sarray_type,
+ typename bucketC_type, typename bucketB_type, typename index_type>
+void
+induceSA(string_type T, sarray_type SA, bucketC_type C, bucketB_type B,
+ index_type n, index_type k, bool recount) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ sarray_type b;
+ index_type i, j;
+ char_type c0, c1;
+ /* compute SAl */
+ if(recount != false) { getCounts(T, C, n, k); }
+ getBuckets(C, B, k, false); /* find starts of buckets */
+ b = SA + B[c1 = T[j = n - 1]];
+ *b++ = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
+ for(i = 0; i < n; ++i) {
+ j = SA[i], SA[i] = ~j;
+ if(0 < j) {
+ if((c0 = T[--j]) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ *b++ = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
+ }
+ }
+ /* compute SAs */
+ if(recount != false) { getCounts(T, C, n, k); }
+ getBuckets(C, B, k, true); /* find ends of buckets */
+ for(i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) {
+ if(0 < (j = SA[i])) {
+ if((c0 = T[--j]) != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ *--b = ((j == 0) || (T[j - 1] > c1)) ? ~j : j;
+ } else {
+ SA[i] = ~j;
+ }
+ }
+}
+template<typename string_type, typename sarray_type,
+ typename bucketC_type, typename bucketB_type, typename index_type>
+int
+computeBWT(string_type T, sarray_type SA, bucketC_type C, bucketB_type B,
+ index_type n, index_type k, bool recount) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ sarray_type b;
+ index_type i, j, pidx = -1;
+ char_type c0, c1;
+ /* compute SAl */
+ if(recount != false) { getCounts(T, C, n, k); }
+ getBuckets(C, B, k, false); /* find starts of buckets */
+ b = SA + B[c1 = T[j = n - 1]];
+ *b++ = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
+ for(i = 0; i < n; ++i) {
+ if(0 < (j = SA[i])) {
+ SA[i] = ~((index_type)(c0 = T[--j]));
+ if(c0 != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ *b++ = ((0 < j) && (T[j - 1] < c1)) ? ~j : j;
+ } else if(j != 0) {
+ SA[i] = ~j;
+ }
+ }
+ /* compute SAs */
+ if(recount != false) { getCounts(T, C, n, k); }
+ getBuckets(C, B, k, true); /* find ends of buckets */
+ for(i = n - 1, b = SA + B[c1 = 0]; 0 <= i; --i) {
+ if(0 < (j = SA[i])) {
+ SA[i] = (c0 = T[--j]);
+ if(c0 != c1) { B[c1] = b - SA; b = SA + B[c1 = c0]; }
+ *--b = ((0 < j) && (T[j - 1] > c1)) ? ~((index_type)T[j - 1]) : j;
+ } else if(j != 0) {
+ SA[i] = ~j;
+ } else {
+ pidx = i;
+ }
+ }
+ return pidx;
+}
+
+template<typename string_type, typename sarray_type,
+ typename bucketC_type, typename bucketB_type,
+ typename index_type>
+std::pair<index_type, index_type>
+stage1sort(string_type T, sarray_type SA,
+ bucketC_type C, bucketB_type B,
+ index_type n, index_type k, unsigned flags) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ sarray_type b;
+ index_type i, j, name, m;
+ char_type c0, c1;
+ getCounts(T, C, n, k); getBuckets(C, B, k, true); /* find ends of buckets */
+ for(i = 0; i < n; ++i) { SA[i] = 0; }
+ b = SA + n - 1; i = n - 1; j = n; m = 0; c0 = T[n - 1];
+ do { c1 = c0; } while((0 <= --i) && ((c0 = T[i]) >= c1));
+ for(; 0 <= i;) {
+ do { c1 = c0; } while((0 <= --i) && ((c0 = T[i]) <= c1));
+ if(0 <= i) {
+ *b = j; b = SA + --B[c1]; j = i; ++m; assert(B[c1] != (n - 1));
+ do { c1 = c0; } while((0 <= --i) && ((c0 = T[i]) >= c1));
+ }
+ }
+ SA[n - 1] = 0;
+
+ if(1 < m) {
+ if(flags & (16 | 32)) {
+ assert((j + 1) < n);
+ ++B[T[j + 1]];
+ if(flags & 16) {
+ index_type *D;
+ try { D = new index_type[k * 2]; } catch(...) { D = 0; }
+ if(D == 0) { return std::make_pair(-2, -2); }
+ for(i = 0, j = 0; i < k; ++i) {
+ j += C[i];
+ if(B[i] != j) { assert(SA[B[i]] != 0); SA[B[i]] += n; }
+ D[i] = D[i + k] = 0;
+ }
+ LMSsort2(T, SA, C, B, D, n, k);
+ delete[] D;
+ } else {
+ bucketB_type D = B - k * 2;
+ for(i = 0, j = 0; i < k; ++i) {
+ j += C[i];
+ if(B[i] != j) { assert(SA[B[i]] != 0); SA[B[i]] += n; }
+ D[i] = D[i + k] = 0;
+ }
+ LMSsort2(T, SA, C, B, D, n, k);
+ }
+ name = LMSpostproc2(SA, n, m);
+ } else {
+ LMSsort1(T, SA, C, B, n, k, (flags & (4 | 64)) != 0);
+ name = LMSpostproc1(T, SA, n, m);
+ }
+ } else if(m == 1) {
+ *b = j + 1;
+ name = 1;
+ } else {
+ name = 0;
+ }
+ return std::make_pair(m, name);
+}
+template<typename string_type, typename sarray_type,
+ typename bucketC_type, typename bucketB_type, typename index_type>
+index_type
+stage3sort(string_type T, sarray_type SA, bucketC_type C, bucketB_type B,
+ index_type n, index_type m, index_type k,
+ unsigned flags, bool isbwt) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ index_type i, j, p, q, pidx = 0;
+ char_type c0, c1;
+ if((flags & 8) != 0) { getCounts(T, C, n, k); }
+ /* put all left-most S characters into their buckets */
+ if(1 < m) {
+ getBuckets(C, B, k, 1); /* find ends of buckets */
+ i = m - 1, j = n, p = SA[m - 1], c1 = T[p];
+ do {
+ q = B[c0 = c1];
+ while(q < j) { SA[--j] = 0; }
+ do {
+ SA[--j] = p;
+ if(--i < 0) { break; }
+ p = SA[i];
+ } while((c1 = T[p]) == c0);
+ } while(0 <= i);
+ while(0 < j) { SA[--j] = 0; }
+ }
+ if(isbwt == false) { induceSA(T, SA, C, B, n, k, (flags & (4 | 64)) != 0); }
+ else { pidx = computeBWT(T, SA, C, B, n, k, (flags & (4 | 64)) != 0); }
+ return pidx;
+}
+
+/* find the suffix array SA of T[0..n-1] in {0..k}^n
+ use a working space (excluding s and SA) of at most 2n+O(1) for a constant alphabet */
+template<typename string_type, typename sarray_type, typename index_type>
+int
+suffixsort(string_type T, sarray_type SA,
+ index_type fs, index_type n, index_type k,
+ bool isbwt) {
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ sarray_type RA, C, B;
+ index_type *Cp, *Bp;
+ index_type i, j, m, name, pidx, newfs;
+ unsigned flags = 0;
+ char_type c0, c1;
+
+ /* stage 1: reduce the problem by at least 1/2
+ sort all the S-substrings */
+ C = B = SA; /* for warnings */
+ Cp = 0, Bp = 0;
+ if(k <= 256) {
+ try { Cp = new index_type[k]; } catch(...) { Cp = 0; }
+ if(Cp == 0) { return -2; }
+ if(k <= fs) {
+ B = SA + (n + fs - k);
+ flags = 1;
+ } else {
+ try { Bp = new index_type[k]; } catch(...) { Bp = 0; }
+ if(Bp == 0) { return -2; }
+ flags = 3;
+ }
+ } else if(k <= fs) {
+ C = SA + (n + fs - k);
+ if(k <= (fs - k)) {
+ B = C - k;
+ flags = 0;
+ } else if(k <= 1024) {
+ try { Bp = new index_type[k]; } catch(...) { Bp = 0; }
+ if(Bp == 0) { return -2; }
+ flags = 2;
+ } else {
+ B = C;
+ flags = 64 | 8;
+ }
+ } else {
+ try { Cp = new index_type[k]; } catch(...) { Cp = 0; }
+ if(Cp == 0) { return -2; }
+ Bp = Cp;
+ flags = 4 | 8;
+ }
+ if((n <= ((std::numeric_limits<index_type>::max)() / 2)) && (2 <= (n / k))) {
+ if(flags & 1) { flags |= ((k * 2) <= (fs - k)) ? 32 : 16; }
+ else if((flags == 0) && ((k * 2) <= (fs - k * 2))) { flags |= 32; }
+ }
+ {
+ std::pair<index_type, index_type> r;
+ if(Cp != 0) {
+ if(Bp != 0) { r = stage1sort(T, SA, Cp, Bp, n, k, flags); }
+ else { r = stage1sort(T, SA, Cp, B, n, k, flags); }
+ } else {
+ if(Bp != 0) { r = stage1sort(T, SA, C, Bp, n, k, flags); }
+ else { r = stage1sort(T, SA, C, B, n, k, flags); }
+ }
+ m = r.first, name = r.second;
+ }
+ if(m < 0) {
+ if(flags & (1 | 4)) { delete[] Cp; }
+ if(flags & 2) { delete[] Bp; }
+ return -2;
+ }
+
+ /* stage 2: solve the reduced problem
+ recurse if names are not yet unique */
+ if(name < m) {
+ if(flags & 4) { delete[] Cp; }
+ if(flags & 2) { delete[] Bp; }
+ newfs = (n + fs) - (m * 2);
+ if((flags & (1 | 4 | 64)) == 0) {
+ if((k + name) <= newfs) { newfs -= k; }
+ else { flags |= 8; }
+ }
+ assert((n >> 1) <= (newfs + m));
+ RA = SA + m + newfs;
+ for(i = m + (n >> 1) - 1, j = m - 1; m <= i; --i) {
+ if(SA[i] != 0) { RA[j--] = SA[i] - 1; }
+ }
+ if(suffixsort(RA, SA, newfs, m, name, false) != 0) { if(flags & 1) { delete[] Cp; } return -2; }
+ i = n - 1; j = m - 1; c0 = T[n - 1];
+ do { c1 = c0; } while((0 <= --i) && ((c0 = T[i]) >= c1));
+ for(; 0 <= i;) {
+ do { c1 = c0; } while((0 <= --i) && ((c0 = T[i]) <= c1));
+ if(0 <= i) {
+ RA[j--] = i + 1;
+ do { c1 = c0; } while((0 <= --i) && ((c0 = T[i]) >= c1));
+ }
+ }
+ for(i = 0; i < m; ++i) { SA[i] = RA[SA[i]]; }
+ if(flags & 4) {
+ try { Cp = new index_type[k]; } catch(...) { Cp = 0; }
+ if(Cp == 0) { return -2; }
+ Bp = Cp;
+ }
+ if(flags & 2) {
+ try { Bp = new index_type[k]; } catch(...) { Bp = 0; }
+ if(Bp == 0) { if(flags & 1) { delete[] Cp; } return -2; }
+ }
+ }
+
+ /* stage 3: induce the result for the original problem */
+ if(Cp != 0) {
+ if(Bp != 0) { pidx = stage3sort(T, SA, Cp, Bp, n, m, k, flags, isbwt); }
+ else { pidx = stage3sort(T, SA, Cp, B, n, m, k, flags, isbwt); }
+ } else {
+ if(Bp != 0) { pidx = stage3sort(T, SA, C, Bp, n, m, k, flags, isbwt); }
+ else { pidx = stage3sort(T, SA, C, B, n, m, k, flags, isbwt); }
+ }
+ if(flags & (1 | 4)) { delete[] Cp; }
+ if(flags & 2) { delete[] Bp; }
+
+ return pidx;
+}
+
+} /* namespace saisxx_private */
+
+
+/**
+ * @brief Constructs the suffix array of a given string in linear time.
+ * @param T[0..n-1] The input string. (random access iterator)
+ * @param SA[0..n-1] The output array of suffixes. (random access iterator)
+ * @param n The length of the given string.
+ * @param k The alphabet size.
+ * @return 0 if no error occurred, -1 or -2 otherwise.
+ */
+template<typename string_type, typename sarray_type, typename index_type>
+int
+saisxx(string_type T, sarray_type SA, index_type n, index_type k = 256) {
+typedef typename std::iterator_traits<sarray_type>::value_type savalue_type;
+ assert((std::numeric_limits<index_type>::min)() < 0);
+ assert((std::numeric_limits<savalue_type>::min)() < 0);
+ assert((std::numeric_limits<savalue_type>::max)() == (std::numeric_limits<index_type>::max)());
+ assert((std::numeric_limits<savalue_type>::min)() == (std::numeric_limits<index_type>::min)());
+ if((n < 0) || (k <= 0)) { return -1; }
+ if(n <= 1) { if(n == 1) { SA[0] = 0; } return 0; }
+ return saisxx_private::suffixsort(T, SA, (index_type)0, n, k, false);
+}
+
+/**
+ * @brief Constructs the burrows-wheeler transformed string of a given string in linear time.
+ * @param T[0..n-1] The input string. (random access iterator)
+ * @param U[0..n-1] The output string. (random access iterator)
+ * @param A[0..n-1] The temporary array. (random access iterator)
+ * @param n The length of the given string.
+ * @param k The alphabet size.
+ * @return The primary index if no error occurred, -1 or -2 otherwise.
+ */
+template<typename string_type, typename sarray_type, typename index_type>
+index_type
+saisxx_bwt(string_type T, string_type U, sarray_type A, index_type n, index_type k = 256) {
+typedef typename std::iterator_traits<sarray_type>::value_type savalue_type;
+typedef typename std::iterator_traits<string_type>::value_type char_type;
+ index_type i, pidx;
+ assert((std::numeric_limits<index_type>::min)() < 0);
+ assert((std::numeric_limits<savalue_type>::min)() < 0);
+ assert((std::numeric_limits<savalue_type>::max)() == (std::numeric_limits<index_type>::max)());
+ assert((std::numeric_limits<savalue_type>::min)() == (std::numeric_limits<index_type>::min)());
+ if((n < 0) || (k <= 0)) { return -1; }
+ if(n <= 1) { if(n == 1) { U[0] = T[0]; } return n; }
+ pidx = saisxx_private::suffixsort(T, A, (index_type)0, n, k, true);
+ if(0 <= pidx) {
+ U[0] = T[n - 1];
+ for(i = 0; i < pidx; ++i) { U[i + 1] = (char_type)A[i]; }
+ for(i += 1; i < n; ++i) { U[i] = (char_type)A[i]; }
+ pidx += 1;
+ }
+ return pidx;
+}
+
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+#endif /* __cplusplus */
+#endif /* _SAIS_HXX */
diff --git a/FilterGraph/FilterGraph.cpp b/FilterGraph/FilterGraph.cpp
new file mode 100644
index 0000000..e4b96a9
--- /dev/null
+++ b/FilterGraph/FilterGraph.cpp
@@ -0,0 +1,598 @@
+/**
+ * Remove short contigs that do not contribute any relevant
+ * information to the assembly.
+ * Written by Tony Raymond <traymond at bcgsc.ca>
+ */
+
+#include "Common/Options.h"
+#include "ContigID.h"
+#include "ContigPath.h"
+#include "ContigProperties.h"
+#include "FastaReader.h"
+#include "IOUtil.h"
+#include "Uncompress.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/GraphIO.h"
+#include "Graph/GraphUtil.h"
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <algorithm>
+#include <fstream>
+#include <functional>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
+
+using namespace std;
+using namespace rel_ops;
+using namespace boost::lambda;
+using boost::tie;
+
+#define PROGRAM "abyss-filtergraph"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Tony Raymond.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... ADJ\n"
+"Remove short contigs that do not contribute any relevant\n"
+"information to the assembly.\n"
+" ADJ contig adjacency graph\n"
+"\n"
+" -k, --kmer=N k-mer size\n"
+" -T, --island=N remove islands shorter than N [0]\n"
+" -t, --tip=N remove tips shorter than N [0]\n"
+" -l, --length=N remove contigs shorter than N [0]\n"
+" --shim remove filler contigs that only contribute\n"
+" to adjacency [default]\n"
+" --no-shim disable filler contigs removal\n"
+" -m, --min-overlap=N require a minimum overlap of N bases [10]\n"
+" --assemble assemble unambiguous paths\n"
+" --no-assemble disable assembling of paths [default]\n"
+" -g, --graph=FILE write the contig adjacency graph to FILE\n"
+" -i, --ignore=FILE ignore contigs seen in FILE\n"
+" --adj output the graph in adj format [default]\n"
+" --asqg output the graph in asqg format\n"
+" --dot output the graph in dot format\n"
+" --dot-meancov same as above but give the mean coverage\n"
+" --sam output the graph in SAM format\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by ContigProperties
+
+ /** Remove island contigs less than this length. */
+ static unsigned minIslandLen = 0;
+
+ /** Remove tips less than this length. */
+ static unsigned minTipLen = 0;
+
+ /** Remove all contigs less than this length. */
+ static unsigned minLen = 0;
+
+ /** Remove short contigs that don't contribute any sequence. */
+ static int shim = 1;
+
+ /** Assemble unambiguous paths. */
+ static int assemble = 0;
+
+ /** Write the contig adjacency graph to this file. */
+ static string graphPath;
+
+ /** Contigs to ignore. */
+ static string ignorePath;
+
+ /** The minimum overlap allowed between two contigs. */
+ static int minOverlap = 10;
+
+ /** Output graph format. */
+ int format = ADJ; // used by ContigProperties
+}
+
+static const char shortopts[] = "g:i:k:l:m:t:T:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "adj", no_argument, &opt::format, ADJ },
+ { "asqg", no_argument, &opt::format, ASQG },
+ { "dot", no_argument, &opt::format, DOT },
+ { "dot-meancov", no_argument, &opt::format, DOT_MEANCOV },
+ { "sam", no_argument, &opt::format, SAM },
+ { "graph", required_argument, NULL, 'g' },
+ { "ignore", required_argument, NULL, 'i' },
+ { "kmer", required_argument, NULL, 'k' },
+ { "island", required_argument, NULL, 'T' },
+ { "tip", required_argument, NULL, 't' },
+ { "length", required_argument, NULL, 'l' },
+ { "shim", no_argument, &opt::shim, 1 },
+ { "no-shim", no_argument, &opt::shim, 0 },
+ { "assemble", no_argument, &opt::assemble, 1 },
+ { "no-assemble", no_argument, &opt::assemble, 0 },
+ { "min-overlap", required_argument, NULL, 'm' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+static vector<ContigID> g_removed;
+
+/** Contig adjacency graph. */
+typedef ContigGraph<DirectedGraph<ContigProperties, Distance> > Graph;
+typedef Graph::vertex_descriptor vertex_descriptor;
+
+/** Data for verbose output. */
+static struct {
+ unsigned removed;
+ unsigned tails;
+ unsigned too_long;
+ unsigned too_complex;
+ unsigned self_adj;
+ unsigned checked;
+ unsigned parallel_edge;
+} g_count;
+
+/** Returns if the contig can be removed from the graph. */
+static bool removable(const Graph* pg, vertex_descriptor v)
+{
+ typedef graph_traits<Graph> GTraits;
+ typedef GTraits::out_edge_iterator OEit;
+ typedef GTraits::in_edge_iterator IEit;
+ typedef GTraits::vertex_descriptor V;
+
+ const Graph& g = *pg;
+
+ // Check if previously removed
+ if (get(vertex_removed, g, v)) {
+ g_count.removed++;
+ return false;
+ }
+
+ // Check for tails
+ if (out_degree(v, g) == 0 || in_degree(v, g) == 0) {
+ g_count.tails++;
+ return false;
+ }
+
+ // Check that the result will be less complex that the original
+ if (!(out_degree(v, g) == 1 && in_degree(v, g) > 1)
+ && !(out_degree(v, g) > 1 && in_degree(v, g) == 1)) {
+ g_count.too_complex++;
+ return false;
+ }
+
+ // Check if self adjacent
+ OEit oei0, oei1;
+ tie(oei0, oei1) = out_edges(v, g);
+ for (OEit vw = oei0; vw != oei1; ++vw) {
+ V w = target(*vw, g);
+ V vc = get(vertex_complement, g, v);
+ if (v == w || vc == w) {
+ g_count.self_adj++;
+ return false;
+ }
+ }
+
+ // Check that removing the contig will result in adjacent contigs
+ // overlapping by at least opt::minOverlap.
+ IEit iei0, iei1;
+ tie(iei0, iei1) = in_edges(v, g);
+ IEit maxuv = iei0;
+ for (IEit uv = iei0; uv != iei1; ++uv)
+ if (g[*maxuv].distance < g[*uv].distance)
+ maxuv = uv;
+ OEit maxvw = oei0;
+ for (OEit vw = oei0; vw != oei1; ++vw)
+ if (g[*maxvw].distance < g[*vw].distance)
+ maxvw = vw;
+
+ if (g[*maxuv].distance + (int)g[v].length + g[*maxvw].distance >
+ -opt::minOverlap) {
+ g_count.too_long++;
+ return false;
+ }
+ return true;
+}
+
+/** Data to store information of an edge. */
+struct EdgeInfo {
+ vertex_descriptor u;
+ vertex_descriptor w;
+ edge_bundle_type<Graph>::type ep;
+
+ EdgeInfo(vertex_descriptor u, vertex_descriptor w, int ep)
+ : u(u), w(w), ep(ep) {}
+ EdgeInfo() : u(), w(), ep() {}
+};
+
+/** Returns a list of edges that may be added when the vertex v is
+ * removed. */
+static bool findNewEdges(const Graph& g, vertex_descriptor v,
+ vector<EdgeInfo>& eds, vector<bool>& markedContigs)
+{
+ typedef graph_traits<Graph> GTraits;
+ typedef GTraits::vertex_descriptor V;
+ typedef GTraits::out_edge_iterator OEit;
+ typedef GTraits::in_edge_iterator IEit;
+
+ IEit iei0, iei1;
+ tie(iei0, iei1) = in_edges(v, g);
+ OEit oei0, oei1;
+ tie(oei0, oei1) = out_edges(v, g);
+
+ vector<V> marked;
+
+ // if not marked and longest link LE contig length.
+ // for every edge from u->v and v->w we must add an edge u->w
+ for (IEit uv = iei0; uv != iei1; ++uv) {
+ for (OEit vw = oei0; vw != oei1; ++vw) {
+ int x = g[*uv].distance + (int)g[v].length +
+ g[*vw].distance;
+ assert(x <= 0);
+ EdgeInfo ed(source(*uv, g), target(*vw, g), x);
+ eds.push_back(ed);
+ if (out_degree(v, g) > 1)
+ marked.push_back(ed.u);
+ if (in_degree(v, g) > 1)
+ marked.push_back(ed.w);
+
+ // Don't remove a vertex if the result is a parallel edge.
+ if (edge(ed.u, ed.w, g).second) {
+ g_count.parallel_edge++;
+ return false;
+ }
+ }
+ }
+ for (vector<V>::const_iterator it = marked.begin();
+ it != marked.end(); it++)
+ markedContigs[get(vertex_index, g, *it)] = true;
+ return true;
+}
+
+/** Adds all edges described in the vector eds. */
+static void addNewEdges(Graph& g, const vector<EdgeInfo>& eds)
+{
+ for (vector<EdgeInfo>::const_iterator edsit = eds.begin();
+ edsit != eds.end(); ++edsit) {
+ assert(!edge(edsit->u, edsit->w, g).second);
+ assert(edsit->ep.distance <= -opt::minOverlap);
+ add_edge(edsit->u, edsit->w, edsit->ep, g);
+ }
+}
+
+/** Remove the specified contig from the adjacency graph. */
+static void removeContigs(Graph& g, vector<vertex_descriptor>& sc)
+{
+ typedef graph_traits<Graph> GTraits;
+ typedef GTraits::vertex_descriptor V;
+ typedef GTraits::out_edge_iterator OEit;
+ typedef GTraits::in_edge_iterator IEit;
+
+ vector<vertex_descriptor> out;
+ out.reserve(sc.size());
+
+ vector<bool> markedContigs(g.num_vertices());
+ for (vector<vertex_descriptor>::iterator it = sc.begin();
+ it != sc.end(); ++it) {
+ V v = *it;
+ if (opt::verbose > 0 && ++g_count.checked % 10000000 == 0)
+ cerr << "Removed " << g_count.removed << "/"
+ << g_count.checked
+ << " vertices that have been checked.\n";
+
+ if (markedContigs[get(vertex_index, g, v)]) {
+ out.push_back(v);
+ continue;
+ }
+
+ if (!removable(&g, v))
+ continue;
+
+ vector<EdgeInfo> eds;
+ if (findNewEdges(g, v, eds, markedContigs))
+ addNewEdges(g, eds);
+ else
+ continue;
+
+ clear_vertex(v, g);
+ remove_vertex(v, g);
+ g_removed.push_back(get(vertex_contig_index, g, v));
+ g_count.removed++;
+ }
+ sc.swap(out);
+}
+
+/** Return the value of the bit at the specified index. */
+struct Marked : unary_function<vertex_descriptor, bool> {
+ typedef vector<bool> Data;
+ Marked(const Graph& g, const Data& data)
+ : m_g(g), m_data(data) { }
+ bool operator()(vertex_descriptor u) const
+ {
+ return m_data[get(vertex_contig_index, m_g, u)];
+ }
+ private:
+ const Graph& m_g;
+ const Data& m_data;
+};
+
+/** Finds all potentially removable contigs in the graph. */
+static void findShortContigs(const Graph& g, const vector<bool>& seen,
+ vector<vertex_descriptor>& sc)
+{
+ typedef graph_traits<Graph> GTraits;
+ typedef GTraits::vertex_iterator Vit;
+ Vit first, second;
+ tie(first, second) = vertices(g);
+ copy_if(first, second, back_inserter(sc),
+ !bind(Marked(g, seen), _1) && bind(removable, &g, _1));
+}
+
+/** Functor used for sorting contigs based on degree, then size,
+ * and then ID. */
+struct sortContigs {
+ const Graph& g;
+
+ sortContigs(const Graph& g) : g(g) {}
+
+ template <typename V>
+ bool operator() (V a, V b)
+ {
+ const ContigProperties& ap = g[a];
+ const ContigProperties& bp = g[b];
+
+ unsigned dega = out_degree(a, g) * in_degree(a, g);
+ unsigned degb = out_degree(b, g) * in_degree(b, g);
+
+ return dega != degb ? dega < degb
+ : ap.length != bp.length ? ap.length < bp.length
+ : a < b;
+ }
+};
+
+struct ShorterThanX : unary_function<vertex_descriptor, bool> {
+ const Graph& g;
+ const vector<bool>& seen;
+ size_t x;
+
+ ShorterThanX(const Graph& g, const vector<bool>& seen, size_t x)
+ : g(g), seen(seen), x(x) { }
+
+ bool operator()(vertex_descriptor y) const
+ {
+ return g[y].length < x && !get(vertex_removed, g, y)
+ && !seen[get(vertex_contig_index, g, y)];
+ }
+};
+
+static void removeShims(Graph& g, const vector<bool>& seen)
+{
+ if (opt::verbose > 0)
+ cerr << "Removing shim contigs from the graph...\n";
+ vector<vertex_descriptor> shortContigs;
+ findShortContigs(g, seen, shortContigs);
+ for (unsigned i = 0; !shortContigs.empty(); ++i) {
+ if (opt::verbose > 0)
+ cerr << "Pass " << i + 1 << ": Checking "
+ << shortContigs.size() << " contigs.\n";
+ sort(shortContigs.begin(), shortContigs.end(),
+ sortContigs(g));
+ removeContigs(g, shortContigs);
+ }
+ if (opt::verbose > 0) {
+ cerr << "Shim removal stats:\n";
+ cerr << "Removed: " << g_count.removed/2
+ << " Too Complex: " << g_count.too_complex/2
+ << " Tails: " << g_count.tails/2
+ << " Too Long: " << g_count.too_long/2
+ << " Self Adjacent: " << g_count.self_adj/2
+ << " Parallel Edges: " << g_count.parallel_edge/2 << '\n';
+ }
+}
+
+static void removeShortContigs(Graph& g, const vector<bool>& seen)
+{
+ typedef graph_traits<Graph> GTraits;
+ typedef GTraits::vertex_iterator Vit;
+ typedef GTraits::vertex_descriptor V;
+ Vit first, second;
+ tie(first, second) = vertices(g);
+ vector<V> sc;
+ copy_if(first, second, back_inserter(sc),
+ ShorterThanX(g, seen, opt::minLen));
+ remove_vertex_if(g, sc.begin(), sc.end(), True<V>());
+ transform(sc.begin(), sc.end(), back_inserter(g_removed),
+ mem_fun_ref(&ContigNode::contigIndex));
+ if (opt::verbose > 0)
+ cerr << "Removed " << sc.size()/2 << " short contigs.\n";
+}
+
+int main(int argc, char** argv)
+{
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?':
+ die = true;
+ break;
+ case 'l':
+ arg >> opt::minLen;
+ break;
+ case 'm':
+ arg >> opt::minOverlap;
+ break;
+ case 'g':
+ arg >> opt::graphPath;
+ break;
+ case 'i':
+ arg >> opt::ignorePath;
+ break;
+ case 'k':
+ arg >> opt::k;
+ break;
+ case 'T':
+ arg >> opt::minIslandLen;
+ break;
+ case 't':
+ arg >> opt::minTipLen;
+ break;
+ case 'v':
+ opt::verbose++;
+ break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::minOverlap < 0) {
+ cerr << PROGRAM ": "
+ << "--min-overlap must be a positive integer.\n";
+ die = true;
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": " << "missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (argc - optind < 1) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (argc - optind > 1) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ Graph g;
+ // Read the contig adjacency graph.
+ {
+ string adjPath(argv[optind++]);
+ if (opt::verbose > 0)
+ cerr << "Loading graph from file: " << adjPath
+ << '\n';
+ ifstream fin(adjPath.c_str());
+ assert_good(fin, adjPath);
+ fin >> g;
+ assert(fin.eof());
+ }
+
+ // Read the set of contigs to ignore.
+ vector<bool> seen(num_vertices(g) / 2);
+ if (!opt::ignorePath.empty()) {
+ ifstream in(opt::ignorePath.c_str());
+ assert_good(in, opt::ignorePath);
+ markSeenInPath(in, seen);
+ }
+
+ if (opt::verbose > 0) {
+ cerr << "Graph stats before:\n";
+ printGraphStats(cerr, g);
+ }
+
+ // Remove shims.
+ if (opt::shim)
+ removeShims(g, seen);
+
+ // Remove islands.
+ if (opt::minIslandLen > 0) {
+ size_t s = g_removed.size();
+ removeIslands_if(g, back_inserter(g_removed),
+ ShorterThanX(g, seen, opt::minIslandLen));
+ if (opt::verbose)
+ cerr << "Removed " << g_removed.size() - s
+ << " islands.\n";
+ }
+
+ // Remove tips.
+ if (opt::minTipLen > 0) {
+ size_t s = g_removed.size();
+ pruneTips_if(g, back_inserter(g_removed),
+ ShorterThanX(g, seen, opt::minTipLen));
+ if (opt::verbose)
+ cerr << "Removed " << g_removed.size() - s
+ << " tips.\n";
+ }
+
+ // Remove short contigs.
+ if (opt::minLen > 0)
+ removeShortContigs(g, seen);
+
+ if (opt::verbose > 0) {
+ cerr << "Graph stats after:\n";
+ printGraphStats(cerr, g);
+ }
+
+ sort(g_removed.begin(), g_removed.end());
+ g_removed.erase(unique(g_removed.begin(), g_removed.end()),
+ g_removed.end());
+ for (vector<ContigID>::const_iterator it = g_removed.begin();
+ it != g_removed.end(); ++it)
+ cout << get(g_contigNames, *it) << '\n';
+
+ // Assemble unambiguous paths.
+ if (opt::assemble) {
+ size_t numContigs = num_vertices(g) / 2;
+ typedef vector<ContigPath> ContigPaths;
+ ContigPaths paths;
+ assemble(g, back_inserter(paths));
+ for (ContigPaths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ ContigNode u(numContigs + it - paths.begin(), false);
+ string name = createContigName();
+ put(vertex_name, g, u, name);
+ cout << name << '\t' << *it << '\n';
+ }
+ }
+
+ // Output the updated adjacency graph.
+ if (!opt::graphPath.empty()) {
+ ofstream fout(opt::graphPath.c_str());
+ assert_good(fout, opt::graphPath);
+ write_graph(fout, g, PROGRAM, commandLine);
+ assert_good(fout, opt::graphPath);
+ }
+
+ return 0;
+}
diff --git a/FilterGraph/Makefile.am b/FilterGraph/Makefile.am
new file mode 100644
index 0000000..1f43927
--- /dev/null
+++ b/FilterGraph/Makefile.am
@@ -0,0 +1,14 @@
+bin_PROGRAMS = abyss-filtergraph
+
+abyss_filtergraph_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+abyss_filtergraph_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+
+abyss_filtergraph_LDADD = \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_filtergraph_SOURCES = FilterGraph.cpp
diff --git a/FilterGraph/Makefile.in b/FilterGraph/Makefile.in
new file mode 100644
index 0000000..6aed6e3
--- /dev/null
+++ b/FilterGraph/Makefile.in
@@ -0,0 +1,533 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = abyss-filtergraph$(EXEEXT)
+subdir = FilterGraph
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_abyss_filtergraph_OBJECTS = \
+ abyss_filtergraph-FilterGraph.$(OBJEXT)
+abyss_filtergraph_OBJECTS = $(am_abyss_filtergraph_OBJECTS)
+abyss_filtergraph_DEPENDENCIES = $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+abyss_filtergraph_LINK = $(CXXLD) $(abyss_filtergraph_CXXFLAGS) \
+ $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(abyss_filtergraph_SOURCES)
+DIST_SOURCES = $(abyss_filtergraph_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+abyss_filtergraph_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+abyss_filtergraph_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+abyss_filtergraph_LDADD = \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_filtergraph_SOURCES = FilterGraph.cpp
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign FilterGraph/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign FilterGraph/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+abyss-filtergraph$(EXEEXT): $(abyss_filtergraph_OBJECTS) $(abyss_filtergraph_DEPENDENCIES) $(EXTRA_abyss_filtergraph_DEPENDENCIES)
+ @rm -f abyss-filtergraph$(EXEEXT)
+ $(abyss_filtergraph_LINK) $(abyss_filtergraph_OBJECTS) $(abyss_filtergraph_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_filtergraph-FilterGraph.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+abyss_filtergraph-FilterGraph.o: FilterGraph.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_filtergraph_CPPFLAGS) $(CPPFLAGS) $(abyss_filtergraph_CXXFLAGS) $(CXXFLAGS) -MT abyss_filtergraph-FilterGraph.o -MD -MP -MF $(DEPDIR)/abyss_filtergraph-FilterGraph.Tpo -c -o abyss_filtergraph-FilterGraph.o `test -f 'FilterGraph.cpp' || echo '$(srcdir)/'`FilterGraph.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_filtergraph-FilterGraph.Tpo $(DEPDIR)/abyss_filtergraph-FilterGraph.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='FilterGraph.cpp' object='abyss_filtergraph-FilterGraph.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_filtergraph_CPPFLAGS) $(CPPFLAGS) $(abyss_filtergraph_CXXFLAGS) $(CXXFLAGS) -c -o abyss_filtergraph-FilterGraph.o `test -f 'FilterGraph.cpp' || echo '$(srcdir)/'`FilterGraph.cpp
+
+abyss_filtergraph-FilterGraph.obj: FilterGraph.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_filtergraph_CPPFLAGS) $(CPPFLAGS) $(abyss_filtergraph_CXXFLAGS) $(CXXFLAGS) -MT abyss_filtergraph-FilterGraph.obj -MD -MP -MF $(DEPDIR)/abyss_filtergraph-FilterGraph.Tpo -c -o abyss_filtergraph-FilterGraph.obj `if test -f 'FilterGraph.cpp'; then $(CYGPATH_W) 'FilterGraph.cpp'; else $(CYGPATH_W) '$(srcdir)/FilterGraph.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_filtergraph-FilterGraph.Tpo $(DEPDIR)/abyss_filtergraph-FilterGraph.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='FilterGraph.cpp' object='abyss_filtergraph-FilterGraph.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_filtergraph_CPPFLAGS) $(CPPFLAGS) $(abyss_filtergraph_CXXFLAGS) $(CXXFLAGS) -c -o abyss_filtergraph-FilterGraph.obj `if test -f 'FilterGraph.cpp'; then $(CYGPATH_W) 'FilterGraph.cpp'; else $(CYGPATH_W) '$(srcdir)/FilterGraph.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Graph/AdjIO.h b/Graph/AdjIO.h
new file mode 100644
index 0000000..48f2cd9
--- /dev/null
+++ b/Graph/AdjIO.h
@@ -0,0 +1,204 @@
+#ifndef ADJIO_H
+#define ADJIO_H 1
+
+#include "ContigID.h"
+#include "ContigGraph.h"
+#include "IOUtil.h"
+#include <boost/graph/graph_traits.hpp>
+#include <algorithm> // for count
+#include <cassert>
+#include <cstdlib>
+#include <istream>
+#include <ostream>
+#include <utility>
+
+using namespace std::rel_ops;
+using boost::graph_traits;
+
+template <typename EdgeProp>
+void write_edge_prop(std::ostream& out, const EdgeProp& ep)
+{
+ if (ep != EdgeProp())
+ out << " [" << ep << ']';
+}
+
+static inline void write_edge_prop(std::ostream&, const no_property&)
+{
+}
+
+/** Output a contig adjacency graph. */
+template <typename Graph>
+std::ostream& write_adj(std::ostream& out, const Graph& g)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor
+ vertex_descriptor;
+ typedef typename graph_traits<Graph>::vertex_iterator
+ vertex_iterator;
+ typedef typename graph_traits<Graph>::out_edge_iterator
+ out_edge_iterator;
+
+ std::pair<vertex_iterator, vertex_iterator> vit = vertices(g);
+ bool sense = false;
+ for (vertex_iterator u = vit.first; u != vit.second; ++u,
+ sense = !sense) {
+ if (get(vertex_removed, g, *u))
+ continue;
+ if (!sense)
+ out << get(vertex_contig_name, g, *u)
+ << get(vertex_bundle, g, *u);
+ out << "\t;";
+ std::pair<out_edge_iterator, out_edge_iterator>
+ adj = out_edges(*u, g);
+ for (out_edge_iterator e = adj.first; e != adj.second; ++e) {
+ vertex_descriptor v = target(*e, g);
+ assert(!get(vertex_removed, g, v));
+ out << ' ' << get(vertex_name, g, v ^ sense);
+ write_edge_prop(out, get(edge_bundle, g, e));
+ }
+ if (sense)
+ out << '\n';
+ }
+ return out;
+}
+
+/** Read the edges of a graph in dist format. */
+template <typename Graph, typename BetterEP>
+std::istream& readDistEdges(std::istream& in, ContigGraph<Graph>& g,
+ typename graph_traits<Graph>::vertex_descriptor u,
+ BetterEP betterEP)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+ typedef typename graph_traits<Graph>::edge_descriptor E;
+ typedef typename Graph::edge_property_type EP;
+ for (std::string vname; getline(in >> std::ws, vname, ',');) {
+ assert(!vname.empty());
+ V v = find_vertex(vname, g);
+ v = v ^ get(vertex_sense, g, u);
+ EP ep;
+ in >> ep;
+ assert(in);
+ if (in.peek() != ' ')
+ in >> Ignore(' ');
+
+ E e;
+ bool found;
+ boost::tie(e, found) = edge(u, v, g);
+ if (found) {
+ // Parallel edge
+ EP& ref = g[e];
+ ref = betterEP(ref, ep);
+ } else
+ g.Graph::add_edge(u, v, ep);
+ }
+ assert(in.eof());
+ return in;
+}
+
+/** Read a contig adjacency graph.
+ * @param betterEP handle parallel edges
+ */
+template <typename Graph, typename BetterEP>
+std::istream& read_adj(std::istream& in, ContigGraph<Graph>& g,
+ BetterEP betterEP)
+{
+ assert(in);
+
+ typedef typename Graph::vertex_descriptor vertex_descriptor;
+ typedef typename Graph::vertex_property_type vertex_property_type;
+ typedef typename Graph::edge_property_type edge_property_type;
+
+ // Check for ADJ or DIST format.
+ std::string line;
+ getline(in, line);
+ assert(in);
+ unsigned numSemicolons
+ = std::count(line.begin(), line.end(), ';');
+ if (numSemicolons > 2) {
+ std::cerr << "error: expected 0, 1 or 2 semicolons and saw "
+ << numSemicolons << '\n';
+ exit(EXIT_FAILURE);
+ }
+ bool faiFormat = numSemicolons == 0;
+ bool adjFormat = numSemicolons == 2;
+
+ // Read the vertex properties.
+ if (adjFormat || faiFormat) {
+ assert(num_vertices(g) == 0);
+ in.clear();
+ in.seekg(std::ios_base::beg);
+ assert(in);
+ for (std::string uname; in >> uname;) {
+ vertex_property_type vp;
+ if (faiFormat) {
+ unsigned length;
+ in >> length;
+ put(vertex_length, vp, length);
+ } else
+ in >> vp;
+ in >> Ignore('\n');
+ assert(in);
+ vertex_descriptor u = add_vertex(vp, g);
+ put(vertex_name, g, u, uname);
+ }
+ assert(in.eof());
+ }
+ assert(num_vertices(g) > 0);
+ g_contigNames.lock();
+
+ if (faiFormat)
+ return in;
+
+ // Read the edges.
+ in.clear();
+ in.seekg(std::ios_base::beg);
+ assert(in);
+ for (std::string name; in >> name;) {
+ if (adjFormat)
+ in >> Ignore(';');
+ vertex_descriptor u = find_vertex(name, false, g);
+ for (int sense = false; sense <= true; ++sense) {
+ std::string s;
+ getline(in, s, !sense ? ';' : '\n');
+ assert(in.good());
+ std::istringstream ss(s);
+ if (!adjFormat) {
+ readDistEdges(ss, g, u ^ sense, betterEP);
+ } else
+ for (std::string vname; ss >> vname >> std::ws;) {
+ vertex_descriptor v = find_vertex(vname, g);
+ assert(!edge(u ^ sense, v ^ sense, g).second);
+ if (ss.peek() == '[') {
+ ss.get();
+ edge_property_type ep;
+ ss >> ep >> Ignore(']');
+ g.Graph::add_edge(u ^ sense, v ^ sense, ep);
+ } else
+ g.Graph::add_edge(u ^ sense, v ^ sense);
+ }
+ assert(ss.eof());
+ }
+ }
+ assert(in.eof());
+ return in;
+}
+
+template <typename Graph>
+class AdjWriter
+{
+ const Graph& m_g;
+ public:
+ AdjWriter(const Graph& g) : m_g(g) { }
+ friend std::ostream& operator<<(std::ostream& out,
+ const AdjWriter& o)
+ {
+ return write_adj<Graph>(out, o.m_g);
+ }
+};
+
+template <typename Graph>
+AdjWriter<Graph> adj_writer(const Graph& g)
+{
+ return AdjWriter<Graph>(g);
+}
+
+#endif
diff --git a/Graph/AsqgIO.h b/Graph/AsqgIO.h
new file mode 100644
index 0000000..a3bc142
--- /dev/null
+++ b/Graph/AsqgIO.h
@@ -0,0 +1,156 @@
+#ifndef ASQGIO_H
+#define ASQGIO_H 1
+
+#include "Common/IOUtil.h"
+#include "Graph/Properties.h"
+#include <boost/graph/graph_traits.hpp>
+#include <cassert>
+#include <cstdlib>
+#include <iostream>
+#include <string>
+
+using boost::graph_traits;
+
+/** Write a graph in ASQG format. */
+template <typename Graph>
+std::ostream& write_asqg(std::ostream& out, Graph& g)
+{
+ typedef typename graph_traits<Graph>::edge_descriptor E;
+ typedef typename graph_traits<Graph>::edge_iterator Eit;
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+ typedef typename graph_traits<Graph>::vertex_iterator Vit;
+ typedef typename vertex_bundle_type<Graph>::type VP;
+
+ out << "HT\tVN:i:1\n";
+ assert(out);
+
+ std::pair<Vit, Vit> vrange = vertices(g);
+ for (Vit uit = vrange.first; uit != vrange.second; ++uit, ++uit) {
+ V u = *uit;
+ if (get(vertex_removed, g, u))
+ continue;
+ const VP& vp = g[u];
+ out << "VT\t" << get(vertex_contig_name, g, u)
+ << "\t*\tLN:i:" << vp.length;
+ if (vp.coverage > 0)
+ out << "\tXC:i:" << vp.coverage;
+ out << '\n';
+ }
+
+ std::pair<Eit, Eit> erange = edges(g);
+ for (Eit eit = erange.first; eit != erange.second; ++eit) {
+ E e = *eit;
+ V u = source(e, g);
+ V v = target(e, g);
+ if (v < u || get(vertex_removed, g, u))
+ continue;
+ assert(!get(vertex_removed, g, v));
+ int distance = g[e].distance;
+ assert(distance < 0);
+ unsigned overlap = -distance;
+ unsigned ulen = g[u].length;
+ unsigned vlen = g[v].length;
+ bool usense = get(vertex_sense, g, u);
+ bool vsense = get(vertex_sense, g, v);
+ out << "ED\t" << get(vertex_contig_name, g, u)
+ << ' ' << get(vertex_contig_name, g, v)
+ << ' ' << (usense ? 0 : ulen - overlap)
+ << ' ' << (usense ? overlap : ulen) - 1
+ << ' ' << ulen
+ << ' ' << (!vsense ? 0 : vlen - overlap)
+ << ' ' << (!vsense ? overlap : vlen) - 1
+ << ' ' << vlen
+ << ' ' << (usense != vsense)
+ << " -1\n"; // number of mismatches
+ }
+ return out;
+}
+
+/** Read a graph in ASQG format. */
+template <typename Graph>
+std::istream& read_asqg(std::istream& in, Graph& g)
+{
+ assert(in);
+
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+ typedef typename graph_traits<Graph>::edge_descriptor E;
+ typedef typename vertex_property<Graph>::type VP;
+ typedef typename edge_property<Graph>::type EP;
+
+ // Add vertices if this graph is empty.
+ bool addVertices = num_vertices(g) == 0;
+
+ while (in && in.peek() != EOF) {
+ switch (in.peek()) {
+ case 'H':
+ in >> expect("HT") >> Ignore('\n');
+ assert(in);
+ break;
+ case 'V': {
+ std::string uname, seq;
+ in >> expect("VT") >> uname >> seq;
+ assert(in);
+ assert(!seq.empty());
+
+ unsigned length = 0;
+ if (seq == "*") {
+ in >> expect(" LN:i:") >> length;
+ assert(in);
+ } else
+ length = seq.size();
+ in >> Ignore('\n');
+
+ if (addVertices) {
+ VP vp;
+ put(vertex_length, vp, length);
+ V u = add_vertex(vp, g);
+ put(vertex_name, g, u, uname);
+ } else {
+ V u = find_vertex(uname, false, g);
+ assert(get(vertex_index, g, u) < num_vertices(g));
+ (void)u;
+ }
+ break;
+ }
+ case 'E': {
+ std::string uname, vname;
+ unsigned s1, e1, l1, s2, e2, l2;
+ bool rc;
+ int nd;
+ in >> expect("ED") >> uname >> vname
+ >> s1 >> e1 >> l1
+ >> s2 >> e2 >> l2
+ >> rc >> nd >> Ignore('\n');
+ assert(in);
+ assert(s1 < e1 && e1 < l1 && s2 < e2 && e2 < l2);
+ assert(e1 - s1 == e2 - s2);
+ assert(e1 - s1 + 1 < l1 && e2 - s2 + 1 < l2);
+ assert(((s1 > 0) == (s2 > 0)) == rc);
+ int d = -(e1 - s1 + 1);
+ assert(d < 0);
+ EP ep(d);
+ V u = find_vertex(uname, s1 == 0, g);
+ V v = find_vertex(vname, s2 > 0, g);
+ std::pair<E, bool> e = edge(u, v, g);
+ if (e.second) {
+ // Ignore duplicate edges that are self loops.
+ assert(g[e.first] == ep);
+ assert(u == v);
+ } else
+ add_edge(u, v, ep, g);
+ break;
+ }
+ default: {
+ std::string s;
+ in >> s;
+ std::cerr << "error: unknown record type: `"
+ << s << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+ }
+ assert(in.eof());
+ return in;
+}
+
+#endif
diff --git a/Graph/Assemble.h b/Graph/Assemble.h
new file mode 100644
index 0000000..323e524
--- /dev/null
+++ b/Graph/Assemble.h
@@ -0,0 +1,67 @@
+#ifndef ASSEMBLE_H
+#define ASSEMBLE_H 1
+
+#include "Common/ContigNode.h" // for ContigIndexMap
+#include "Common/Iterator.h" // for output_iterator_traits
+#include "Graph/DepthFirstSearch.h"
+
+using boost::graph_traits;
+
+/** Return true if this edge is contiguous. */
+template <typename Graph>
+bool isContiguous(const Graph &g,
+ typename graph_traits<Graph>::edge_descriptor e)
+{
+ return out_degree(source(e, g), g) == 1
+ && in_degree(target(e, g), g) == 1;
+}
+
+/** Assemble contigous paths. Write the paths to out. */
+template <typename OutIt>
+class AssembleVisitor : public boost::default_dfs_visitor
+{
+ public:
+ AssembleVisitor(OutIt it) : m_it(it) { }
+
+ template <typename Vertex, typename Graph>
+ void discover_vertex(const Vertex& u, Graph&)
+ {
+ m_path.push_back(u);
+ }
+
+ template <typename Vertex, typename Graph>
+ void finish_vertex(const Vertex&, Graph&)
+ {
+ finishContig();
+ }
+
+ template <typename Edge, typename Graph>
+ void examine_edge(const Edge& e, const Graph& g)
+ {
+ if (!isContiguous(g, e))
+ finishContig();
+ }
+
+ private:
+ void finishContig()
+ {
+ if (m_path.size() > 1)
+ *m_it++ = m_path;
+ m_path.clear();
+ }
+
+ OutIt m_it;
+ typename output_iterator_traits<OutIt>::value_type m_path;
+};
+
+/** Assemble unambiguous paths. Write the paths to out. */
+template<typename Graph, typename OutIt>
+void assembleDFS(const Graph& g, OutIt out)
+{
+ typedef boost::vector_property_map<
+ boost::default_color_type, ContigIndexMap> ColorMap;
+ depthFirstSearch(g, AssembleVisitor<OutIt>(out),
+ ColorMap(num_vertices(g) / 2));
+}
+
+#endif
diff --git a/Graph/ConstrainedSearch.cpp b/Graph/ConstrainedSearch.cpp
new file mode 100644
index 0000000..6f4691e
--- /dev/null
+++ b/Graph/ConstrainedSearch.cpp
@@ -0,0 +1,131 @@
+#include "ConstrainedSearch.h"
+#include "ContigGraph.h"
+#include "DirectedGraph.h"
+#include "Graph/Properties.h"
+#include <algorithm>
+#include <climits> // for INT_MIN
+#include <utility>
+
+using namespace std;
+
+namespace opt {
+ /** Abort the search after visiting maxCost vertices. */
+ unsigned maxCost = 100000;
+}
+
+/** Compare the distance of two constraints. */
+static inline bool compareDistance(
+ const Constraint& a, const Constraint& b)
+{
+ return a.second < b.second;
+}
+
+/** Compare the ID of a constraint. */
+static inline bool compareID(const Constraint& constraint,
+ const ContigNode& key)
+{
+ return constraint.first < key;
+}
+
+/** Find a constraint by ID. */
+static inline Constraints::iterator findConstraint(
+ Constraints& constraints,
+ const ContigNode& key)
+{
+ Constraints::iterator it = lower_bound(
+ constraints.begin(), constraints.end(),
+ key, compareID);
+ return it != constraints.end()
+ && it->first == key ? it : constraints.end();
+}
+
+typedef graph_traits<Graph>::vertex_descriptor vertex_descriptor;
+typedef graph_traits<Graph>::out_edge_iterator out_edge_iterator;
+
+/** Find paths through the graph that satisfy the constraints.
+ * @return false if the search exited early
+ */
+bool constrainedSearch(const Graph& g,
+ vertex_descriptor u,
+ Constraints& constraints,
+ Constraints::const_iterator nextConstraint,
+ unsigned satisfied,
+ ContigPath& path, ContigPaths& solutions,
+ int distance, unsigned& visitedCount)
+{
+ assert(satisfied < constraints.size());
+ static const int SATISFIED = INT_MAX;
+ if (!path.empty()) {
+ vertex_descriptor v = path.back();
+ Constraints::iterator it = findConstraint(constraints, v);
+ if (it != constraints.end() && it->second != SATISFIED) {
+ if (distance > it->second)
+ return true; // This constraint cannot be met.
+
+ if (++satisfied == constraints.size()) {
+ // All the constraints have been satisfied.
+ solutions.push_back(path);
+ return solutions.size() <= opt::maxPaths;
+ }
+ // This constraint has been satisfied.
+ int constraint = it->second;
+ it->second = SATISFIED;
+ if (!constrainedSearch(g, u, constraints,
+ nextConstraint, satisfied, path, solutions,
+ distance, visitedCount))
+ return false;
+ it->second = constraint;
+ return true;
+ }
+
+ if (++visitedCount >= opt::maxCost)
+ return false; // Too complex.
+
+ // Check that the next constraint has not been violated.
+ while (distance > nextConstraint->second
+ && findConstraint(constraints,
+ nextConstraint->first)->second == SATISFIED)
+ ++nextConstraint; // This constraint is satisfied.
+ if (distance > nextConstraint->second)
+ return true; // This constraint cannot be met.
+
+ distance += g[v].length;
+ u = v;
+ }
+
+ path.push_back(vertex_descriptor());
+ pair<out_edge_iterator, out_edge_iterator> adj = g.out_edges(u);
+ for (out_edge_iterator it = adj.first; it != adj.second; ++it) {
+ path.back() = target(*it, g);
+ if (!constrainedSearch(g, u, constraints,
+ nextConstraint, satisfied, path, solutions,
+ distance + g[*it].distance, visitedCount))
+ return false;
+ }
+ assert(!path.empty());
+ path.pop_back();
+ return true;
+}
+
+/** Find paths through the graph that satisfy the constraints.
+ * @return false if the search exited early
+ */
+bool constrainedSearch(const Graph& g, vertex_descriptor v,
+ Constraints& constraints, ContigPaths& paths,
+ unsigned& cost)
+{
+ if (constraints.empty())
+ return false;
+
+ // Sort the constraints by ID.
+ sort(constraints.begin(), constraints.end());
+
+ // Sort the constraints by distance.
+ Constraints queue(constraints);
+ sort(queue.begin(), queue.end(), compareDistance);
+
+ ContigPath path;
+ constrainedSearch(g, v, constraints, queue.begin(), 0,
+ path, paths, 0, cost);
+ return cost >= opt::maxCost ? false : !paths.empty();
+}
diff --git a/Graph/ConstrainedSearch.h b/Graph/ConstrainedSearch.h
new file mode 100644
index 0000000..1553830
--- /dev/null
+++ b/Graph/ConstrainedSearch.h
@@ -0,0 +1,30 @@
+#ifndef CONSTRAINEDSEARCH_H
+#define CONSTRAINEDSEARCH_H 1
+
+#include "ContigGraph.h"
+#include "ContigPath.h"
+#include "ContigProperties.h"
+#include "DirectedGraph.h"
+#include <cassert>
+#include <istream>
+#include <utility>
+#include <vector>
+
+namespace opt {
+ extern unsigned maxCost;
+
+ /** Abort the search after visiting maxPaths solutions. */
+ static const unsigned maxPaths = 200;
+}
+
+typedef ContigGraph<DirectedGraph<ContigProperties, Distance> > Graph;
+typedef std::pair<ContigNode, int> Constraint;
+typedef std::vector<Constraint> Constraints;
+typedef std::vector<ContigPath> ContigPaths;
+
+bool constrainedSearch(const Graph& g,
+ graph_traits<Graph>::vertex_descriptor origin,
+ Constraints& constraints,
+ ContigPaths& superPaths, unsigned& compCost);
+
+#endif
diff --git a/Graph/ContigGraph.h b/Graph/ContigGraph.h
new file mode 100644
index 0000000..4c51f79
--- /dev/null
+++ b/Graph/ContigGraph.h
@@ -0,0 +1,518 @@
+#ifndef CONTIGGRAPH_H
+#define CONTIGGRAPH_H 1
+
+#include "ContigID.h"
+#include "Graph/Properties.h"
+#include <boost/graph/graph_traits.hpp>
+#include <cassert>
+#include <utility>
+
+using boost::graph_traits;
+
+/** A contig graph is a directed graph with the property that
+ * the edge (u,v) implies the existence of the edge (~v,~u).
+ */
+template <typename G>
+class ContigGraph : public G {
+ public:
+ typedef G base_type;
+
+ // Graph
+ typedef typename graph_traits<G>::vertex_descriptor
+ vertex_descriptor;
+ typedef typename graph_traits<G>::directed_category
+ directed_category;
+ typedef typename graph_traits<G>::traversal_category
+ traversal_category;
+ typedef typename graph_traits<G>::edge_parallel_category
+ edge_parallel_category;
+
+ // IncidenceGraph
+ typedef typename graph_traits<G>::edge_descriptor
+ edge_descriptor;
+ typedef typename graph_traits<G>::out_edge_iterator
+ out_edge_iterator;
+ typedef typename graph_traits<G>::degree_size_type
+ degree_size_type;
+
+ // AdjacencyGraph
+ typedef typename graph_traits<G>::adjacency_iterator
+ adjacency_iterator;
+
+ // VertexListGraph
+ typedef typename graph_traits<G>::vertex_iterator
+ vertex_iterator;
+ typedef typename graph_traits<G>::vertices_size_type
+ vertices_size_type;
+
+ // EdgeListGraph
+ typedef typename graph_traits<G>::edge_iterator
+ edge_iterator;
+ typedef typename graph_traits<G>::edges_size_type
+ edges_size_type;
+
+ // VertexMutablePropertyGraph
+ typedef typename vertex_property<G>::type vertex_property_type;
+
+ // EdgeMutablePropertyGraph
+ typedef typename edge_property<G>::type edge_property_type;
+
+ // BidirectionalGraph
+/** Iterate through the in-edges. */
+class in_edge_iterator
+ : public std::iterator<std::input_iterator_tag, edge_descriptor>
+{
+ /** Return the complement (~v, ~u) of the edge (u, v). */
+ static edge_descriptor complement(const edge_descriptor& e)
+ {
+ return std::pair<vertex_descriptor, vertex_descriptor>(
+ e.second ^ 1, e.first ^ 1);
+ }
+
+ public:
+ in_edge_iterator() { }
+
+ in_edge_iterator(typename graph_traits<G>::out_edge_iterator it)
+ : m_it(it) { }
+
+ edge_descriptor operator*() const
+ {
+ return complement(*m_it);
+ }
+
+ bool operator==(const in_edge_iterator& it) const
+ {
+ return m_it == it.m_it;
+ }
+
+ bool operator!=(const in_edge_iterator& it) const
+ {
+ return m_it != it.m_it;
+ }
+
+ in_edge_iterator& operator++() { ++m_it; return *this; }
+
+ in_edge_iterator operator++(int)
+ {
+ in_edge_iterator it = *this;
+ ++*this;
+ return it;
+ }
+
+ private:
+ out_edge_iterator m_it;
+};
+
+ public:
+ /** Construct an empty contig graph. */
+ ContigGraph() { }
+
+ /** Construct a contig graph with n vertices. The underlying
+ * directed graph has two vertices for each contig. */
+ ContigGraph(vertices_size_type n) : G(2 * n) { }
+
+ /** Return the in degree of vertex v. */
+ degree_size_type in_degree(vertex_descriptor v) const
+ {
+ return G::out_degree(get(vertex_complement, *this, v));
+ }
+
+ /** Remove all out edges from vertex u. */
+ void clear_out_edges(vertex_descriptor u)
+ {
+ std::pair<adjacency_iterator, adjacency_iterator>
+ adj = G::adjacent_vertices(u);
+ for (adjacency_iterator v = adj.first; v != adj.second; ++v) {
+ vertex_descriptor uc = get(vertex_complement, *this, u);
+ vertex_descriptor vc = get(vertex_complement, *this, *v);
+ if (vc == u) {
+ // When ~v == u, removing (~v,~u), which is (u,~u),
+ // would invalidate our iterator. This edge will be
+ // removed by clear_out_edges.
+ } else
+ G::remove_edge(vc, uc);
+ }
+ G::clear_out_edges(u);
+ }
+
+ /** Remove all in edges from vertex v. */
+ void clear_in_edges(vertex_descriptor v)
+ {
+ clear_out_edges(get(vertex_complement, *this, v));
+ }
+
+ /** Remove all edges to and from vertex v. */
+ void clear_vertex(vertex_descriptor v)
+ {
+ clear_out_edges(v);
+ clear_in_edges(v);
+ }
+
+ /** Add a vertex to this graph. */
+ vertex_descriptor add_vertex(
+ const vertex_property_type& data = vertex_property_type())
+ {
+ vertex_descriptor v = G::add_vertex(data);
+ G::add_vertex(data);
+ return v;
+ }
+
+ /** Remove vertex v from this graph. It is assumed that there
+ * are no edges to or from vertex v. It is best to call
+ * clear_vertex before remove_vertex.
+ */
+ void remove_vertex(vertex_descriptor v)
+ {
+ G::remove_vertex(v);
+ G::remove_vertex(get(vertex_complement, *this, v));
+ }
+
+ /** Add edge (u,v) to this graph. */
+ std::pair<edge_descriptor, bool>
+ add_edge(vertex_descriptor u, vertex_descriptor v)
+ {
+ vertex_descriptor uc = get(vertex_complement, *this, u);
+ vertex_descriptor vc = get(vertex_complement, *this, v);
+ std::pair<edge_descriptor, bool> e = G::add_edge(u, v);
+ if (u != vc)
+ G::add_edge(vc, uc);
+ return e;
+ }
+
+ /** Add edge (u,v) to this graph. */
+ std::pair<edge_descriptor, bool>
+ add_edge(vertex_descriptor u, vertex_descriptor v,
+ const edge_property_type& ep)
+ {
+ vertex_descriptor uc = get(vertex_complement, *this, u);
+ vertex_descriptor vc = get(vertex_complement, *this, v);
+ std::pair<edge_descriptor, bool> e = G::add_edge(u, v, ep);
+ if (u != vc)
+ G::add_edge(vc, uc, ep);
+ return e;
+ }
+
+ /** Remove the edge (u,v) from this graph. */
+ void remove_edge(vertex_descriptor u, vertex_descriptor v)
+ {
+ vertex_descriptor uc = get(vertex_complement, *this, u);
+ vertex_descriptor vc = get(vertex_complement, *this, v);
+ G::remove_edge(u, v);
+ if (u != vc)
+ G::remove_edge(vc, uc);
+ }
+
+ /** Remove the edge e from this graph. */
+ void remove_edge(edge_descriptor e)
+ {
+ remove_edge(source(e, *this), target(e, *this));
+ }
+};
+
+namespace std {
+ template <typename G>
+ inline void swap(ContigGraph<G>& a, ContigGraph<G>& b)
+ {
+ a.swap(b);
+ }
+}
+
+// IncidenceGraph
+
+template <typename G>
+std::pair<
+ typename ContigGraph<G>::out_edge_iterator,
+ typename ContigGraph<G>::out_edge_iterator>
+out_edges(
+ typename ContigGraph<G>::vertex_descriptor u,
+ const ContigGraph<G>& g)
+{
+ return g.out_edges(u);
+}
+
+template <typename G>
+typename ContigGraph<G>::degree_size_type
+out_degree(
+ typename ContigGraph<G>::vertex_descriptor u,
+ const ContigGraph<G>& g)
+{
+ return g.out_degree(u);
+}
+
+// BidirectionalGraph
+
+template <typename G>
+std::pair<
+ typename ContigGraph<G>::in_edge_iterator,
+ typename ContigGraph<G>::in_edge_iterator>
+in_edges(
+ typename ContigGraph<G>::vertex_descriptor u,
+ const ContigGraph<G>& g)
+{
+ typedef typename ContigGraph<G>::in_edge_iterator
+ in_edge_iterator;
+ typedef typename ContigGraph<G>::out_edge_iterator
+ out_edge_iterator;
+ std::pair<out_edge_iterator, out_edge_iterator> it
+ = out_edges(get(vertex_complement, g, u), g);
+ return std::pair<in_edge_iterator, in_edge_iterator>(
+ it.first, it.second);
+}
+
+template <typename G>
+typename ContigGraph<G>::degree_size_type
+in_degree(
+ typename ContigGraph<G>::vertex_descriptor u,
+ const ContigGraph<G>& g)
+{
+ return g.in_degree(u);
+}
+
+// AdjacencyGraph
+
+template <typename G>
+std::pair<
+ typename ContigGraph<G>::adjacency_iterator,
+ typename ContigGraph<G>::adjacency_iterator>
+adjacent_vertices(
+ typename ContigGraph<G>::vertex_descriptor u,
+ const ContigGraph<G>& g)
+{
+ return g.adjacent_vertices(u);
+}
+
+// VertexListGraph
+
+template <typename G>
+typename ContigGraph<G>::vertices_size_type
+num_vertices(const ContigGraph<G>& g)
+{
+ return g.num_vertices();
+}
+
+template <typename G>
+std::pair<typename ContigGraph<G>::vertex_iterator,
+ typename ContigGraph<G>::vertex_iterator>
+vertices(const ContigGraph<G>& g)
+{
+ return g.vertices();
+}
+
+// EdgeListGraph
+
+template <typename G>
+typename ContigGraph<G>::edges_size_type
+num_edges(const ContigGraph<G>& g)
+{
+ return g.num_edges();
+}
+
+template <typename G>
+std::pair<typename ContigGraph<G>::edge_iterator,
+ typename ContigGraph<G>::edge_iterator>
+edges(const ContigGraph<G>& g)
+{
+ return g.edges();
+}
+
+// AdjacencyMatrix
+
+template <typename G>
+std::pair<typename ContigGraph<G>::edge_descriptor, bool>
+edge(
+ typename ContigGraph<G>::vertex_descriptor u,
+ typename ContigGraph<G>::vertex_descriptor v,
+ const ContigGraph<G>& g)
+{
+ return g.edge(u, v);
+}
+
+// VertexMutableGraph
+
+template <typename G>
+typename ContigGraph<G>::vertex_descriptor
+add_vertex(ContigGraph<G>& g)
+{
+ return g.add_vertex();
+}
+
+template <typename G>
+void
+remove_vertex(
+ typename ContigGraph<G>::vertex_descriptor u,
+ ContigGraph<G>& g)
+{
+ g.remove_vertex(u);
+}
+
+// EdgeMutableGraph
+
+template <typename G>
+void
+clear_vertex(
+ typename ContigGraph<G>::vertex_descriptor u,
+ ContigGraph<G>& g)
+{
+ g.clear_vertex(u);
+}
+
+template <typename G>
+std::pair<typename ContigGraph<G>::edge_descriptor, bool>
+add_edge(
+ typename ContigGraph<G>::vertex_descriptor u,
+ typename ContigGraph<G>::vertex_descriptor v,
+ ContigGraph<G>& g)
+{
+ return g.add_edge(u, v);
+}
+
+template <typename G>
+void
+remove_edge(
+ typename ContigGraph<G>::vertex_descriptor u,
+ typename ContigGraph<G>::vertex_descriptor v,
+ ContigGraph<G>& g)
+{
+ return g.remove_edge(u, v);
+}
+
+template <typename G>
+void
+remove_edge(
+ typename ContigGraph<G>::edge_descriptor e,
+ ContigGraph<G>& g)
+{
+ g.remove_edge(e);
+}
+
+// MutableIncidenceGraph
+
+template <typename G>
+void
+clear_out_edges(
+ typename ContigGraph<G>::vertex_descriptor u,
+ ContigGraph<G>& g)
+{
+ g.clear_out_edges(u);
+}
+
+// MutableBidirectionalGraph
+
+template <typename G>
+void
+clear_in_edges(
+ typename ContigGraph<G>::vertex_descriptor u,
+ ContigGraph<G>& g)
+{
+ g.clear_in_edges(u);
+}
+
+// PropertyGraph
+
+/** Return true if this vertex has been removed. */
+template <typename G>
+bool get(vertex_removed_t tag, const ContigGraph<G>& g,
+ typename ContigGraph<G>::vertex_descriptor u)
+{
+ return get(tag, static_cast<const G&>(g), u);
+}
+
+template <typename G>
+void put(vertex_removed_t tag, ContigGraph<G>& g,
+ typename ContigGraph<G>::vertex_descriptor u,
+ bool flag)
+{
+ put(tag, static_cast<G&>(g), u, flag);
+ put(tag, static_cast<G&>(g), get(vertex_complement, g, u), flag);
+}
+
+/** Return the properties of the edge of iterator eit. */
+template <typename G>
+const typename ContigGraph<G>::edge_property_type&
+get(edge_bundle_t, const ContigGraph<G>&,
+ typename ContigGraph<G>::out_edge_iterator eit)
+{
+ return eit.get_property();
+}
+
+// PropertyGraph
+
+template <typename G>
+typename vertex_bundle_type<G>::type
+get(vertex_bundle_t, const ContigGraph<G>& g,
+ typename ContigGraph<G>::vertex_descriptor u)
+{
+ return g[u];
+}
+
+template <typename G>
+typename edge_bundle_type<G>::type
+get(edge_bundle_t, const ContigGraph<G>& g,
+ typename ContigGraph<G>::edge_descriptor e)
+{
+ return g[e];
+}
+
+// PropertyGraph
+
+namespace boost {
+template <typename G>
+struct property_map<ContigGraph<G>, vertex_index_t>
+{
+ typedef typename property_map<G, vertex_index_t>::type type;
+ typedef type const_type;
+};
+}
+
+/** Return the complement of the specified vertex. */
+template <typename G>
+typename graph_traits<G>::vertex_descriptor
+get(vertex_complement_t, const ContigGraph<G>&,
+ typename graph_traits<G>::vertex_descriptor u)
+{
+ return u ^ 1;
+}
+
+/** Return the contig index of the specified vertex. */
+template <typename G>
+ContigID
+get(vertex_contig_index_t, const ContigGraph<G>&,
+ typename graph_traits<G>::vertex_descriptor u)
+{
+ return u.contigIndex();
+}
+
+/** Return the sense of the specified vertex. */
+template <typename G>
+bool
+get(vertex_sense_t, const ContigGraph<G>&,
+ typename graph_traits<G>::vertex_descriptor u)
+{
+ return u.sense();
+}
+
+// VertexMutablePropertyGraph
+
+template <typename G>
+typename ContigGraph<G>::vertex_descriptor
+add_vertex(
+ const typename vertex_property<G>::type& vp,
+ ContigGraph<G>& g)
+{
+ return g.add_vertex(vp);
+}
+
+// EdgeMutablePropertyGraph
+
+template <typename G>
+std::pair<typename ContigGraph<G>::edge_descriptor, bool>
+add_edge(
+ typename ContigGraph<G>::vertex_descriptor u,
+ typename ContigGraph<G>::vertex_descriptor v,
+ const typename ContigGraph<G>::edge_property_type& ep,
+ ContigGraph<G>& g)
+{
+ return g.add_edge(u, v, ep);
+}
+
+#endif
diff --git a/Graph/ContigGraphAlgorithms.h b/Graph/ContigGraphAlgorithms.h
new file mode 100644
index 0000000..023a898
--- /dev/null
+++ b/Graph/ContigGraphAlgorithms.h
@@ -0,0 +1,340 @@
+#ifndef CONTIGGRAPHALGORITHMS_H
+#define CONTIGGRAPHALGORITHMS_H 1
+
+#include "Algorithms.h"
+#include "ContigGraph.h"
+#include "ContigNode.h"
+#include "Estimate.h" // for BetterDistanceEst
+#include "Functional.h"
+#include "Iterator.h"
+#include <boost/graph/graph_traits.hpp>
+#include <algorithm>
+#include <cassert>
+#include <functional>
+#include <set>
+#include <utility>
+
+using boost::graph_traits;
+
+/** Return true if the edge e is a palindrome. */
+template<typename Graph>
+struct IsPalindrome : std::unary_function<
+ typename graph_traits<Graph>::edge_descriptor, bool>
+{
+ IsPalindrome(const Graph& g) : m_g(g) { }
+ bool operator()(
+ typename graph_traits<Graph>::edge_descriptor e) const
+ {
+ return source(e, m_g)
+ == get(vertex_complement, m_g, target(e, m_g));
+ }
+ private:
+ const Graph& m_g;
+};
+
+/** Return whether the outgoing edge of vertex u is contiguous. */
+template<typename Graph>
+bool contiguous_out(const Graph& g,
+ typename graph_traits<Graph>::vertex_descriptor u)
+{
+ return out_degree(u, g) == 1
+ && in_degree(*adjacent_vertices(u, g).first, g) == 1;
+}
+
+/** Return whether the incoming edge of vertex u is contiguous. */
+template<typename Graph>
+bool contiguous_in(const Graph& g,
+ typename graph_traits<Graph>::vertex_descriptor u)
+{
+ return contiguous_out(g, get(vertex_complement, g, u));
+}
+
+/** Add the outgoing edges of vertex u to vertex uout. */
+template<typename Graph>
+void copy_out_edges(Graph &g,
+ typename Graph::vertex_descriptor u,
+ typename Graph::vertex_descriptor uout)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor
+ vertex_descriptor;
+ typedef typename graph_traits<Graph>::out_edge_iterator
+ out_edge_iterator;
+ typedef typename edge_property<Graph>::type edge_property_type;
+ assert(u != uout);
+ std::pair<out_edge_iterator, out_edge_iterator>
+ edges = g.out_edges(u);
+ bool palindrome = false;
+ edge_property_type palindrome_ep;
+ for (out_edge_iterator e = edges.first; e != edges.second; ++e) {
+ vertex_descriptor v = target(*e, g);
+ vertex_descriptor vc = get(vertex_complement, g, v);
+ if (vc == u) {
+ // When ~v == u, adding the edge (~v,~u), which is (u,~u),
+ // would invalidate our iterator. Add the edge after this
+ // loop completes.
+ palindrome = true;
+ palindrome_ep = g[*e];
+ } else
+ g.add_edge(uout, v, g[*e]);
+ }
+ if (palindrome) {
+ vertex_descriptor uc = get(vertex_complement, g, u);
+ vertex_descriptor uoutc = get(vertex_complement, g, uout);
+ g.add_edge(uout, uc, palindrome_ep);
+ g.add_edge(uout, uoutc, palindrome_ep);
+ }
+}
+
+/** Add the incoming edges of vertex u to vertex v. */
+template<typename Graph>
+void copy_in_edges(Graph& g,
+ typename Graph::vertex_descriptor u,
+ typename Graph::vertex_descriptor v)
+{
+ copy_out_edges(g,
+ get(vertex_complement, g, u),
+ get(vertex_complement, g, v));
+}
+
+/** Assemble a path of unambigous out edges starting at vertex u.
+ * u itself is not copied to out.
+ */
+template<typename Graph, typename OutIt>
+OutIt extend(const Graph& g,
+ typename Graph::vertex_descriptor u, OutIt out)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor
+ vertex_descriptor;
+ std::set<vertex_descriptor> seen;
+ while (out_degree(u, g) == 1 && seen.insert(u).second) {
+ u = *adjacent_vertices(u, g).first;
+ *out++ = u;
+ }
+ return out;
+}
+
+/** Assemble an unambiguous path starting at vertex u.
+ * Every edge must satisfy the predicate. */
+template<typename Graph, typename OutIt, typename Predicate>
+OutIt assemble_if(const Graph& g,
+ typename Graph::vertex_descriptor u, OutIt out,
+ Predicate pred)
+{
+ typedef typename graph_traits<Graph>::edge_descriptor
+ edge_descriptor;
+ while (contiguous_out(g, u)) {
+ edge_descriptor e = *out_edges(u, g).first;
+ if (!pred(e))
+ break;
+ *out++ = u;
+ u = target(e, g);
+ }
+ *out++ = u;
+ return out;
+}
+
+/** Remove vertices in the sequence [first, last) from the graph
+ * for which the predicate p is true. Edges incident to those vertices
+ * are removed as well.
+ */
+template<typename Graph, typename It, typename Predicate>
+void remove_vertex_if(Graph& g, It first, It last, Predicate p)
+{
+ for_each_if(first, last,
+ bind1st(std::mem_fun(&Graph::clear_vertex), &g), p);
+ for_each_if(first, last,
+ bind1st(std::mem_fun(&Graph::remove_vertex), &g), p);
+}
+
+/** Add the vertex and edge propeties of the path [first, last). */
+template<typename Graph, typename It, typename VP>
+VP addProp(const Graph& g, It first, It last, const VP*)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor
+ vertex_descriptor;
+ assert(first != last);
+ VP vp = get(vertex_bundle, g, *first);
+ for (It it = first + 1; it != last; ++it) {
+ vertex_descriptor u = *(it - 1);
+ vertex_descriptor v = *it;
+ vp += get(edge_bundle, g, u, v);
+ vp += get(vertex_bundle, g, v);
+ }
+ return vp;
+}
+
+template<typename Graph, typename It>
+no_property addProp(const Graph&, It, It, const no_property*)
+{
+ return no_property();
+}
+
+template<typename Graph, typename It>
+typename vertex_property<Graph>::type addProp(const Graph& g,
+ It first, It last)
+{
+ return addProp(g, first, last,
+ (typename vertex_property<Graph>::type*)NULL);
+}
+
+/** Merge the vertices in the sequence [first, last).
+ * Create a new vertex whose property is the sum of [first, last).
+ * Remove the vertices [first, last).
+ */
+template<typename Graph, typename It>
+typename graph_traits<Graph>::vertex_descriptor
+merge(Graph& g, It first, It last)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor
+ vertex_descriptor;
+ assert(first != last);
+ vertex_descriptor u = add_vertex(addProp(g, first, last), g);
+ copy_in_edges(g, *first, u);
+ copy_out_edges(g, *(last - 1), u);
+ return u;
+}
+
+/** Assemble unambiguous paths. Write the paths to out.
+ * Every edge must satisfy the predicate. */
+template<typename Graph, typename OutIt, typename Predicate>
+OutIt assemble_if(Graph& g, OutIt out, Predicate pred0)
+{
+ typedef typename Graph::vertex_descriptor vertex_descriptor;
+ typedef typename Graph::vertex_iterator vertex_iterator;
+ // pred(e) = !isPalindrome(e) && pred0(e)
+ binary_compose<std::logical_and<bool>,
+ std::unary_negate<IsPalindrome<Graph> >, Predicate>
+ pred(compose2(std::logical_and<bool>(),
+ std::not1(IsPalindrome<Graph>(g)), pred0));
+ std::pair<vertex_iterator, vertex_iterator> uit = g.vertices();
+ for (vertex_iterator u = uit.first; u != uit.second; ++u) {
+ if (!contiguous_out(g, *u) || contiguous_in(g, *u)
+ || !pred(*out_edges(*u, g).first))
+ continue;
+ typename output_iterator_traits<OutIt>::value_type path;
+ assemble_if(g, *u, back_inserter(path), pred);
+ assert(path.size() >= 2);
+ assert(path.front() != path.back());
+ merge(g, path.begin(), path.end());
+ remove_vertex_if(g, path.begin(), path.end(),
+ not1(std::mem_fun_ref(&ContigNode::ambiguous)));
+ *out++ = path;
+ }
+ return out;
+}
+
+/** Assemble unambiguous paths. Write the paths to out. */
+template<typename Graph, typename OutIt>
+OutIt assemble(Graph& g, OutIt out)
+{
+ typedef typename graph_traits<Graph>::edge_descriptor
+ edge_descriptor;
+ return assemble_if(g, out, True<edge_descriptor>());
+}
+
+/** Remove tips.
+ * For an edge (u,v), remove the vertex v if deg+(u) > 1,
+ * deg-(v) = 1 and deg+(v) = 0, and p(v) is true.
+ * Stores all removed vertices in result.
+ */
+template <typename Graph, typename OutputIt, typename Pred>
+OutputIt pruneTips_if(Graph& g, OutputIt result, Pred p)
+{
+ typedef typename graph_traits<Graph>::adjacency_iterator Vit;
+ typedef typename graph_traits<Graph>::vertex_iterator Uit;
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+
+ /** Identify the tips. */
+ std::vector<V> tips;
+ std::pair<Uit, Uit> urange = vertices(g);
+ for (Uit uit = urange.first; uit != urange.second; ++uit) {
+ V u = *uit;
+ if (out_degree(u, g) < 2)
+ continue;
+ std::pair<Vit, Vit> vrange = adjacent_vertices(u, g);
+ for (Vit vit = vrange.first; vit != vrange.second; ++vit) {
+ V v = *vit;
+ //assert(v != u);
+ if (in_degree(v, g) == 1 && out_degree(v, g) == 0 && p(v))
+ tips.push_back(v);
+ }
+ }
+
+ /** Remove the tips. */
+ remove_vertex_if(g, tips.begin(), tips.end(), True<V>());
+ std::transform(tips.begin(), tips.end(), result,
+ std::mem_fun_ref(&ContigNode::contigIndex));
+
+ return result;
+}
+
+/** Remove tips.
+ * For an edge (u,v), remove the vertex v if deg+(u) > 1
+ * and deg-(v) = 1 and deg+(v) = 0.
+ * Stores all removed vertices in result.
+ */
+template <typename Graph, typename OutputIt>
+OutputIt pruneTips(Graph& g, OutputIt result)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+ return pruneTips_if(g, result, True<V>());
+}
+
+/** Remove islands.
+ * For a vertex v, remove v if deg+(v) = 0, deg-(v) = 0 and p(v) is
+ * true.
+ * Stores all removed vertices in result.
+ */
+template <typename Graph, typename OutputIt, typename Pred>
+OutputIt removeIslands_if(Graph& g, OutputIt result, Pred p)
+{
+ typedef typename graph_traits<Graph>::vertex_iterator Uit;
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+
+ /** Identify and remove Islands. */
+ std::pair<Uit, Uit> urange = vertices(g);
+ for (Uit uit = urange.first; uit != urange.second; ++uit) {
+ V u = *uit;
+ if (get(vertex_removed, g, u))
+ continue;
+ if (p(u) && in_degree(u, g) == 0 && out_degree(u, g) == 0) {
+ *result++ = get(vertex_contig_index, g, u);
+ clear_vertex(u, g);
+ remove_vertex(u, g);
+ }
+ }
+ return result;
+}
+
+/** Add missing complementary edges. */
+template <typename DG>
+size_t addComplementaryEdges(ContigGraph<DG>& g)
+{
+ typedef ContigGraph<DG> Graph;
+ typedef graph_traits<Graph> GTraits;
+ typedef typename GTraits::edge_descriptor E;
+ typedef typename GTraits::edge_iterator Eit;
+ typedef typename GTraits::vertex_descriptor V;
+
+ std::pair<Eit, Eit> erange = edges(g);
+ size_t numAdded = 0;
+ for (Eit eit = erange.first; eit != erange.second; ++eit) {
+ E e = *eit;
+ V u = source(e, g), v = target(e, g);
+ V uc = get(vertex_complement, g, u);
+ V vc = get(vertex_complement, g, v);
+ E f;
+ bool found;
+ tie(f, found) = edge(vc, uc, g);
+ if (!found) {
+ add_edge(vc, uc, g[e], static_cast<DG&>(g));
+ numAdded++;
+ } else if (g[e] != g[f]) {
+ // The edge properties do not agree. Select the better.
+ g[e] = g[f] = BetterDistanceEst()(g[e], g[f]);
+ }
+ }
+ return numAdded;
+}
+
+#endif
diff --git a/Graph/DepthFirstSearch.h b/Graph/DepthFirstSearch.h
new file mode 100644
index 0000000..11757f5
--- /dev/null
+++ b/Graph/DepthFirstSearch.h
@@ -0,0 +1,65 @@
+#ifndef DEPTHFIRSTSEARCH_H
+#define DEPTHFIRSTSEARCH_H 1
+
+#include "Graph/ContigGraphAlgorithms.h" // for contiguous_in
+#include <boost/graph/depth_first_search.hpp>
+
+using boost::graph_traits;
+
+/**
+ * Perform a depth-first search starting first with vertices with
+ * deg-(u) = 0 and then visiting any remaining vertices.
+ */
+template <class Graph, class Visitor, class ColorMap>
+void depthFirstSearch(const Graph& g, Visitor vis, ColorMap color)
+{
+ using boost::color_traits;
+ using boost::property_traits;
+ using boost::tie;
+
+ typedef graph_traits<Graph> GTraits;
+ typedef typename GTraits::vertex_descriptor V;
+ typedef typename GTraits::vertex_iterator Vit;
+ typedef typename property_traits<ColorMap>::value_type ColorValue;
+ const ColorValue white = color_traits<ColorValue>::white();
+
+ // Initialize the vertices.
+ Vit uit, ulast;
+ for (tie(uit, ulast) = vertices(g); uit != ulast; ++uit) {
+ V u = *uit;
+ put(color, u, white);
+ vis.initialize_vertex(u, g);
+ }
+
+ // Visit vertices with deg-(u) = 0.
+ for (tie(uit, ulast) = vertices(g); uit != ulast; ++uit) {
+ V u = *uit;
+ if (get(color, u) == white && in_degree(u, g) == 0) {
+ vis.start_vertex(u, g);
+ boost::detail::depth_first_visit_impl(g, u, vis, color,
+ boost::detail::nontruth2());
+ }
+ }
+
+ // Visit vertices where discontiguous-(u).
+ for (tie(uit, ulast) = vertices(g); uit != ulast; ++uit) {
+ V u = *uit;
+ if (get(color, u) == white && !contiguous_in(g, u)) {
+ vis.start_vertex(u, g);
+ boost::detail::depth_first_visit_impl(g, u, vis, color,
+ boost::detail::nontruth2());
+ }
+ }
+
+ // Visit the remaining vertices.
+ for (tie(uit, ulast) = vertices(g); uit != ulast; ++uit) {
+ V u = *uit;
+ if (get(color, u) == white) {
+ vis.start_vertex(u, g);
+ boost::detail::depth_first_visit_impl(g, u, vis, color,
+ boost::detail::nontruth2());
+ }
+ }
+}
+
+#endif
diff --git a/Graph/DirectedGraph.h b/Graph/DirectedGraph.h
new file mode 100644
index 0000000..eec9682
--- /dev/null
+++ b/Graph/DirectedGraph.h
@@ -0,0 +1,822 @@
+#ifndef DIRECTEDGRAPH_H
+#define DIRECTEDGRAPH_H 1
+
+#include "ContigNode.h"
+#include "Graph/Properties.h"
+#include <algorithm>
+#include <cassert>
+#include <utility>
+#include <vector>
+
+/** A directed graph. */
+template <typename VertexProp = no_property,
+ typename EdgeProp = no_property>
+class DirectedGraph
+{
+ class Vertex;
+ typedef typename std::vector<Vertex> Vertices;
+ class Edge;
+ typedef typename std::vector<Edge> Edges;
+
+ public:
+ // Graph
+ typedef ContigNode vertex_descriptor;
+
+ // IncidenceGraph
+ typedef std::pair<vertex_descriptor, vertex_descriptor>
+ edge_descriptor;
+ typedef unsigned degree_size_type;
+
+ // BidirectionalGraph
+ typedef void in_edge_iterator;
+
+ // VertexListGraph
+ typedef unsigned vertices_size_type;
+
+ // EdgeListGraph
+ typedef unsigned edges_size_type;
+
+ // PropertyGraph
+ typedef VertexProp vertex_bundled;
+ typedef VertexProp vertex_property_type;
+ typedef EdgeProp edge_bundled;
+ typedef EdgeProp edge_property_type;
+
+ typedef boost::directed_tag directed_category;
+ typedef boost::allow_parallel_edge_tag edge_parallel_category;
+ struct traversal_category
+ : boost::incidence_graph_tag,
+ boost::adjacency_graph_tag,
+ boost::vertex_list_graph_tag,
+ boost::edge_list_graph_tag { };
+
+/** Iterate through the vertices of this graph. */
+class vertex_iterator
+ : public std::iterator<std::input_iterator_tag,
+ const vertex_descriptor>
+{
+ public:
+ vertex_iterator() { }
+ explicit vertex_iterator(vertices_size_type v) : m_v(v) { }
+ const vertex_descriptor& operator *() const { return m_v; }
+
+ bool operator ==(const vertex_iterator& it) const
+ {
+ return m_v == it.m_v;
+ }
+
+ bool operator !=(const vertex_iterator& it) const
+ {
+ return m_v != it.m_v;
+ }
+
+ vertex_iterator& operator ++() { ++m_v; return *this; }
+ vertex_iterator operator ++(int)
+ {
+ vertex_iterator it = *this;
+ ++*this;
+ return it;
+ }
+
+ private:
+ vertex_descriptor m_v;
+};
+
+/** Iterate through the out-edges. */
+class out_edge_iterator
+ : public std::iterator<std::input_iterator_tag, edge_descriptor>
+{
+ typedef typename Edges::const_iterator const_iterator;
+
+ public:
+ out_edge_iterator() { }
+ out_edge_iterator(const const_iterator& it,
+ vertex_descriptor src) : m_it(it), m_src(src) { }
+
+ edge_descriptor operator *() const
+ {
+ return edge_descriptor(m_src, m_it->target());
+ }
+
+ bool operator ==(const out_edge_iterator& it) const
+ {
+ return m_it == it.m_it;
+ }
+
+ bool operator !=(const out_edge_iterator& it) const
+ {
+ return m_it != it.m_it;
+ }
+
+ out_edge_iterator& operator ++() { ++m_it; return *this; }
+ out_edge_iterator operator ++(int)
+ {
+ out_edge_iterator it = *this;
+ ++*this;
+ return it;
+ }
+
+ const edge_property_type& get_property() const
+ {
+ return m_it->get_property();
+ }
+
+ private:
+ const_iterator m_it;
+ vertex_descriptor m_src;
+};
+
+/** Iterate through adjacent vertices. */
+class adjacency_iterator : public Edges::const_iterator
+{
+ typedef typename Edges::const_iterator It;
+ public:
+ adjacency_iterator() { }
+ adjacency_iterator(const It& it) : It(it) { }
+ vertex_descriptor operator*() const
+ {
+ return It::operator*().target();
+ }
+};
+
+/** Iterate through edges. */
+class edge_iterator
+ : public std::iterator<std::input_iterator_tag, edge_descriptor>
+{
+ void nextVertex()
+ {
+ vertex_iterator vlast = m_g->vertices().second;
+ for (; m_vit != vlast; ++m_vit) {
+ std::pair<adjacency_iterator, adjacency_iterator>
+ adj = m_g->adjacent_vertices(*m_vit);
+ if (adj.first != adj.second) {
+ m_eit = adj.first;
+ return;
+ }
+ }
+ // Set m_eit to a known value.
+ static const adjacency_iterator s_eitNULL;
+ m_eit = s_eitNULL;
+ }
+
+ public:
+ edge_iterator() { }
+ edge_iterator(const DirectedGraph* g, const vertex_iterator& vit)
+ : m_g(g), m_vit(vit)
+ {
+ nextVertex();
+ }
+
+ edge_descriptor operator*() const
+ {
+ return edge_descriptor(*m_vit, *m_eit);
+ }
+
+ bool operator==(const edge_iterator& it) const
+ {
+ return m_vit == it.m_vit && m_eit == it.m_eit;
+ }
+
+ bool operator!=(const edge_iterator& it) const
+ {
+ return !(*this == it);
+ }
+
+ edge_iterator& operator++()
+ {
+ if (++m_eit == m_g->adjacent_vertices(*m_vit).second) {
+ ++m_vit;
+ nextVertex();
+ }
+ return *this;
+ }
+
+ edge_iterator operator++(int)
+ {
+ edge_iterator it = *this;
+ ++*this;
+ return it;
+ }
+
+ private:
+ const DirectedGraph* m_g;
+ vertex_iterator m_vit;
+ adjacency_iterator m_eit;
+};
+
+ private:
+/** A vertex and its properties. */
+class Vertex
+{
+ public:
+ Vertex() { }
+ Vertex(const vertex_property_type& p) : m_prop(p) { }
+
+ /** Return the properties of this vertex. */
+ const vertex_property_type& get_property() const
+ {
+ return m_prop;
+ }
+
+ /** Returns an iterator-range to the out edges of vertex u. */
+ std::pair<out_edge_iterator, out_edge_iterator>
+ out_edges(vertex_descriptor u) const
+ {
+ return make_pair(out_edge_iterator(m_edges.begin(), u),
+ out_edge_iterator(m_edges.end(), u));
+ }
+
+ /** Returns an iterator-range to the adjacent vertices. */
+ std::pair<adjacency_iterator, adjacency_iterator>
+ adjacent_vertices() const
+ {
+ return make_pair(m_edges.begin(), m_edges.end());
+ }
+
+ /** Return the number of outgoing edges. */
+ degree_size_type out_degree() const
+ {
+ return m_edges.size();
+ }
+
+ /** Add an edge to this vertex. */
+ bool add_edge(vertex_descriptor v, const edge_property_type& ep)
+ {
+ m_edges.push_back(Edge(v, ep));
+ return true;
+ }
+
+ /** Remove the edge to v from this vertex. */
+ void remove_edge(vertex_descriptor v)
+ {
+ m_edges.erase(remove(m_edges.begin(), m_edges.end(), v),
+ m_edges.end());
+ }
+
+ /** Remove all out edges from this vertex. */
+ void clear_out_edges()
+ {
+ m_edges.clear();
+ }
+
+ /** Return the properties of the edge with target v. */
+ edge_property_type& operator[](vertex_descriptor v)
+ {
+ typename Edges::iterator it
+ = find(m_edges.begin(), m_edges.end(), v);
+ assert(it != m_edges.end());
+ return it->get_property();
+ }
+
+ /** Return the properties of the edge with target v. */
+ const edge_property_type& operator[](vertex_descriptor v) const
+ {
+ typename Edges::const_iterator it
+ = find(m_edges.begin(), m_edges.end(), v);
+ assert(it != m_edges.end());
+ return it->get_property();
+ }
+
+ /** Return true if edge (u,v) exists. */
+ bool edge(vertex_descriptor v) const
+ {
+ return count(m_edges.begin(), m_edges.end(), v) > 0;
+ }
+
+ /** Remove edges that satisfy the predicate. */
+ template <typename Predicate>
+ void remove_edge_if(vertex_descriptor u, Predicate predicate)
+ {
+ typename Edges::iterator out = m_edges.begin();
+ for (typename Edges::iterator it = m_edges.begin();
+ it != m_edges.end(); ++it) {
+ if (!predicate(edge_descriptor(u, it->target()))) {
+ if (out != it)
+ *out = *it;
+ ++out;
+ }
+ }
+ m_edges.erase(out, m_edges.end());
+ }
+
+ private:
+ Edges m_edges;
+ vertex_property_type m_prop;
+};
+
+/** A directed edge. */
+class Edge
+{
+ public:
+ explicit Edge(vertex_descriptor v, const edge_property_type& ep)
+ : m_target(v), m_ep(ep) { }
+
+ /** Returns the target vertex of this edge. */
+ vertex_descriptor target() const { return m_target; }
+
+ /** Return true if the target of this edge is v. */
+ bool operator ==(const vertex_descriptor& v) const
+ {
+ return m_target == v;
+ }
+
+ edge_property_type& get_property() { return m_ep; }
+ const edge_property_type& get_property() const { return m_ep; }
+
+ private:
+ /** The target vertex of this edge. */
+ vertex_descriptor m_target;
+ edge_property_type m_ep;
+};
+
+ public:
+ /** Create an empty graph. */
+ DirectedGraph() { }
+
+ /** Create a graph with n vertices and zero edges. */
+ DirectedGraph(vertices_size_type n) : m_vertices(n) { }
+
+ /** Swap this graph with graph x. */
+ void swap(DirectedGraph& x)
+ {
+ m_vertices.swap(x.m_vertices);
+ m_removed.swap(x.m_removed);
+ }
+
+ /** Return properties of vertex u. */
+ const vertex_property_type& operator[](vertex_descriptor u) const
+ {
+ vertices_size_type ui = get(vertex_index, *this, u);
+ assert(ui < num_vertices());
+ return m_vertices[ui].get_property();
+ }
+
+ /** Returns an iterator-range to the vertices. */
+ std::pair<vertex_iterator, vertex_iterator> vertices() const
+ {
+ return make_pair(vertex_iterator(0),
+ vertex_iterator(num_vertices()));
+ }
+
+ /** Remove all the edges and vertices from this graph. */
+ void clear() { m_vertices.clear(); m_removed.clear(); }
+
+ /** Add a vertex to this graph. */
+ vertex_descriptor add_vertex(
+ const vertex_property_type& vp = vertex_property_type())
+ {
+ m_vertices.push_back(Vertex(vp));
+ return vertex_descriptor(num_vertices() - 1);
+ }
+
+ /** Returns an iterator-range to the out edges of vertex u. */
+ std::pair<out_edge_iterator, out_edge_iterator>
+ out_edges(vertex_descriptor u) const
+ {
+ vertices_size_type ui = get(vertex_index, *this, u);
+ assert(ui < num_vertices());
+ return m_vertices[ui].out_edges(u);
+ }
+
+ /** Returns an iterator-range to the adjacent vertices of
+ * vertex u. */
+ std::pair<adjacency_iterator, adjacency_iterator>
+ adjacent_vertices(vertex_descriptor u) const
+ {
+ vertices_size_type ui = get(vertex_index, *this, u);
+ assert(ui < num_vertices());
+ return m_vertices[ui].adjacent_vertices();
+ }
+
+ /** Adds edge (u,v) to this graph. */
+ std::pair<edge_descriptor, bool>
+ add_edge(vertex_descriptor u, vertex_descriptor v,
+ const edge_property_type& ep = edge_property_type())
+ {
+ vertices_size_type ui = get(vertex_index, *this, u);
+ assert(ui < num_vertices());
+ assert(get(vertex_index, *this, v) < num_vertices());
+ return make_pair(edge_descriptor(u, v),
+ m_vertices[ui].add_edge(v, ep));
+ }
+
+ /** Remove the edge (u,v) from this graph. */
+ void remove_edge(vertex_descriptor u, vertex_descriptor v)
+ {
+ vertices_size_type ui = get(vertex_index, *this, u);
+ assert(ui < num_vertices());
+ m_vertices[ui].remove_edge(v);
+ }
+
+ /** Remove the edge e from this graph. */
+ void remove_edge(edge_descriptor e)
+ {
+ remove_edge(e.first, e.second);
+ }
+
+ /** Remove all out edges from vertex u. */
+ void clear_out_edges(vertex_descriptor u)
+ {
+ vertices_size_type ui = get(vertex_index, *this, u);
+ assert(ui < num_vertices());
+ m_vertices[ui].clear_out_edges();
+ }
+
+ /** Remove all edges to and from vertex u from this graph.
+ * O(V+E) */
+ void clear_vertex(vertex_descriptor u)
+ {
+ clear_out_edges(u);
+ std::pair<adjacency_iterator, adjacency_iterator>
+ adj = adjacent_vertices(u);
+ for (adjacency_iterator v = adj.first; v != adj.second; ++v)
+ remove_edge(*v, u);
+ }
+
+ /** Set the vertex_removed property. */
+ void put(vertex_removed_t, vertex_descriptor u, bool flag)
+ {
+ vertices_size_type ui = get(vertex_index, *this, u);
+ if (ui >= m_removed.size())
+ m_removed.resize(ui + 1);
+ m_removed[ui] = flag;
+ }
+
+ /** Remove vertex u from this graph. It is assumed that there
+ * are no edges to or from vertex u. It is best to call
+ * clear_vertex before remove_vertex.
+ */
+ void remove_vertex(vertex_descriptor u)
+ {
+ put(vertex_removed, u, true);
+ }
+
+ /** Return the number of vertices. */
+ vertices_size_type num_vertices() const
+ {
+ return m_vertices.size();
+ }
+
+ /** Return the number of edges. */
+ edges_size_type num_edges() const
+ {
+ edges_size_type n = 0;
+ std::pair<vertex_iterator, vertex_iterator> vit = vertices();
+ for (vertex_iterator v = vit.first; v != vit.second; ++v)
+ n += out_degree(*v);
+ return n;
+ }
+
+ /** Return the out degree of vertex u. */
+ degree_size_type out_degree(vertex_descriptor u) const
+ {
+ vertices_size_type ui = get(vertex_index, *this, u);
+ assert(ui < num_vertices());
+ return m_vertices[ui].out_degree();
+ }
+
+ /** Return the nth vertex. */
+ static vertex_descriptor vertex(vertices_size_type n)
+ {
+ return vertex_descriptor(n);
+ }
+
+ /** Iterate through the edges of this graph. */
+ std::pair<edge_iterator, edge_iterator> edges() const
+ {
+ std::pair<vertex_iterator, vertex_iterator> vit = vertices();
+ return make_pair(edge_iterator(this, vit.first),
+ edge_iterator(this, vit.second));
+ }
+
+ /** Return the edge (u,v) if it exists and a flag indicating
+ * whether the edge exists.
+ */
+ std::pair<edge_descriptor, bool> edge(
+ vertex_descriptor u, vertex_descriptor v) const
+ {
+ vertices_size_type ui = get(vertex_index, *this, u);
+ assert(ui < num_vertices());
+ return make_pair(edge_descriptor(u, v),
+ m_vertices[ui].edge(v));
+ }
+
+ /** Return properties of edge e. */
+ edge_property_type& operator[](edge_descriptor e)
+ {
+ vertices_size_type ui = get(vertex_index, *this, e.first);
+ assert(ui < num_vertices());
+ return m_vertices[ui][e.second];
+ }
+
+ /** Return properties of edge e. */
+ const edge_property_type& operator[](edge_descriptor e) const
+ {
+ vertices_size_type ui = get(vertex_index, *this, e.first);
+ assert(ui < num_vertices());
+ return m_vertices[ui][e.second];
+ }
+
+ /** Remove edges that satisfy the predicate. */
+ template <typename Predicate>
+ void remove_edge_if(Predicate predicate)
+ {
+ unsigned i = 0;
+ for (typename Vertices::iterator it = m_vertices.begin();
+ it != m_vertices.end(); ++it)
+ it->remove_edge_if(vertex(i++), predicate);
+ }
+
+ /** Return true if this vertex has been removed. */
+ bool is_removed(vertex_descriptor u) const
+ {
+ vertices_size_type ui = get(vertex_index, *this, u);
+ return ui < m_removed.size() ? m_removed[ui] : false;
+ }
+
+ private:
+ DirectedGraph& operator =(const DirectedGraph& x);
+
+ /** The set of vertices. */
+ Vertices m_vertices;
+
+ /** Flags indicating vertices that have been removed. */
+ std::vector<bool> m_removed;
+};
+
+namespace std {
+ template <typename VertexProp, typename EdgeProp>
+ inline void swap(DirectedGraph<VertexProp, EdgeProp>& a,
+ DirectedGraph<VertexProp, EdgeProp>& b) { a.swap(b); }
+}
+
+// IncidenceGraph
+
+template <typename VP, typename EP>
+std::pair<
+ typename DirectedGraph<VP, EP>::out_edge_iterator,
+ typename DirectedGraph<VP, EP>::out_edge_iterator>
+out_edges(
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ const DirectedGraph<VP, EP>& g)
+{
+ return g.out_edges(u);
+}
+
+template <typename VP, typename EP>
+typename DirectedGraph<VP, EP>::degree_size_type
+out_degree(
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ const DirectedGraph<VP, EP>& g)
+{
+ return g.out_degree(u);
+}
+
+// AdjacencyGraph
+
+template <typename VP, typename EP>
+std::pair<
+ typename DirectedGraph<VP, EP>::adjacency_iterator,
+ typename DirectedGraph<VP, EP>::adjacency_iterator>
+adjacent_vertices(
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ const DirectedGraph<VP, EP>& g)
+{
+ return g.adjacent_vertices(u);
+}
+
+// VertexListGraph
+
+template <typename VP, typename EP>
+typename DirectedGraph<VP, EP>::vertices_size_type
+num_vertices(const DirectedGraph<VP, EP>& g)
+{
+ return g.num_vertices();
+}
+
+template <typename VP, typename EP>
+std::pair<typename DirectedGraph<VP, EP>::vertex_iterator,
+ typename DirectedGraph<VP, EP>::vertex_iterator>
+vertices(const DirectedGraph<VP, EP>& g)
+{
+ return g.vertices();
+}
+
+// EdgeListGraph
+
+template <typename VP, typename EP>
+typename DirectedGraph<VP, EP>::edges_size_type
+num_edges(const DirectedGraph<VP, EP>& g)
+{
+ return g.num_edges();
+}
+
+template <typename VP, typename EP>
+std::pair<typename DirectedGraph<VP, EP>::edge_iterator,
+ typename DirectedGraph<VP, EP>::edge_iterator>
+edges(const DirectedGraph<VP, EP>& g)
+{
+ return g.edges();
+}
+
+// AdjacencyMatrix
+
+template <typename VP, typename EP>
+std::pair<typename DirectedGraph<VP, EP>::edge_descriptor, bool>
+edge(
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ typename DirectedGraph<VP, EP>::vertex_descriptor v,
+ const DirectedGraph<VP, EP>& g)
+{
+ return g.edge(u, v);
+}
+
+// VertexMutableGraph
+
+template <typename VP, typename EP>
+typename DirectedGraph<VP, EP>::vertex_descriptor
+add_vertex(DirectedGraph<VP, EP>& g)
+{
+ return g.add_vertex();
+}
+
+template <typename VP, typename EP>
+void
+remove_vertex(
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ DirectedGraph<VP, EP>& g)
+{
+ g.remove_vertex(u);
+}
+
+// EdgeMutableGraph
+
+template <typename VP, typename EP>
+void
+clear_vertex(
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ DirectedGraph<VP, EP>& g)
+{
+ g.clear_vertex(u);
+}
+
+template <typename VP, typename EP>
+std::pair<typename DirectedGraph<VP, EP>::edge_descriptor, bool>
+add_edge(
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ typename DirectedGraph<VP, EP>::vertex_descriptor v,
+ DirectedGraph<VP, EP>& g)
+{
+ return g.add_edge(u, v);
+}
+
+template <typename VP, typename EP>
+void
+remove_edge(
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ typename DirectedGraph<VP, EP>::vertex_descriptor v,
+ DirectedGraph<VP, EP>& g)
+{
+ g.remove_edge(u, v);
+}
+
+template <typename VP, typename EP>
+void
+remove_edge(
+ typename DirectedGraph<VP, EP>::edge_descriptor e,
+ DirectedGraph<VP, EP>& g)
+{
+ g.remove_edge(e);
+}
+
+// MutableIncidenceGraph
+
+template <typename VP, typename EP>
+void
+clear_out_edges(
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ DirectedGraph<VP, EP>& g)
+{
+ g.clear_out_edges(u);
+}
+
+// MutableEdgeListGraph
+
+template <typename VP, typename EP, class Predicate>
+void
+remove_edge_if(Predicate predicate, DirectedGraph<VP, EP>& g)
+{
+ g.remove_edge_if(predicate);
+}
+
+// PropertyGraph
+
+/** Return true if this vertex has been removed. */
+template <typename VP, typename EP>
+bool get(vertex_removed_t, const DirectedGraph<VP, EP>& g,
+ typename DirectedGraph<VP, EP>::vertex_descriptor u)
+{
+ return g.is_removed(u);
+}
+
+template <typename VP, typename EP>
+void put(vertex_removed_t tag, DirectedGraph<VP, EP>& g,
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ bool flag)
+{
+ g.put(tag, u, flag);
+}
+
+/** Return the properties of the edge of iterator eit. */
+template <typename VP, typename EP>
+const typename DirectedGraph<VP, EP>::edge_property_type&
+get(edge_bundle_t, const DirectedGraph<VP, EP>&,
+ typename DirectedGraph<VP, EP>::out_edge_iterator eit)
+{
+ return eit.get_property();
+}
+
+// PropertyGraph
+
+template <typename VP, typename EP>
+const VP&
+get(vertex_bundle_t, const DirectedGraph<VP, EP>& g,
+ typename DirectedGraph<VP, EP>::vertex_descriptor u)
+{
+ return g[u];
+}
+
+template <typename VP, typename EP>
+const EP&
+get(edge_bundle_t, const DirectedGraph<VP, EP>& g,
+ typename DirectedGraph<VP, EP>::edge_descriptor e)
+{
+ return g[e];
+}
+
+// PropertyGraph vertex_index
+
+namespace boost {
+template <typename VP, typename EP>
+struct property_map<DirectedGraph<VP, EP>, vertex_index_t>
+{
+ typedef ContigNodeIndexMap type;
+ typedef type const_type;
+};
+}
+
+template <typename VP, typename EP>
+ContigNodeIndexMap
+get(vertex_index_t, const DirectedGraph<VP, EP>&)
+{
+ return ContigNodeIndexMap();
+}
+
+template <typename VP, typename EP>
+ContigNodeIndexMap::reference
+get(vertex_index_t tag, const DirectedGraph<VP, EP>& g,
+ typename DirectedGraph<VP, EP>::vertex_descriptor u)
+{
+ return get(get(tag, g), u);
+}
+
+// VertexMutablePropertyGraph
+
+template <typename VP, typename EP>
+typename DirectedGraph<VP, EP>::vertex_descriptor
+add_vertex(const VP& vp, DirectedGraph<VP, EP>& g)
+{
+ return g.add_vertex(vp);
+}
+
+// EdgeMutablePropertyGraph
+
+template <typename VP, typename EP>
+std::pair<typename DirectedGraph<VP, EP>::edge_descriptor, bool>
+add_edge(
+ typename DirectedGraph<VP, EP>::vertex_descriptor u,
+ typename DirectedGraph<VP, EP>::vertex_descriptor v,
+ const typename DirectedGraph<VP, EP>::edge_property_type& ep,
+ DirectedGraph<VP, EP>& g)
+{
+ return g.add_edge(u, v, ep);
+}
+
+// NamedGraph
+
+template <typename VP, typename EP>
+typename DirectedGraph<VP, EP>::vertex_descriptor
+find_vertex(const std::string& name, const DirectedGraph<VP, EP>&)
+{
+ return find_vertex(name, g_contigNames);
+}
+
+template <typename VP, typename EP>
+typename DirectedGraph<VP, EP>::vertex_descriptor
+find_vertex(const std::string& name, bool sense,
+ const DirectedGraph<VP, EP>&)
+{
+ return find_vertex(name, sense, g_contigNames);
+}
+
+#endif
diff --git a/Graph/DistIO.h b/Graph/DistIO.h
new file mode 100644
index 0000000..8e33a26
--- /dev/null
+++ b/Graph/DistIO.h
@@ -0,0 +1,42 @@
+#ifndef DISTIO_H
+#define DISTIO_H 1
+
+#include <boost/graph/graph_traits.hpp>
+#include <cassert>
+#include <ostream>
+
+using boost::graph_traits;
+
+/** Output a distance estimate graph. */
+template <typename Graph>
+std::ostream& write_dist(std::ostream& out, const Graph& g)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+ typedef typename graph_traits<Graph>::vertex_iterator Vit;
+ typedef typename graph_traits<Graph>::out_edge_iterator Eit;
+
+ std::pair<Vit, Vit> urange = vertices(g);
+ for (Vit uit = urange.first; uit != urange.second; ++uit) {
+ V u = *uit;
+ if (get(vertex_removed, g, u)
+ || out_degree(u, g) + in_degree(u, g) == 0)
+ continue;
+ bool sense = get(vertex_sense, g, u);
+ if (!sense)
+ out << get(vertex_contig_name, g, u);
+ else
+ out << " ;";
+ std::pair<Eit, Eit> erange = out_edges(u, g);
+ for (Eit eit = erange.first; eit != erange.second; ++eit) {
+ V v = target(*eit, g) ^ sense;
+ assert(!get(vertex_removed, g, v));
+ out << ' ' << get(vertex_name, g, v)
+ << ',' << get(edge_bundle, g, eit);
+ }
+ if (sense)
+ out << '\n';
+ }
+ return out;
+}
+
+#endif
diff --git a/Graph/DotIO.h b/Graph/DotIO.h
new file mode 100644
index 0000000..0e08639
--- /dev/null
+++ b/Graph/DotIO.h
@@ -0,0 +1,300 @@
+#ifndef DOTIO_H
+#define DOTIO_H 1
+
+#include "ContigID.h" // for g_contigNames.lock
+#include "Graph/Options.h"
+#include "IOUtil.h"
+#include <boost/graph/graph_traits.hpp>
+#include <cassert>
+#include <cstdlib> // for exit
+#include <istream>
+#include <ostream>
+
+using boost::graph_traits;
+
+template <typename Graph, typename VertexProp>
+void write_vertex(std::ostream& out, const Graph& g,
+ typename graph_traits<Graph>::vertex_descriptor u,
+ const VertexProp*)
+{
+ out << '"' << get(vertex_name, g, u) << "\""
+ " [" << get(vertex_bundle, g, u) << "]\n";
+}
+
+template <typename Graph>
+void write_vertex(std::ostream&, const Graph&,
+ typename graph_traits<Graph>::vertex_descriptor,
+ const no_property*)
+{
+}
+
+template <typename Graph, typename EdgeProp>
+void write_edges(std::ostream& out, const Graph& g,
+ typename graph_traits<Graph>::vertex_descriptor u,
+ const EdgeProp*)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor
+ vertex_descriptor;
+ typedef typename graph_traits<Graph>::out_edge_iterator
+ out_edge_iterator;
+ typedef typename edge_property<Graph>::type edge_property_type;
+ std::pair<out_edge_iterator, out_edge_iterator>
+ adj = out_edges(u, g);
+ for (out_edge_iterator e = adj.first; e != adj.second; ++e) {
+ assert(!get(vertex_removed, g, target(*e, g)));
+ out << get(edge_name, g, *e);
+ const edge_property_type& ep = get(edge_bundle, g, e);
+ if (!(ep == edge_property_type()))
+ out << " [" << ep << ']';
+ out << '\n';
+ }
+}
+
+template <typename Graph>
+void write_edges(std::ostream& out, const Graph& g,
+ typename graph_traits<Graph>::vertex_descriptor u,
+ const no_property*)
+{
+ typedef typename graph_traits<Graph>::adjacency_iterator
+ adjacency_iterator;
+ unsigned outdeg = out_degree(u, g);
+ if (outdeg == 0)
+ return;
+ out << '"' << get(vertex_name, g, u) << "\" ->";
+ if (outdeg > 1)
+ out << " {";
+ std::pair<adjacency_iterator, adjacency_iterator>
+ adj = adjacent_vertices(u, g);
+ for (adjacency_iterator v = adj.first; v != adj.second; ++v)
+ out << " \"" << get(vertex_name, g, *v) << '"';
+ if (outdeg > 1)
+ out << " }";
+ out << '\n';
+}
+
+/** Output a GraphViz dot graph. */
+template <typename Graph>
+std::ostream& write_dot(std::ostream& out, const Graph& g)
+{
+ typedef typename graph_traits<Graph>::vertex_iterator
+ vertex_iterator;
+ typedef typename vertex_property<Graph>::type
+ vertex_property_type;
+ typedef typename edge_property<Graph>::type edge_property_type;
+
+ out << "digraph adj {\n";
+
+ // Graph properties
+ if (opt::k > 0)
+ out << "graph [k=" << opt::k << "]\n"
+ "edge [d=" << -int(opt::k - 1) << "]\n";
+
+ // Vertices
+ std::pair<vertex_iterator, vertex_iterator> vit = vertices(g);
+ for (vertex_iterator u = vit.first; u != vit.second; ++u) {
+ if (get(vertex_removed, g, *u))
+ continue;
+ write_vertex(out, g, *u, (vertex_property_type*)NULL);
+ }
+
+ // Edges
+ for (vertex_iterator u = vit.first; u != vit.second; ++u) {
+ if (get(vertex_removed, g, *u))
+ continue;
+ write_edges(out, g, *u, (edge_property_type*)NULL);
+ }
+
+ return out << "}\n";
+}
+
+/** Output a GraphViz dot graph. */
+template <typename Graph>
+struct DotWriter
+{
+ const Graph& g;
+ DotWriter(const Graph& g) : g(g) { }
+ friend std::ostream& operator<<(std::ostream& out,
+ const DotWriter& o)
+ {
+ return write_dot<Graph>(out, o.g);
+ }
+};
+
+/** Output a GraphViz dot graph. */
+template <typename Graph>
+DotWriter<Graph> dot_writer(const Graph& g)
+{
+ return DotWriter<Graph>(g);
+}
+
+/** Read a string delimited by double quotes. */
+static inline
+std::istream& read_dot_name(std::istream& in, std::string& s)
+{
+ if (in >> std::ws && in.peek() == '"') {
+ in.get();
+ getline(in, s, '"');
+ } else
+ in.clear(std::ios::failbit);
+ return in;
+}
+
+/** Read a vertex descriptor delimited by double quotes. */
+template <typename Graph>
+std::istream& read_dot_id(std::istream& in, const Graph& g,
+ typename graph_traits<Graph>::vertex_descriptor& u)
+{
+ std::string s;
+ if (read_dot_name(in, s))
+ u = find_vertex(s, g);
+ return in;
+}
+
+/** Read a GraphViz dot graph.
+ * @param betterEP handle parallel edges
+ */
+template <typename Graph, typename BetterEP>
+std::istream& read_dot(std::istream& in, Graph& g, BetterEP betterEP)
+{
+ assert(in);
+ typedef typename graph_traits<Graph>::vertex_descriptor
+ vertex_descriptor;
+ typedef typename vertex_property<Graph>::type
+ vertex_property_type;
+ typedef typename graph_traits<Graph>::edge_descriptor
+ edge_descriptor;
+ typedef typename edge_property<Graph>::type edge_property_type;
+
+ // Add vertices if this graph is empty.
+ bool addVertices = num_vertices(g) == 0;
+
+ // Graph properties
+ in >> expect("digraph") >> Ignore('{');
+ assert(in);
+
+ edge_property_type defaultEdgeProp;
+ for (bool done = false; !done && in >> std::ws;) {
+ switch (in.peek()) {
+ case 'g': {
+ // Graph Properties
+ in >> expect("graph [ ");
+ if (in.peek() == 'k') {
+ unsigned k;
+ in >> expect("k =") >> k;
+ assert(in);
+ if (opt::k > 0)
+ assert(k == opt::k);
+ opt::k = k;
+ }
+ in >> Ignore(']');
+ break;
+ }
+ case 'e': // edge
+ // Default edge properties
+ in >> expect("edge [") >> defaultEdgeProp >> Ignore(']');
+ assert(in);
+ break;
+ default:
+ done = true;
+ break;
+ }
+ if (in >> std::ws && in.peek() == ';')
+ in.get();
+ }
+
+ for (std::string uname; read_dot_name(in, uname);) {
+ char c;
+ in >> c;
+ assert(in);
+ if (c == ';') {
+ // Vertex
+ if (addVertices) {
+ vertex_descriptor u = add_vertex(g);
+ put(vertex_name, g, u, uname);
+ } else {
+ vertex_descriptor u = find_vertex(uname, g);
+ assert(get(vertex_index, g, u) < num_vertices(g));
+ (void)u;
+ }
+ } else if (c == '[') {
+ // Vertex properties
+ vertex_property_type vp;
+ in >> vp >> Ignore(']');
+ assert(in);
+ if (addVertices) {
+ vertex_descriptor u = add_vertex(vp, g);
+ put(vertex_name, g, u, uname);
+ } else {
+ vertex_descriptor u = find_vertex(uname, g);
+ assert(get(vertex_index, g, u) < num_vertices(g));
+ if (g[u] != vp) {
+ std::cerr << "error: "
+ "vertex properties do not agree: "
+ "\"" << uname << "\" "
+ "[" << g[u] << "] [" << vp << "]\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+ } else if (c == '-') {
+ // Edge
+ in >> expect(">");
+ assert(in);
+ g_contigNames.lock();
+
+ vertex_descriptor u = find_vertex(uname, g);
+ if (in >> std::ws && in.peek() == '{') {
+ // Subgraph
+ in >> expect("{");
+ for (vertex_descriptor v; read_dot_id(in, g, v);)
+ add_edge(u, v, defaultEdgeProp, g);
+ if (in.fail())
+ in.clear();
+ in >> expect(" }");
+ assert(in);
+ } else {
+ vertex_descriptor v;
+ if (!read_dot_id(in, g, v)) {
+ in.clear();
+ std::cerr << "error: Expected `\"' and saw `"
+ << (char)in.peek() << "'.\n";
+ exit(EXIT_FAILURE);
+ }
+ assert(in);
+
+ edge_property_type ep = defaultEdgeProp;
+ if (in >> std::ws && in.peek() == '[') {
+ // Edge properties
+ in >> expect("[") >> ep >> Ignore(']');
+ assert(in);
+ }
+
+ edge_descriptor e;
+ bool found;
+ boost::tie(e, found) = edge(u, v, g);
+ if (found) {
+ // Parallel edge
+ edge_property_type& ref = g[e];
+ ref = betterEP(ref, ep);
+ } else
+ add_edge(u, v, ep, g);
+ }
+ } else {
+ std::cerr << "error: Expected `[' or `->' and saw `"
+ << c << "'.\n";
+ exit(EXIT_FAILURE);
+ }
+ if (in >> std::ws && in.peek() == ';')
+ in.get();
+ }
+ if (in.fail())
+ in.clear();
+
+ // Check for the closing brace.
+ in >> expect("}") >> std::ws;
+ assert(in.eof());
+
+ assert(num_vertices(g) > 0);
+ return in;
+}
+
+#endif
diff --git a/Graph/FastaIO.h b/Graph/FastaIO.h
new file mode 100644
index 0000000..c4daa4f
--- /dev/null
+++ b/Graph/FastaIO.h
@@ -0,0 +1,45 @@
+#ifndef FASTAIO_H
+#define FASTAIO_H 1
+
+#include "Graph/Properties.h"
+#include <boost/graph/graph_traits.hpp>
+#include <cassert>
+#include <istream>
+#include <sstream>
+#include <string>
+
+using boost::graph_traits;
+
+/** Read the vertices from a FASTA file. */
+template <typename Graph>
+std::istream& read_fasta(std::istream& in, Graph& g)
+{
+ assert(in);
+
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+ typedef typename vertex_property<Graph>::type VP;
+
+ for (std::string uname;
+ in.peek() != EOF && in >> expect(">") >> uname;) {
+ std::string comment;
+ getline(in, comment);
+ assert(in);
+ std::istringstream ss(comment);
+ VP vp;
+ ss >> vp;
+ size_t n = 0;
+ while (in >> std::ws && in.peek() != '>' && in) {
+ in >> Ignore('\n');
+ assert(in);
+ assert(in.gcount() > 1);
+ n += in.gcount() - 1;
+ }
+ put(vertex_length, vp, n);
+ V u = add_vertex(vp, g);
+ put(vertex_name, g, u, uname);
+ }
+ assert(in.eof());
+ return in;
+}
+
+#endif
diff --git a/Graph/GraphAlgorithms.h b/Graph/GraphAlgorithms.h
new file mode 100644
index 0000000..62f453b
--- /dev/null
+++ b/Graph/GraphAlgorithms.h
@@ -0,0 +1,103 @@
+#ifndef GRAPHALGORITHMS_H
+#define GRAPHALGORITHMS_H 1
+
+#include <boost/graph/graph_traits.hpp>
+#include <cassert>
+#include <vector>
+
+using boost::graph_traits;
+
+/**
+ * Return the transitive edges.
+ * Find the subset of edges (u,w) in E for which there exists a vertex
+ * v such that the edges (u,v) and (v,w) exist in E.
+ * This algorithm is not a general-purpose transitive reduction
+ * algorithm. It is able to find transitive edges with exactly one
+ * intermediate vertex.
+ */
+template <typename Graph, typename OutIt>
+void find_transitive_edges(const Graph& g, OutIt out)
+{
+ typedef graph_traits<Graph> GTraits;
+ typedef typename GTraits::adjacency_iterator adjacency_iterator;
+ typedef typename GTraits::edge_descriptor edge_descriptor;
+ typedef typename GTraits::out_edge_iterator out_edge_iterator;
+ typedef typename GTraits::vertex_descriptor vertex_descriptor;
+ typedef typename GTraits::vertex_iterator vertex_iterator;
+
+ std::vector<bool> seen(num_vertices(g));
+ std::pair<vertex_iterator, vertex_iterator> urange = vertices(g);
+ for (vertex_iterator uit = urange.first;
+ uit != urange.second; ++uit) {
+ vertex_descriptor u = *uit;
+ if (get(vertex_removed, g, u))
+ continue;
+
+ // Clear the colour of the adjacent vertices.
+ std::pair<adjacency_iterator, adjacency_iterator>
+ vrange = adjacent_vertices(u, g);
+ for (adjacency_iterator vit = vrange.first;
+ vit != vrange.second; ++vit)
+ seen[get(vertex_index, g, *vit)] = false;
+
+ // Set the colour of all vertices reachable in two hops.
+ for (adjacency_iterator vit = vrange.first;
+ vit != vrange.second; ++vit) {
+ vertex_descriptor v = *vit;
+ assert(u != v); // no self loops
+ std::pair<adjacency_iterator, adjacency_iterator>
+ wrange = adjacent_vertices(v, g);
+ for (adjacency_iterator wit = wrange.first;
+ wit != wrange.second; ++wit) {
+ vertex_descriptor w = *wit;
+ assert(v != w); // no self loops
+ seen[get(vertex_index, g, w)] = true;
+ }
+ }
+
+ // Find the transitive edges.
+ std::pair<out_edge_iterator, out_edge_iterator>
+ uvrange = out_edges(u, g);
+ for (out_edge_iterator uvit = uvrange.first;
+ uvit != uvrange.second; ++uvit) {
+ edge_descriptor uv = *uvit;
+ vertex_descriptor v = target(uv, g);
+ if (seen[get(vertex_index, g, v)]) {
+ // The edge (u,v) is transitive. Mark it for removal.
+ *out++ = uv;
+ }
+ }
+ }
+}
+
+/** Remove the edges [first,last) from g.
+ * @return the number of removed edges
+ */
+template <typename Graph, typename It>
+void remove_edges(Graph& g, It first, It last)
+{
+ for (It it = first; it != last; ++it)
+ remove_edge(*it, g);
+}
+
+/**
+ * Remove transitive edges from the specified graph.
+ * Find and remove the subset of edges (u,w) in E for which there
+ * exists a vertex v such that the edges (u,v) and (v,w) exist in E.
+ * This algorithm is not a general-purpose transitive reduction
+ * algorithm. It is able to find transitive edges with exactly one
+ * intermediate vertex.
+ * @return the number of transitive edges removed from g
+ */
+template <typename Graph>
+unsigned remove_transitive_edges(Graph& g)
+{
+ typedef typename graph_traits<Graph>::edge_descriptor
+ edge_descriptor;
+ std::vector<edge_descriptor> transitive;
+ find_transitive_edges(g, back_inserter(transitive));
+ remove_edges(g, transitive.begin(), transitive.end());
+ return transitive.size();
+}
+
+#endif
diff --git a/Graph/GraphIO.h b/Graph/GraphIO.h
new file mode 100644
index 0000000..6f33c95
--- /dev/null
+++ b/Graph/GraphIO.h
@@ -0,0 +1,80 @@
+#ifndef GRAPHIO_H
+#define GRAPHIO_H 1
+
+#include "Graph/Options.h"
+#include "AdjIO.h"
+#include "AsqgIO.h"
+#include "DistIO.h"
+#include "DotIO.h"
+#include "FastaIO.h"
+#include "SAMIO.h"
+#include <cassert>
+#include <cstdlib> // for abort
+#include <istream>
+#include <ostream>
+#include <string>
+
+/** Write the graph g to the specified output stream in the format
+ * specified by opt::format.
+ */
+template <typename Graph>
+std::ostream& write_graph(std::ostream& out, const Graph& g,
+ const std::string& program, const std::string& commandLine)
+{
+ switch (opt::format) {
+ case ADJ:
+ return out << adj_writer<Graph>(g);
+ case ASQG:
+ return write_asqg(out, g);
+ case DIST:
+ return write_dist(out, g);
+ case DOT: case DOT_MEANCOV:
+ return out << dot_writer(g);
+ case SAM:
+ return write_sam(out, g, program, commandLine);
+ default:
+ assert(false);
+ abort();
+ }
+}
+
+#include "ContigGraph.h"
+
+/** Read a graph. */
+template <typename Graph, typename BetterEP>
+std::istream& read_graph(std::istream& in, ContigGraph<Graph>& g,
+ BetterEP betterEP)
+{
+ in >> std::ws;
+ assert(in);
+ switch (in.peek()) {
+ case 'd': // digraph: GraphViz dot format
+ return read_dot<Graph>(in, g, betterEP);
+ case 'H': // HT: ASQG format
+ return read_asqg(in, g);
+ case '>': // FASTA format for vertices
+ return read_fasta(in, g);
+ default: // adj format
+ return read_adj(in, g, betterEP);
+ }
+}
+
+/** Disallow parallel edges. */
+struct DisallowParallelEdges {
+ template <typename EP>
+ EP operator()(const EP& a, const EP& b) const
+ {
+ std::cerr << "error: parallel edges:"
+ " [" << a << "], [" << b << "]\n";
+ exit(EXIT_FAILURE);
+ }
+};
+
+/** Read a graph. */
+template <typename Graph>
+std::istream& operator>>(std::istream& in, ContigGraph<Graph>& g)
+{
+ return read_graph(in, g, DisallowParallelEdges());
+}
+
+#endif
diff --git a/Graph/GraphUtil.h b/Graph/GraphUtil.h
new file mode 100644
index 0000000..ef34c43
--- /dev/null
+++ b/Graph/GraphUtil.h
@@ -0,0 +1,61 @@
+#ifndef GRAPHUTIL_H
+#define GRAPHUTIL_H 1
+
+#include "Histogram.h"
+#include <boost/graph/graph_traits.hpp>
+#include <iomanip>
+#include <ostream>
+
+using boost::graph_traits;
+
+/** Return the number of vertices that have been marked as removed. */
+template <typename Graph>
+typename graph_traits<Graph>::vertices_size_type
+num_vertices_removed(const Graph& g)
+{
+ typedef graph_traits<Graph> GTraits;
+ typedef typename GTraits::vertices_size_type vertices_size_type;
+ typedef typename GTraits::vertex_iterator vertex_iterator;
+ vertices_size_type n = 0;
+ std::pair<vertex_iterator, vertex_iterator> vit = vertices(g);
+ for (vertex_iterator u = vit.first; u != vit.second; ++u)
+ if (get(vertex_removed, g, *u))
+ n++;
+ return n;
+}
+
+/** Print statistics of the number of vertices and edges. */
+template <typename Graph>
+std::ostream& printGraphStats(std::ostream& out, const Graph& g)
+{
+ using std::setprecision;
+ typedef typename graph_traits<Graph>::vertex_iterator
+ vertex_iterator;
+
+ unsigned v = num_vertices(g) - num_vertices_removed(g);
+ unsigned e = num_edges(g);
+ out << "V=" << v << " E=" << e
+ << " E/V=" << setprecision(3) << (float)e / v << std::endl;
+
+ // Print a histogram of the degree.
+ Histogram h;
+ std::pair<vertex_iterator, vertex_iterator> vit = vertices(g);
+ for (vertex_iterator u = vit.first; u != vit.second; ++u) {
+ if (get(vertex_removed, g, *u))
+ continue;
+ h.insert(out_degree(*u, g));
+ }
+ unsigned n = h.size();
+ unsigned n0 = h.count(0), n1 = h.count(1), n234 = h.count(2, 4);
+ unsigned n5 = n - (n0 + n1 + n234);
+ return out <<
+ "Degree: " << h.barplot(h.maximum() + 1) << "\n"
+ " 01234\n"
+ "0: " << setprecision(2) << (float)100 * n0 / n << "% "
+ "1: " << setprecision(2) << (float)100 * n1 / n << "% "
+ "2-4: " << setprecision(2) << (float)100 * n234 / n << "% "
+ "5+: " << setprecision(2) << (float)100 * n5 / n << "% "
+ "max: " << h.maximum() << std::endl;
+}
+
+#endif
diff --git a/Graph/Makefile.am b/Graph/Makefile.am
new file mode 100644
index 0000000..f46756d
--- /dev/null
+++ b/Graph/Makefile.am
@@ -0,0 +1,34 @@
+noinst_LIBRARIES = libgraph.a
+bin_PROGRAMS = abyss-gc abyss-todot
+
+libgraph_a_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/Common
+
+libgraph_a_SOURCES = \
+ AdjIO.h \
+ AsqgIO.h \
+ Assemble.h \
+ ConstrainedSearch.cpp ConstrainedSearch.h \
+ ContigGraph.h \
+ ContigGraphAlgorithms.h \
+ DepthFirstSearch.h \
+ DirectedGraph.h \
+ DistIO.h \
+ DotIO.h \
+ FastaIO.h \
+ GraphAlgorithms.h \
+ GraphIO.h \
+ GraphUtil.h \
+ Options.h \
+ PopBubbles.h \
+ Properties.h \
+ SAMIO.h
+
+abyss_todot_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/Common
+abyss_todot_LDFLAGS = -L.
+abyss_todot_LDADD = libgraph.a \
+ $(top_builddir)/Common/libcommon.a
+abyss_todot_SOURCES = todot.cc
+
+abyss_gc_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/Common
+abyss_gc_LDADD = $(top_builddir)/Common/libcommon.a
+abyss_gc_SOURCES = gc.cc
diff --git a/Graph/Makefile.in b/Graph/Makefile.in
new file mode 100644
index 0000000..16c0741
--- /dev/null
+++ b/Graph/Makefile.in
@@ -0,0 +1,623 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = abyss-gc$(EXEEXT) abyss-todot$(EXEEXT)
+subdir = Graph
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libgraph_a_AR = $(AR) $(ARFLAGS)
+libgraph_a_LIBADD =
+am_libgraph_a_OBJECTS = libgraph_a-ConstrainedSearch.$(OBJEXT)
+libgraph_a_OBJECTS = $(am_libgraph_a_OBJECTS)
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_abyss_gc_OBJECTS = abyss_gc-gc.$(OBJEXT)
+abyss_gc_OBJECTS = $(am_abyss_gc_OBJECTS)
+abyss_gc_DEPENDENCIES = $(top_builddir)/Common/libcommon.a
+am_abyss_todot_OBJECTS = abyss_todot-todot.$(OBJEXT)
+abyss_todot_OBJECTS = $(am_abyss_todot_OBJECTS)
+abyss_todot_DEPENDENCIES = libgraph.a \
+ $(top_builddir)/Common/libcommon.a
+abyss_todot_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(abyss_todot_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libgraph_a_SOURCES) $(abyss_gc_SOURCES) \
+ $(abyss_todot_SOURCES)
+DIST_SOURCES = $(libgraph_a_SOURCES) $(abyss_gc_SOURCES) \
+ $(abyss_todot_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LIBRARIES = libgraph.a
+libgraph_a_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/Common
+libgraph_a_SOURCES = \
+ AdjIO.h \
+ AsqgIO.h \
+ Assemble.h \
+ ConstrainedSearch.cpp ConstrainedSearch.h \
+ ContigGraph.h \
+ ContigGraphAlgorithms.h \
+ DepthFirstSearch.h \
+ DirectedGraph.h \
+ DistIO.h \
+ DotIO.h \
+ FastaIO.h \
+ GraphAlgorithms.h \
+ GraphIO.h \
+ GraphUtil.h \
+ Options.h \
+ PopBubbles.h \
+ Properties.h \
+ SAMIO.h
+
+abyss_todot_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/Common
+abyss_todot_LDFLAGS = -L.
+abyss_todot_LDADD = libgraph.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_todot_SOURCES = todot.cc
+abyss_gc_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/Common
+abyss_gc_LDADD = $(top_builddir)/Common/libcommon.a
+abyss_gc_SOURCES = gc.cc
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Graph/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Graph/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libgraph.a: $(libgraph_a_OBJECTS) $(libgraph_a_DEPENDENCIES) $(EXTRA_libgraph_a_DEPENDENCIES)
+ -rm -f libgraph.a
+ $(libgraph_a_AR) libgraph.a $(libgraph_a_OBJECTS) $(libgraph_a_LIBADD)
+ $(RANLIB) libgraph.a
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+abyss-gc$(EXEEXT): $(abyss_gc_OBJECTS) $(abyss_gc_DEPENDENCIES) $(EXTRA_abyss_gc_DEPENDENCIES)
+ @rm -f abyss-gc$(EXEEXT)
+ $(CXXLINK) $(abyss_gc_OBJECTS) $(abyss_gc_LDADD) $(LIBS)
+abyss-todot$(EXEEXT): $(abyss_todot_OBJECTS) $(abyss_todot_DEPENDENCIES) $(EXTRA_abyss_todot_DEPENDENCIES)
+ @rm -f abyss-todot$(EXEEXT)
+ $(abyss_todot_LINK) $(abyss_todot_OBJECTS) $(abyss_todot_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_gc-gc.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_todot-todot.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/libgraph_a-ConstrainedSearch.Po at am__quote@
+
+.cc.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+libgraph_a-ConstrainedSearch.o: ConstrainedSearch.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgraph_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgraph_a-ConstrainedSearch.o -MD -MP -MF $(DEPDIR)/libgraph_a-ConstrainedSearch.Tpo -c -o libgraph_a-ConstrainedSearch.o `test -f 'ConstrainedSearch.cpp' || echo '$(srcdir)/'`ConstrainedSearch.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgraph_a-ConstrainedSearch.Tpo $(DEPDIR)/libgraph_a-ConstrainedSearch.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ConstrainedSearch.cpp' object='libgraph_a-ConstrainedSearch.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgraph_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgraph_a-ConstrainedSearch.o `test -f 'ConstrainedSearch.cpp' || echo '$(srcdir)/'`ConstrainedSearch.cpp
+
+libgraph_a-ConstrainedSearch.obj: ConstrainedSearch.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgraph_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT libgraph_a-ConstrainedSearch.obj -MD -MP -MF $(DEPDIR)/libgraph_a-ConstrainedSearch.Tpo -c -o libgraph_a-ConstrainedSearch.obj `if test -f 'ConstrainedSearch.cpp'; then $(CYGPATH_W) 'ConstrainedSearch.cpp'; else $(CYGPATH_W) '$(srcdir)/ConstrainedSearch.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/libgraph_a-ConstrainedSearch.Tpo $(DEPDIR)/libgraph_a-ConstrainedSearch.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ConstrainedSearch.cpp' object='libgraph_a-ConstrainedSearch.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgraph_a_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o libgraph_a-ConstrainedSearch.obj `if test -f 'ConstrainedSearch.cpp'; then $(CYGPATH_W) 'ConstrainedSearch.cpp'; else $(CYGPATH_W) '$(srcdir)/ConstrainedSearch.cpp'; fi`
+
+abyss_gc-gc.o: gc.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_gc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_gc-gc.o -MD -MP -MF $(DEPDIR)/abyss_gc-gc.Tpo -c -o abyss_gc-gc.o `test -f 'gc.cc' || echo '$(srcdir)/'`gc.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_gc-gc.Tpo $(DEPDIR)/abyss_gc-gc.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='gc.cc' object='abyss_gc-gc.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_gc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_gc-gc.o `test -f 'gc.cc' || echo '$(srcdir)/'`gc.cc
+
+abyss_gc-gc.obj: gc.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_gc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_gc-gc.obj -MD -MP -MF $(DEPDIR)/abyss_gc-gc.Tpo -c -o abyss_gc-gc.obj `if test -f 'gc.cc'; then $(CYGPATH_W) 'gc.cc'; else $(CYGPATH_W) '$(srcdir)/gc.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_gc-gc.Tpo $(DEPDIR)/abyss_gc-gc.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='gc.cc' object='abyss_gc-gc.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_gc_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_gc-gc.obj `if test -f 'gc.cc'; then $(CYGPATH_W) 'gc.cc'; else $(CYGPATH_W) '$(srcdir)/gc.cc'; fi`
+
+abyss_todot-todot.o: todot.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_todot_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_todot-todot.o -MD -MP -MF $(DEPDIR)/abyss_todot-todot.Tpo -c -o abyss_todot-todot.o `test -f 'todot.cc' || echo '$(srcdir)/'`todot.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_todot-todot.Tpo $(DEPDIR)/abyss_todot-todot.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='todot.cc' object='abyss_todot-todot.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_todot_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_todot-todot.o `test -f 'todot.cc' || echo '$(srcdir)/'`todot.cc
+
+abyss_todot-todot.obj: todot.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_todot_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_todot-todot.obj -MD -MP -MF $(DEPDIR)/abyss_todot-todot.Tpo -c -o abyss_todot-todot.obj `if test -f 'todot.cc'; then $(CYGPATH_W) 'todot.cc'; else $(CYGPATH_W) '$(srcdir)/todot.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_todot-todot.Tpo $(DEPDIR)/abyss_todot-todot.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='todot.cc' object='abyss_todot-todot.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_todot_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_todot-todot.obj `if test -f 'todot.cc'; then $(CYGPATH_W) 'todot.cc'; else $(CYGPATH_W) '$(srcdir)/todot.cc'; fi`
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-noinstLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-noinstLIBRARIES cscopelist ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Graph/Options.h b/Graph/Options.h
new file mode 100644
index 0000000..23cf054
--- /dev/null
+++ b/Graph/Options.h
@@ -0,0 +1,15 @@
+#ifndef GRAPH_OPTIONS_H
+#define GRAPH_OPTIONS_H 1
+
+namespace opt {
+ /** The size of a k-mer. */
+ extern unsigned k;
+
+ /** The file format of the graph when writing. */
+ extern int format;
+}
+
+/** Enumeration of output formats */
+enum { ADJ, ASQG, DIST, DOT, DOT_MEANCOV, SAM };
+
+#endif
diff --git a/Graph/PopBubbles.h b/Graph/PopBubbles.h
new file mode 100644
index 0000000..8eea310
--- /dev/null
+++ b/Graph/PopBubbles.h
@@ -0,0 +1,204 @@
+#ifndef POPBUBBLES_H
+#define POPBUBBLES_H 1
+
+#include "Common/Options.h"
+#include "DepthFirstSearch.h"
+#include <boost/graph/graph_traits.hpp>
+#include <boost/unordered_map.hpp>
+#include <algorithm>
+#include <iostream>
+#include <iterator>
+#include <set>
+#include <utility>
+#include <vector>
+
+using boost::graph_traits;
+
+/** Record a topological order of the vertices. */
+template <typename OutIt>
+struct TopoVisitor : public boost::default_dfs_visitor
+{
+ TopoVisitor(OutIt it) : m_it(it) { }
+
+ template <typename Vertex, typename Graph>
+ void finish_vertex(const Vertex& u, Graph&) { *m_it++ = u; }
+
+ private:
+ OutIt m_it;
+};
+
+/** Record a topological order of the vertices. */
+template <typename Graph, typename It>
+void topologicalSort(const Graph& g, It it)
+{
+ using boost::default_color_type;
+ using boost::property_map;
+ using boost::vector_property_map;
+ typedef typename property_map<Graph, vertex_index_t>::type
+ VertexIndexMap;
+ typedef vector_property_map<default_color_type, VertexIndexMap>
+ ColorMap;
+ depthFirstSearch(g, TopoVisitor<It>(it),
+ ColorMap(num_vertices(g)));
+}
+
+/** Return true if the specified sequence of vertices is a bubble. */
+template <typename Graph, typename It>
+bool isBubble(const Graph& g, It first, It last)
+{
+ typedef typename graph_traits<Graph>::adjacency_iterator Ait;
+ typedef typename graph_traits<Graph>::in_edge_iterator Iit;
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+ assert(last - first > 1);
+ if (last - first == 2)
+ return false; // unambiguous edge
+ if (*first == get(vertex_complement, g, last[-1]))
+ return false; // palindrome
+ std::set<V> targets(first, first + 1);
+ for (It it = first; it != last - 1; ++it) {
+ std::pair<Ait, Ait> adj = adjacent_vertices(*it, g);
+ targets.insert(adj.first, adj.second);
+ }
+ std::set<V> sources(last - 1, last);
+ for (It it = first + 1; it != last; ++it) {
+ std::pair<Iit, Iit> adj = in_edges(*it, g);
+ for (Iit eit = adj.first; eit != adj.second; ++eit)
+ sources.insert(source(*eit, g));
+ }
+ std::set<V> bubble(first, last);
+ return sources == bubble && targets == bubble;
+}
+
+typedef std::vector<ContigNode> Bubble;
+typedef std::vector<Bubble> Bubbles;
+
+/** Discover bubbles. */
+template <typename Graph>
+Bubbles discoverBubbles(const Graph& g)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+
+ std::vector<V> topo(num_vertices(g));
+ topologicalSort(g, topo.rbegin());
+
+ Bubbles bubbles;
+ typedef typename std::vector<V>::const_iterator It;
+ for (It first = topo.begin(); first != topo.end(); ++first) {
+ int sum = out_degree(*first, g);
+ if (sum < 2)
+ continue;
+ if (opt::verbose > 3)
+ std::cerr << "* " << get(vertex_name, g, *first) << '\n';
+ for (It it = first + 1; it != topo.end(); ++it) {
+ unsigned indeg = in_degree(*it, g);
+ unsigned outdeg = out_degree(*it, g);
+ sum -= indeg;
+
+ if (opt::verbose > 3)
+ std::cerr << get(vertex_name, g, *it)
+ << '\t' << indeg << '\t' << outdeg
+ << '\t' << sum
+ << '\t' << sum + (int)outdeg << '\n';
+
+ if (indeg == 0 || sum < 0)
+ break;
+ if (sum == 0) {
+ It last = it + 1;
+ if (isBubble(g, first, last)) {
+ if (opt::verbose > 3)
+ std::cerr << "good\n";
+ bubbles.push_back(Bubble(first, last));
+ first = it - 1;
+ }
+ break;
+ }
+
+ if (outdeg == 0)
+ break;
+ sum += outdeg;
+ }
+ }
+ return bubbles;
+}
+
+/** Return the length of the longest path through the bubble. */
+template <typename Graph>
+int longestPath(const Graph& g, const Bubble& topo)
+{
+ using boost::tie;
+ typedef graph_traits<Graph> GTraits;
+ typedef typename GTraits::edge_descriptor E;
+ typedef typename GTraits::out_edge_iterator Eit;
+ typedef typename GTraits::vertex_descriptor V;
+
+ EdgeWeightMap<Graph> weight(g);
+ /* GCC 4.4.6 has a bug that prevents ContigNode being used as the
+ * key of a std::map. Possibly related to
+ * http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39390
+ */
+ boost::unordered_map<V, int> distance;
+ distance[topo.front()] = 0;
+ for (Bubble::const_iterator it = topo.begin();
+ it != topo.end(); ++it) {
+ V u = *it;
+ Eit eit, elast;
+ for (tie(eit, elast) = out_edges(u, g); eit != elast; ++eit) {
+ E e = *eit;
+ V v = target(e, g);
+ distance[v] = std::max(
+ distance[v], distance[u] + weight[e]);
+ }
+ }
+ V v = topo.back();
+ return distance[v] - g[v].length;
+}
+
+/** Scaffold over the bubble between vertices u and w.
+ * Add an edge (u,w) with the distance property set to the length of
+ * the largest branch of the bubble.
+ */
+template <typename Graph>
+void scaffoldBubble(Graph& g, const Bubble& bubble)
+{
+ typedef graph_traits<Graph> GTraits;
+ typedef typename GTraits::adjacency_iterator Ait;
+ typedef typename GTraits::vertex_descriptor V;
+ assert(bubble.size() > 2);
+
+ V u = bubble.front(), w = bubble.back();
+ if (edge(u, w, g).second) {
+ // Already scaffolded.
+ return;
+ }
+ assert(isBubble(g, bubble.begin(), bubble.end()));
+
+ add_edge(u, w, std::max(longestPath(g, bubble), 1), g);
+}
+
+/** Replace each bubble in the graph with a single edge.
+ * Remove the vertices in the bubbles from the graph.
+ * @return the vertices that were removed from the graph
+ */
+template <typename Graph>
+std::vector<typename graph_traits<Graph>::vertex_descriptor>
+popBubbles(Graph& g)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+ typedef std::vector<V> Vertices;
+ Vertices popped;
+ Bubbles bubbles = discoverBubbles(g);
+ for (Bubbles::const_iterator it = bubbles.begin();
+ it != bubbles.end(); ++it) {
+ scaffoldBubble(g, *it);
+ popped.insert(popped.end(), it->begin() + 1, it->end() - 1);
+ }
+ for (typename Vertices::const_iterator it = popped.begin();
+ it != popped.end(); ++it) {
+ V u = *it;
+ clear_vertex(u, g);
+ remove_vertex(u, g);
+ }
+ return popped;
+}
+
+#endif
diff --git a/Graph/Properties.h b/Graph/Properties.h
new file mode 100644
index 0000000..c577b6d
--- /dev/null
+++ b/Graph/Properties.h
@@ -0,0 +1,83 @@
+#ifndef GRAPH_PROPERTIES_H
+#define GRAPH_PROPERTIES_H 1
+
+#include <istream>
+#include <ostream>
+#include <boost/graph/properties.hpp>
+
+/** The distance between two vertices. */
+enum edge_distance_t { edge_distance };
+
+/** The complementary vertex of a skew-symmetric graph. */
+enum vertex_complement_t { vertex_complement };
+
+/** The index of a contig. */
+enum vertex_contig_index_t { vertex_contig_index };
+
+/** The name of a contig without an orientation. */
+enum vertex_contig_name_t { vertex_contig_name };
+
+/** The coverage of a vertex. */
+enum vertex_coverage_t { vertex_coverage };
+
+/** The length of a vertex. */
+enum vertex_length_t { vertex_length };
+
+/** A property indicating that this vertex has been removed. */
+enum vertex_removed_t { vertex_removed };
+
+/** The orientation of a vertex. */
+enum vertex_sense_t { vertex_sense };
+
+using boost::edge_bundle;
+using boost::edge_bundle_t;
+using boost::edge_name;
+using boost::edge_name_t;
+using boost::edge_weight;
+using boost::edge_weight_t;
+using boost::no_property;
+using boost::vertex_bundle;
+using boost::vertex_bundle_t;
+using boost::vertex_index;
+using boost::vertex_index_t;
+using boost::vertex_name;
+using boost::vertex_name_t;
+
+using boost::edge_bundle_type;
+using boost::edge_property;
+using boost::vertex_bundle_type;
+using boost::vertex_property;
+
+namespace boost {
+ BOOST_INSTALL_PROPERTY(edge, distance);
+ BOOST_INSTALL_PROPERTY(vertex, complement);
+ BOOST_INSTALL_PROPERTY(vertex, contig_index);
+ BOOST_INSTALL_PROPERTY(vertex, contig_name);
+ BOOST_INSTALL_PROPERTY(vertex, coverage);
+ BOOST_INSTALL_PROPERTY(vertex, length);
+ BOOST_INSTALL_PROPERTY(vertex, removed);
+ BOOST_INSTALL_PROPERTY(vertex, sense);
+}
+
+/** No property. */
+struct NoProperty
+{
+ NoProperty(...) { }
+ bool operator==(const NoProperty&) const { return true; }
+ friend std::ostream& operator<<(std::ostream& out,
+ const NoProperty&)
+ {
+ return out;
+ }
+ friend std::istream& operator>>(std::istream& in, NoProperty&)
+ {
+ return in;
+ }
+};
+
+template <typename Tag>
+void put(Tag, NoProperty&, unsigned)
+{
+}
+
+#endif
diff --git a/Graph/SAMIO.h b/Graph/SAMIO.h
new file mode 100644
index 0000000..b2da70c
--- /dev/null
+++ b/Graph/SAMIO.h
@@ -0,0 +1,72 @@
+#ifndef SAMIO_H
+#define SAMIO_H 1
+
+#include "ContigNode.h"
+#include "Graph/Properties.h"
+#include <boost/graph/graph_traits.hpp>
+#include <ostream>
+
+using boost::graph_traits;
+
+/** Output a graph in SAM alignment format.
+ * vertex_descriptor must be convertible to a ContigNode
+ * vertex_property_type must have members length and coverage
+ * edge_property_type must have a member distance
+ */
+template <typename Graph>
+std::ostream& write_sam(std::ostream& out, const Graph& g,
+ const std::string& program, const std::string& commandLine)
+{
+ typedef typename graph_traits<Graph>::vertex_iterator
+ vertex_iterator;
+ typedef typename vertex_property<Graph>::type
+ vertex_property_type;
+ typedef typename graph_traits<Graph>::edge_iterator
+ edge_iterator;
+ typedef typename edge_property<Graph>::type
+ edge_property_type;
+
+ out << "@HD\tVN:1.0\n"
+ "@PG\tID:" << program << "\tVN:" VERSION "\t"
+ "CL:" << commandLine << '\n';
+
+ std::pair<vertex_iterator, vertex_iterator> vit = vertices(g);
+ for (vertex_iterator u = vit.first; u != vit.second; ++u, ++u) {
+ if (get(vertex_removed, g, *u))
+ continue;
+ const vertex_property_type& vp = g[*u];
+ out << "@SQ\tSN:" << get(vertex_contig_name, g, *u)
+ << "\tLN:" << vp.length;
+ if (vp.coverage > 0)
+ out << "\tXC:" << vp.coverage;
+ out << '\n';
+ }
+
+ std::pair<edge_iterator, edge_iterator> eit = edges(g);
+ for (edge_iterator e = eit.first; e != eit.second; ++e) {
+ ContigNode u = source(*e, g), v = target(*e, g);
+ assert(!get(vertex_removed, g, v));
+ int distance = get(edge_distance, g, *e);
+ if (get(vertex_removed, g, u) || distance >= 0)
+ continue;
+ unsigned flag = u.sense() == v.sense() ? 0 : 0x10; //FREVERSE
+ unsigned alen = -distance;
+ unsigned pos = 1 + (u.sense() ? 0 : g[u].length - alen);
+ out << get(vertex_contig_name, g, v) // QNAME
+ << '\t' << flag // FLAG
+ << '\t' << get(vertex_contig_name, g, u) // RNAME
+ << '\t' << pos // POS
+ << "\t255\t"; // MAPQ
+ // CIGAR
+ unsigned clip = g[v].length - alen;
+ if (u.sense())
+ out << clip << 'H' << alen << "M\t";
+ else
+ out << alen << 'M' << clip << "H\t";
+ // MRNM MPOS ISIZE SEQ QUAL
+ out << "*\t0\t0\t*\t*\n";
+ }
+ return out;
+}
+
+#endif
diff --git a/Graph/gc.cc b/Graph/gc.cc
new file mode 100644
index 0000000..f27f915
--- /dev/null
+++ b/Graph/gc.cc
@@ -0,0 +1,111 @@
+/** Convert a graph to dot format.
+ * Written by Shaun Jackman <sjackman at bcgsc.ca>.
+ */
+#include "ContigGraph.h"
+#include "DirectedGraph.h"
+#include "GraphIO.h"
+#include "GraphUtil.h"
+#include "IOUtil.h"
+#include "Uncompress.h"
+#include <fstream>
+#include <getopt.h>
+#include <iostream>
+
+using namespace std;
+
+#define PROGRAM "abyss-gc"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [FILE]...\n"
+"Count the number of vertices and edges in a graph.\n"
+"\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by DotIO
+ static int verbose;
+}
+
+static const char shortopts[] = "v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** Read a graph from the specified file. */
+template <typename Graph, typename BetterEP>
+static void readGraph(const string& path, Graph& g, BetterEP betterEP)
+{
+ if (opt::verbose > 0)
+ cout << "Reading `" << path << "'...\n";
+ ifstream fin(path.c_str());
+ istream& in = path == "-" ? cin : fin;
+ assert_good(in, path);
+ read_graph(in, g, betterEP);
+ assert(in.eof());
+ printGraphStats(cout, g);
+ g_contigNames.lock();
+}
+
+/** Read a graph from the specified files. */
+template <typename Graph, typename It, typename BetterEP>
+void readGraphs(Graph& g, It first, It last, BetterEP betterEP)
+{
+ if (first != last) {
+ for (It it = first; it < last; ++it)
+ readGraph(*it, g, betterEP);
+ } else
+ readGraph("-", g, betterEP);
+}
+
+int main(int argc, char** argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ ContigGraph<DirectedGraph<NoProperty, NoProperty> > g;
+ readGraphs(g, argv + optind, argv + argc,
+ DisallowParallelEdges());
+ assert_good(cout, "-");
+
+ return 0;
+}
diff --git a/Graph/todot.cc b/Graph/todot.cc
new file mode 100644
index 0000000..16a50b5
--- /dev/null
+++ b/Graph/todot.cc
@@ -0,0 +1,164 @@
+/** Convert a graph to dot format.
+ * Written by Shaun Jackman <sjackman at bcgsc.ca>.
+ */
+#include "ContigGraph.h"
+#include "ContigProperties.h"
+#include "DirectedGraph.h"
+#include "Estimate.h"
+#include "GraphIO.h"
+#include "GraphUtil.h"
+#include "IOUtil.h"
+#include "Uncompress.h"
+#include <fstream>
+#include <getopt.h>
+#include <iostream>
+#include <iterator> // for ostream_iterator
+#include <utility>
+
+using namespace std;
+using namespace std::rel_ops;
+
+#define PROGRAM "abyss-todot"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [FILE]...\n"
+"Convert the specified graph to dot format.\n"
+"\n"
+" -k, --kmer=N report the mean k-mer coverage, otherwise\n"
+" the sum k-mer coverage is reported\n"
+" --adj output the graph in adj format\n"
+" --asqg output the graph in asqg format\n"
+" --dist output the graph in dist format\n"
+" --dot output the graph in dot format [default]\n"
+" --dot-meancov same as above but give the mean coverage\n"
+" --sam output the graph in SAM format\n"
+" -e, --estimate output distance estimates\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by Distance
+ static int verbose;
+
+ /** Output distance estimates. */
+ bool estimate;
+
+ /** Output format */
+ int format = DOT; // used by ContigProperties
+}
+
+static const char shortopts[] = "ek:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "adj", no_argument, &opt::format, ADJ },
+ { "asqg", no_argument, &opt::format, ASQG },
+ { "dist", no_argument, &opt::format, DIST },
+ { "dot", no_argument, &opt::format, DOT },
+ { "dot-meancov", no_argument, &opt::format, DOT_MEANCOV },
+ { "sam", no_argument, &opt::format, SAM },
+ { "estimate", no_argument, NULL, 'e' },
+ { "kmer", required_argument, NULL, 'k' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** Read a graph from the specified file. */
+template <typename Graph, typename BetterEP>
+static void readGraph(const string& path, Graph& g, BetterEP betterEP)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading `" << path << "'...\n";
+ ifstream fin(path.c_str());
+ istream& in = path == "-" ? cin : fin;
+ assert_good(in, path);
+ read_graph(in, g, betterEP);
+ assert(in.eof());
+ if (opt::verbose > 0)
+ printGraphStats(cerr, g);
+ g_contigNames.lock();
+}
+
+/** Read a graph from the specified files. */
+template <typename Graph, typename It, typename BetterEP>
+void readGraphs(Graph& g, It first, It last, BetterEP betterEP)
+{
+ if (first != last) {
+ for (It it = first; it < last; ++it)
+ readGraph(*it, g, betterEP);
+ } else
+ readGraph("-", g, betterEP);
+}
+
+int main(int argc, char** argv)
+{
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'e': opt::estimate = true; break;
+ case 'k': arg >> opt::k; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (argc - optind < 0) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ if (opt::estimate) {
+ ContigGraph<DirectedGraph<ContigProperties, DistanceEst> > g;
+ readGraphs(g, argv + optind, argv + argc,
+ BetterDistanceEst());
+ write_graph(cout, g, PROGRAM, commandLine);
+ } else {
+ ContigGraph<DirectedGraph<ContigProperties, Distance> > g;
+ readGraphs(g, argv + optind, argv + argc,
+ DisallowParallelEdges());
+ write_graph(cout, g, PROGRAM, commandLine);
+ }
+ assert(cout.good());
+
+ return 0;
+}
diff --git a/KAligner/Aligner.cpp b/KAligner/Aligner.cpp
new file mode 100644
index 0000000..6dae9eb
--- /dev/null
+++ b/KAligner/Aligner.cpp
@@ -0,0 +1,249 @@
+#include "Aligner.h"
+#include "Iterator.h"
+#include "SAM.h"
+#include "Sequence.h"
+#include <algorithm>
+#include <cassert>
+#include <cstdlib>
+#include <iterator>
+#include <utility>
+
+using namespace std;
+
+namespace opt {
+ /** For a duplicate k-mer in the target
+ * ERROR: report an error and exit
+ * MULTIMAP: report all alignments
+ * IGNORE: do not report any alignments
+ */
+ int multimap;
+}
+
+template <>
+void Aligner<SeqPosHashMultiMap>::addReferenceSequence(
+ const Kmer& kmer, Position pos)
+{
+ assert(opt::multimap == opt::MULTIMAP);
+ m_target.insert(make_pair(kmer, pos));
+}
+
+template <class SeqPosHashMap>
+void Aligner<SeqPosHashMap>::addReferenceSequence(
+ const Kmer& kmer, Position pos)
+{
+ assert(opt::multimap != opt::MULTIMAP);
+ Kmer rc_kmer = reverseComplement(kmer);
+ map_iterator findIt = m_target.find(rc_kmer);
+
+ if (findIt != m_target.end()) {
+ if (!findIt->second.isDuplicate())
+ findIt->second.setDuplicate(
+ contigIndexToID(findIt->second.contig),
+ contigIndexToID(pos.contig), kmer.str());
+ return;
+ }
+
+ pair<map_iterator, bool> inserted
+ = m_target.insert(make_pair(kmer, pos));
+
+ if (!inserted.second)
+ if (!inserted.first->second.isDuplicate())
+ inserted.first->second.setDuplicate(
+ contigIndexToID(inserted.first->second.contig),
+ contigIndexToID(pos.contig), kmer.str());
+}
+
+/** Create an index of the target sequence. */
+template <class SeqPosHashMap>
+void Aligner<SeqPosHashMap>::addReferenceSequence(
+ const StringID& idString, const Sequence& seq)
+{
+ unsigned id = contigIDToIndex(idString);
+ int size = seq.length();
+ for(int i = 0; i < (size - m_hashSize + 1); ++i)
+ {
+ Sequence subseq(seq, i, m_hashSize);
+ if (subseq.find_first_not_of("ACGT0123") != string::npos)
+ continue;
+ addReferenceSequence(Kmer(subseq), Position(id, i));
+ }
+}
+
+template <class SeqPosHashMap>
+template <class oiterator>
+void Aligner<SeqPosHashMap>::alignRead(
+ const string& qid, const Sequence& seq,
+ oiterator dest)
+{
+ coalesceAlignments(qid, seq,
+ getAlignmentsInternal(seq, false), dest);
+ Sequence seqrc = reverseComplement(seq);
+ coalesceAlignments(qid, seqrc,
+ getAlignmentsInternal(seqrc, true), dest);
+}
+
+/** Store all alignments for a given Kmer in the parameter aligns.
+ * @param[out] aligns Map of contig IDs to alignment vectors.
+ */
+template <class SeqPosHashMap>
+void Aligner<SeqPosHashMap>::alignKmer(
+ AlignmentSet& aligns, const Sequence& seq,
+ bool isRC, bool good, int read_ind, int seqLen)
+{
+ assert(read_ind >= 0);
+ Sequence kmer(seq, read_ind, m_hashSize);
+ if (!good && kmer.find_first_not_of("ACGT0123") != string::npos)
+ return;
+
+ pair<map_const_iterator, map_const_iterator> range
+ = m_target.equal_range(Kmer(kmer));
+
+ if (range.first != range.second
+ && opt::multimap == opt::IGNORE
+ && range.first->second.isDuplicate())
+ return;
+
+ for (map_const_iterator resultIter = range.first;
+ resultIter != range.second; ++resultIter) {
+ assert(opt::multimap != opt::IGNORE
+ || !resultIter->second.isDuplicate());
+
+ int read_pos = !isRC ? read_ind
+ : Alignment::calculateReverseReadStart(
+ read_ind, seqLen, m_hashSize);
+ unsigned ctgIndex = resultIter->second.contig;
+ Alignment align(string(),
+ resultIter->second.pos, read_pos, m_hashSize,
+ seqLen, isRC);
+ aligns[ctgIndex].push_back(align);
+ }
+}
+
+template <class SeqPosHashMap>
+typename Aligner<SeqPosHashMap>::AlignmentSet
+Aligner<SeqPosHashMap>::getAlignmentsInternal(
+ const Sequence& seq, bool isRC)
+{
+ // The results
+ AlignmentSet aligns;
+
+ bool good = seq.find_first_not_of("ACGT0123") == string::npos;
+ int seqLen = seq.length();
+ int last_kmer = seqLen - m_hashSize;
+
+ if (last_kmer < 0)
+ return aligns;
+
+ // Align the first kmer
+ alignKmer(aligns, seq, isRC, good, 0, seqLen);
+
+ if (last_kmer == 0)
+ return aligns;
+
+ // Align the last kmer
+ alignKmer(aligns, seq, isRC, good, last_kmer, seqLen);
+
+ // Short-cut logic ignoring the middle alignments if the first
+ // and last kmers overlap, and align to the same contig
+ if (good && seqLen <= 2 * m_hashSize && aligns.size() == 1) {
+ AlignmentSet::const_iterator ctgIter = aligns.begin();
+ const AlignmentVector& a = ctgIter->second;
+ if (ctgIter->second.size() == 2) {
+ int qstep = isRC
+ ? a[0].read_start_pos - a[1].read_start_pos
+ : a[1].read_start_pos - a[0].read_start_pos;
+ assert(qstep >= 0);
+
+ // Verify this isn't a kmer aligning to two parts of a
+ // contig, and that the alignments are coalescable.
+ if (qstep == last_kmer &&
+ a[1].contig_start_pos
+ == a[0].contig_start_pos + qstep)
+ return aligns;
+ }
+ }
+
+ // Align middle kmers
+ for(int i = 1; i < last_kmer; ++i)
+ alignKmer(aligns, seq, isRC, good, i, seqLen);
+
+ return aligns;
+}
+
+static int compareQueryPos(const Alignment& a1, const Alignment& a2)
+{
+ return a1.read_start_pos < a2.read_start_pos;
+}
+
+/** Coalesce the k-mer alignments into a read alignment. */
+template <class SeqPosHashMap>
+template <class oiterator>
+void Aligner<SeqPosHashMap>::coalesceAlignments(
+ const string& qid, const string& seq,
+ const AlignmentSet& alignSet,
+ oiterator& dest)
+{
+ typedef typename output_iterator_traits<oiterator>::value_type
+ value_type;
+ for (AlignmentSet::const_iterator ctgIter = alignSet.begin();
+ ctgIter != alignSet.end(); ++ctgIter) {
+ AlignmentVector alignVec = ctgIter->second;
+ assert(!alignVec.empty());
+
+ sort(alignVec.begin(), alignVec.end(), compareQueryPos);
+
+ AlignmentVector::iterator prevIter = alignVec.begin();
+ AlignmentVector::iterator currIter = alignVec.begin() + 1;
+ Alignment currAlign = *prevIter;
+ while (currIter != alignVec.end()) {
+ int qstep = currIter->read_start_pos -
+ prevIter->read_start_pos;
+ assert(qstep >= 0);
+ int tstep = currIter->isRC ? -qstep : qstep;
+ if (currIter->contig_start_pos
+ == prevIter->contig_start_pos + tstep
+ && qstep <= m_hashSize) {
+ currAlign.align_length += qstep;
+ if (currAlign.isRC)
+ currAlign.contig_start_pos -= qstep;
+ } else {
+ currAlign.contig = contigIndexToID(ctgIter->first);
+ *dest++ = value_type(currAlign, qid, seq);
+ currAlign = *currIter;
+ }
+
+ prevIter = currIter;
+ currIter++;
+ }
+
+ currAlign.contig = contigIndexToID(ctgIter->first);
+ *dest++ = value_type(currAlign, qid, seq);
+ }
+}
+
+// Explicit instantiation.
+template void Aligner<SeqPosHashMultiMap>::addReferenceSequence(
+ const StringID& id, const Sequence& seq);
+
+template void Aligner<SeqPosHashUniqueMap>::addReferenceSequence(
+ const StringID& id, const Sequence& seq);
+
+template void Aligner<SeqPosHashMultiMap>::
+alignRead<affix_ostream_iterator<Alignment> >(
+ const string& qid, const Sequence& seq,
+ affix_ostream_iterator<Alignment> dest);
+
+template void Aligner<SeqPosHashUniqueMap>::
+alignRead<affix_ostream_iterator<Alignment> >(
+ const string& qid, const Sequence& seq,
+ affix_ostream_iterator<Alignment> dest);
+
+template void Aligner<SeqPosHashMultiMap>::
+alignRead<ostream_iterator<SAMRecord> >(
+ const string& qid, const Sequence& seq,
+ ostream_iterator<SAMRecord> dest);
+
+template void Aligner<SeqPosHashUniqueMap>::
+alignRead<ostream_iterator<SAMRecord> >(
+ const string& qid, const Sequence& seq,
+ ostream_iterator<SAMRecord> dest);
diff --git a/KAligner/Aligner.h b/KAligner/Aligner.h
new file mode 100644
index 0000000..f05d869
--- /dev/null
+++ b/KAligner/Aligner.h
@@ -0,0 +1,156 @@
+#ifndef ALIGNER_H
+#define ALIGNER_H 1
+
+#include "config.h"
+#include "KAligner/Options.h"
+#include "Alignment.h"
+#include "ConstString.h"
+#include "Functional.h"
+#include "Kmer.h"
+#include "UnorderedMap.h"
+#include <cassert>
+#include <cstdlib>
+#include <cstring> // for strcpy
+#include <functional>
+#include <iostream>
+#include <istream>
+#include <limits>
+#include <map>
+#include <ostream>
+#include <string>
+#include <vector>
+
+typedef std::string StringID;
+
+/** A tuple of a target ID and position. */
+struct Position
+{
+ uint32_t contig;
+ uint32_t pos; // 0 indexed
+ Position(uint32_t contig = std::numeric_limits<uint32_t>::max(),
+ uint32_t pos = std::numeric_limits<uint32_t>::max())
+ : contig(contig), pos(pos) { }
+
+ /** Mark this seed as a duplicate. */
+ void setDuplicate(const char* thisContig, const char* otherContig,
+ const Sequence& kmer)
+ {
+ if (opt::multimap == opt::IGNORE)
+ contig = std::numeric_limits<uint32_t>::max();
+ else {
+ std::cerr << "error: duplicate k-mer in "
+ << thisContig
+ << " also in "
+ << otherContig
+ << ": " << kmer << '\n';
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ /** Return whether this seed is a duplciate. */
+ bool isDuplicate() const
+ {
+ return contig == std::numeric_limits<uint32_t>::max();
+ }
+};
+
+typedef unordered_multimap<Kmer, Position, hashKmer>
+ SeqPosHashMultiMap;
+
+#if HAVE_GOOGLE_SPARSE_HASH_MAP
+# include <google/sparse_hash_map>
+typedef google::sparse_hash_map<Kmer, Position,
+ hashKmer> SeqPosHashUniqueMap;
+#else
+typedef unordered_map<Kmer, Position, hashKmer> SeqPosHashUniqueMap;
+#endif
+
+
+typedef std::vector<Alignment> AlignmentVector;
+
+/**
+ * Index a target sequence and align query sequences to that indexed
+ * target.
+ */
+template <class SeqPosHashMap>
+class Aligner
+{
+ public:
+ typedef typename SeqPosHashMap::iterator map_iterator;
+ typedef typename SeqPosHashMap::const_iterator
+ map_const_iterator;
+
+ Aligner(int hashSize, size_t buckets)
+ : m_hashSize(hashSize), m_target(buckets) { }
+
+ Aligner(int hashSize, size_t buckets, float factor)
+ : m_hashSize(hashSize)
+ {
+ m_target.max_load_factor(factor);
+ m_target.rehash(buckets);
+ }
+
+ void addReferenceSequence(const StringID& id,
+ const Sequence& seq);
+ void addReferenceSequence(const Kmer& kmer, Position pos);
+
+ template <class oiterator>
+ void alignRead(const std::string& qid, const Sequence& seq,
+ oiterator dest);
+
+ size_t size() const { return m_target.size(); }
+ size_t bucket_count() const
+ {
+ return m_target.bucket_count();
+ }
+
+ /** Return the number of duplicate k-mer in the target. */
+ size_t countDuplicates() const
+ {
+ assert(opt::multimap == opt::IGNORE);
+ return count_if(m_target.begin(), m_target.end(),
+ compose1(std::mem_fun_ref(&Position::isDuplicate),
+ mem_var(&SeqPosHashMap::value_type::second)));
+ }
+
+ private:
+ explicit Aligner(const Aligner&);
+
+ typedef std::map<unsigned, AlignmentVector> AlignmentSet;
+
+ void alignKmer(
+ AlignmentSet& aligns, const Sequence& kmer,
+ bool isRC, bool good, int read_ind, int seqLen);
+
+ AlignmentSet getAlignmentsInternal(
+ const Sequence& seq, bool isRC);
+
+ template <class oiterator>
+ void coalesceAlignments(
+ const std::string& qid, const std::string& seq,
+ const AlignmentSet& alignSet,
+ oiterator& dest);
+
+ // The number of bases to hash on
+ int m_hashSize;
+
+ /** A map of k-mer to contig coordinates. */
+ SeqPosHashMap m_target;
+
+ /** A dictionary of contig IDs. */
+ std::vector<const_string> m_dict;
+
+ unsigned contigIDToIndex(const std::string& id)
+ {
+ m_dict.push_back(id);
+ return m_dict.size() - 1;
+ }
+
+ cstring contigIndexToID(unsigned index)
+ {
+ assert(index < m_dict.size());
+ return m_dict[index];
+ }
+};
+
+#endif
diff --git a/KAligner/KAligner.cpp b/KAligner/KAligner.cpp
new file mode 100644
index 0000000..899765e
--- /dev/null
+++ b/KAligner/KAligner.cpp
@@ -0,0 +1,587 @@
+#include "Aligner.h"
+#include "Common/Options.h"
+#include "DataLayer/Options.h"
+#include "KAligner/Options.h"
+#include "FastaReader.h"
+#include "Iterator.h"
+#include "IOUtil.h"
+#include "MemoryUtil.h"
+#include "SAM.h"
+#include "StringUtil.h" // for toSI
+#include "Uncompress.h"
+#include "Pipe.h"
+#include "PipeMux.h"
+#include <algorithm>
+#include <cassert>
+#include <cctype>
+#include <cerrno>
+#include <cstdlib>
+#include <cstring>
+#include <fstream>
+#include <getopt.h>
+#include <iostream>
+#include <pthread.h>
+#include <sstream>
+#include <string>
+#include <sys/stat.h>
+#include <sys/time.h>
+
+using namespace std;
+
+#define PROGRAM "KAligner"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Jared Simpson and Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... QUERY... TARGET\n"
+"Align the sequences of the files QUERY to those of TARGET.\n"
+"All perfect matches of at least k bases will be found.\n"
+"\n"
+" -k, -l, --kmer=N k-mer size and minimum alignment length\n"
+" -s, --section=S/N split the target into N sections and align"
+" reads to section S [1/1]\n"
+" -i, --ignore-multimap ignore duplicate k-mer in the target\n"
+" [default]\n"
+" -m, --multimap allow duplicate k-mer in the target\n"
+" --no-multimap disallow duplicate k-mer in the target\n"
+" -j, --threads=N use N threads [2] up to one per query file\n"
+" or if N is 0 use one thread per query file\n"
+" -v, --verbose display verbose output\n"
+" --no-sam output the results in KAligner format\n"
+" --sam output the results in SAM format\n"
+" --seq print the sequence with the alignments\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+/** Enumeration of output formats */
+enum format { KALIGNER, SAM };
+
+namespace opt {
+ static unsigned k;
+ static int threads = 2;
+ static int printSeq;
+ static unsigned section = 1;
+ static unsigned nsections = 1;
+
+ /** Output formats */
+ static int format;
+}
+
+static const char shortopts[] = "ij:k:l:mo:s:v";
+
+
+enum { OPT_HELP = 1, OPT_VERSION, OPT_SYNC };
+
+static const struct option longopts[] = {
+ { "kmer", required_argument, NULL, 'k' },
+ { "section", required_argument, NULL, 's' },
+ { "no-multi", no_argument, &opt::multimap, opt::ERROR },
+ { "multimap", no_argument, &opt::multimap, opt::MULTIMAP },
+ { "ignore-multimap", no_argument, &opt::multimap, opt::IGNORE },
+ { "threads", required_argument, NULL, 'j' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "no-sam", no_argument, &opt::format, KALIGNER },
+ { "sam", no_argument, &opt::format, SAM },
+ { "no-seq", no_argument, &opt::printSeq, 0 },
+ { "seq", no_argument, &opt::printSeq, 1 },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** Return the number of k-mer in the specified file. */
+static size_t countKmer(const string& path)
+{
+ struct stat st;
+ if (stat(path.c_str(), &st) == -1) {
+ perror(path.c_str());
+ exit(EXIT_FAILURE);
+ }
+
+ if (!S_ISREG(st.st_mode)) {
+ cerr << "Not calculating k-mer in `" << path
+ << "', because it is not a regular file.\n";
+ return 500000000;
+ }
+
+ if (opt::verbose > 0)
+ cerr << "Reading target `" << path << "'..." << endl;
+
+ ifstream in(path.c_str());
+ assert(in.is_open());
+ size_t scaffolds = 0, contigs = 0, bases = 0;
+ enum { ID, SEQUENCE, GAP } state = SEQUENCE;
+ for (char c; in.get(c);) {
+ c = toupper(c);
+ switch (state) {
+ case ID:
+ if (c == '\n')
+ state = SEQUENCE;
+ break;
+ case SEQUENCE:
+ case GAP:
+ switch (c) {
+ case '>':
+ scaffolds++;
+ contigs++;
+ state = ID;
+ break;
+ case 'N':
+ case 'B': case 'D': case 'H': case 'K': case 'M':
+ case 'R': case 'S': case 'V': case 'W': case 'Y':
+ if (state != GAP)
+ contigs++;
+ state = GAP;
+ break;
+ case 'A': case 'C': case 'G': case 'T':
+ case '0': case '1': case '2': case '3':
+ bases++;
+ state = SEQUENCE;
+ break;
+ case '\n':
+ break;
+ default:
+ cerr << "error: unexpected character: "
+ "`" << c << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ break;
+ }
+ }
+
+ size_t overlaps = contigs * (opt::k-1);
+ size_t kmer = bases - overlaps;
+ if (opt::verbose > 0) {
+ cerr << "Read " << bases << " bases, "
+ << contigs << " contigs, " << scaffolds << " scaffolds"
+ " from `" << path << "'. "
+ "Expecting " << kmer << " k-mer.\n";
+ cerr << "Index will use at least "
+ << toSI(kmer * sizeof(pair<Kmer, Position>))
+ << "B.\n";
+ }
+ assert(bases > overlaps);
+ return kmer;
+}
+
+template <class SeqPosHashMap>
+static void readContigsIntoDB(string refFastaFile,
+ Aligner<SeqPosHashMap>& aligner);
+static void *alignReadsToDB(void *arg);
+static void *readFile(void *arg);
+
+/** Unique aligner using map */
+static Aligner<SeqPosHashUniqueMap> *g_aligner_u;
+
+/** Multimap aligner using multimap */
+static Aligner<SeqPosHashMultiMap> *g_aligner_m;
+
+/** Number of reads. */
+static unsigned g_readCount;
+
+/** Number of reads that aligned. */
+static unsigned g_alignedCount;
+
+/** Guard cerr. */
+static pthread_mutex_t g_mutexCerr = PTHREAD_MUTEX_INITIALIZER;
+
+/** Stores the output string and the read index number for an
+ * alignment. */
+struct OutData
+{
+ string s;
+ size_t index;
+
+ OutData(string s = string(), size_t index = 0)
+ : s(s), index(index) { }
+
+ /** Operator needed for sorting priority queue. */
+ bool operator<(const OutData& a) const
+ {
+ // Smaller index number has higher priority.
+ return index > a.index;
+ }
+};
+
+/** Shares data between workers and the output thread. */
+static Pipe<OutData> g_pipeOut(1<<7);
+
+/** Shares data between producer and worker threads. */
+static PipeMux<FastaRecord> g_pipeMux(1);
+
+/** Notification of the current size of the g_pqueue. */
+static size_t g_pqSize;
+static const size_t MAX_PQ_SIZE = 1000;
+
+/** Conditional variable used to block workers until the g_pqueue has
+ * become small enough. */
+static pthread_cond_t g_pqSize_cv = PTHREAD_COND_INITIALIZER;
+static pthread_mutex_t g_mutexPqSize = PTHREAD_MUTEX_INITIALIZER;
+
+static void* printAlignments(void*)
+{
+ priority_queue<OutData> pqueue;
+ size_t index = 1;
+ for (pair<OutData, size_t> p = g_pipeOut.pop();
+ p.second > 0; p = g_pipeOut.pop()) {
+ pqueue.push(p.first);
+ while (!pqueue.empty()) {
+ const OutData& rec = pqueue.top();
+ if (index == rec.index) {
+ // Print the record at the current index.
+ index++;
+ assert(rec.index > 0);
+ cout << rec.s;
+ assert_good(cout, "stdout");
+ pqueue.pop();
+ } else if (g_pipeMux.invalidEntry(index)) {
+ // Skip this index since it is invalid.
+ index++;
+ } else {
+ // The record for this index has not been added, get
+ // another record from the pipe.
+ break;
+ }
+ }
+
+ // Let waiting workers continue if the pqueue is small enough.
+ pthread_mutex_lock(&g_mutexPqSize);
+ g_pqSize = pqueue.size();
+ if (g_pqSize < MAX_PQ_SIZE)
+ pthread_cond_broadcast(&g_pqSize_cv);
+ pthread_mutex_unlock(&g_mutexPqSize);
+ }
+ return NULL;
+}
+
+/** Store a FastaReader and Pipe. */
+struct WorkerArg {
+ FastaReader& in;
+ Pipe<FastaRecord>& out;
+ WorkerArg(FastaReader& in, Pipe<FastaRecord>& out)
+ : in(in), out(out) { }
+ ~WorkerArg() { delete ∈ }
+};
+
+static pthread_t getReadFiles(const char *readsFile)
+{
+ if (opt::verbose > 0) {
+ pthread_mutex_lock(&g_mutexCerr);
+ cerr << "Reading `" << readsFile << "'...\n";
+ pthread_mutex_unlock(&g_mutexCerr);
+ }
+
+ FastaReader* in = new FastaReader(
+ readsFile, FastaReader::FOLD_CASE);
+ WorkerArg* arg = new WorkerArg(*in, *g_pipeMux.addPipe());
+
+ pthread_t thread;
+ pthread_create(&thread, NULL, readFile, static_cast<void*>(arg));
+
+ return thread;
+}
+
+int main(int argc, char** argv)
+{
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ char delim = '/';
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'k': case 'l':
+ arg >> opt::k;
+ break;
+ case 'm': opt::multimap = opt::MULTIMAP; break;
+ case 'i': opt::multimap = opt::IGNORE; break;
+ case 'j': arg >> opt::threads; break;
+ case 'v': opt::verbose++; break;
+ case 's': arg >> opt::section >> delim >>
+ opt::nsections; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::section == 0 || opt::section > opt::nsections
+ || delim != '/') {
+ cerr << PROGRAM ": -s, --section option is incorrectly set\n";
+ die = true;
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": missing -k,--kmer option\n";
+ die = true;
+ }
+ Kmer::setLength(opt::k);
+
+ if (argc - optind < 2) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ string refFastaFile(argv[--argc]);
+
+ int numQuery = argc - optind;
+ if (opt::threads <= 0)
+ opt::threads = numQuery;
+
+ // SAM headers.
+ cout << "@HD\tVN:1.0\n"
+ "@PG\tID:" PROGRAM "\tVN:" VERSION "\t"
+ "CL:" << commandLine << '\n';
+
+ size_t numKmer = countKmer(refFastaFile);
+ if (opt::multimap == opt::MULTIMAP) {
+ g_aligner_m = new Aligner<SeqPosHashMultiMap>(opt::k,
+ numKmer);
+ readContigsIntoDB(refFastaFile, *g_aligner_m);
+ } else {
+#if HAVE_GOOGLE_SPARSE_HASH_MAP
+ g_aligner_u = new Aligner<SeqPosHashUniqueMap>(opt::k,
+ numKmer, 0.3);
+#else
+ g_aligner_u = new Aligner<SeqPosHashUniqueMap>(opt::k,
+ numKmer);
+#endif
+ readContigsIntoDB(refFastaFile, *g_aligner_u);
+ }
+
+ g_readCount = 0;
+
+ vector<pthread_t> producer_threads;
+ transform(argv + optind, argv + argc,
+ back_inserter(producer_threads), getReadFiles);
+
+ vector<pthread_t> threads;
+ for (int i = 0; i < opt::threads; i++) {
+ pthread_t thread;
+ pthread_create(&thread, NULL, alignReadsToDB, NULL);
+ threads.push_back(thread);
+ }
+
+ pthread_t out_thread;
+ pthread_create(&out_thread, NULL, printAlignments, NULL);
+
+ void *status;
+ // Wait for all threads to finish.
+ for (size_t i = 0; i < producer_threads.size(); i++)
+ pthread_join(producer_threads[i], &status);
+ for (size_t i = 0; i < threads.size(); i++)
+ pthread_join(threads[i], &status);
+ g_pipeOut.close();
+ pthread_join(out_thread, &status);
+
+ if (opt::verbose > 0)
+ cerr << "Aligned " << g_alignedCount
+ << " of " << g_readCount << " reads ("
+ << (float)100 * g_alignedCount / g_readCount << "%)\n";
+
+ if (opt::multimap == opt::MULTIMAP)
+ delete g_aligner_m;
+ else
+ delete g_aligner_u;
+
+ return 0;
+}
+
+template <class SeqPosHashMap>
+static void printProgress(const Aligner<SeqPosHashMap>& align,
+ unsigned count)
+{
+ size_t size = align.size();
+ size_t buckets = align.bucket_count();
+ cerr << "Read " << count << " contigs. "
+ "Hash load: " << size << " / " << buckets
+ << " = " << (float)size / buckets
+ << " using " << toSI(getMemoryUsage()) << "B." << endl;
+}
+
+template <class SeqPosHashMap>
+static void readContigsIntoDB(string refFastaFile,
+ Aligner<SeqPosHashMap>& aligner)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading target `" << refFastaFile << "'..." << endl;
+
+ unsigned count = 0;
+ FastaReader in(refFastaFile.c_str(), FastaReader::FOLD_CASE);
+ if (opt::nsections > 1)
+ in.split(opt::section, opt::nsections);
+ for (FastaRecord rec; in >> rec;) {
+ if (count == 0) {
+ // Detect colour-space contigs.
+ opt::colourSpace = isdigit(rec.seq[0]);
+ } else {
+ if (opt::colourSpace)
+ assert(isdigit(rec.seq[0]));
+ else
+ assert(isalpha(rec.seq[0]));
+ }
+
+ cout << "@SQ\tSN:" << rec.id
+ << "\tLN:" << rec.seq.length() << '\n';
+ aligner.addReferenceSequence(rec.id, rec.seq);
+
+ count++;
+ if (opt::verbose > 0 && count % 100000 == 0)
+ printProgress(aligner, count);
+ }
+ assert(in.eof());
+ if (opt::verbose > 0)
+ printProgress(aligner, count);
+
+ if (opt::multimap == opt::IGNORE) {
+ // Count the number of duplicate k-mer in the target.
+ size_t duplicates = aligner.countDuplicates();
+ if (duplicates > 0)
+ cerr << "Found " << duplicates
+ << " (" << (float)100 * duplicates / aligner.size()
+ << "%) duplicate k-mer.\n";
+ }
+}
+
+/** Read each fasta record from 'in', and add it to 'pipe'. */
+static void readFile(FastaReader& in, Pipe<FastaRecord>& pipe)
+{
+ for (FastaRecord rec; in >> rec;)
+ pipe.push(rec);
+ assert(in.eof());
+ pipe.close();
+}
+
+/** Producer thread. */
+static void* readFile(void* arg)
+{
+ WorkerArg* p = static_cast<WorkerArg*>(arg);
+ readFile(p->in, p->out);
+ delete p;
+ return NULL;
+}
+
+/** @Returns the time in seconds between [start, end]. */
+static double timeDiff(const timeval& start, const timeval& end)
+{
+ double result = (double)end.tv_sec +
+ (double)end.tv_usec/1000000.0;
+ result -= (double)start.tv_sec +
+ (double)start.tv_usec/1000000.0;
+ return result;
+}
+
+static void* alignReadsToDB(void*)
+{
+ opt::chastityFilter = false;
+ opt::trimMasked = false;
+ static timeval start, end;
+
+ pthread_mutex_lock(&g_mutexCerr);
+ gettimeofday(&start, NULL);
+ pthread_mutex_unlock(&g_mutexCerr);
+
+ for (pair<FastaRecord, size_t> recPair = g_pipeMux.nextValue();
+ recPair.second > 0; recPair = g_pipeMux.nextValue()) {
+ const FastaRecord& rec = recPair.first;
+ const Sequence& seq = rec.seq;
+ ostringstream output;
+ if (seq.find_first_not_of("ACGT0123") == string::npos) {
+ if (opt::colourSpace)
+ assert(isdigit(seq[0]));
+ else
+ assert(isalpha(seq[0]));
+ }
+
+ switch (opt::format) {
+ case KALIGNER:
+ if (opt::multimap == opt::MULTIMAP)
+ g_aligner_m->alignRead(rec.id, seq,
+ affix_ostream_iterator<Alignment>(
+ output, "\t"));
+ else
+ g_aligner_u->alignRead(rec.id, seq,
+ affix_ostream_iterator<Alignment>(
+ output, "\t"));
+ break;
+ case SAM:
+ if (opt::multimap == opt::MULTIMAP)
+ g_aligner_m->alignRead(rec.id, seq,
+ ostream_iterator<SAMRecord>(output, "\n"));
+ else
+ g_aligner_u->alignRead(rec.id, seq,
+ ostream_iterator<SAMRecord>(output, "\n"));
+ break;
+ }
+
+ ostringstream out;
+ string s = output.str();
+ switch (opt::format) {
+ case KALIGNER:
+ out << rec.id;
+ if (opt::printSeq) {
+ out << ' ';
+ if (opt::colourSpace)
+ out << rec.anchor;
+ out << seq;
+ }
+ out << s << '\n';
+ break;
+ case SAM:
+ out << s;
+ break;
+ }
+ g_pipeOut.push(OutData(out.str(), recPair.second));
+
+ // Prevent the priority_queue from growing too large by
+ // waiting for threads going far too slow.
+ pthread_mutex_lock(&g_mutexPqSize);
+ if (g_pqSize >= MAX_PQ_SIZE)
+ pthread_cond_wait(&g_pqSize_cv, &g_mutexPqSize);
+ pthread_mutex_unlock(&g_mutexPqSize);
+
+ if (opt::verbose > 0) {
+ pthread_mutex_lock(&g_mutexCerr);
+ if (!s.empty())
+ g_alignedCount++;
+ if (++g_readCount % 1000000 == 0) {
+ gettimeofday(&end, NULL);
+ double result = timeDiff(start, end);
+ cerr << "Aligned " << g_readCount << " reads at "
+ << (int)(1000000 / result) << " reads/sec.\n";
+ start = end;
+ }
+ pthread_mutex_unlock(&g_mutexCerr);
+ }
+ }
+ return NULL;
+}
diff --git a/KAligner/Makefile.am b/KAligner/Makefile.am
new file mode 100644
index 0000000..0cf2996
--- /dev/null
+++ b/KAligner/Makefile.am
@@ -0,0 +1,14 @@
+bin_PROGRAMS = KAligner
+
+KAligner_CPPFLAGS = -pthread -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+KAligner_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+KAligner_LDFLAGS = -pthread
+
+KAligner_SOURCES = KAligner.cpp Aligner.cpp Aligner.h Options.h \
+ Pipe.h PipeMux.h Semaphore.h
diff --git a/KAligner/Makefile.in b/KAligner/Makefile.in
new file mode 100644
index 0000000..1dfe4bd
--- /dev/null
+++ b/KAligner/Makefile.in
@@ -0,0 +1,552 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = KAligner$(EXEEXT)
+subdir = KAligner
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_KAligner_OBJECTS = KAligner-KAligner.$(OBJEXT) \
+ KAligner-Aligner.$(OBJEXT)
+KAligner_OBJECTS = $(am_KAligner_OBJECTS)
+KAligner_DEPENDENCIES = $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+KAligner_LINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(KAligner_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(KAligner_SOURCES)
+DIST_SOURCES = $(KAligner_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+KAligner_CPPFLAGS = -pthread -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+KAligner_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+KAligner_LDFLAGS = -pthread
+KAligner_SOURCES = KAligner.cpp Aligner.cpp Aligner.h Options.h \
+ Pipe.h PipeMux.h Semaphore.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign KAligner/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign KAligner/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+KAligner$(EXEEXT): $(KAligner_OBJECTS) $(KAligner_DEPENDENCIES) $(EXTRA_KAligner_DEPENDENCIES)
+ @rm -f KAligner$(EXEEXT)
+ $(KAligner_LINK) $(KAligner_OBJECTS) $(KAligner_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/KAligner-Aligner.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/KAligner-KAligner.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+KAligner-KAligner.o: KAligner.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(KAligner_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT KAligner-KAligner.o -MD -MP -MF $(DEPDIR)/KAligner-KAligner.Tpo -c -o KAligner-KAligner.o `test -f 'KAligner.cpp' || echo '$(srcdir)/'`KAligner.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/KAligner-KAligner.Tpo $(DEPDIR)/KAligner-KAligner.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='KAligner.cpp' object='KAligner-KAligner.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(KAligner_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o KAligner-KAligner.o `test -f 'KAligner.cpp' || echo '$(srcdir)/'`KAligner.cpp
+
+KAligner-KAligner.obj: KAligner.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(KAligner_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT KAligner-KAligner.obj -MD -MP -MF $(DEPDIR)/KAligner-KAligner.Tpo -c -o KAligner-KAligner.obj `if test -f 'KAligner.cpp'; then $(CYGPATH_W) 'KAligner.cpp'; else $(CYGPATH_W) '$(srcdir)/KAligner.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/KAligner-KAligner.Tpo $(DEPDIR)/KAligner-KAligner.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='KAligner.cpp' object='KAligner-KAligner.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(KAligner_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o KAligner-KAligner.obj `if test -f 'KAligner.cpp'; then $(CYGPATH_W) 'KAligner.cpp'; else $(CYGPATH_W) '$(srcdir)/KAligner.cpp'; fi`
+
+KAligner-Aligner.o: Aligner.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(KAligner_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT KAligner-Aligner.o -MD -MP -MF $(DEPDIR)/KAligner-Aligner.Tpo -c -o KAligner-Aligner.o `test -f 'Aligner.cpp' || echo '$(srcdir)/'`Aligner.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/KAligner-Aligner.Tpo $(DEPDIR)/KAligner-Aligner.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Aligner.cpp' object='KAligner-Aligner.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(KAligner_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o KAligner-Aligner.o `test -f 'Aligner.cpp' || echo '$(srcdir)/'`Aligner.cpp
+
+KAligner-Aligner.obj: Aligner.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(KAligner_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT KAligner-Aligner.obj -MD -MP -MF $(DEPDIR)/KAligner-Aligner.Tpo -c -o KAligner-Aligner.obj `if test -f 'Aligner.cpp'; then $(CYGPATH_W) 'Aligner.cpp'; else $(CYGPATH_W) '$(srcdir)/Aligner.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/KAligner-Aligner.Tpo $(DEPDIR)/KAligner-Aligner.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Aligner.cpp' object='KAligner-Aligner.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(KAligner_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o KAligner-Aligner.obj `if test -f 'Aligner.cpp'; then $(CYGPATH_W) 'Aligner.cpp'; else $(CYGPATH_W) '$(srcdir)/Aligner.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/KAligner/Options.h b/KAligner/Options.h
new file mode 100644
index 0000000..3d18842
--- /dev/null
+++ b/KAligner/Options.h
@@ -0,0 +1,9 @@
+#ifndef ALIGN_OPTIONS_H
+#define ALIGN_OPTIONS_H 1
+
+namespace opt {
+ enum { IGNORE, MULTIMAP, ERROR };
+ extern int multimap;
+}
+
+#endif
diff --git a/KAligner/Pipe.h b/KAligner/Pipe.h
new file mode 100644
index 0000000..a919289
--- /dev/null
+++ b/KAligner/Pipe.h
@@ -0,0 +1,102 @@
+#ifndef PIPE_H
+#define PIPE_H 1
+
+#include "Semaphore.h"
+#include <queue>
+#include <pthread.h>
+
+/** An asynchronous queue for transmitting data from one thread to
+ * another. */
+template <class T>
+class Pipe {
+ public:
+ /** Ready to use after constructed. Not thread safe. */
+ Pipe(unsigned size = 1024)
+ : m_sem_in(size), m_sem_out(0), m_open(true)
+ {
+ assert(size > 0);
+ pthread_mutex_init(&m_mutex_queue, NULL);
+ }
+
+ /** Destoyr semaphores/mutexs. Not thread safe. */
+ ~Pipe()
+ {
+ pthread_mutex_destroy(&m_mutex_queue);
+ }
+
+ /** Add data to the buffer/queue. */
+ void push(T x)
+ {
+ // Block if pipe is full, or in use.
+ m_sem_in.wait();
+ pthread_mutex_lock(&m_mutex_queue);
+ assert(m_open);
+ add(x);
+ pthread_mutex_unlock(&m_mutex_queue);
+ m_sem_out.post();
+ }
+
+ /** Get data and remove it from the buffer. */
+ std::pair<T, size_t> pop()
+ {
+ // block when pipe is empty and m_open, or in use.
+ m_sem_out.wait();
+ pthread_mutex_lock(&m_mutex_queue);
+
+ std::pair<T, size_t> temp = remove();
+
+ pthread_mutex_unlock(&m_mutex_queue);
+
+ // If pipe is m_open ensure poping will allow one more push.
+ // Otherwise, let next accessor know pipe is closed.
+ if (temp.second)
+ m_sem_in.post();
+ else {
+ assert(!m_open);
+ m_sem_out.post();
+ }
+ return temp;
+ }
+
+ /** Allows a pop when the pipe is empty to signal the pipe is
+ * closed. */
+ void close()
+ {
+ pthread_mutex_lock(&m_mutex_queue);
+ m_open = false;
+ pthread_mutex_unlock(&m_mutex_queue);
+ m_sem_out.post();
+ }
+
+ private:
+ /** Add an element to the buffer. */
+ void add(const T& t) { m_queue.push(t); }
+
+ /** Remove an element from the buffer. */
+ std::pair<T, size_t> remove()
+ {
+ std::pair<T, size_t> temp;
+ if (!m_queue.empty()) {
+ temp.first = m_queue.front();
+ temp.second = 1;
+ m_queue.pop();
+ } else {
+ temp.second = 0;
+ }
+ return temp;
+ }
+
+ /** Semaphores to block read on empty, or write on full. */
+ Semaphore m_sem_in, m_sem_out;
+
+ /** Mutual exclusion for reading and writing */
+ pthread_mutex_t m_mutex_queue;
+
+ /** True if close() has not been called. */
+ bool m_open;
+
+ /** Pipe's buffer */
+ std::queue<T> m_queue;
+};
+
+#endif
diff --git a/KAligner/PipeMux.h b/KAligner/PipeMux.h
new file mode 100644
index 0000000..a3d702d
--- /dev/null
+++ b/KAligner/PipeMux.h
@@ -0,0 +1,146 @@
+#ifndef PIPEMUX_H
+#define PIPEMUX_H 1
+
+#include "Pipe.h"
+#include <semaphore.h>
+#include <pthread.h>
+#include <vector>
+
+template <class T>
+class PipeMux {
+ public:
+ /** Default constructor. */
+ PipeMux(size_t pipe_size = 1)
+ : m_index(0), m_entry_num(0), m_pipe_size(pipe_size)
+ {
+ pthread_rwlock_init(&m_rwlock_vecs, NULL);
+ pthread_mutex_init(&m_mutex_index, NULL);
+ }
+
+ /** Destroy remaining pipes, and mutexes. */
+ ~PipeMux()
+ {
+ pthread_rwlock_destroy(&m_rwlock_vecs);
+ pthread_mutex_destroy(&m_mutex_index);
+ assert(m_pipes.empty());
+ assert(m_mutex_pipes.empty());
+ }
+
+ /** Instantiates a new pipe and adds it to this PipeMux. */
+ Pipe<T>* addPipe()
+ {
+ Pipe<T>* p = new Pipe<T>(m_pipe_size);
+ pthread_mutex_t* m = new pthread_mutex_t;
+ pthread_mutex_init(m, NULL);
+
+ pthread_rwlock_wrlock(&m_rwlock_vecs);
+ m_pipes.push_back(p);
+ m_mutex_pipes.push_back(m);
+ pthread_rwlock_unlock(&m_rwlock_vecs);
+
+ return p;
+ }
+
+ /** Returns the next value from the appropriate pipe, deletes
+ * closed pipes and returns */
+ std::pair<T, size_t> nextValue()
+ {
+ size_t entry;
+ std::pair<T, size_t> t(T(), 0);
+ do {
+ pthread_rwlock_rdlock(&m_rwlock_vecs);
+ pthread_mutex_lock(&m_mutex_index);
+
+ if (m_pipes.empty() && m_mutex_pipes.empty()) {
+ pthread_rwlock_unlock(&m_rwlock_vecs);
+ pthread_mutex_unlock(&m_mutex_index);
+ return t;
+ }
+ unsigned i = m_index;
+ m_index = m_index + 1 < m_pipes.size() ? m_index + 1 : 0;
+ entry = ++m_entry_num;
+
+ assert(i < m_mutex_pipes.size());
+ pthread_mutex_lock(m_mutex_pipes[i]);
+ pthread_mutex_unlock(&m_mutex_index);
+
+ assert(i < m_pipes.size());
+ Pipe<T>* p_pipe = m_pipes[i];
+ t = p_pipe->pop();
+
+ // you know you're fed up with race conditions when...
+ assert(i < m_mutex_pipes.size());
+ pthread_mutex_unlock(m_mutex_pipes[i]);
+ pthread_rwlock_unlock(&m_rwlock_vecs);
+ if (!t.second)
+ removePipe(p_pipe, entry);
+ } while (!t.second);
+ t.second = entry;
+ return t;
+ }
+
+ bool invalidEntry(size_t e)
+ {
+ pthread_rwlock_rdlock(&m_rwlock_vecs);
+ for (unsigned i = 0; i < m_invalid_entries.size(); i++) {
+ assert(i < m_invalid_entries.size());
+ if (m_invalid_entries[i] == e) {
+ pthread_rwlock_unlock(&m_rwlock_vecs);
+ return true;
+ }
+ }
+ pthread_rwlock_unlock(&m_rwlock_vecs);
+ return false;
+ }
+
+ /** Checks that the PipeMux is empty. */
+ bool empty() {
+ pthread_rwlock_rdlock(&m_rwlock_vecs);
+ bool isEmpty = m_pipes.empty();
+ pthread_rwlock_unlock(&m_rwlock_vecs);
+ return isEmpty;
+ }
+
+ private:
+ std::vector<Pipe<T>*> m_pipes;
+ std::vector<pthread_mutex_t*> m_mutex_pipes;
+ std::vector<size_t> m_invalid_entries;
+ pthread_rwlock_t m_rwlock_vecs;
+ pthread_mutex_t m_mutex_index;
+ unsigned m_index;
+ size_t m_entry_num;
+ size_t m_pipe_size;
+
+ /** Removes Pipe p if it is still present in m_pipes. */
+ void removePipe(Pipe<T>* p, size_t entry)
+ {
+ pthread_rwlock_wrlock(&m_rwlock_vecs);
+ m_invalid_entries.push_back(entry);
+ unsigned i;
+ for (i = 0; i < m_pipes.size(); i++) {
+ assert(i < m_pipes.size());
+ if (m_pipes[i] == p)
+ break;
+ }
+ if (i >= m_pipes.size()) {
+ pthread_rwlock_unlock(&m_rwlock_vecs);
+ return;
+ }
+ assert(i < m_pipes.size());
+ delete m_pipes[i];
+ m_pipes.erase(m_pipes.begin()+i);
+ assert(i < m_mutex_pipes.size());
+ pthread_mutex_destroy(m_mutex_pipes[i]);
+ delete m_mutex_pipes[i];
+ m_mutex_pipes.erase(m_mutex_pipes.begin()+i);
+ // Make sure the index points to the next element.
+ pthread_mutex_lock(&m_mutex_index);
+ m_index = m_index == m_pipes.size() ? 0 : m_index;
+ pthread_mutex_unlock(&m_mutex_index);
+
+ pthread_rwlock_unlock(&m_rwlock_vecs);
+ }
+
+};
+
+#endif
diff --git a/KAligner/Semaphore.h b/KAligner/Semaphore.h
new file mode 100644
index 0000000..6f3412d
--- /dev/null
+++ b/KAligner/Semaphore.h
@@ -0,0 +1,96 @@
+#ifndef SEMAPHORE_H
+#define SEMAPHORE_H 1
+
+/** Semaphore class needed since some OS' do not support unnamed
+ * semaphores. */
+#if __APPLE__
+# include <pthread.h>
+class Semaphore {
+ public:
+ Semaphore(unsigned value) : m_value(value)
+ {
+ pthread_mutex_init(&m_mutex, NULL);
+ pthread_cond_init(&m_cv, NULL);
+ }
+
+ ~Semaphore()
+ {
+ pthread_mutex_destroy(&m_mutex);
+ pthread_cond_destroy(&m_cv);
+ }
+
+ void wait()
+ {
+ pthread_mutex_lock(&m_mutex);
+ // Not a spinlock! For some reason signaling a condvar can
+ // cause more than one thread waiting to continue...
+ while (m_value == 0)
+ pthread_cond_wait(&m_cv, &m_mutex);
+ assert(m_value > 0);
+ m_value--;
+ pthread_mutex_unlock(&m_mutex);
+ }
+
+ void post()
+ {
+ pthread_mutex_lock(&m_mutex);
+ m_value++;
+ pthread_cond_signal(&m_cv);
+ pthread_mutex_unlock(&m_mutex);
+ }
+
+ private:
+ unsigned m_value;
+ pthread_mutex_t m_mutex;
+ pthread_cond_t m_cv;
+};
+#else
+# include <semaphore.h>
+# include <cerrno>
+# include <cstring> // for strerror
+class Semaphore {
+ public:
+ Semaphore(unsigned value)
+ {
+#if SEM_VALUE_MAX
+ assert(value <= SEM_VALUE_MAX);
+#endif
+ if (sem_init(&m_sem, 0, value) == -1) {
+ std::cerr << "error: sem_init:" <<
+ strerror(errno) << std::endl;
+ assert(false);
+ exit(EXIT_FAILURE);
+ }
+ }
+ ~Semaphore()
+ {
+ if (sem_destroy(&m_sem) == -1) {
+ std::cerr << "error: sem_destroy:" <<
+ strerror(errno) << std::endl;
+ assert(false);
+ exit(EXIT_FAILURE);
+ }
+ }
+ void wait()
+ {
+ if (sem_wait(&m_sem) == -1) {
+ std::cerr << "error: sem_wait:" <<
+ strerror(errno) << std::endl;
+ assert(false);
+ exit(EXIT_FAILURE);
+ }
+ }
+ void post()
+ {
+ if (sem_post(&m_sem) == -1) {
+ std::cerr << "error: sem_post:" <<
+ strerror(errno) << std::endl;
+ assert(false);
+ exit(EXIT_FAILURE);
+ }
+ }
+ private:
+ sem_t m_sem;
+};
+#endif
+#endif
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..f640300
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,230 @@
+ABySS
+Copyright 2012 Genome Sciences Centre
+
+BC CANCER AGENCY SOFTWARE LICENSE AGREEMENT (ACADEMIC USE)
+CAREFULLY READ THE FOLLOWING TERMS AND CONDITIONS. This License
+Agreement (the "Agreement") is a legal contract between you, your
+employer, educational institution or organization (collectively, "You")
+and the British Columbia Cancer Agency ("BCCA") with respect to the
+license of the software, including all associated documentation
+(collectively, the "Product").
+
+BCCA is willing to license the Product to You only if You accept the
+terms and conditions of this Agreement. By clicking on the "I ACCEPT"
+button, or by copying, downloading, accessing or otherwise using the
+Product, You automatically agree to be bound by the terms of this
+Agreement. IF YOU DO NOT WISH TO BE BOUND BY THE TERMS OF THIS
+AGREEMENT, DO NOT COPY, DOWNLOAD, ACCESS OR OTHERWISE USE THE
+PRODUCT.
+
+1. AUTHORITY: In the event that You are an educational institution or
+organization, Your representative who is clicking the "I ACCEPT"
+button, or otherwise copying, downloading, accessing or using the
+Product hereby, in their personal capacity, represents and warrants
+that they possess the legal authority to enter into this Agreement
+on Your behalf and to bind You to the terms of this Agreement.
+
+2. LICENSE TO USE: BCCA hereby grants to You a personal, non-exclusive,
+non-transferable, limited license to use the Product solely for
+internal, non-commercial use for non-profit research or educational
+purposes only on the terms and conditions contained in this Agreement.
+The Product may be installed at a single site at Your premises only. A
+copy of the Product installed on a single common machine or cluster of
+machines may be shared for internal use by Qualified Users only. In
+order to be a "Qualified User", an individual must be a student,
+researcher, professor, instructor or staff member of a non-profit
+educational institution or organization who uses the Product solely for
+non-profit research or educational purposes.
+
+3. RESTRICTIONS: You acknowledge and agree that You shall not, and
+shall not authorize any third party to:
+(a) make copies of the Product, except as provided in Section 2 and
+except for a single backup copy, and any such copy together with the
+original must be kept in Your possession or control;
+(b) modify, adapt, decompile, disassemble, translate into another
+computer language, create derivative works of, or otherwise reverse
+engineer the Product, or disclose any trade secrets relating to the
+Product, except as permitted in Section 5;
+(c) license, sublicense, distribute, sell, lease, transfer, assign,
+trade, rent or publish the Product or any part thereof and/or copies
+thereof, to any third party;
+(d) use the Product to process any data other than Your own;
+(e) use the Product or any part thereof for any commercial or
+for-profit purpose or any other purpose other than as permitted in
+Section 2; or
+(f) use, without its express permission, the name of BCCA.
+
+4. INTELLECTUAL PROPERTY RIGHTS: Subject to Section 5 below, all
+patents, copyrights, trade secrets, service marks, trademarks and
+other proprietary rights in or related to the Product and any
+improvements, modifications and enhancements thereof are and will
+remain the exclusive property of BCCA or its licensors. You agree
+that You will not, either during or after the termination of this
+Agreement, contest or challenge the title to or the intellectual
+property rights of BCCA or its licensors in the Product or any
+portion thereof.
+
+5. OWNERSHIP OF IMPROVEMENTS: In the event that the Product, in the
+form provided to You, includes source code (the "Source Code"),
+You are entitled to make improvements, modifications and
+enhancements to the Source Code (collectively, "Improvements")
+which Improvements are to be used by You for non-profit research
+and educational purposes only and You shall be the owner of those
+Improvements that You directly make and of all intellectual
+property rights to such Improvements, subject to the foregoing
+limits on Your use and distribution of such Improvements. You
+hereby grant to BCCA a perpetual, non-exclusive, worldwide,
+fully-paid, irrevocable license to use such Improvements for any
+purposes whatsoever, and to sublicense such Improvements including
+the right for third parties to sublicense the same, in perpetuity
+to the extent such rights are not limited in duration under
+applicable law, without identifying or seeking Your
+consent. Notwithstanding the foregoing, You acknowledge that BCCA
+and its licensors will retain or own all rights in and to any
+pre-existing code or other technology, content and data that may be
+incorporated in the Improvements. For greater certainty, this
+Section applies solely to the Source Code and shall not give You
+any rights with respect to the object code or any other portion or
+format of the Product which use, for greater certainty, is limited
+as set forth in this Agreement including as set out in Section 3(b)
+above. You acknowledge and agree that you will provide copies of
+Improvements to BCCA in such format as reasonably requested by BCCA
+at any time upon the request of BCCA.
+
+6. CONFIDENTIALITY: You acknowledge that the Product is and
+incorporates confidential and proprietary information developed,
+acquired by or licensed to BCCA. You will take all reasonable
+precautions necessary to safeguard the confidentiality of the
+Product, and will not disclose any information about the Product to
+any other person without BCCA's prior written consent. You will
+not allow the removal or defacement of any confidential or
+proprietary notice placed on the Product. You acknowledge that any
+breach of this Section 6 will cause irreparable harm to BCCA and
+its licensors.
+
+7. NO WARRANTIES: THIS PRODUCT IS PROVIDED TO YOU BY BCCA IN ORDER TO
+ALLOW YOU TO OBTAIN ACCESS TO LEADING ACADEMIC RESEARCH. THE PRODUCT
+IS PROVIDED TO YOU ON AN "AS IS" BASIS WITHOUT WARRANTY OF ANY
+KIND. NO WARRANTY, REPRESENTATION OR CONDITION EITHER EXPRESS OR
+IMPLIED, INCLUDING WITHOUT LIMITATION, ANY IMPLIED WARRANTY OR
+CONDITION OF MERCHANTABILITY, NON-INFRINGEMENT, PERFORMANCE,
+DURABILITY OR FITNESS FOR A PARTICULAR PURPOSE OR USE SHALL
+APPLY. BCCA DOES NOT WARRANT THAT THE PRODUCT WILL OPERATE ON A
+CONTINUOUS OR TROUBLE FREE BASIS.
+
+8. LIMITATION OF LIABILITY: TO THE MAXIMUM EXTENT PERMITTED BY
+APPLICABLE LAW, IN NO EVENT SHALL THE AGGREGATE LIABILITY OF BCCA TO
+YOU EXCEED THE AMOUNT YOU HAVE PAID TO ACQUIRE THE PRODUCT ("MAXIMUM
+AMOUNT") AND WHERE YOU HAVE NOT PAID ANY AMOUNT FOR THE PRODUCT THEN
+THE MAXIMUM AMOUNT SHALL BE DEEMED TO BE CDN$100.00. IN NO EVENT SHALL
+BCCA BE LIABLE FOR ANY INDIRECT, INCIDENTAL, CONSEQUENTIAL, OR SPECIAL
+DAMAGES, INCLUDING WITHOUT LIMITATION ANY DAMAGES FOR LOST PROFITS OR
+SAVINGS, REGARDLESS OF WHETHER THEY HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE. EXCEPT TO THE EXTENT THAT THE LAWS OF A
+COMPETENT JURISDICTION REQUIRE LIABILITIES BEYOND AND DESPITE THESE
+LIMITATIONS, EXCLUSIONS AND DISCLAIMERS, THESE LIMITATIONS, EXCLUSIONS
+AND DISCLAIMERS SHALL APPLY WHETHER AN ACTION, CLAIM OR DEMAND ARISES
+FROM A BREACH OF WARRANTY OR CONDITION, BREACH OF CONTRACT,
+NEGLIGENCE, STRICT LIABILITY OR ANY OTHER KIND OF CIVIL OR STATUTORY
+LIABILITY CONNECTED WITH OR ARISING FROM THIS AGREEMENT. YOU AGREE
+THAT THE FOREGOING DISCLAIMER OF WARRANTIES AND LIMITATION OF
+LIABILITY ARE FAIR IN LIGHT OF THE NATURE OF THE RIGHTS GRANTED HEREIN
+AND THE AMOUNT OF FEES PAID BY YOU IN RESPECT OF THE PRODUCT.
+
+9. INDEMNITY: You will indemnify, defend and hold harmless BCCA, its
+board of directors, staff and agents from and against any and all
+liability, loss, damage, action, claim or expense (including
+attorney's fees and costs at trial and appellate levels) in
+connection with any claim, suit, action, demand or judgement
+(collectively, "Claim") arising out of, connected with, resulting
+from, or sustained as a result of Your use of the Product or the
+downloading of the Product, including without limitation, any Claim
+relating to infringement of BCCA's intellectual property rights or
+the intellectual property rights of any third party.
+
+10. SUPPORT AND MAINTENANCE: You acknowledge and agree that, unless
+and to the extent expressly agreed by BCCA in a separate written
+document, the Product is provided to You without any support or
+maintenance from BCCA and, for greater certainty, BCCA shall have
+no obligation to issue any update or upgrade to any Product.
+
+11. TERM: This Agreement is effective until terminated. You may
+terminate this Agreement at any time by ceasing use of the Product
+and destroying or deleting any copies of the Product. This
+Agreement will terminate immediately without notice from BCCA if
+You fail to comply with any provision of this Agreement. BCCA may
+terminate this Agreement at any time upon notice to you where BCCA
+determines, in its sole discretion, that any continued use of the
+Product could infringe the rights of any third parties. Upon
+termination of this Agreement, and in any event upon BCCA
+delivering You notice of termination, You shall immediately purge
+all Products from Your computer system(s), return to BCCA all
+copies of the Product that are in Your possession or control, and
+cease any further development of any Improvements. On any
+termination of this Agreement Sections 1, 4, 6, 7, 8, 9, 13 and 14
+shall survive such termination.
+
+12. GOVERNMENT END USERS: Where any of the Product is used, duplicated
+or disclosed by or to the United States government or a government
+contractor or sub contractor, it is provided with RESTRICTED
+RIGHTS as defined in Title 48 CFR 52.227-19 and is subject to the
+following: Title 48 CFR 2.101, 52.227-19, 227.7201 through
+227.7202-4, FAR 52.227-14, and FAR 52.227-19(c)(1-2) and (6/87),
+and where applicable, the customary software license, as described
+in Title 48 CFR 227-7202 with respect to commercial software and
+commercial software documentation including DFAR 252.227-7013,
+DFAR 252,227-7014, DFAR 252.227-7015 and DFAR 252.7018, all as
+applicable.
+
+13. USE OF THE DOWNLOAD SERVICE: You acknowledge and agree that you
+will be responsible for all costs, charges and taxes (where
+applicable) arising out of Your use of the Product and the
+downloading of the Product. You acknowledge that You are
+responsible for supplying any hardware or software necessary to
+use the Product pursuant to this Agreement.
+
+14. GENERAL PROVISIONS:
+(a) This Agreement will be governed by the laws of the Province of
+British Columbia, and the laws of Canada applicable therein, excluding
+any rules of private international law that lead to the application of
+the laws of any other jurisdiction. The United Nations Convention on
+Contracts for the International Sale of Goods (1980) does not apply to
+this Agreement. The courts of the Province of British Columbia shall
+have non-exclusive jurisdiction to hear any matter arising in
+connection with this Agreement.
+(b) USE OF THE PRODUCT IS PROHIBITED IN ANY JURISDICTION WHICH DOES
+NOT GIVE EFFECT TO THE TERMS OF THIS AGREEMENT.
+(c) You agree that no joint venture, partnership, employment,
+consulting or agency relationship exists between You and BCCA as a
+result of this Agreement or Your use of the Product.
+(d) You hereby consent to Your contact information and any other
+personally identifiable information that You provide to us being
+disclosed to and maintained and used by us and our business partners
+for the purposes of (i) managing and developing our respective
+businesses and operations; (ii) marketing products and services to You
+and your staff; and (iii) developing new and enhancing existing
+products. You further agree that we may provide this information to
+other persons as required to satisfy any legal requirements and to any
+person that acquires some or all of the assets of BCCA. Where any of
+the personally identifiable information that You provide to us is in
+respect of individuals other than Yourself (such as Your staff) then
+You represent and warrant to use that You have obtained all necessary
+consents and authorizations from such individuals in order to comply
+with this provision. Please see the BCCA website for further
+information regarding personally identifiable information.
+(e) This Agreement is the entire Agreement between You and BCCA
+relating to this subject matter. You will not contest the validity of
+this Agreement merely because it is in electronic form. No
+modification of this Agreement will be binding, unless in writing and
+accepted by an authorized representative of each party.
+(f) The provisions of this Agreement are severable in that if any
+provision in the Agreement is determined to be invalid or
+unenforceable under any controlling body of law, that will not affect
+the validity or enforceability of the remaining provisions of the
+Agreement.
+(g) You agree to print out or download a copy of this Agreement and
+retain it for Your records.
+(h) You consent to the use of the English language in this Agreement.
+(i) You may not assign this Agreement or any of Your rights or
+obligations hereunder without BCCA's prior written consent. BCCA, at
+its sole discretion may assign this Agreement without notice to You.
diff --git a/Makefile.am b/Makefile.am
new file mode 100644
index 0000000..19e84f9
--- /dev/null
+++ b/Makefile.am
@@ -0,0 +1,38 @@
+if HAVE_LIBMPI
+Parallel=Parallel
+endif
+
+dist_doc_DATA = ChangeLog COPYRIGHT LICENSE \
+ README.css README.html README.md
+
+EXTRA_DIST=doxygen.conf
+
+SUBDIRS = \
+ bin \
+ doc \
+ Assembly \
+ Common \
+ DataLayer \
+ FMIndex \
+ Graph \
+ dialign \
+ Align \
+ ABYSS $(Parallel) \
+ AdjList \
+ Consensus \
+ DAssembler \
+ DistanceEst \
+ KAligner \
+ Map \
+ MergePaths \
+ Overlap \
+ ParseAligns \
+ PathOverlap \
+ PopBubbles \
+ Scaffold \
+ SimpleGraph \
+ kmerprint \
+ FilterGraph
+
+%.html: %.md
+ multimarkdown $< >$@
diff --git a/Makefile.in b/Makefile.in
new file mode 100644
index 0000000..a9a26fa
--- /dev/null
+++ b/Makefile.in
@@ -0,0 +1,844 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = .
+DIST_COMMON = $(am__configure_deps) $(dist_doc_DATA) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/config.h.in $(top_srcdir)/configure ChangeLog \
+ depcomp install-sh missing
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
+ configure.lineno config.status.lineno
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(docdir)"
+DATA = $(dist_doc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ cscope distdir dist dist-all distcheck
+ETAGS = etags
+CTAGS = ctags
+CSCOPE = cscope
+DIST_SUBDIRS = bin doc Assembly Common DataLayer FMIndex Graph dialign \
+ Align ABYSS Parallel AdjList Consensus DAssembler DistanceEst \
+ KAligner Map MergePaths Overlap ParseAligns PathOverlap \
+ PopBubbles Scaffold SimpleGraph kmerprint FilterGraph
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+distdir = $(PACKAGE)-$(VERSION)
+top_distdir = $(distdir)
+am__remove_distdir = \
+ if test -d "$(distdir)"; then \
+ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -rf "$(distdir)" \
+ || { sleep 5 && rm -rf "$(distdir)"; }; \
+ else :; fi
+am__post_remove_distdir = $(am__remove_distdir)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+DIST_TARGETS = dist-gzip
+distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
+distcleancheck_listfiles = find . -type f -print
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+ at HAVE_LIBMPI_TRUE@Parallel = Parallel
+dist_doc_DATA = ChangeLog COPYRIGHT LICENSE \
+ README.css README.html README.md
+
+EXTRA_DIST = doxygen.conf
+SUBDIRS = \
+ bin \
+ doc \
+ Assembly \
+ Common \
+ DataLayer \
+ FMIndex \
+ Graph \
+ dialign \
+ Align \
+ ABYSS $(Parallel) \
+ AdjList \
+ Consensus \
+ DAssembler \
+ DistanceEst \
+ KAligner \
+ Map \
+ MergePaths \
+ Overlap \
+ ParseAligns \
+ PathOverlap \
+ PopBubbles \
+ Scaffold \
+ SimpleGraph \
+ kmerprint \
+ FilterGraph
+
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
+
+.SUFFIXES:
+am--refresh: Makefile
+ @:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ $(SHELL) ./config.status --recheck
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ $(am__cd) $(srcdir) && $(AUTOCONF)
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+ @if test ! -f $@; then rm -f stamp-h1; else :; fi
+ @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+
+stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
+ @rm -f stamp-h1
+ cd $(top_builddir) && $(SHELL) ./config.status config.h
+$(srcdir)/config.h.in: $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
+install-dist_docDATA: $(dist_doc_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
+ done
+
+uninstall-dist_docDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
+
+# This directory's subdirectories are mostly independent; you can cd
+# into them and run 'make' without going through this Makefile.
+# To change the values of 'make' variables: instead of editing Makefiles,
+# (1) if the variable is set in 'config.status', edit 'config.status'
+# (which will cause the Makefiles to be regenerated when you run 'make');
+# (2) otherwise, pass the desired values on the 'make' command line.
+$(RECURSIVE_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ target=`echo $@ | sed s/-recursive//`; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ dot_seen=yes; \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done; \
+ if test "$$dot_seen" = "no"; then \
+ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
+ fi; test -z "$$fail"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
+ esac; \
+ done; \
+ dot_seen=no; \
+ case "$@" in \
+ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
+ *) list='$(SUBDIRS)' ;; \
+ esac; \
+ rev=''; for subdir in $$list; do \
+ if test "$$subdir" = "."; then :; else \
+ rev="$$subdir $$rev"; \
+ fi; \
+ done; \
+ rev="$$rev ."; \
+ target=`echo $@ | sed s/-recursive//`; \
+ for subdir in $$rev; do \
+ echo "Making $$target in $$subdir"; \
+ if test "$$subdir" = "."; then \
+ local_target="$$target-am"; \
+ else \
+ local_target="$$target"; \
+ fi; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ done
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ done
+cscopelist-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) cscopelist); \
+ done
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
+ include_option=--etags-include; \
+ empty_fix=.; \
+ else \
+ include_option=--include; \
+ empty_fix=; \
+ fi; \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ test ! -f $$subdir/TAGS || \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ fi; \
+ done; \
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscope: cscope.files
+ test ! -s cscope.files \
+ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
+
+clean-cscope:
+ -rm -f cscope.files
+
+cscope.files: clean-cscope cscopelist-recursive cscopelist
+
+cscopelist: cscopelist-recursive $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+ -rm -f cscope.out cscope.in.out cscope.po.out cscope.files
+
+distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ $(am__make_dryrun) \
+ || test -d "$(distdir)/$$subdir" \
+ || $(MKDIR_P) "$(distdir)/$$subdir" \
+ || exit 1; \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -o \
+ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
+ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r "$(distdir)"
+dist-gzip: distdir
+ tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(am__post_remove_distdir)
+
+dist-bzip2: distdir
+ tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
+ $(am__post_remove_distdir)
+
+dist-lzip: distdir
+ tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
+ $(am__post_remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ $(am__post_remove_distdir)
+
+dist-tarZ: distdir
+ tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(am__post_remove_distdir)
+
+dist-shar: distdir
+ shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
+ $(am__post_remove_distdir)
+
+dist-zip: distdir
+ -rm -f $(distdir).zip
+ zip -rq $(distdir).zip $(distdir)
+ $(am__post_remove_distdir)
+
+dist dist-all:
+ $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
+ $(am__post_remove_distdir)
+
+# This target untars the dist file and tries a VPATH configuration. Then
+# it guarantees that the distribution is self-contained by making another
+# tarfile.
+distcheck: dist
+ case '$(DIST_ARCHIVES)' in \
+ *.tar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lz*) \
+ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__cd) $(distdir)/_build \
+ && ../configure --srcdir=.. --prefix="$$dc_install_base" \
+ $(AM_DISTCHECK_CONFIGURE_FLAGS) \
+ $(DISTCHECK_CONFIGURE_FLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) \
+ && $(MAKE) $(AM_MAKEFLAGS) dvi \
+ && $(MAKE) $(AM_MAKEFLAGS) check \
+ && $(MAKE) $(AM_MAKEFLAGS) install \
+ && $(MAKE) $(AM_MAKEFLAGS) installcheck \
+ && $(MAKE) $(AM_MAKEFLAGS) uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
+ distuninstallcheck \
+ && chmod -R a-w "$$dc_install_base" \
+ && ({ \
+ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
+ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
+ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
+ } || { rm -rf "$$dc_destdir"; exit 1; }) \
+ && rm -rf "$$dc_destdir" \
+ && $(MAKE) $(AM_MAKEFLAGS) dist \
+ && rm -rf $(DIST_ARCHIVES) \
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__post_remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @test -n '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: trying to run $@ with an empty' \
+ '$$(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ $(am__cd) '$(distuninstallcheck_dir)' || { \
+ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+ exit 1; \
+ }; \
+ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left after uninstall:" ; \
+ if test -n "$(DESTDIR)"; then \
+ echo " (check DESTDIR support)"; \
+ fi ; \
+ $(distuninstallcheck_listfiles) ; \
+ exit 1; } >&2
+distcleancheck: distclean
+ @if test '$(srcdir)' = . ; then \
+ echo "ERROR: distcleancheck can only run from a VPATH build" ; \
+ exit 1 ; \
+ fi
+ @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
+ || { echo "ERROR: files left in build directory after distclean:" ; \
+ $(distcleancheck_listfiles) ; \
+ exit 1; } >&2
+check-am: all-am
+check: check-recursive
+all-am: Makefile $(DATA) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(docdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-recursive
+install-exec: install-exec-recursive
+install-data: install-data-recursive
+uninstall: uninstall-recursive
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-recursive
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-recursive
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic distclean-hdr distclean-tags
+
+dvi: dvi-recursive
+
+dvi-am:
+
+html: html-recursive
+
+html-am:
+
+info: info-recursive
+
+info-am:
+
+install-data-am: install-dist_docDATA
+
+install-dvi: install-dvi-recursive
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-recursive
+
+install-html-am:
+
+install-info: install-info-recursive
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
+ -rm -rf $(top_srcdir)/autom4te.cache
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-recursive
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-recursive
+
+pdf-am:
+
+ps: ps-recursive
+
+ps-am:
+
+uninstall-am: uninstall-dist_docDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+ cscopelist-recursive ctags-recursive install-am install-strip \
+ tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am am--refresh check check-am clean clean-cscope \
+ clean-generic cscope cscopelist cscopelist-recursive ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-lzip \
+ dist-shar dist-tarZ dist-xz dist-zip distcheck distclean \
+ distclean-generic distclean-hdr distclean-tags distcleancheck \
+ distdir distuninstallcheck dvi dvi-am html html-am info \
+ info-am install install-am install-data install-data-am \
+ install-dist_docDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-dist_docDATA
+
+
+%.html: %.md
+ multimarkdown $< >$@
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Map/Makefile.am b/Map/Makefile.am
new file mode 100644
index 0000000..86497c7
--- /dev/null
+++ b/Map/Makefile.am
@@ -0,0 +1,41 @@
+bin_PROGRAMS = abyss-index abyss-map abyss-overlap
+
+abyss_index_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer \
+ -I$(top_srcdir)/FMIndex
+
+abyss_index_LDADD = \
+ $(top_builddir)/FMIndex/libfmindex.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_index_SOURCES = index.cc
+
+abyss_map_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer \
+ -I$(top_srcdir)/FMIndex
+
+abyss_map_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+
+abyss_map_LDADD = \
+ $(top_builddir)/FMIndex/libfmindex.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_map_SOURCES = map.cc
+
+abyss_overlap_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer \
+ -I$(top_srcdir)/FMIndex
+
+abyss_overlap_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+
+abyss_overlap_LDADD = \
+ $(top_builddir)/FMIndex/libfmindex.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_overlap_SOURCES = overlap.cc
diff --git a/Map/Makefile.in b/Map/Makefile.in
new file mode 100644
index 0000000..00ece28
--- /dev/null
+++ b/Map/Makefile.in
@@ -0,0 +1,607 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = abyss-index$(EXEEXT) abyss-map$(EXEEXT) \
+ abyss-overlap$(EXEEXT)
+subdir = Map
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_abyss_index_OBJECTS = abyss_index-index.$(OBJEXT)
+abyss_index_OBJECTS = $(am_abyss_index_OBJECTS)
+abyss_index_DEPENDENCIES = $(top_builddir)/FMIndex/libfmindex.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+am_abyss_map_OBJECTS = abyss_map-map.$(OBJEXT)
+abyss_map_OBJECTS = $(am_abyss_map_OBJECTS)
+abyss_map_DEPENDENCIES = $(top_builddir)/FMIndex/libfmindex.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+abyss_map_LINK = $(CXXLD) $(abyss_map_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_abyss_overlap_OBJECTS = abyss_overlap-overlap.$(OBJEXT)
+abyss_overlap_OBJECTS = $(am_abyss_overlap_OBJECTS)
+abyss_overlap_DEPENDENCIES = $(top_builddir)/FMIndex/libfmindex.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+abyss_overlap_LINK = $(CXXLD) $(abyss_overlap_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(abyss_index_SOURCES) $(abyss_map_SOURCES) \
+ $(abyss_overlap_SOURCES)
+DIST_SOURCES = $(abyss_index_SOURCES) $(abyss_map_SOURCES) \
+ $(abyss_overlap_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+abyss_index_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer \
+ -I$(top_srcdir)/FMIndex
+
+abyss_index_LDADD = \
+ $(top_builddir)/FMIndex/libfmindex.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_index_SOURCES = index.cc
+abyss_map_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer \
+ -I$(top_srcdir)/FMIndex
+
+abyss_map_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+abyss_map_LDADD = \
+ $(top_builddir)/FMIndex/libfmindex.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_map_SOURCES = map.cc
+abyss_overlap_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer \
+ -I$(top_srcdir)/FMIndex
+
+abyss_overlap_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+abyss_overlap_LDADD = \
+ $(top_builddir)/FMIndex/libfmindex.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_overlap_SOURCES = overlap.cc
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Map/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Map/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+abyss-index$(EXEEXT): $(abyss_index_OBJECTS) $(abyss_index_DEPENDENCIES) $(EXTRA_abyss_index_DEPENDENCIES)
+ @rm -f abyss-index$(EXEEXT)
+ $(CXXLINK) $(abyss_index_OBJECTS) $(abyss_index_LDADD) $(LIBS)
+abyss-map$(EXEEXT): $(abyss_map_OBJECTS) $(abyss_map_DEPENDENCIES) $(EXTRA_abyss_map_DEPENDENCIES)
+ @rm -f abyss-map$(EXEEXT)
+ $(abyss_map_LINK) $(abyss_map_OBJECTS) $(abyss_map_LDADD) $(LIBS)
+abyss-overlap$(EXEEXT): $(abyss_overlap_OBJECTS) $(abyss_overlap_DEPENDENCIES) $(EXTRA_abyss_overlap_DEPENDENCIES)
+ @rm -f abyss-overlap$(EXEEXT)
+ $(abyss_overlap_LINK) $(abyss_overlap_OBJECTS) $(abyss_overlap_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_index-index.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_map-map.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_overlap-overlap.Po at am__quote@
+
+.cc.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+abyss_index-index.o: index.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_index_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_index-index.o -MD -MP -MF $(DEPDIR)/abyss_index-index.Tpo -c -o abyss_index-index.o `test -f 'index.cc' || echo '$(srcdir)/'`index.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_index-index.Tpo $(DEPDIR)/abyss_index-index.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='index.cc' object='abyss_index-index.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_index_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_index-index.o `test -f 'index.cc' || echo '$(srcdir)/'`index.cc
+
+abyss_index-index.obj: index.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_index_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_index-index.obj -MD -MP -MF $(DEPDIR)/abyss_index-index.Tpo -c -o abyss_index-index.obj `if test -f 'index.cc'; then $(CYGPATH_W) 'index.cc'; else $(CYGPATH_W) '$(srcdir)/index.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_index-index.Tpo $(DEPDIR)/abyss_index-index.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='index.cc' object='abyss_index-index.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_index_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_index-index.obj `if test -f 'index.cc'; then $(CYGPATH_W) 'index.cc'; else $(CYGPATH_W) '$(srcdir)/index.cc'; fi`
+
+abyss_map-map.o: map.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_map_CPPFLAGS) $(CPPFLAGS) $(abyss_map_CXXFLAGS) $(CXXFLAGS) -MT abyss_map-map.o -MD -MP -MF $(DEPDIR)/abyss_map-map.Tpo -c -o abyss_map-map.o `test -f 'map.cc' || echo '$(srcdir)/'`map.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_map-map.Tpo $(DEPDIR)/abyss_map-map.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='map.cc' object='abyss_map-map.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_map_CPPFLAGS) $(CPPFLAGS) $(abyss_map_CXXFLAGS) $(CXXFLAGS) -c -o abyss_map-map.o `test -f 'map.cc' || echo '$(srcdir)/'`map.cc
+
+abyss_map-map.obj: map.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_map_CPPFLAGS) $(CPPFLAGS) $(abyss_map_CXXFLAGS) $(CXXFLAGS) -MT abyss_map-map.obj -MD -MP -MF $(DEPDIR)/abyss_map-map.Tpo -c -o abyss_map-map.obj `if test -f 'map.cc'; then $(CYGPATH_W) 'map.cc'; else $(CYGPATH_W) '$(srcdir)/map.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_map-map.Tpo $(DEPDIR)/abyss_map-map.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='map.cc' object='abyss_map-map.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_map_CPPFLAGS) $(CPPFLAGS) $(abyss_map_CXXFLAGS) $(CXXFLAGS) -c -o abyss_map-map.obj `if test -f 'map.cc'; then $(CYGPATH_W) 'map.cc'; else $(CYGPATH_W) '$(srcdir)/map.cc'; fi`
+
+abyss_overlap-overlap.o: overlap.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_overlap_CPPFLAGS) $(CPPFLAGS) $(abyss_overlap_CXXFLAGS) $(CXXFLAGS) -MT abyss_overlap-overlap.o -MD -MP -MF $(DEPDIR)/abyss_overlap-overlap.Tpo -c -o abyss_overlap-overlap.o `test -f 'overlap.cc' || echo '$(srcdir)/'`overlap.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_overlap-overlap.Tpo $(DEPDIR)/abyss_overlap-overlap.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='overlap.cc' object='abyss_overlap-overlap.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_overlap_CPPFLAGS) $(CPPFLAGS) $(abyss_overlap_CXXFLAGS) $(CXXFLAGS) -c -o abyss_overlap-overlap.o `test -f 'overlap.cc' || echo '$(srcdir)/'`overlap.cc
+
+abyss_overlap-overlap.obj: overlap.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_overlap_CPPFLAGS) $(CPPFLAGS) $(abyss_overlap_CXXFLAGS) $(CXXFLAGS) -MT abyss_overlap-overlap.obj -MD -MP -MF $(DEPDIR)/abyss_overlap-overlap.Tpo -c -o abyss_overlap-overlap.obj `if test -f 'overlap.cc'; then $(CYGPATH_W) 'overlap.cc'; else $(CYGPATH_W) '$(srcdir)/overlap.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_overlap-overlap.Tpo $(DEPDIR)/abyss_overlap-overlap.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='overlap.cc' object='abyss_overlap-overlap.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_overlap_CPPFLAGS) $(CPPFLAGS) $(abyss_overlap_CXXFLAGS) $(CXXFLAGS) -c -o abyss_overlap-overlap.obj `if test -f 'overlap.cc'; then $(CYGPATH_W) 'overlap.cc'; else $(CYGPATH_W) '$(srcdir)/overlap.cc'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Map/index.cc b/Map/index.cc
new file mode 100644
index 0000000..ec041f0
--- /dev/null
+++ b/Map/index.cc
@@ -0,0 +1,288 @@
+#include "config.h"
+#include "BitUtil.h"
+#include "FastaIndex.h"
+#include "FMIndex.h"
+#include "IOUtil.h"
+#include "MemoryUtil.h"
+#include "StringUtil.h"
+#include "Uncompress.h"
+#include <algorithm>
+#include <cctype> // for toupper
+#include <cstdlib>
+#include <fstream>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <string>
+
+using namespace std;
+
+#define PROGRAM "abyss-index"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... FILE\n"
+"Build an FM-index of FILE and store it in FILE.fm.\n"
+"\n"
+" --both build both FAI and FM indexes [default]\n"
+" --fai build a FAI index\n"
+" --fm build a FM index\n"
+" --fa2bwt build the BWT directly without the SA\n"
+" --bwt2fm build the FM index from the BWT\n"
+" -a, --alphabet=STRING use the alphabet STRING [-ACGT]\n"
+" -s, --sample=N sample the suffix array [16]\n"
+" -d, --decompress decompress the index FILE\n"
+" -c, --stdout write output to standard output\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ /** Sample the suffix array. */
+ static unsigned sampleSA = 16;
+
+ /** Which indexes to create. */
+ enum { NONE, FAI, FM, BOTH };
+ static int indexes = BOTH;
+
+ /** Build the BWT directly without the SA. */
+ static int fa2bwt;
+
+ /** Build the FM index from the BWT. */
+ static int bwt2fm;
+
+ /** The alphabet. */
+ static string alphabet = "-ACGT";
+
+ /** Decompress the index. */
+ static bool decompress;
+
+ /** Write output to standard output. */
+ static bool toStdout;
+
+ /** Verbose output. */
+ static int verbose;
+}
+
+static const char shortopts[] = "a:cds:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "both", no_argument, &opt::indexes, opt::BOTH },
+ { "fai", no_argument, &opt::indexes, opt::FAI },
+ { "fm", no_argument, &opt::indexes, opt::FM },
+ { "fa2bwt", no_argument, &opt::fa2bwt, true },
+ { "bwt2fm", no_argument, &opt::bwt2fm, true },
+ { "alphabet", optional_argument, NULL, 'a' },
+ { "decompress", no_argument, NULL, 'd' },
+ { "sample", required_argument, NULL, 's' },
+ { "stdout", no_argument, NULL, 'c' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** Index the specified FASTA file. */
+static void indexFasta(const string& faPath, const string& faiPath)
+{
+ cerr << "Reading `" << faPath << "'...\n";
+ FastaIndex fai;
+ fai.index(faPath);
+
+ if (opt::verbose > 0)
+ cerr << "Read " << fai.size() << " contigs.\n";
+
+ cerr << "Writing `" << faiPath << "'...\n";
+ ofstream out(faiPath.c_str());
+ assert_good(out, faiPath);
+ out << fai;
+ out.flush();
+ assert_good(out, faiPath);
+}
+
+/** Build the FM index from the BWT. */
+static void buildFMIndexFromBWT(FMIndex& fm, const string& path)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading `" << path << "'...\n";
+ std::vector<FMIndex::value_type> bwt;
+ readFile(path.c_str(), bwt);
+ assert(bwt.size() > 1);
+
+ if (opt::alphabet.empty()) {
+ fm.setAlphabet(bwt.begin(), bwt.end());
+ std::cerr << "The alphabet has "
+ << fm.alphabetSize() << " symbols.\n";
+ } else
+ fm.setAlphabet(opt::alphabet);
+
+ fm.encode(bwt.begin(), bwt.end());
+ fm.sampleSA(opt::sampleSA);
+ fm.assignBWT(bwt.begin(), bwt.end());
+}
+
+/** Build an FM index of the specified file. */
+static void buildFMIndex(FMIndex& fm, const string& path)
+{
+ if (opt::verbose > 0)
+ std::cerr << "Reading `" << path << "'...\n";
+ std::vector<FMIndex::value_type> s;
+ readFile(path.c_str(), s);
+
+ size_t MAX_SIZE = numeric_limits<FMIndex::sais_size_type>::max();
+ if (s.size() > MAX_SIZE) {
+ std::cerr << PROGRAM << ": `" << path << "', "
+ << toSI(s.size())
+ << "B, must be smaller than "
+ << toSI(MAX_SIZE) << "B\n";
+ exit(EXIT_FAILURE);
+ }
+
+ // Set the alphabet.
+ transform(s.begin(), s.end(), s.begin(), ::toupper);
+ if (opt::alphabet.empty()) {
+ fm.setAlphabet(s.begin(), s.end());
+ std::cerr << "The alphabet has "
+ << fm.alphabetSize() << " symbols.\n";
+ } else
+ fm.setAlphabet(opt::alphabet);
+
+ if (opt::fa2bwt) {
+ // Build the BWT first.
+ s.push_back(0);
+ fm.buildBWT(s.begin(), s.end() - 1);
+ fm.sampleSA(opt::sampleSA);
+ fm.assignBWT(s.begin(), s.end());
+ } else {
+ // Construct the suffix array first.
+ fm.assign(s.begin(), s.end());
+ fm.sampleSA(opt::sampleSA);
+ }
+}
+
+int main(int argc, char **argv)
+{
+ checkPopcnt();
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'a':
+ opt::alphabet = arg.str();
+ arg.clear(ios::eofbit);
+ break;
+ case 'c': opt::toStdout = true; break;
+ case 'd': opt::decompress = true; break;
+ case 's': arg >> opt::sampleSA; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (argc - optind < 1) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (argc - optind > 1) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ if (opt::decompress) {
+ // Decompress the index.
+ string fmPath(argv[optind]);
+ if (fmPath.size() < 4
+ || !equal(fmPath.end() - 3, fmPath.end(), ".fm"))
+ fmPath.append(".fm");
+ string faPath(fmPath, 0, fmPath.size() - 3);
+
+ ifstream in(fmPath.c_str());
+ assert_good(in, fmPath);
+ FMIndex fmIndex;
+ in >> fmIndex;
+ assert_good(in, fmPath);
+ in.close();
+
+ ofstream fout;
+ if (!opt::toStdout)
+ fout.open(faPath.c_str());
+ ostream& out = opt::toStdout ? cout : fout;
+ assert_good(out, faPath);
+ fmIndex.decompress(
+ ostream_iterator<FMIndex::value_type>(out, ""));
+ out.flush();
+ assert_good(out, faPath);
+
+ in.open((faPath + ".fai").c_str());
+ FastaIndex faIndex;
+ if (in) {
+ in >> faIndex;
+ faIndex.writeFASTAHeaders(out);
+ }
+ return 0;
+ }
+
+
+ string path = argv[optind];
+ FMIndex fm;
+ if (opt::bwt2fm) {
+ buildFMIndexFromBWT(fm, path);
+ } else {
+ if (opt::indexes & opt::FAI)
+ indexFasta(path, path + ".fai");
+
+ if ((opt::indexes & opt::FM) == 0)
+ return 0;
+
+ buildFMIndex(fm, path);
+ }
+
+ if (opt::verbose > 0) {
+ size_t n = fm.size();
+ ssize_t bytes = getMemoryUsage();
+ cerr << "Read " << toSI(n) << "B. "
+ "Used " << toSI(bytes) << "B of memory and "
+ << setprecision(3) << (float)bytes / n << " B/bp.\n";
+ }
+
+ string fmPath = opt::toStdout ? "-" : path + ".fm";
+ cerr << "Writing `" << fmPath << "'...\n";
+ ofstream fout;
+ if (!opt::toStdout)
+ fout.open(fmPath.c_str());
+ ostream& out = opt::toStdout ? cout : fout;
+ assert_good(out, fmPath);
+ out << fm;
+ out.flush();
+ assert_good(out, fmPath);
+
+ return 0;
+}
diff --git a/Map/map.cc b/Map/map.cc
new file mode 100644
index 0000000..6449aa6
--- /dev/null
+++ b/Map/map.cc
@@ -0,0 +1,481 @@
+#include "BitUtil.h"
+#include "DataLayer/Options.h"
+#include "FMIndex.h"
+#include "FastaIndex.h"
+#include "FastaInterleave.h"
+#include "FastaReader.h"
+#include "IOUtil.h"
+#include "MemoryUtil.h"
+#include "SAM.h"
+#include "StringUtil.h"
+#include "Uncompress.h"
+#include <algorithm>
+#include <cassert>
+#include <cctype> // for toupper
+#include <cstdlib>
+#include <getopt.h>
+#include <iostream>
+#include <sstream>
+#include <stdint.h>
+#include <string>
+#include <utility>
+#if _OPENMP
+# include <omp.h>
+#endif
+
+using namespace std;
+
+#define PROGRAM "abyss-map"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... QUERY... TARGET\n"
+"Map the sequences of the files QUERY to those of the file TARGET.\n"
+"The index files TARGET.fai and TARGET.fm will be used if present.\n"
+"\n"
+" -l, --min-align=N find matches at least N bp [1]\n"
+" -j, --threads=N use N parallel threads [1]\n"
+" -s, --sample=N sample the suffix array [1]\n"
+" -d, --dup identify and print duplicate sequence\n"
+" IDs between QUERY and TARGET\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ /** Find matches at least k bp. */
+ static unsigned k;
+
+ /** Sample the suffix array. */
+ static unsigned sampleSA;
+
+ /** The number of parallel threads. */
+ static unsigned threads = 1;
+
+ /** Identify duplicate and subsumed sequences. */
+ static bool dup = false;
+
+ /** Verbose output. */
+ static int verbose;
+}
+
+static const char shortopts[] = "j:k:l:s:dv";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "sample", required_argument, NULL, 's' },
+ { "min-align", required_argument, NULL, 'l' },
+ { "dup", no_argument, NULL, 'd' },
+ { "threads", required_argument, NULL, 'j' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** Counts. */
+static struct {
+ unsigned unique;
+ unsigned multimapped;
+ unsigned unmapped;
+} g_count;
+
+typedef FMIndex::Match Match;
+
+/** Return a SAM record of the specified match. */
+static SAMRecord toSAM(const FastaIndex& faIndex,
+ const FMIndex& fmIndex, const Match& m, bool rc,
+ unsigned qlength)
+{
+ SAMRecord a;
+ if (m.size() == 0) {
+ // No hit.
+ a.rname = "*";
+ a.pos = -1;
+ a.flag = SAMAlignment::FUNMAP;
+ a.mapq = 0;
+ a.cigar = "*";
+ } else {
+ FastaIndex::SeqPos seqPos = faIndex[fmIndex[m.l]];
+ a.rname = seqPos.get<0>().id;
+ a.pos = seqPos.get<1>();
+ a.flag = rc ? SAMAlignment::FREVERSE : 0;
+
+ // Set the mapq to the alignment score.
+ assert(m.qstart < m.qend);
+ unsigned matches = m.qend - m.qstart;
+ a.mapq = m.size() > 1 ? 0 : min(matches, 255U);
+
+ ostringstream ss;
+ if (m.qstart > 0)
+ ss << m.qstart << 'S';
+ ss << matches << 'M';
+ if (m.qend < qlength)
+ ss << qlength - m.qend << 'S';
+ a.cigar = ss.str();
+ }
+ a.mrnm = "*";
+ a.mpos = -1;
+ a.isize = 0;
+ return a;
+}
+
+/** Return the position of the current contig. */
+static size_t getMyPos(const Match& m, const FastaIndex& faIndex,
+ const FMIndex& fmIndex, const string& id)
+{
+ for (size_t i = m.l; i < m.u; i++) {
+ if (faIndex[fmIndex[i]].get<0>().id == id)
+ return fmIndex[i];
+ }
+ return fmIndex[m.l];
+}
+
+/** Return the earlies position of all contigs in m. */
+static size_t getMinPos(const Match& m, size_t maxLen,
+ const FastaIndex& faIndex, const FMIndex& fmIndex)
+{
+ size_t minPos = numeric_limits<size_t>::max();
+ for (size_t i = m.l; i < m.u; i++) {
+ size_t pos = fmIndex[i];
+ if (faIndex[pos].get<0>().size == maxLen && pos < minPos)
+ minPos = fmIndex[i];
+ }
+ return minPos;
+}
+
+/** Return the largest length of all contig in m. */
+static size_t getMaxLen(const Match& m, const FastaIndex& faIndex,
+ const FMIndex& fmIndex)
+{
+ size_t maxLen = 0;
+ for (size_t i = m.l; i < m.u; i++) {
+ size_t len = faIndex[fmIndex[i]].get<0>().size;
+ if (len > maxLen)
+ maxLen = len;
+ }
+ return maxLen;
+}
+
+/** Print the current contig id if it is not the lartest and earliest
+ * contig in m. */
+static void printDuplicates(const Match& m, const Match& rcm,
+ const FastaIndex& faIndex, const FMIndex& fmIndex,
+ const FastqRecord& rec)
+{
+ size_t myLen = m.qspan();
+ size_t maxLen = max(getMaxLen(m, faIndex, fmIndex),
+ getMaxLen(rcm, faIndex, fmIndex));
+ if (myLen < maxLen) {
+#pragma omp atomic
+ g_count.multimapped++;
+#pragma omp critical(cout)
+ {
+ cout << rec.id << '\n';
+ assert_good(cout, "stdout");
+ }
+ return;
+ }
+ size_t myPos = getMyPos(m, faIndex, fmIndex, rec.id);
+ size_t minPos = min(getMinPos(m, maxLen, faIndex, fmIndex),
+ getMinPos(rcm, maxLen, faIndex, fmIndex));
+ if (myPos > minPos) {
+#pragma omp atomic
+ g_count.multimapped++;
+#pragma omp critical(cout)
+ {
+ cout << rec.id << '\n';
+ assert_good(cout, "stdout");
+ }
+ }
+#pragma omp atomic
+ g_count.unique++;
+ return;
+}
+
+
+/** Return the mapping of the specified sequence. */
+static void find(const FastaIndex& faIndex, const FMIndex& fmIndex,
+ const FastqRecord& rec)
+{
+ if (rec.seq.empty()) {
+ cerr << PROGRAM ": error: "
+ "the sequence `" << rec.id << "' is empty\n";
+ exit(EXIT_FAILURE);
+ }
+
+ Match m = fmIndex.find(rec.seq,
+ opt::dup ? rec.seq.length() : opt::k);
+
+ string rcqseq = reverseComplement(rec.seq);
+ Match rcm = fmIndex.find(rcqseq,
+ opt::dup ? rcqseq.length() : m.qspan());
+
+ if (opt::dup) {
+ printDuplicates(m, rcm, faIndex, fmIndex, rec);
+ return;
+ }
+
+ bool rc = rcm.qspan() > m.qspan();
+
+ SAMRecord sam = toSAM(faIndex, fmIndex, rc ? rcm : m, rc,
+ rec.seq.size());
+ sam.qname = rec.id;
+#if SAM_SEQ_QUAL
+ sam.seq = rc ? rcqseq : rec.seq;
+ sam.qual = rec.qual.empty() ? "*" : rec.qual;
+ if (rc)
+ reverse(sam.qual.begin(), sam.qual.end());
+#endif
+
+ if (m.qstart == rec.seq.size() - rcm.qend
+ && m.qspan() == rcm.qspan()) {
+ // This matching sequence maps to both strands.
+ sam.mapq = 0;
+ }
+
+#pragma omp critical(cout)
+ {
+ cout << sam << '\n';
+ assert_good(cout, "stdout");
+ }
+
+ if (sam.isUnmapped())
+#pragma omp atomic
+ g_count.unmapped++;
+ else if (sam.mapq == 0)
+#pragma omp atomic
+ g_count.multimapped++;
+ else
+#pragma omp atomic
+ g_count.unique++;
+}
+
+/** Map the sequences of the specified file. */
+static void find(const FastaIndex& faIndex, const FMIndex& fmIndex,
+ FastaInterleave& in)
+{
+#pragma omp parallel
+ for (FastqRecord rec;;) {
+ bool good;
+#pragma omp critical(in)
+ good = in >> rec;
+ if (good)
+ find(faIndex, fmIndex, rec);
+ else
+ break;
+ }
+ assert(in.eof());
+}
+
+/** Build an FM index of the specified file. */
+static void buildFMIndex(FMIndex& fm, const char* path)
+{
+ if (opt::verbose > 0)
+ std::cerr << "Reading `" << path << "'...\n";
+ std::vector<FMIndex::value_type> s;
+ readFile(path, s);
+
+ size_t MAX_SIZE = numeric_limits<FMIndex::sais_size_type>::max();
+ if (s.size() > MAX_SIZE) {
+ std::cerr << PROGRAM << ": `" << path << "', "
+ << toSI(s.size())
+ << "B, must be smaller than "
+ << toSI(MAX_SIZE) << "B\n";
+ exit(EXIT_FAILURE);
+ }
+
+ transform(s.begin(), s.end(), s.begin(), ::toupper);
+ fm.setAlphabet("-ACGT");
+ fm.assign(s.begin(), s.end());
+}
+
+/** Return the size of the specified file. */
+static streampos fileSize(const string& path)
+{
+ std::ifstream in(path.c_str());
+ assert_good(in, path);
+ in.seekg(0, std::ios::end);
+ assert_good(in, path);
+ return in.tellg();
+}
+
+/** Check that the indexes are up to date. */
+static void checkIndexes(const string& path,
+ const FMIndex& fmIndex, const FastaIndex& faIndex)
+{
+ size_t fastaFileSize = fileSize(path);
+ if (fmIndex.size() != fastaFileSize) {
+ cerr << PROGRAM ": `" << path << "': "
+ "The size of the FM-index, "
+ << fmIndex.size()
+ << " B, does not match the size of the FASTA file, "
+ << fastaFileSize << " B. The index is likely stale.\n";
+ exit(EXIT_FAILURE);
+ }
+ if (faIndex.fileSize() != fastaFileSize) {
+ cerr << PROGRAM ": `" << path << "': "
+ "The size of the FASTA index, "
+ << faIndex.fileSize()
+ << " B, does not match the size of the FASTA file, "
+ << fastaFileSize << " B. The index is likely stale.\n";
+ exit(EXIT_FAILURE);
+ }
+}
+
+int main(int argc, char** argv)
+{
+ checkPopcnt();
+
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'j': arg >> opt::threads; break;
+ case 'k': case 'l':
+ arg >> opt::k;
+ break;
+ case 's': arg >> opt::sampleSA; break;
+ case 'd': opt::dup = true; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (argc - optind < 2) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+#if _OPENMP
+ if (opt::threads > 0)
+ omp_set_num_threads(opt::threads);
+#endif
+
+ const char* targetFile(argv[--argc]);
+ ostringstream ss;
+ ss << targetFile << ".fm";
+ string fmPath(ss.str());
+ ss.str("");
+ ss << targetFile << ".fai";
+ string faiPath(ss.str());
+
+ ifstream in;
+
+ // Read the FASTA index.
+ FastaIndex faIndex;
+ in.open(faiPath.c_str());
+ if (in) {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << faiPath << "'...\n";
+ in >> faIndex;
+ assert(in.eof());
+ in.close();
+ } else {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << targetFile << "'...\n";
+ faIndex.index(targetFile);
+ }
+ if (opt::verbose > 0) {
+ ssize_t bytes = getMemoryUsage();
+ if (bytes > 0)
+ cerr << "Using " << toSI(bytes) << "B of memory and "
+ << setprecision(3) << (float)bytes / faIndex.size()
+ << " B/sequence.\n";
+ }
+
+ // Read the FM index.
+ FMIndex fmIndex;
+ in.open(fmPath.c_str());
+ if (in) {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << fmPath << "'...\n";
+ assert_good(in, fmPath);
+ in >> fmIndex;
+ assert_good(in, fmPath);
+ in.close();
+ } else
+ buildFMIndex(fmIndex, targetFile);
+ if (opt::sampleSA > 1)
+ fmIndex.sampleSA(opt::sampleSA);
+
+ if (opt::verbose > 0) {
+ size_t bp = fmIndex.size();
+ cerr << "Read " << toSI(bp) << "B in "
+ << faIndex.size() << " contigs.\n";
+ ssize_t bytes = getMemoryUsage();
+ if (bytes > 0)
+ cerr << "Using " << toSI(bytes) << "B of memory and "
+ << setprecision(3) << (float)bytes / bp << " B/bp.\n";
+ }
+
+ // Check that the indexes are up to date.
+ checkIndexes(targetFile, fmIndex, faIndex);
+
+ if (!opt::dup) {
+ // Write the SAM header.
+ cout << "@HD\tVN:1.4\n"
+ "@PG\tID:" PROGRAM "\tPN:" PROGRAM "\tVN:" VERSION "\t"
+ "CL:" << commandLine << '\n';
+ faIndex.writeSAMHeader(cout);
+ cout.flush();
+ assert_good(cout, "stdout");
+ } else if (opt::verbose > 0)
+ cerr << "Identifying duplicates.\n";
+
+ opt::chastityFilter = false;
+ opt::trimMasked = false;
+ FastaInterleave fa(argv + optind, argv + argc,
+ FastaReader::FOLD_CASE);
+ find(faIndex, fmIndex, fa);
+
+ if (opt::verbose > 0) {
+ size_t unique = g_count.unique;
+ size_t mapped = unique + g_count.multimapped;
+ size_t total = mapped + g_count.unmapped;
+ cerr << "Mapped " << mapped << " of " << total << " reads ("
+ << (float)100 * mapped / total << "%)\n"
+ << "Mapped " << unique << " of " << total
+ << " reads uniquely (" << (float)100 * unique / total
+ << "%)\n";
+ }
+
+ cout.flush();
+ assert_good(cout, "stdout");
+ return 0;
+}
diff --git a/Map/overlap.cc b/Map/overlap.cc
new file mode 100644
index 0000000..b3f856f
--- /dev/null
+++ b/Map/overlap.cc
@@ -0,0 +1,461 @@
+#if __APPLE_CC__
+/* Work around a bug in i686-apple-darwin11-llvm-gcc 4.2.1
+ * Undefined symbols for architecture x86_64:
+ * "___builtin_expect", referenced from:
+ */
+#define NDEBUG 1
+#endif
+
+#include "BitUtil.h"
+#include "ContigProperties.h"
+#include "DataLayer/Options.h"
+#include "FMIndex.h"
+#include "FastaIndex.h"
+#include "FastaReader.h"
+#include "IOUtil.h"
+#include "MemoryUtil.h"
+#include "SAM.h"
+#include "StringUtil.h"
+#include "Uncompress.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/GraphIO.h"
+#include "Graph/GraphUtil.h"
+#include <algorithm>
+#include <cassert>
+#include <cctype> // for toupper
+#include <cstdlib>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <string>
+#include <utility>
+#if _OPENMP
+# include <omp.h>
+#endif
+
+using namespace std;
+
+#define PROGRAM "abyss-overlap"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... FILE\n"
+"Find overlaps of [m,k) bases. Sequences are read from FILE.\n"
+"Output is written to standard output. The index files FILE.fai\n"
+"and FILE.fm will be used if present.\n"
+"\n"
+" -m, --min=N find matches at least N bp [30]\n"
+" -k, --max=N find matches less than N bp [inf]\n"
+" -j, --threads=N use N parallel threads [1]\n"
+" -s, --sample=N sample the suffix array [1]\n"
+" --adj output the results in adj format\n"
+" --dot output the results in dot format [default]\n"
+" --sam output the results in SAM format\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ /** Find matches at least k bp. */
+ static unsigned minOverlap = 30;
+
+ /** Find matches less than k bp. */
+ static unsigned maxOverlap = UINT_MAX;
+
+ /** Sample the suffix array. */
+ static unsigned sampleSA;
+
+ /** The number of parallel threads. */
+ static unsigned threads = 1;
+
+ /** Verbose output. */
+ static int verbose;
+
+ unsigned k; // used by GraphIO
+ int format = DOT; // used by GraphIO
+}
+
+static const char shortopts[] = "j:k:m:s:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "adj", no_argument, &opt::format, ADJ },
+ { "dot", no_argument, &opt::format, DOT },
+ { "sam", no_argument, &opt::format, SAM },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "max", required_argument, NULL, 'k' },
+ { "min", required_argument, NULL, 'm' },
+ { "sample", required_argument, NULL, 's' },
+ { "threads", required_argument, NULL, 'j' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** The overlap graph. */
+typedef DirectedGraph<ContigProperties, Distance> DG;
+typedef ContigGraph<DG> Graph;
+
+typedef FMIndex::Match Match;
+
+/** Add suffix overlaps to the graph. */
+static void addSuffixOverlaps(Graph &g,
+ const FastaIndex& faIndex, const FMIndex& fmIndex,
+ const ContigNode& u, const Match& fmi)
+{
+ typedef edge_property<Graph>::type EP;
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ Distance ep(-fmi.qspan());
+ assert(ep.distance < 0);
+ for (unsigned i = fmi.l; i < fmi.u; ++i) {
+ size_t tstart = fmIndex[i] + 1;
+ V v = find_vertex(faIndex[tstart].get<0>().id, false, g);
+#pragma omp critical(g)
+ {
+ pair<E, bool> e = edge(u, v, g);
+ if (e.second) {
+ const EP& ep0 = g[e.first];
+ if (opt::verbose > 1)
+ cerr << "duplicate edge: "
+ << get(edge_name, g, e.first) << ' '
+ << ep0 << ' ' << ep << '\n';
+ assert(ep0.distance < ep.distance);
+ } else if(u.sense()) {
+ // Add u- -> v+
+ add_edge(u, v, ep, static_cast<DG&>(g));
+ } else {
+ // Add u+ -> v+ and v- -> u-
+ add_edge(u, v, ep, g);
+ }
+ }
+ }
+}
+
+/** Add prefix overlaps to the graph. */
+static void addPrefixOverlaps(Graph &g,
+ const FastaIndex& faIndex, const FMIndex& fmIndex,
+ const ContigNode& v, const Match& fmi)
+{
+ typedef edge_property<Graph>::type EP;
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ assert(v.sense());
+ assert(fmi.qstart == 0);
+ Distance ep(-fmi.qspan());
+ assert(ep.distance < 0);
+ for (unsigned i = fmi.l; i < fmi.u; ++i) {
+ size_t tstart = fmIndex[i];
+ V u = find_vertex(faIndex[tstart].get<0>().id, false, g);
+#pragma omp critical(g)
+ {
+ pair<E, bool> e = edge(u, v, g);
+ if (e.second) {
+ const EP& ep0 = g[e.first];
+ if (opt::verbose > 1)
+ cerr << "duplicate edge: "
+ << get(edge_name, g, e.first) << ' '
+ << ep0 << ' ' << ep << '\n';
+ assert(ep0.distance < ep.distance);
+ } else {
+ // Add u+ -> v-
+ add_edge(u, v, ep, static_cast<DG&>(g));
+ }
+ }
+ }
+}
+
+/** Find suffix overlaps. */
+static void findOverlapsSuffix(Graph &g,
+ const FastaIndex& faIndex, const FMIndex& fmIndex,
+ const ContigNode& u, const string& seq)
+{
+ size_t pos = seq.size() > opt::maxOverlap
+ ? seq.size() - opt::maxOverlap + 1 : 1;
+ string suffix(seq, pos);
+ typedef vector<Match> Matches;
+ vector<Match> matches;
+ fmIndex.findOverlapSuffix(suffix, back_inserter(matches),
+ opt::minOverlap);
+
+ for (Matches::reverse_iterator it = matches.rbegin();
+ it != matches.rend(); ++it)
+ addSuffixOverlaps(g, faIndex, fmIndex, u, *it);
+}
+
+/** Find prefix overlaps. */
+static void findOverlapsPrefix(Graph &g,
+ const FastaIndex& faIndex, const FMIndex& fmIndex,
+ const ContigNode& v, const string& seq)
+{
+ assert(v.sense());
+ string prefix(seq, 0,
+ min((size_t)opt::maxOverlap, seq.size()) - 1);
+ typedef vector<Match> Matches;
+ vector<Match> matches;
+ fmIndex.findOverlapPrefix(prefix, back_inserter(matches),
+ opt::minOverlap);
+
+ for (Matches::reverse_iterator it = matches.rbegin();
+ it != matches.rend(); ++it)
+ addPrefixOverlaps(g, faIndex, fmIndex, v, *it);
+}
+
+static void findOverlaps(Graph& g,
+ const FastaIndex& faIndex, const FMIndex& fmIndex,
+ const FastqRecord& rec)
+{
+ typedef graph_traits<Graph>::vertex_descriptor V;
+ V u = find_vertex(rec.id, false, g);
+ V uc = get(vertex_complement, g, u);
+ // Add edges u+ -> v+ and v- -> u-
+ findOverlapsSuffix(g, faIndex, fmIndex, u, rec.seq);
+ string rcseq = reverseComplement(rec.seq);
+ // Add edges u- -> v+
+ findOverlapsSuffix(g, faIndex, fmIndex, uc, rcseq);
+ // Add edges v+ -> u-
+ findOverlapsPrefix(g, faIndex, fmIndex, uc, rcseq);
+}
+
+/** Map the sequences of the specified file. */
+static void findOverlaps(Graph& g,
+ const FastaIndex& faIndex, const FMIndex& fmIndex,
+ FastaReader& in)
+{
+#pragma omp parallel
+ for (FastqRecord rec;;) {
+ bool good;
+#pragma omp critical(in)
+ good = in >> rec;
+ if (good)
+ findOverlaps(g, faIndex, fmIndex, rec);
+ else
+ break;
+ }
+ assert(in.eof());
+}
+
+/** Build an FM index of the specified file. */
+static void buildFMIndex(FMIndex& fm, const char* path)
+{
+ if (opt::verbose > 0)
+ std::cerr << "Reading `" << path << "'...\n";
+ std::vector<FMIndex::value_type> s;
+ readFile(path, s);
+
+ size_t MAX_SIZE = numeric_limits<FMIndex::sais_size_type>::max();
+ if (s.size() > MAX_SIZE) {
+ std::cerr << PROGRAM << ": `" << path << "', "
+ << toSI(s.size())
+ << "B, must be smaller than "
+ << toSI(MAX_SIZE) << "B\n";
+ exit(EXIT_FAILURE);
+ }
+
+ transform(s.begin(), s.end(), s.begin(), ::toupper);
+ fm.setAlphabet("-ACGT");
+ fm.assign(s.begin(), s.end());
+}
+
+/** Read contigs and add vertices to the graph. */
+static void addVertices(const string& path, Graph& g)
+{
+ typedef vertex_property<Graph>::type VP;
+ if (opt::verbose > 0)
+ cerr << "Reading `" << path << "'...\n";
+ ifstream in(path.c_str());
+ assert_good(in, path);
+ in >> g;
+ g_contigNames.lock();
+ assert(in.eof());
+}
+
+/** Return the size of the specified file. */
+static streampos fileSize(const string& path)
+{
+ std::ifstream in(path.c_str());
+ assert_good(in, path);
+ in.seekg(0, std::ios::end);
+ assert_good(in, path);
+ return in.tellg();
+}
+
+/** Check that the indexes are up to date. */
+static void checkIndexes(const string& path,
+ const FMIndex& fmIndex, const FastaIndex& faIndex)
+{
+ size_t fastaFileSize = fileSize(path);
+ if (fmIndex.size() != fastaFileSize) {
+ cerr << PROGRAM ": `" << path << "': "
+ "The size of the FM-index, "
+ << fmIndex.size()
+ << " B, does not match the size of the FASTA file, "
+ << fastaFileSize << " B. The index is likely stale.\n";
+ exit(EXIT_FAILURE);
+ }
+ if (faIndex.fileSize() != fastaFileSize) {
+ cerr << PROGRAM ": `" << path << "': "
+ "The size of the FASTA index, "
+ << faIndex.fileSize()
+ << " B, does not match the size of the FASTA file, "
+ << fastaFileSize << " B. The index is likely stale.\n";
+ exit(EXIT_FAILURE);
+ }
+}
+
+int main(int argc, char** argv)
+{
+ checkPopcnt();
+
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?':
+ die = true;
+ break;
+ case 'j':
+ arg >> opt::threads;
+ break;
+ case 'm':
+ arg >> opt::minOverlap;
+ break;
+ case 'k':
+ arg >> opt::maxOverlap;
+ break;
+ case 's':
+ arg >> opt::sampleSA;
+ break;
+ case 'v':
+ opt::verbose++;
+ break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (argc - optind < 1) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ } else if (argc - optind > 1) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+#if _OPENMP
+ if (opt::threads > 0)
+ omp_set_num_threads(opt::threads);
+#endif
+
+ if (opt::minOverlap == 0)
+ opt::minOverlap = opt::maxOverlap - 1;
+ opt::minOverlap = min(opt::minOverlap, opt::maxOverlap - 1);
+ if (opt::maxOverlap != UINT_MAX)
+ opt::k = opt::maxOverlap;
+
+ const char* fastaFile(argv[--argc]);
+ ostringstream ss;
+ ss << fastaFile << ".fm";
+ string fmPath(ss.str());
+ ss.str("");
+ ss << fastaFile << ".fai";
+ string faiPath(ss.str());
+
+ ifstream in;
+
+ // Read the FASTA index.
+ FastaIndex faIndex;
+ in.open(faiPath.c_str());
+ if (in) {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << faiPath << "'...\n";
+ in >> faIndex;
+ assert(in.eof());
+ in.close();
+ } else {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << fastaFile << "'...\n";
+ faIndex.index(fastaFile);
+ }
+
+ // Read the FM index.
+ FMIndex fmIndex;
+ in.open(fmPath.c_str());
+ if (in) {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << fmPath << "'...\n";
+ assert_good(in, fmPath);
+ in >> fmIndex;
+ assert_good(in, fmPath);
+ in.close();
+ } else
+ buildFMIndex(fmIndex, fastaFile);
+ if (opt::sampleSA > 1)
+ fmIndex.sampleSA(opt::sampleSA);
+
+ if (opt::verbose > 0) {
+ size_t bp = fmIndex.size();
+ cerr << "Read " << toSI(bp) << "B in "
+ << faIndex.size() << " contigs.\n";
+ ssize_t bytes = getMemoryUsage();
+ if (bytes > 0)
+ cerr << "Using " << toSI(bytes) << "B of memory and "
+ << setprecision(3) << (float)bytes / bp << " B/bp.\n";
+ }
+
+ // Check that the indexes are up to date.
+ checkIndexes(fastaFile, fmIndex, faIndex);
+
+ opt::chastityFilter = false;
+ opt::trimMasked = false;
+
+ Graph g;
+ addVertices(fastaFile, g);
+ FastaReader fa(fastaFile, FastaReader::FOLD_CASE);
+ findOverlaps(g, faIndex, fmIndex, fa);
+
+ if (opt::verbose > 0)
+ printGraphStats(cerr, g);
+
+ write_graph(cout, g, PROGRAM, commandLine);
+ cout.flush();
+ assert_good(cout, "stdout");
+ return 0;
+}
diff --git a/MergePaths/Makefile.am b/MergePaths/Makefile.am
new file mode 100644
index 0000000..764f2e7
--- /dev/null
+++ b/MergePaths/Makefile.am
@@ -0,0 +1,44 @@
+bin_PROGRAMS = MergePaths MergeContigs PathConsensus
+
+MergePaths_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+MergePaths_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+
+MergePaths_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/Graph/libgraph.a
+
+MergePaths_SOURCES = \
+ MergePaths.cpp
+
+MergeContigs_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Align \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+MergeContigs_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Align/libalign.a \
+ $(top_builddir)/Common/libcommon.a
+
+MergeContigs_SOURCES = MergeContigs.cpp
+
+PathConsensus_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Align \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer \
+ -I$(top_srcdir)/SimpleGraph
+
+PathConsensus_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Align/libalign.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/dialign/libdialign.a
+
+PathConsensus_SOURCES = \
+ PathConsensus.cpp
diff --git a/MergePaths/Makefile.in b/MergePaths/Makefile.in
new file mode 100644
index 0000000..20dbaec
--- /dev/null
+++ b/MergePaths/Makefile.in
@@ -0,0 +1,614 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = MergePaths$(EXEEXT) MergeContigs$(EXEEXT) \
+ PathConsensus$(EXEEXT)
+subdir = MergePaths
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_MergeContigs_OBJECTS = MergeContigs-MergeContigs.$(OBJEXT)
+MergeContigs_OBJECTS = $(am_MergeContigs_OBJECTS)
+MergeContigs_DEPENDENCIES = $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Align/libalign.a \
+ $(top_builddir)/Common/libcommon.a
+am_MergePaths_OBJECTS = MergePaths-MergePaths.$(OBJEXT)
+MergePaths_OBJECTS = $(am_MergePaths_OBJECTS)
+MergePaths_DEPENDENCIES = $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/Graph/libgraph.a
+MergePaths_LINK = $(CXXLD) $(MergePaths_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_PathConsensus_OBJECTS = PathConsensus-PathConsensus.$(OBJEXT)
+PathConsensus_OBJECTS = $(am_PathConsensus_OBJECTS)
+PathConsensus_DEPENDENCIES = $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Align/libalign.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/dialign/libdialign.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(MergeContigs_SOURCES) $(MergePaths_SOURCES) \
+ $(PathConsensus_SOURCES)
+DIST_SOURCES = $(MergeContigs_SOURCES) $(MergePaths_SOURCES) \
+ $(PathConsensus_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+MergePaths_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+MergePaths_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+MergePaths_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/Graph/libgraph.a
+
+MergePaths_SOURCES = \
+ MergePaths.cpp
+
+MergeContigs_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Align \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+MergeContigs_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Align/libalign.a \
+ $(top_builddir)/Common/libcommon.a
+
+MergeContigs_SOURCES = MergeContigs.cpp
+PathConsensus_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Align \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer \
+ -I$(top_srcdir)/SimpleGraph
+
+PathConsensus_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Align/libalign.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/dialign/libdialign.a
+
+PathConsensus_SOURCES = \
+ PathConsensus.cpp
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign MergePaths/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign MergePaths/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+MergeContigs$(EXEEXT): $(MergeContigs_OBJECTS) $(MergeContigs_DEPENDENCIES) $(EXTRA_MergeContigs_DEPENDENCIES)
+ @rm -f MergeContigs$(EXEEXT)
+ $(CXXLINK) $(MergeContigs_OBJECTS) $(MergeContigs_LDADD) $(LIBS)
+MergePaths$(EXEEXT): $(MergePaths_OBJECTS) $(MergePaths_DEPENDENCIES) $(EXTRA_MergePaths_DEPENDENCIES)
+ @rm -f MergePaths$(EXEEXT)
+ $(MergePaths_LINK) $(MergePaths_OBJECTS) $(MergePaths_LDADD) $(LIBS)
+PathConsensus$(EXEEXT): $(PathConsensus_OBJECTS) $(PathConsensus_DEPENDENCIES) $(EXTRA_PathConsensus_DEPENDENCIES)
+ @rm -f PathConsensus$(EXEEXT)
+ $(CXXLINK) $(PathConsensus_OBJECTS) $(PathConsensus_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MergeContigs-MergeContigs.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/MergePaths-MergePaths.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/PathConsensus-PathConsensus.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+MergeContigs-MergeContigs.o: MergeContigs.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MergeContigs_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MergeContigs-MergeContigs.o -MD -MP -MF $(DEPDIR)/MergeContigs-MergeContigs.Tpo -c -o MergeContigs-MergeContigs.o `test -f 'MergeContigs.cpp' || echo '$(srcdir)/'`MergeContigs.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/MergeContigs-MergeContigs.Tpo $(DEPDIR)/MergeContigs-MergeContigs.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MergeContigs.cpp' object='MergeContigs-MergeContigs.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MergeContigs_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MergeContigs-MergeContigs.o `test -f 'MergeContigs.cpp' || echo '$(srcdir)/'`MergeContigs.cpp
+
+MergeContigs-MergeContigs.obj: MergeContigs.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MergeContigs_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT MergeContigs-MergeContigs.obj -MD -MP -MF $(DEPDIR)/MergeContigs-MergeContigs.Tpo -c -o MergeContigs-MergeContigs.obj `if test -f 'MergeContigs.cpp'; then $(CYGPATH_W) 'MergeContigs.cpp'; else $(CYGPATH_W) '$(srcdir)/MergeContigs.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/MergeContigs-MergeContigs.Tpo $(DEPDIR)/MergeContigs-MergeContigs.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MergeContigs.cpp' object='MergeContigs-MergeContigs.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MergeContigs_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o MergeContigs-MergeContigs.obj `if test -f 'MergeContigs.cpp'; then $(CYGPATH_W) 'MergeContigs.cpp'; else $(CYGPATH_W) '$(srcdir)/MergeContigs.cpp'; fi`
+
+MergePaths-MergePaths.o: MergePaths.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MergePaths_CPPFLAGS) $(CPPFLAGS) $(MergePaths_CXXFLAGS) $(CXXFLAGS) -MT MergePaths-MergePaths.o -MD -MP -MF $(DEPDIR)/MergePaths-MergePaths.Tpo -c -o MergePaths-MergePaths.o `test -f 'MergePaths.cpp' || echo '$(srcdir)/'`MergePaths.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/MergePaths-MergePaths.Tpo $(DEPDIR)/MergePaths-MergePaths.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MergePaths.cpp' object='MergePaths-MergePaths.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MergePaths_CPPFLAGS) $(CPPFLAGS) $(MergePaths_CXXFLAGS) $(CXXFLAGS) -c -o MergePaths-MergePaths.o `test -f 'MergePaths.cpp' || echo '$(srcdir)/'`MergePaths.cpp
+
+MergePaths-MergePaths.obj: MergePaths.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MergePaths_CPPFLAGS) $(CPPFLAGS) $(MergePaths_CXXFLAGS) $(CXXFLAGS) -MT MergePaths-MergePaths.obj -MD -MP -MF $(DEPDIR)/MergePaths-MergePaths.Tpo -c -o MergePaths-MergePaths.obj `if test -f 'MergePaths.cpp'; then $(CYGPATH_W) 'MergePaths.cpp'; else $(CYGPATH_W) '$(srcdir)/MergePaths.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/MergePaths-MergePaths.Tpo $(DEPDIR)/MergePaths-MergePaths.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MergePaths.cpp' object='MergePaths-MergePaths.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(MergePaths_CPPFLAGS) $(CPPFLAGS) $(MergePaths_CXXFLAGS) $(CXXFLAGS) -c -o MergePaths-MergePaths.obj `if test -f 'MergePaths.cpp'; then $(CYGPATH_W) 'MergePaths.cpp'; else $(CYGPATH_W) '$(srcdir)/MergePaths.cpp'; fi`
+
+PathConsensus-PathConsensus.o: PathConsensus.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PathConsensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT PathConsensus-PathConsensus.o -MD -MP -MF $(DEPDIR)/PathConsensus-PathConsensus.Tpo -c -o PathConsensus-PathConsensus.o `test -f 'PathConsensus.cpp' || echo '$(srcdir)/'`PathConsensus.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/PathConsensus-PathConsensus.Tpo $(DEPDIR)/PathConsensus-PathConsensus.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='PathConsensus.cpp' object='PathConsensus-PathConsensus.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PathConsensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o PathConsensus-PathConsensus.o `test -f 'PathConsensus.cpp' || echo '$(srcdir)/'`PathConsensus.cpp
+
+PathConsensus-PathConsensus.obj: PathConsensus.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PathConsensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT PathConsensus-PathConsensus.obj -MD -MP -MF $(DEPDIR)/PathConsensus-PathConsensus.Tpo -c -o PathConsensus-PathConsensus.obj `if test -f 'PathConsensus.cpp'; then $(CYGPATH_W) 'PathConsensus.cpp'; else $(CYGPATH_W) '$(srcdir)/PathConsensus.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/PathConsensus-PathConsensus.Tpo $(DEPDIR)/PathConsensus-PathConsensus.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='PathConsensus.cpp' object='PathConsensus-PathConsensus.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PathConsensus_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o PathConsensus-PathConsensus.obj `if test -f 'PathConsensus.cpp'; then $(CYGPATH_W) 'PathConsensus.cpp'; else $(CYGPATH_W) '$(srcdir)/PathConsensus.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/MergePaths/MergeContigs.cpp b/MergePaths/MergeContigs.cpp
new file mode 100644
index 0000000..e7ab728
--- /dev/null
+++ b/MergePaths/MergeContigs.cpp
@@ -0,0 +1,589 @@
+#include "config.h"
+#include "Common/Options.h"
+#include "ContigNode.h"
+#include "ContigPath.h"
+#include "ContigProperties.h"
+#include "DataLayer/Options.h"
+#include "Dictionary.h"
+#include "FastaReader.h"
+#include "Histogram.h"
+#include "IOUtil.h"
+#include "MemoryUtil.h"
+#include "smith_waterman.h"
+#include "Sequence.h"
+#include "StringUtil.h"
+#include "Uncompress.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/GraphIO.h"
+#include "Graph/GraphUtil.h"
+#include "Graph/Options.h"
+#include <algorithm>
+#include <cstdlib>
+#include <fstream>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <limits>
+#include <sstream>
+#include <string>
+#include <vector>
+
+using namespace std;
+
+#define PROGRAM "MergeContigs"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... FASTA [OVERLAP] PATH\n"
+"Merge paths of contigs to create larger contigs.\n"
+" FASTA contigs in FASTA format\n"
+" OVERLAP contig overlap graph\n"
+" PATH sequences of contig IDs\n"
+"\n"
+" -k, --kmer=KMER_SIZE k-mer size\n"
+" -o, --out=FILE output the merged contigs to FILE [stdout]\n"
+" -g, --graph=FILE write the contig overlap graph to FILE\n"
+" --merged output only merged contigs\n"
+" --adj output the graph in adj format\n"
+" --dot output the graph in dot format [default]\n"
+" --dot-meancov same as above but give the mean coverage\n"
+" --sam output the graph in SAM format\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by ContigProperties
+
+ /** Output FASTA path. */
+ static string out = "-";
+
+ /** Output graph path. */
+ static string graphPath;
+
+ /** Output graph format. */
+ int format = DOT;
+
+ /** Output only merged contigs. */
+ int onlyMerged;
+
+ /** Minimum overlap. */
+ static unsigned minOverlap = 20;
+
+ /** Minimum alignment identity. */
+ static float minIdentity = 0.9;
+}
+
+static const char shortopts[] = "g:k:o:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "adj", no_argument, &opt::format, ADJ },
+ { "dot", no_argument, &opt::format, DOT },
+ { "dot-meancov", no_argument, &opt::format, DOT_MEANCOV },
+ { "sam", no_argument, &opt::format, SAM },
+ { "graph", required_argument, NULL, 'g' },
+ { "kmer", required_argument, NULL, 'k' },
+ { "merged", no_argument, &opt::onlyMerged, 1 },
+ { "out", required_argument, NULL, 'o' },
+ { "path", required_argument, NULL, 'p' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/* A contig sequence. */
+struct Contig {
+ Contig(const string& comment, const string& seq)
+ : comment(comment), seq(seq) { }
+ Contig(const FastaRecord& o) : comment(o.comment), seq(o.seq) { }
+ string comment;
+ string seq;
+};
+
+/** The contig sequences. */
+typedef vector<Contig> Contigs;
+
+/** Return the sequence of the specified contig node. The sequence
+ * may be ambiguous or reverse complemented.
+ */
+static Sequence sequence(const Contigs& contigs, const ContigNode& id)
+{
+ if (id.ambiguous()) {
+ string s(id.ambiguousSequence());
+ if (s.length() < opt::k)
+ transform(s.begin(), s.end(), s.begin(), ::tolower);
+ return string(opt::k - 1, 'N') + s;
+ } else {
+ const Sequence& seq = contigs[id.id()].seq;
+ return id.sense() ? reverseComplement(seq) : seq;
+ }
+}
+
+/** Return a consensus sequence of a and b.
+ * @return an empty string if a consensus could not be found
+ */
+static string createConsensus(const Sequence& a, const Sequence& b)
+{
+ assert(a.length() == b.length());
+ if (a == b)
+ return a;
+ string s;
+ s.reserve(a.length());
+ for (string::const_iterator ita = a.begin(), itb = b.begin();
+ ita != a.end(); ++ita, ++itb) {
+ bool mask = islower(*ita) || islower(*itb);
+ char ca = toupper(*ita), cb = toupper(*itb);
+ char c = ca == cb ? ca
+ : ca == 'N' ? cb
+ : cb == 'N' ? ca
+ : ambiguityIsSubset(ca, cb) ? ambiguityOr(ca, cb)
+ : 'x';
+ if (c == 'x')
+ return string("");
+ s += mask ? tolower(c) : c;
+ }
+ return s;
+}
+
+typedef ContigGraph<DirectedGraph<ContigProperties, Distance> > Graph;
+typedef graph_traits<Graph>::vertex_descriptor vertex_descriptor;
+
+/** Return the properties of the specified vertex, unless u is
+ * ambiguous, in which case return the length of the ambiguous
+ * sequence.
+ */
+static inline
+ContigProperties get(vertex_bundle_t, const Graph& g, ContigNode u)
+{
+ return u.ambiguous()
+ ? ContigProperties(u.length() + opt::k - 1, 0)
+ : g[u];
+}
+
+/** Append the sequence of contig v to seq. */
+static void mergeContigs(const Graph& g, const Contigs& contigs,
+ vertex_descriptor u, vertex_descriptor v,
+ Sequence& seq, const ContigPath& path)
+{
+ int d = get(edge_bundle, g, u, v).distance;
+ assert(d < 0);
+ unsigned overlap = -d;
+ const Sequence& s = sequence(contigs, v);
+ assert(s.length() > overlap);
+ Sequence ao;
+ Sequence bo(s, 0, overlap);
+ Sequence o;
+ do {
+ assert(seq.length() > overlap);
+ ao = seq.substr(seq.length() - overlap);
+ o = createConsensus(ao, bo);
+ if (!o.empty()) {
+ seq.resize(seq.length() - overlap);
+ seq += o;
+ seq += Sequence(s, overlap);
+ return;
+ }
+ } while (chomp(seq, 'n'));
+
+ // Try an overlap alignment.
+ if (opt::verbose > 2)
+ cerr << '\n';
+ vector<overlap_align> overlaps;
+ alignOverlap(ao, bo, 0, overlaps, false, opt::verbose > 2);
+ bool good = false;
+ if (!overlaps.empty()) {
+ assert(overlaps.size() == 1);
+ const overlap_align& o = overlaps.front();
+ unsigned matches = o.overlap_match;
+ const string& consensus = o.overlap_str;
+ float identity = (float)matches / consensus.size();
+ good = matches >= opt::minOverlap
+ && identity >= opt::minIdentity;
+ if (opt::verbose > 2)
+ cerr << matches << " / " << consensus.size()
+ << " = " << identity
+ << (matches < opt::minOverlap ? " (too few)"
+ : identity < opt::minIdentity ? " (too low)"
+ : " (good)") << '\n';
+ }
+ if (good) {
+ assert(overlaps.size() == 1);
+ const overlap_align& o = overlaps.front();
+ seq.erase(seq.length() - overlap + o.overlap_t_pos);
+ seq += o.overlap_str;
+ seq += Sequence(s, o.overlap_h_pos + 1);
+ } else {
+ cerr << "warning: the head of " << get(vertex_name, g, v)
+ << " does not match the tail of the previous contig\n"
+ << ao << '\n' << bo << '\n' << path << endl;
+ seq += 'n';
+ seq += s;
+ }
+}
+
+/** Return a FASTA comment for the specified path. */
+static void pathToComment(ostream& out,
+ const Graph& g, const ContigPath& path)
+{
+ assert(path.size() > 1);
+ out << get(vertex_name, g, path.front());
+ if (path.size() == 3)
+ out << ',' << get(vertex_name, g, path[1]);
+ else if (path.size() > 3)
+ out << ",...";
+ out << ',' << get(vertex_name, g, path.back());
+}
+
+/** Merge the specified path. */
+static Contig mergePath(const Graph& g, const Contigs& contigs,
+ const ContigPath& path)
+{
+ Sequence seq;
+ unsigned coverage = 0;
+ for (ContigPath::const_iterator it = path.begin();
+ it != path.end(); ++it) {
+ if (!it->ambiguous())
+ coverage += g[*it].coverage;
+ if (seq.empty()) {
+ seq = sequence(contigs, *it);
+ } else {
+ assert(it != path.begin());
+ mergeContigs(g, contigs, *(it-1), *it, seq, path);
+ }
+ }
+ ostringstream ss;
+ ss << seq.size() << ' ' << coverage << ' ';
+ pathToComment(ss, g, path);
+ return Contig(ss.str(), seq);
+}
+
+/** A container of ContigPath. */
+typedef vector<ContigPath> ContigPaths;
+
+/** Read contig paths from the specified file.
+ * @param ids [out] the string ID of the paths
+ */
+static ContigPaths readPaths(const string& inPath,
+ vector<string>* ids = NULL)
+{
+ if (ids != NULL)
+ assert(ids->empty());
+ ifstream fin(inPath.c_str());
+ if (opt::verbose > 0)
+ cerr << "Reading `" << inPath << "'..." << endl;
+ if (inPath != "-")
+ assert_good(fin, inPath);
+ istream& in = inPath == "-" ? cin : fin;
+
+ unsigned count = 0;
+ ContigPaths paths;
+ string id;
+ ContigPath path;
+ while (in >> id >> path) {
+ paths.push_back(path);
+ if (ids != NULL)
+ ids->push_back(id);
+
+ ++count;
+ if (opt::verbose > 1 && count % 1000000 == 0)
+ cerr << "Read " << count << " paths. "
+ "Using " << toSI(getMemoryUsage())
+ << "B of memory.\n";
+ }
+ if (opt::verbose > 0)
+ cerr << "Read " << count << " paths. "
+ "Using " << toSI(getMemoryUsage()) << "B of memory.\n";
+ assert(in.eof());
+ return paths;
+}
+
+/** Finds all contigs used in each path in paths, and
+ * marks them as seen in the vector seen. */
+static void seenContigs(vector<bool>& seen, const ContigPaths& paths)
+{
+ for (ContigPaths::const_iterator it = paths.begin();
+ it != paths.end(); ++it)
+ for (ContigPath::const_iterator itc = it->begin();
+ itc != it->end(); ++itc)
+ if (itc->id() < seen.size())
+ seen[itc->id()] = true;
+}
+
+/** Mark contigs for removal. An empty path indicates that a contig
+ * should be removed.
+ */
+static void markRemovedContigs(vector<bool>& marked,
+ const vector<string>& pathIDs, const ContigPaths& paths)
+{
+ for (ContigPaths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ if (it->empty()) {
+ size_t i = get(g_contigNames,
+ pathIDs[it - paths.begin()]);
+ assert(i < marked.size());
+ marked[i] = true;
+ }
+ }
+}
+
+/** Output the updated overlap graph. */
+static void outputGraph(Graph& g,
+ const vector<string>& pathIDs, const ContigPaths& paths,
+ const string& commandLine)
+{
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ // Add the path vertices.
+ g_contigNames.unlock();
+ for (ContigPaths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ const ContigPath& path = *it;
+ const string& id = pathIDs[it - paths.begin()];
+ if (!path.empty()) {
+ V u = merge(g, path.begin(), path.end());
+ put(vertex_name, g, u, id);
+ }
+ }
+ g_contigNames.lock();
+
+ // Remove the vertices that are used in paths.
+ for (ContigPaths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ const ContigPath& path = *it;
+ const string& id = pathIDs[it - paths.begin()];
+ if (path.empty()) {
+ remove_vertex(find_vertex(id, false, g), g);
+ } else {
+ remove_vertex_if(g, path.begin(), path.end(),
+ not1(std::mem_fun_ref(&ContigNode::ambiguous)));
+ }
+ }
+
+ // Output the graph.
+ const string& graphPath = opt::graphPath;
+ assert(!graphPath.empty());
+ if (opt::verbose > 0)
+ cerr << "Writing `" << graphPath << "'..." << endl;
+ ofstream fout(graphPath.c_str());
+ assert_good(fout, graphPath);
+ write_graph(fout, g, PROGRAM, commandLine);
+ assert_good(fout, graphPath);
+ if (opt::verbose > 0)
+ printGraphStats(cerr, g);
+}
+
+int main(int argc, char** argv)
+{
+ opt::trimMasked = false;
+
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'g': arg >> opt::graphPath; break;
+ case 'k': arg >> opt::k; break;
+ case 'o': arg >> opt::out; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (opt::out.empty()) {
+ cerr << PROGRAM ": " << "missing -o,--out option\n";
+ die = true;
+ }
+
+ if (argc - optind < 2) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (argc - optind > 3) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ const char* contigFile = argv[optind++];
+ string adjPath, mergedPathFile;
+ Graph g;
+ if (argc - optind > 1) {
+ adjPath = string(argv[optind++]);
+
+ // Read the contig adjacency graph.
+ if (opt::verbose > 0)
+ cerr << "Reading `" << adjPath << "'..." << endl;
+ ifstream fin(adjPath.c_str());
+ assert_good(fin, adjPath);
+ fin >> g;
+ assert(fin.eof());
+ if (opt::verbose > 0)
+ cerr << "Read " << num_vertices(g) << " vertices. "
+ "Using " << toSI(getMemoryUsage())
+ << "B of memory.\n";
+ }
+ mergedPathFile = string(argv[optind++]);
+
+ // Read the contig sequence.
+ Contigs contigs;
+ {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << contigFile << "'..." << endl;
+ unsigned count = 0;
+ FastaReader in(contigFile, FastaReader::NO_FOLD_CASE);
+ for (FastaRecord rec; in >> rec;) {
+ if (!adjPath.empty()
+ && g_contigNames.count(rec.id) == 0)
+ continue;
+ if (adjPath.empty())
+ put(g_contigNames, contigs.size(), rec.id);
+ else
+ assert(get(g_contigNames, rec.id) == contigs.size());
+ contigs.push_back(rec);
+
+ ++count;
+ if (opt::verbose > 1 && count % 1000000 == 0)
+ cerr << "Read " << count << " sequences. "
+ "Using " << toSI(getMemoryUsage())
+ << "B of memory.\n";
+ }
+ if (opt::verbose > 0)
+ cerr << "Read " << count << " sequences. "
+ "Using " << toSI(getMemoryUsage())
+ << "B of memory.\n";
+ assert(in.eof());
+ assert(!contigs.empty());
+ opt::colourSpace = isdigit(contigs[0].seq[0]);
+ g_contigNames.lock();
+ }
+
+ vector<string> pathIDs;
+ ContigPaths paths = readPaths(mergedPathFile, &pathIDs);
+
+ // Record all the contigs that are in a path.
+ vector<bool> seen(contigs.size());
+ seenContigs(seen, paths);
+ markRemovedContigs(seen, pathIDs, paths);
+
+ // Output those contigs that were not seen in a path.
+ Histogram lengthHistogram;
+ ofstream fout;
+ ostream& out = opt::out == "-" ? cout
+ : (fout.open(opt::out.c_str()), fout);
+ assert_good(out, opt::out);
+ if (!opt::onlyMerged) {
+ for (Contigs::const_iterator it = contigs.begin();
+ it != contigs.end(); ++it) {
+ ContigID id(it - contigs.begin());
+ if (!seen[id]) {
+ const Contig& contig = *it;
+ out << '>' << get(g_contigNames, id);
+ if (!contig.comment.empty())
+ out << ' ' << contig.comment;
+ out << '\n' << contig.seq << '\n';
+ if (opt::verbose > 0)
+ lengthHistogram.insert(
+ count_if(contig.seq.begin(), contig.seq.end(),
+ isACGT));
+ }
+ }
+ }
+
+ if (adjPath.empty())
+ return 0;
+
+ unsigned npaths = 0;
+ for (ContigPaths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ const ContigPath& path = *it;
+ if (path.empty())
+ continue;
+ Contig contig = mergePath(g, contigs, path);
+ out << '>' << pathIDs[it - paths.begin()]
+ << ' ' << contig.comment << '\n'
+ << contig.seq << '\n';
+ assert_good(out, opt::out);
+ npaths++;
+ if (opt::verbose > 0)
+ lengthHistogram.insert(
+ count_if(contig.seq.begin(), contig.seq.end(),
+ isACGT));
+ }
+
+ if (npaths == 0)
+ return 0;
+
+ float minCov = numeric_limits<float>::infinity(),
+ minCovUsed = numeric_limits<float>::infinity();
+ for (unsigned i = 0; i < contigs.size(); i++) {
+ ContigProperties vp = g[ContigNode(i, false)];
+ if (vp.coverage == 0)
+ continue;
+ assert((int)vp.length - opt::k + 1 > 0);
+ float cov = (float)vp.coverage / (vp.length - opt::k + 1);
+ minCov = min(minCov, cov);
+ if (seen[i])
+ minCovUsed = min(minCovUsed, cov);
+ }
+
+ if (!opt::graphPath.empty())
+ outputGraph(g, pathIDs, paths, commandLine);
+
+ cerr << "The minimum coverage of single-end contigs is "
+ << minCov << ".\n"
+ << "The minimum coverage of merged contigs is "
+ << minCovUsed << ".\n";
+ if (minCov < minCovUsed)
+ cerr << "Consider increasing the coverage threshold "
+ "parameter, c, to " << minCovUsed << ".\n";
+
+ if (opt::verbose > 0) {
+ const unsigned STATS_MIN_LENGTH = 200; // bp
+ printContiguityStats(cerr, lengthHistogram, STATS_MIN_LENGTH)
+ << '\t' << opt::out << '\n';
+ }
+ return 0;
+}
diff --git a/MergePaths/MergePaths.cpp b/MergePaths/MergePaths.cpp
new file mode 100644
index 0000000..f73e5e8
--- /dev/null
+++ b/MergePaths/MergePaths.cpp
@@ -0,0 +1,1422 @@
+#include "config.h"
+#include "Common/Options.h"
+#include "ContigID.h"
+#include "ContigPath.h"
+#include "Functional.h" // for mem_var
+#include "IOUtil.h"
+#include "Uncompress.h"
+#include "Graph/Assemble.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/DotIO.h"
+#include "Graph/GraphAlgorithms.h"
+#include "Graph/GraphUtil.h"
+#include <boost/tuple/tuple.hpp>
+#include <algorithm>
+#include <cassert>
+#include <climits> // for UINT_MAX
+#include <cstdlib>
+#include <deque>
+#include <fstream>
+#include <functional>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <limits>
+#include <map>
+#include <numeric>
+#include <set>
+#include <sstream>
+#include <string>
+#include <vector>
+#if _OPENMP
+# include <omp.h>
+#endif
+
+using namespace std;
+using boost::tie;
+
+#define PROGRAM "MergePaths"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Jared Simpson and Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... LEN PATH\n"
+"Merge sequences of contigs IDs.\n"
+" LEN lengths of the contigs\n"
+" PATH sequences of contig IDs\n"
+"\n"
+" -k, --kmer=KMER_SIZE k-mer size\n"
+" -s, --seed-length=L minimum length of a seed contig [0]\n"
+" -o, --out=FILE write result to FILE\n"
+" --no-greedy use the non-greedy algorithm [default]\n"
+" --greedy use the greedy algorithm\n"
+" -g, --graph=FILE write the path overlap graph to FILE\n"
+" -j, --threads=N use N parallel threads [1]\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by GraphIO
+ static string out;
+ static int threads = 1;
+
+ /** Minimum length of a seed contig. */
+ static unsigned seedLen;
+
+ /** Use a greedy algorithm. */
+ static int greedy;
+
+ /** Write the path overlap graph to this file. */
+ static string graphPath;
+}
+
+static const char shortopts[] = "g:j:k:o:s:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "graph", no_argument, NULL, 'g' },
+ { "greedy", no_argument, &opt::greedy, true },
+ { "no-greedy", no_argument, &opt::greedy, false },
+ { "kmer", required_argument, NULL, 'k' },
+ { "out", required_argument, NULL, 'o' },
+ { "seed-length", required_argument, NULL, 's' },
+ { "threads", required_argument, NULL, 'j' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+typedef map<ContigID, ContigPath> ContigPathMap;
+
+/** Orientation of an edge. */
+enum dir_type {
+ DIR_X, // u--v none
+ DIR_F, // u->v forward
+ DIR_R, // u<-v reverse
+ DIR_B, // u<>v both
+};
+
+/** Lengths of contigs measured in k-mer. */
+typedef vector<unsigned> Lengths;
+
+static ContigPath align(const Lengths& lengths,
+ const ContigPath& p1, const ContigPath& p2,
+ ContigNode pivot);
+static ContigPath align(const Lengths& lengths,
+ const ContigPath& p1, const ContigPath& p2,
+ ContigNode pivot, dir_type& orientation);
+
+static bool gDebugPrint;
+
+/** Return all contigs that are tandem repeats, identified as those
+ * contigs that appear more than once in a single path.
+ */
+static set<ContigID> findRepeats(const ContigPathMap& paths)
+{
+ set<ContigID> repeats;
+ for (ContigPathMap::const_iterator pathIt = paths.begin();
+ pathIt != paths.end(); ++pathIt) {
+ const ContigPath& path = pathIt->second;
+ map<ContigID, unsigned> count;
+ for (ContigPath::const_iterator it = path.begin();
+ it != path.end(); ++it)
+ if (!it->ambiguous())
+ count[it->contigIndex()]++;
+ for (map<ContigID, unsigned>::const_iterator
+ it = count.begin(); it != count.end(); ++it)
+ if (it->second > 1)
+ repeats.insert(it->first);
+ }
+ return repeats;
+}
+
+/** Remove tandem repeats from the set of paths.
+ * @return the removed paths
+ */
+static set<ContigID> removeRepeats(ContigPathMap& paths)
+{
+ set<ContigID> repeats = findRepeats(paths);
+ if (gDebugPrint) {
+ cout << "Repeats:";
+ if (!repeats.empty()) {
+ for (set<ContigID>::const_iterator it = repeats.begin();
+ it != repeats.end(); ++it)
+ cout << ' ' << get(g_contigNames, *it);
+ } else
+ cout << " none";
+ cout << '\n';
+ }
+
+ unsigned removed = 0;
+ for (set<ContigID>::const_iterator it = repeats.begin();
+ it != repeats.end(); ++it)
+ if (paths.count(*it) > 0)
+ removed++;
+ if (removed == paths.size()) {
+ // Every path was identified as a repeat. It's most likely a
+ // cyclic sequence. Don't remove anything.
+ repeats.clear();
+ return repeats;
+ }
+
+ ostringstream ss;
+ for (set<ContigID>::const_iterator it = repeats.begin();
+ it != repeats.end(); ++it)
+ if (paths.erase(*it) > 0)
+ ss << ' ' << get(g_contigNames, *it);
+
+ if (opt::verbose > 0 && removed > 0)
+ cout << "Removing paths in repeats:" << ss.str() << '\n';
+ return repeats;
+}
+
+static void appendToMergeQ(deque<ContigNode>& mergeQ,
+ set<ContigNode>& seen, const ContigPath& path)
+{
+ for (ContigPath::const_iterator it = path.begin();
+ it != path.end(); ++it)
+ if (!it->ambiguous() && seen.insert(*it).second)
+ mergeQ.push_back(*it);
+}
+
+/** A path overlap graph. */
+typedef ContigGraph<DirectedGraph<> > PathGraph;
+
+/** Add an edge if the two paths overlap.
+ * @param pivot the pivot at which to seed the alignment
+ * @return whether an overlap was found
+ */
+static bool addOverlapEdge(const Lengths& lengths,
+ PathGraph& gout, ContigNode pivot,
+ ContigNode seed1, const ContigPath& path1,
+ ContigNode seed2, const ContigPath& path2)
+{
+ assert(seed1 != seed2);
+
+ // Determine the orientation of the overlap edge.
+ dir_type orientation = DIR_X;
+ ContigPath consensus = align(lengths,
+ path1, path2, pivot, orientation);
+ if (consensus.empty())
+ return false;
+ assert(orientation != DIR_X);
+ if (orientation == DIR_B) {
+ // One of the paths subsumes the other. Use the order of the
+ // seeds to determine the orientation of the edge.
+ orientation = find(consensus.begin(), consensus.end(), seed1)
+ < find(consensus.begin(), consensus.end(), seed2)
+ ? DIR_F : DIR_R;
+ }
+ assert(orientation == DIR_F || orientation == DIR_R);
+
+ // Add the edge.
+ ContigNode u = orientation == DIR_F ? seed1 : seed2;
+ ContigNode v = orientation == DIR_F ? seed2 : seed1;
+ bool added = false;
+#pragma omp critical(gout)
+ if (!edge(u, v, gout).second) {
+ add_edge(u, v, gout);
+ added = true;
+ }
+ return added;
+}
+
+/** Return the specified path. */
+static ContigPath getPath(const ContigPathMap& paths, ContigNode u)
+{
+ ContigPathMap::const_iterator it = paths.find(u.contigIndex());
+ assert(it != paths.end());
+ ContigPath path = it->second;
+ if (u.sense())
+ reverseComplement(path.begin(), path.end());
+ return path;
+}
+
+/** Find the overlaps between paths and add edges to the graph. */
+static void findPathOverlaps(const Lengths& lengths,
+ const ContigPathMap& paths,
+ const ContigNode& seed1, const ContigPath& path1,
+ PathGraph& gout)
+{
+ for (ContigPath::const_iterator it = path1.begin();
+ it != path1.end(); ++it) {
+ ContigNode seed2 = *it;
+ if (seed1 == seed2)
+ continue;
+ if (seed2.ambiguous())
+ continue;
+ ContigPathMap::const_iterator path2It
+ = paths.find(seed2.contigIndex());
+ if (path2It == paths.end())
+ continue;
+
+ ContigPath path2 = path2It->second;
+ if (seed2.sense())
+ reverseComplement(path2.begin(), path2.end());
+ addOverlapEdge(lengths,
+ gout, seed2, seed1, path1, seed2, path2);
+ }
+}
+
+/** Attempt to merge the paths specified in mergeQ with path.
+ * @return the number of paths merged
+ */
+static unsigned mergePaths(const Lengths& lengths,
+ ContigPath& path,
+ deque<ContigNode>& mergeQ, set<ContigNode>& seen,
+ const ContigPathMap& paths)
+{
+ unsigned merged = 0;
+ deque<ContigNode> invalid;
+ for (ContigNode pivot; !mergeQ.empty(); mergeQ.pop_front()) {
+ pivot = mergeQ.front();
+ ContigPathMap::const_iterator path2It
+ = paths.find(pivot.contigIndex());
+ if (path2It == paths.end())
+ continue;
+
+ ContigPath path2 = path2It->second;
+ if (pivot.sense())
+ reverseComplement(path2.begin(), path2.end());
+ ContigPath consensus = align(lengths, path, path2, pivot);
+ if (consensus.empty()) {
+ invalid.push_back(pivot);
+ continue;
+ }
+
+ appendToMergeQ(mergeQ, seen, path2);
+ path.swap(consensus);
+ if (gDebugPrint)
+#pragma omp critical(cout)
+ cout << get(g_contigNames, pivot)
+ << '\t' << path2 << '\n'
+ << '\t' << path << '\n';
+ merged++;
+ }
+ mergeQ.swap(invalid);
+ return merged;
+}
+
+/** Merge the paths of the specified seed path.
+ * @return the merged contig path
+ */
+static ContigPath mergePath(const Lengths& lengths,
+ const ContigPathMap& paths, const ContigPath& seedPath)
+{
+ assert(!seedPath.empty());
+ ContigNode seed1 = seedPath.front();
+ ContigPathMap::const_iterator path1It
+ = paths.find(seed1.contigIndex());
+ assert(path1It != paths.end());
+ ContigPath path(path1It->second);
+ if (seedPath.front().sense())
+ reverseComplement(path.begin(), path.end());
+ if (opt::verbose > 1)
+#pragma omp critical(cout)
+ cout << "\n* " << seedPath << '\n'
+ << get(g_contigNames, seedPath.front())
+ << '\t' << path << '\n';
+ for (ContigPath::const_iterator it = seedPath.begin() + 1;
+ it != seedPath.end(); ++it) {
+ ContigNode seed2 = *it;
+ ContigPathMap::const_iterator path2It
+ = paths.find(seed2.contigIndex());
+ assert(path2It != paths.end());
+ ContigPath path2 = path2It->second;
+ if (seed2.sense())
+ reverseComplement(path2.begin(), path2.end());
+
+ ContigNode pivot
+ = find(path.begin(), path.end(), seed2) != path.end()
+ ? seed2 : seed1;
+ ContigPath consensus = align(lengths, path, path2, pivot);
+ if (consensus.empty()) {
+ // This seed could be removed from the seed path.
+ if (opt::verbose > 1)
+#pragma omp critical(cout)
+ cout << get(g_contigNames, seed2)
+ << '\t' << path2 << '\n'
+ << "\tinvalid\n";
+ } else {
+ path.swap(consensus);
+ if (opt::verbose > 1)
+#pragma omp critical(cout)
+ cout << get(g_contigNames, seed2)
+ << '\t' << path2 << '\n'
+ << '\t' << path << '\n';
+ }
+ seed1 = seed2;
+ }
+ return path;
+}
+
+/** A collection of contig paths. */
+typedef vector<ContigPath> ContigPaths;
+
+/** Merge the specified seed paths.
+ * @return the merged contig paths
+ */
+static ContigPaths mergeSeedPaths(const Lengths& lengths,
+ const ContigPathMap& paths, const ContigPaths& seedPaths)
+{
+ if (opt::verbose > 0)
+ cout << "\nMerging paths\n";
+
+ ContigPaths out;
+ out.reserve(seedPaths.size());
+ for (ContigPaths::const_iterator it = seedPaths.begin();
+ it != seedPaths.end(); ++it)
+ out.push_back(mergePath(lengths, paths, *it));
+ return out;
+}
+
+/** Extend the specified path as long as is unambiguously possible and
+ * add the result to the specified container.
+ */
+static void extendPaths(const Lengths& lengths,
+ ContigID id, const ContigPathMap& paths,
+ ContigPathMap& out)
+{
+ ContigPathMap::const_iterator pathIt = paths.find(id);
+ assert(pathIt != paths.end());
+
+ pair<ContigPathMap::iterator, bool> inserted;
+ #pragma omp critical(out)
+ inserted = out.insert(*pathIt);
+ assert(inserted.second);
+ ContigPath& path = inserted.first->second;
+
+ if (gDebugPrint)
+ #pragma omp critical(cout)
+ cout << "\n* " << get(g_contigNames, id) << "+\n"
+ << '\t' << path << '\n';
+
+ set<ContigNode> seen;
+ seen.insert(ContigNode(id, false));
+ deque<ContigNode> mergeQ;
+ appendToMergeQ(mergeQ, seen, path);
+ while (mergePaths(lengths, path, mergeQ, seen, paths) > 0)
+ ;
+
+ if (!mergeQ.empty() && gDebugPrint) {
+ #pragma omp critical(cout)
+ {
+ cout << "invalid\n";
+ for (deque<ContigNode>::const_iterator it
+ = mergeQ.begin(); it != mergeQ.end(); ++it)
+ cout << get(g_contigNames, *it) << '\t'
+ << paths.find(it->contigIndex())->second << '\n';
+ }
+ }
+}
+
+/** Return true if the contigs are equal or both are ambiguous. */
+static bool equalOrBothAmbiguos(const ContigNode& a,
+ const ContigNode& b)
+{
+ return a == b || (a.ambiguous() && b.ambiguous());
+}
+
+/** Return true if both paths are equal, ignoring ambiguous nodes. */
+static bool equalIgnoreAmbiguos(const ContigPath& a,
+ const ContigPath& b)
+{
+ return a.size() == b.size()
+ && equal(a.begin(), a.end(), b.begin(), equalOrBothAmbiguos);
+}
+
+/** Return whether this path is a cycle. */
+static bool isCycle(const Lengths& lengths, const ContigPath& path)
+{
+ return !align(lengths, path, path, path.front()).empty();
+}
+
+/** Identify paths subsumed by the specified path.
+ * @param overlaps [out] paths that are found to overlap
+ * @return the ID of the subsuming path
+ */
+static ContigID identifySubsumedPaths(const Lengths& lengths,
+ ContigPathMap::const_iterator path1It,
+ ContigPathMap& paths,
+ set<ContigID>& out,
+ set<ContigID>& overlaps)
+{
+ ostringstream vout;
+ out.clear();
+ ContigID id(path1It->first);
+ const ContigPath& path = path1It->second;
+ if (gDebugPrint)
+ vout << get(g_contigNames, ContigNode(id, false))
+ << '\t' << path << '\n';
+
+ for (ContigPath::const_iterator it = path.begin();
+ it != path.end(); ++it) {
+ ContigNode pivot = *it;
+ if (pivot.ambiguous() || pivot.id() == id)
+ continue;
+ ContigPathMap::iterator path2It
+ = paths.find(pivot.contigIndex());
+ if (path2It == paths.end())
+ continue;
+ ContigPath path2 = path2It->second;
+ if (pivot.sense())
+ reverseComplement(path2.begin(), path2.end());
+ ContigPath consensus = align(lengths, path, path2, pivot);
+ if (consensus.empty())
+ continue;
+ if (equalIgnoreAmbiguos(consensus, path)) {
+ if (gDebugPrint)
+ vout << get(g_contigNames, pivot)
+ << '\t' << path2 << '\n';
+ out.insert(path2It->first);
+ } else if (equalIgnoreAmbiguos(consensus, path2)) {
+ // This path is larger. Use it as the seed.
+ return identifySubsumedPaths(lengths, path2It, paths, out,
+ overlaps);
+ } else if (isCycle(lengths, consensus)) {
+ // The consensus path is a cycle.
+ bool isCyclePath1 = isCycle(lengths, path);
+ bool isCyclePath2 = isCycle(lengths, path2);
+ if (!isCyclePath1 && !isCyclePath2) {
+ // Neither path is a cycle.
+ if (gDebugPrint)
+ vout << get(g_contigNames, pivot)
+ << '\t' << path2 << '\n'
+ << "ignored\t" << consensus << '\n';
+ overlaps.insert(id);
+ overlaps.insert(path2It->first);
+ } else {
+ // At least one path is a cycle.
+ if (gDebugPrint)
+ vout << get(g_contigNames, pivot)
+ << '\t' << path2 << '\n'
+ << "cycle\t" << consensus << '\n';
+ if (isCyclePath1 && isCyclePath2)
+ out.insert(path2It->first);
+ else if (!isCyclePath1)
+ overlaps.insert(id);
+ else if (!isCyclePath2)
+ overlaps.insert(path2It->first);
+ }
+ } else {
+ if (gDebugPrint)
+ vout << get(g_contigNames, pivot)
+ << '\t' << path2 << '\n'
+ << "ignored\t" << consensus << '\n';
+ overlaps.insert(id);
+ overlaps.insert(path2It->first);
+ }
+ }
+ cout << vout.str();
+ return id;
+}
+
+/** Remove paths subsumed by the specified path.
+ * @param seed [out] the ID of the subsuming path
+ * @param overlaps [out] paths that are found to overlap
+ * @return the next iterator after path1it
+ */
+static ContigPathMap::const_iterator removeSubsumedPaths(
+ const Lengths& lengths,
+ ContigPathMap::const_iterator path1It, ContigPathMap& paths,
+ ContigID& seed, set<ContigID>& overlaps)
+{
+ if (gDebugPrint)
+ cout << '\n';
+ set<ContigID> eq;
+ seed = identifySubsumedPaths(lengths,
+ path1It, paths, eq, overlaps);
+ ++path1It;
+ for (set<ContigID>::const_iterator it = eq.begin();
+ it != eq.end(); ++it) {
+ if (*it == path1It->first)
+ ++path1It;
+ paths.erase(*it);
+ }
+ return path1It;
+}
+
+/** Remove paths subsumed by another path.
+ * @return paths that are found to overlap
+ */
+static set<ContigID> removeSubsumedPaths(const Lengths& lengths,
+ ContigPathMap& paths)
+{
+ set<ContigID> overlaps, seen;
+ for (ContigPathMap::const_iterator iter = paths.begin();
+ iter != paths.end();) {
+ if (seen.count(iter->first) == 0) {
+ ContigID seed;
+ iter = removeSubsumedPaths(lengths,
+ iter, paths, seed, overlaps);
+ seen.insert(seed);
+ } else
+ ++iter;
+ }
+ return overlaps;
+}
+
+/** Add missing overlap edges. For each vertex u with at least two
+ * outgoing edges, (u,v1) and (u,v2), add the edge (v1,v2) if v1 < v2,
+ * and add the edge (v2,v1) if v2 < v1.
+ */
+static void addMissingEdges(const Lengths& lengths,
+ PathGraph& g, const ContigPathMap& paths)
+{
+ typedef graph_traits<PathGraph>::adjacency_iterator Vit;
+ typedef graph_traits<PathGraph>::vertex_iterator Uit;
+ typedef graph_traits<PathGraph>::vertex_descriptor V;
+
+ unsigned numAdded = 0;
+ pair<Uit, Uit> urange = vertices(g);
+ for (Uit uit = urange.first; uit != urange.second; ++uit) {
+ V u = *uit;
+ if (out_degree(u, g) < 2)
+ continue;
+ pair<Vit, Vit> vrange = adjacent_vertices(u, g);
+ for (Vit vit1 = vrange.first; vit1 != vrange.second;) {
+ V v1 = *vit1;
+ ++vit1;
+ assert(v1 != u);
+ ContigPath path1 = getPath(paths, v1);
+ if (find(path1.begin(), path1.end(),
+ ContigPath::value_type(u)) == path1.end())
+ continue;
+ for (Vit vit2 = vit1; vit2 != vrange.second; ++vit2) {
+ V v2 = *vit2;
+ assert(v2 != u);
+ assert(v1 != v2);
+ if (edge(v1, v2, g).second || edge(v2, v1, g).second)
+ continue;
+ ContigPath path2 = getPath(paths, v2);
+ if (find(path2.begin(), path2.end(),
+ ContigPath::value_type(u)) == path2.end())
+ continue;
+ numAdded += addOverlapEdge(lengths,
+ g, u, v1, path1, v2, path2);
+ }
+ }
+ }
+ if (opt::verbose > 0)
+ cout << "Added " << numAdded << " missing edges.\n";
+}
+
+/** Remove transitive edges. */
+static void removeTransitiveEdges(PathGraph& pathGraph)
+{
+ unsigned nbefore = num_edges(pathGraph);
+ unsigned nremoved = remove_transitive_edges(pathGraph);
+ unsigned nafter = num_edges(pathGraph);
+ if (opt::verbose > 0)
+ cout << "Removed " << nremoved << " transitive edges of "
+ << nbefore << " edges leaving "
+ << nafter << " edges.\n";
+ assert(nbefore - nremoved == nafter);
+}
+
+/** Remove ambiguous edges that overlap by only a small amount.
+ * Remove the edge (u,v) if deg+(u) > 1 and deg-(v) > 1 and the
+ * overlap of (u,v) is small.
+ */
+static void removeSmallOverlaps(PathGraph& g,
+ const ContigPathMap& paths)
+{
+ typedef graph_traits<PathGraph>::edge_descriptor E;
+ typedef graph_traits<PathGraph>::out_edge_iterator Eit;
+ typedef graph_traits<PathGraph>::vertex_descriptor V;
+ typedef graph_traits<PathGraph>::vertex_iterator Vit;
+
+ vector<E> edges;
+ pair<Vit, Vit> urange = vertices(g);
+ for (Vit uit = urange.first; uit != urange.second; ++uit) {
+ V u = *uit;
+ if (out_degree(u, g) < 2)
+ continue;
+ ContigPath pathu = getPath(paths, u);
+ pair<Eit, Eit> uvits = out_edges(u, g);
+ for (Eit uvit = uvits.first; uvit != uvits.second; ++uvit) {
+ E uv = *uvit;
+ V v = target(uv, g);
+ assert(v != u);
+ if (in_degree(v, g) < 2)
+ continue;
+ ContigPath pathv = getPath(paths, v);
+ if (pathu.back() == pathv.front()
+ && paths.count(pathu.back().contigIndex()) > 0)
+ edges.push_back(uv);
+ }
+ }
+ remove_edges(g, edges.begin(), edges.end());
+ if (opt::verbose > 0)
+ cout << "Removed " << edges.size()
+ << " small overlap edges.\n";
+}
+
+/** Output the path overlap graph. */
+static void outputPathGraph(PathGraph& pathGraph)
+{
+ if (opt::graphPath.empty())
+ return;
+ ofstream out(opt::graphPath.c_str());
+ assert_good(out, opt::graphPath);
+ write_dot(out, pathGraph);
+ assert_good(out, opt::graphPath);
+}
+
+/** Sort and output the specified paths. */
+static void outputSortedPaths(const ContigPathMap& paths)
+{
+ // Sort the paths.
+ vector<ContigPath> sortedPaths(paths.size());
+ transform(paths.begin(), paths.end(), sortedPaths.begin(),
+ mem_var(&ContigPathMap::value_type::second));
+ sort(sortedPaths.begin(), sortedPaths.end());
+
+ // Output the paths.
+ ofstream fout(opt::out.c_str());
+ ostream& out = opt::out.empty() ? cout : fout;
+ assert_good(out, opt::out);
+ for (vector<ContigPath>::const_iterator it = sortedPaths.begin();
+ it != sortedPaths.end(); ++it)
+ out << createContigName() << '\t' << *it << '\n';
+ assert_good(out, opt::out);
+}
+
+/** Assemble the path overlap graph. */
+static void assemblePathGraph(const Lengths& lengths,
+ PathGraph& pathGraph, ContigPathMap& paths)
+{
+ ContigPaths seedPaths;
+ assembleDFS(pathGraph, back_inserter(seedPaths));
+ ContigPaths mergedPaths = mergeSeedPaths(lengths,
+ paths, seedPaths);
+ if (opt::verbose > 1)
+ cout << '\n';
+
+ // Replace each path with the merged path.
+ for (ContigPaths::const_iterator it1 = seedPaths.begin();
+ it1 != seedPaths.end(); ++it1) {
+ const ContigPath& path(mergedPaths[it1 - seedPaths.begin()]);
+ ContigPath pathrc(path);
+ reverseComplement(pathrc.begin(), pathrc.end());
+ for (ContigPath::const_iterator it2 = it1->begin();
+ it2 != it1->end(); ++it2) {
+ ContigNode seed(*it2);
+ if (find(path.begin(), path.end(), seed) != path.end()) {
+ paths[seed.contigIndex()]
+ = seed.sense() ? pathrc : path;
+ } else {
+ // This seed was not included in the merged path.
+ }
+ }
+ }
+
+ removeRepeats(paths);
+
+ // Remove the subsumed paths.
+ if (opt::verbose > 0)
+ cout << "Removing redundant contigs\n";
+ removeSubsumedPaths(lengths, paths);
+
+ outputSortedPaths(paths);
+}
+
+/** Read a set of paths from the specified file. */
+static ContigPathMap readPaths(const Lengths& lengths,
+ const string& filePath)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading `" << filePath << "'..." << endl;
+ ifstream in(filePath.c_str());
+ assert_good(in, filePath);
+
+ unsigned tooSmall = 0;
+ ContigPathMap paths;
+ std::string name;
+ ContigPath path;
+ while (in >> name >> path) {
+ // Ignore seed contigs shorter than the threshold length.
+ ContigID id(get(g_contigNames, name));
+ unsigned len = lengths[id] + opt::k - 1;
+ if (len < opt::seedLen) {
+ tooSmall++;
+ continue;
+ }
+
+ bool inserted = paths.insert(
+ make_pair(id, path)).second;
+ assert(inserted);
+ (void)inserted;
+ }
+ assert(in.eof());
+
+ if (opt::seedLen > 0)
+ cout << "Ignored " << tooSmall
+ << " paths whose seeds are shorter than "
+ << opt::seedLen << " bp.\n";
+ return paths;
+}
+
+/** Store it in out and increment it.
+ * @return true if out != last
+ */
+template<class T>
+bool atomicInc(T& it, T last, T& out)
+{
+ #pragma omp critical(atomicInc)
+ out = it == last ? it : it++;
+ return out != last;
+}
+
+/** Build the path overlap graph. */
+static void buildPathGraph(const Lengths& lengths,
+ PathGraph& g, const ContigPathMap& paths)
+{
+ // Create the vertices of the path overlap graph.
+ PathGraph(lengths.size()).swap(g);
+
+ // Remove the non-seed contigs.
+ typedef graph_traits<PathGraph>::vertex_iterator vertex_iterator;
+ pair<vertex_iterator, vertex_iterator> vit = g.vertices();
+ for (vertex_iterator u = vit.first; u != vit.second; ++u)
+ if (paths.count(get(vertex_contig_index, g, *u)) == 0)
+ remove_vertex(*u, g);
+
+ // Find the overlapping paths.
+ ContigPathMap::const_iterator sharedIt = paths.begin();
+ #pragma omp parallel
+ for (ContigPathMap::const_iterator it;
+ atomicInc(sharedIt, paths.end(), it);)
+ findPathOverlaps(lengths, paths,
+ ContigNode(it->first, false), it->second, g);
+ if (gDebugPrint)
+ cout << '\n';
+
+ addMissingEdges(lengths, g, paths);
+ removeTransitiveEdges(g);
+ removeSmallOverlaps(g, paths);
+ if (opt::verbose > 0)
+ printGraphStats(cout, g);
+ outputPathGraph(g);
+}
+
+/** Read contig lengths. */
+static Lengths readContigLengths(istream& in)
+{
+ assert(in);
+ assert(g_contigNames.empty());
+ Lengths lengths;
+ string s;
+ unsigned len;
+ while (in >> s >> len) {
+ in.ignore(numeric_limits<streamsize>::max(), '\n');
+ put(g_contigNames, lengths.size(), s);
+ assert(len >= opt::k);
+ lengths.push_back(len - opt::k + 1);
+ }
+ assert(in.eof());
+ assert(!lengths.empty());
+ g_contigNames.lock();
+ return lengths;
+}
+
+/** Read contig lengths. */
+static Lengths readContigLengths(const string& path)
+{
+ ifstream in(path.c_str());
+ assert_good(in, path);
+ return readContigLengths(in);
+}
+
+int main(int argc, char** argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'g': arg >> opt::graphPath; break;
+ case 'j': arg >> opt::threads; break;
+ case 'k': arg >> opt::k; break;
+ case 'o': arg >> opt::out; break;
+ case 's': arg >> opt::seedLen; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (argc - optind < 2) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ } else if (argc - optind > 2) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ if (!opt::graphPath.empty())
+ opt::greedy = false;
+
+ gDebugPrint = opt::verbose > 1;
+
+#if _OPENMP
+ if (opt::threads > 0)
+ omp_set_num_threads(opt::threads);
+#endif
+
+ if (opt::verbose > 0)
+ cerr << "Reading `" << argv[optind] << "'..." << endl;
+
+ Lengths lengths = readContigLengths(argv[optind++]);
+ ContigPathMap originalPathMap = readPaths(
+ lengths, argv[optind++]);
+
+ removeRepeats(originalPathMap);
+
+ if (!opt::greedy) {
+ // Assemble the path overlap graph.
+ PathGraph pathGraph;
+ buildPathGraph(lengths, pathGraph, originalPathMap);
+ if (!opt::out.empty())
+ assemblePathGraph(lengths, pathGraph, originalPathMap);
+ exit(EXIT_SUCCESS);
+ }
+
+ ContigPathMap resultsPathMap;
+#if _OPENMP
+ ContigPathMap::iterator sharedIt = originalPathMap.begin();
+ #pragma omp parallel
+ for (ContigPathMap::iterator it;
+ atomicInc(sharedIt, originalPathMap.end(), it);)
+ extendPaths(lengths,
+ it->first, originalPathMap, resultsPathMap);
+#else
+ for (ContigPathMap::const_iterator it = originalPathMap.begin();
+ it != originalPathMap.end(); ++it)
+ extendPaths(lengths,
+ it->first, originalPathMap, resultsPathMap);
+#endif
+ if (gDebugPrint)
+ cout << '\n';
+
+ set<ContigID> repeats = removeRepeats(resultsPathMap);
+
+ if (gDebugPrint)
+ cout << "\nRemoving redundant contigs\n";
+ set<ContigID> overlaps = removeSubsumedPaths(lengths,
+ resultsPathMap);
+
+ if (!overlaps.empty() && !repeats.empty()) {
+ // Remove the newly-discovered repeat contigs from the
+ // original paths.
+ for (set<ContigID>::const_iterator it = repeats.begin();
+ it != repeats.end(); ++it)
+ originalPathMap.erase(*it);
+
+ // Reassemble the paths that were found to overlap.
+ if (gDebugPrint) {
+ cout << "\nReassembling overlapping contigs:";
+ for (set<ContigID>::const_iterator it = overlaps.begin();
+ it != overlaps.end(); ++it)
+ cout << ' ' << get(g_contigNames, *it);
+ cout << '\n';
+ }
+
+ for (set<ContigID>::const_iterator it = overlaps.begin();
+ it != overlaps.end(); ++it) {
+ if (originalPathMap.count(*it) == 0)
+ continue; // repeat
+ ContigPathMap::iterator oldIt = resultsPathMap.find(*it);
+ if (oldIt == resultsPathMap.end())
+ continue; // subsumed
+ ContigPath old = oldIt->second;
+ resultsPathMap.erase(oldIt);
+ extendPaths(lengths,
+ *it, originalPathMap, resultsPathMap);
+ if (gDebugPrint) {
+ if (resultsPathMap[*it] == old)
+ cout << "no change\n";
+ else
+ cout << "was\t" << old << '\n';
+ }
+ }
+ if (gDebugPrint)
+ cout << '\n';
+
+ removeRepeats(resultsPathMap);
+ overlaps = removeSubsumedPaths(lengths, resultsPathMap);
+ if (!overlaps.empty() && gDebugPrint) {
+ cout << "\nOverlapping contigs:";
+ for (set<ContigID>::const_iterator it = overlaps.begin();
+ it != overlaps.end(); ++it)
+ cout << ' ' << get(g_contigNames, *it);
+ cout << '\n';
+ }
+ }
+ originalPathMap.clear();
+
+ outputSortedPaths(resultsPathMap);
+ return 0;
+}
+
+/** Return the length of the specified contig in k-mer. */
+static unsigned getLength(const Lengths& lengths,
+ const ContigNode& u)
+{
+ return u.ambiguous() ? u.length()
+ : lengths.at(u.id());
+}
+
+/** Functor to add the number of k-mer in two contigs. */
+struct AddLength
+{
+ AddLength(const Lengths& lengths) : m_lengths(lengths) { }
+ unsigned operator()(unsigned addend, const ContigNode& u) const
+ {
+ return addend + getLength(m_lengths, u);
+ }
+ private:
+ const Lengths& m_lengths;
+};
+
+/** Attempt to fill in gaps in one path with the sequence from the
+ * other path and store the consensus at result if an alignment is
+ * found.
+ * @return true if an alignment is found
+ */
+template <class iterator, class oiterator>
+static bool alignCoordinates(const Lengths& lengths,
+ iterator& first1, iterator last1,
+ iterator& first2, iterator last2, oiterator& result)
+{
+ oiterator out = result;
+
+ int ambiguous1 = 0, ambiguous2 = 0;
+ iterator it1 = first1, it2 = first2;
+ while (it1 != last1 && it2 != last2) {
+ if (it1->ambiguous()) {
+ ambiguous1 += it1->length();
+ ++it1;
+ assert(it1 != last1);
+ assert(!it1->ambiguous());
+ }
+ if (it2->ambiguous()) {
+ ambiguous2 += it2->length();
+ ++it2;
+ assert(it2 != last2);
+ assert(!it2->ambiguous());
+ }
+
+ if (ambiguous1 > 0 && ambiguous2 > 0) {
+ if (ambiguous1 > ambiguous2) {
+ *out++ = ContigNode(ambiguous2, 'N');
+ ambiguous1 -= ambiguous2;
+ ambiguous2 = 0;
+ } else {
+ *out++ = ContigNode(ambiguous1, 'N');
+ ambiguous2 -= ambiguous1;
+ ambiguous1 = 0;
+ }
+ } else if (ambiguous1 > 0) {
+ ambiguous1 -= getLength(lengths, *it2);
+ *out++ = *it2++;
+ } else if (ambiguous2 > 0) {
+ ambiguous2 -= getLength(lengths, *it1);
+ *out++ = *it1++;
+ } else
+ assert(false);
+
+ if (ambiguous1 == 0 && ambiguous2 == 0)
+ break;
+ if (ambiguous1 < 0 || ambiguous2 < 0)
+ return false;
+ }
+
+ assert(ambiguous1 == 0 || ambiguous2 == 0);
+ int ambiguous = ambiguous1 + ambiguous2;
+ assert(out > result);
+ if (out[-1].ambiguous())
+ assert(ambiguous == 0);
+ else
+ *out++ = ContigNode(max(1, ambiguous), 'N');
+ first1 = it1;
+ first2 = it2;
+ result = out;
+ return true;
+}
+
+/** Align the ambiguous region [it1, it1e) to [it2, it2e) and store
+ * the consensus at out if an alignment is found.
+ * @return true if an alignment is found
+ */
+template <class iterator, class oiterator>
+static bool buildConsensus(const Lengths& lengths,
+ iterator it1, iterator it1e,
+ iterator it2, iterator it2e, oiterator& out)
+{
+ iterator it1b = it1 + 1;
+ assert(!it1b->ambiguous());
+
+ if (it1b == it1e) {
+ // path2 completely fills the gap in path1.
+ out = copy(it2, it2e, out);
+ return true;
+ }
+
+ // The gaps of path1 and path2 overlap.
+ iterator it2a = it2e - 1;
+ if (it2e == it2 || !it2a->ambiguous()) {
+ // The two paths do not agree. No alignment.
+ return false;
+ }
+
+ unsigned ambiguous1 = it1->length();
+ unsigned ambiguous2 = it2a->length();
+ unsigned unambiguous1 = accumulate(it1b, it1e,
+ 0, AddLength(lengths));
+ unsigned unambiguous2 = accumulate(it2, it2a,
+ 0, AddLength(lengths));
+ if (ambiguous1 < unambiguous2
+ || ambiguous2 < unambiguous1) {
+ // Two gaps overlap and either of the gaps is smaller
+ // than the unambiguous sequence that overlaps the
+ // gap. No alignment.
+ return false;
+ }
+
+ unsigned n = max(1U,
+ max(ambiguous2 - unambiguous1,
+ ambiguous1 - unambiguous2));
+ out = copy(it2, it2a, out);
+ *out++ = ContigNode(n, 'N');
+ out = copy(it1b, it1e, out);
+ return true;
+}
+
+/** Align the ambiguous region [it1, last1) to [it2, last2) using it1e
+ * as the seed of the alignment. The end of the alignment is returned
+ * in it1 and it2.
+ * @return true if an alignment is found
+ */
+template <class iterator, class oiterator>
+static bool alignAtSeed(const Lengths& lengths,
+ iterator& it1, iterator it1e, iterator last1,
+ iterator& it2, iterator last2, oiterator& out)
+{
+ assert(it1 != last1);
+ assert(it1->ambiguous());
+ assert(it1 + 1 != last1);
+ assert(!it1e->ambiguous());
+ assert(it2 != last2);
+
+ // Find the best seeded alignment. The best alignment has the
+ // fewest number of contigs in the consensus sequence.
+ unsigned bestLen = UINT_MAX;
+ iterator bestIt2e;
+ for (iterator it2e = it2;
+ (it2e = find(it2e, last2, *it1e)) != last2; ++it2e) {
+ oiterator myOut = out;
+ if (buildConsensus(lengths, it1, it1e, it2, it2e, myOut)
+ && align(lengths, it1e, last1, it2e, last2, myOut)) {
+ unsigned len = myOut - out;
+ if (len <= bestLen) {
+ bestLen = len;
+ bestIt2e = it2e;
+ }
+ }
+ }
+ if (bestLen != UINT_MAX) {
+ bool good = buildConsensus(lengths,
+ it1, it1e, it2, bestIt2e, out);
+ assert(good);
+ it1 = it1e;
+ it2 = bestIt2e;
+ return good;
+ } else
+ return false;
+}
+
+/** Align the ambiguous region [it1, last1) to [it2, last2).
+ * The end of the alignment is returned in it1 and it2.
+ * @return true if an alignment is found
+ */
+template <class iterator, class oiterator>
+static bool alignAmbiguous(const Lengths& lengths,
+ iterator& it1, iterator last1,
+ iterator& it2, iterator last2, oiterator& out)
+{
+ assert(it1 != last1);
+ assert(it1->ambiguous());
+ assert(it1 + 1 != last1);
+ assert(it2 != last2);
+
+ // Find a seed for the alignment.
+ for (iterator it1e = it1; it1e != last1; ++it1e) {
+ if (it1e->ambiguous())
+ continue;
+ if (alignAtSeed(lengths, it1, it1e, last1, it2, last2, out))
+ return true;
+ }
+
+ // No valid seeded alignment. Check whether path2 fits entirely
+ // within the gap of path1.
+ return alignCoordinates(lengths, it1, last1, it2, last2, out);
+}
+
+/** Align the next pair of contigs.
+ * The end of the alignment is returned in it1 and it2.
+ * @return true if an alignment is found
+ */
+template <class iterator, class oiterator>
+static bool alignOne(const Lengths& lengths,
+ iterator& it1, iterator last1,
+ iterator& it2, iterator last2, oiterator& out)
+{
+ // Check for a trivial alignment.
+ unsigned n1 = last1 - it1, n2 = last2 - it2;
+ if (n1 <= n2 && equal(it1, last1, it2)) {
+ // [it1,last1) is a prefix of [it2,last2).
+ out = copy(it1, last1, out);
+ it1 += n1;
+ it2 += n1;
+ assert(it1 == last1);
+ return true;
+ } else if (n2 < n1 && equal(it2, last2, it1)) {
+ // [it2,last2) is a prefix of [it1,last1).
+ out = copy(it2, last2, out);
+ it1 += n2;
+ it2 += n2;
+ assert(it2 == last2);
+ return true;
+ }
+
+ return
+ it1->ambiguous() && it2->ambiguous()
+ ? (it1->length() > it2->length()
+ ? alignAmbiguous(lengths, it1, last1, it2, last2, out)
+ : alignAmbiguous(lengths, it2, last2, it1, last1, out)
+ )
+ : it1->ambiguous()
+ ? alignAmbiguous(lengths, it1, last1, it2, last2, out)
+ : it2->ambiguous()
+ ? alignAmbiguous(lengths, it2, last2, it1, last1, out)
+ : (*out++ = *it1, *it1++ == *it2++);
+}
+
+/** Align the ambiguous region [it1, last1) to [it2, last2)
+ * and store the consensus at out if an alignment is found.
+ * @return the orientation of the alignment if an alignments is found
+ * or zero otherwise
+ */
+template <class iterator, class oiterator>
+static dir_type align(const Lengths& lengths,
+ iterator it1, iterator last1,
+ iterator it2, iterator last2, oiterator& out)
+{
+ assert(it1 != last1);
+ assert(it2 != last2);
+ while (it1 != last1 && it2 != last2)
+ if (!alignOne(lengths, it1, last1, it2, last2, out))
+ return DIR_X;
+ assert(it1 == last1 || it2 == last2);
+ out = copy(it1, last1, out);
+ out = copy(it2, last2, out);
+ return it1 == last1 && it2 == last2 ? DIR_B
+ : it1 == last1 ? DIR_F
+ : it2 == last2 ? DIR_R
+ : DIR_X;
+}
+
+/** Find an equivalent region of the two specified paths, starting the
+ * alignment at pivot1 of path1 and pivot2 of path2.
+ * @param[out] orientation the orientation of the alignment
+ * @return the consensus sequence
+ */
+static ContigPath align(const Lengths& lengths,
+ const ContigPath& p1, const ContigPath& p2,
+ ContigPath::const_iterator pivot1,
+ ContigPath::const_iterator pivot2,
+ dir_type& orientation)
+{
+ assert(*pivot1 == *pivot2);
+ ContigPath::const_reverse_iterator
+ rit1 = ContigPath::const_reverse_iterator(pivot1+1),
+ rit2 = ContigPath::const_reverse_iterator(pivot2+1);
+ ContigPath alignmentr(p1.rend() - rit1 + p2.rend() - rit2);
+ ContigPath::iterator rout = alignmentr.begin();
+ dir_type alignedr = align(lengths,
+ rit1, p1.rend(), rit2, p2.rend(), rout);
+ alignmentr.erase(rout, alignmentr.end());
+
+ ContigPath::const_iterator it1 = pivot1, it2 = pivot2;
+ ContigPath alignmentf(p1.end() - it1 + p2.end() - it2);
+ ContigPath::iterator fout = alignmentf.begin();
+ dir_type alignedf = align(lengths,
+ it1, p1.end(), it2, p2.end(), fout);
+ alignmentf.erase(fout, alignmentf.end());
+
+ ContigPath consensus;
+ if (alignedr != DIR_X && alignedf != DIR_X) {
+ // Found an alignment.
+ assert(!alignmentf.empty());
+ assert(!alignmentr.empty());
+ consensus.reserve(alignmentr.size()-1 + alignmentf.size());
+ consensus.assign(alignmentr.rbegin(), alignmentr.rend()-1);
+ consensus.insert(consensus.end(),
+ alignmentf.begin(), alignmentf.end());
+
+ // Determine the orientation of the alignment.
+ unsigned dirs = alignedr << 2 | alignedf;
+ static const dir_type DIRS[16] = {
+ DIR_X, // 0000 XX impossible
+ DIR_X, // 0001 XF impossible
+ DIR_X, // 0010 XR impossible
+ DIR_X, // 0011 XB impossible
+ DIR_X, // 0100 FX impossible
+ DIR_B, // 0101 FF u is subsumed in v
+ DIR_R, // 0110 FR v->u
+ DIR_R, // 0111 FB v->u
+ DIR_X, // 1000 RX impossible
+ DIR_F, // 1001 RF u->v
+ DIR_B, // 1010 RR v is subsumed in u
+ DIR_F, // 1011 RB u->v
+ DIR_X, // 1100 BX impossible
+ DIR_F, // 1101 BF u->v
+ DIR_R, // 1110 BR v->u
+ DIR_B, // 1111 BB u and v are equal
+ };
+ assert(dirs < 16);
+ orientation = DIRS[dirs];
+ assert(orientation != DIR_X);
+ }
+ return consensus;
+}
+
+/** Return a pivot suitable for aligning the two paths if one exists,
+ * otherwise return false.
+ */
+static pair<ContigNode, bool> findPivot(
+ const ContigPath& path1, const ContigPath& path2)
+{
+ for (ContigPath::const_iterator it = path2.begin();
+ it != path2.end(); ++it) {
+ if (it->ambiguous())
+ continue;
+ if (count(path2.begin(), path2.end(), *it) == 1
+ && count(path1.begin(), path1.end(), *it) == 1)
+ return make_pair(*it, true);
+ }
+ return make_pair(ContigNode(0), false);
+}
+
+/** Find an equivalent region of the two specified paths.
+ * @param[out] orientation the orientation of the alignment
+ * @return the consensus sequence
+ */
+static ContigPath align(const Lengths& lengths,
+ const ContigPath& path1, const ContigPath& path2,
+ ContigNode pivot, dir_type& orientation)
+{
+ if (&path1 == &path2) {
+ // Ignore the trivial alignment when aligning a path to
+ // itself.
+ } else if (path1 == path2) {
+ // These two paths are identical.
+ orientation = DIR_B;
+ return path1;
+ } else {
+ ContigPath::const_iterator it
+ = search(path1.begin(), path1.end(),
+ path2.begin(), path2.end());
+ if (it != path1.end()) {
+ // path2 is subsumed in path1.
+ // Determine the orientation of the edge.
+ orientation
+ = it == path1.begin() ? DIR_R
+ : it + path2.size() == path1.end() ? DIR_F
+ : DIR_B;
+ return path1;
+ }
+ }
+
+ // Find a suitable pivot.
+ if (find(path1.begin(), path1.end(), pivot) == path1.end()
+ || find(path2.begin(), path2.end(), pivot)
+ == path2.end()) {
+ bool good;
+ tie(pivot, good) = findPivot(path1, path2);
+ if (!good)
+ return ContigPath();
+ }
+ assert(find(path1.begin(), path1.end(), pivot) != path1.end());
+
+ ContigPath::const_iterator it2 = find(path2.begin(), path2.end(),
+ pivot);
+ assert(it2 != path2.end());
+ if (&path1 != &path2) {
+ // The seed must be unique in path2, unless we're aligning a
+ // path to itself.
+ assert(count(it2+1, path2.end(), pivot) == 0);
+ }
+
+ ContigPath consensus;
+ for (ContigPath::const_iterator it1 = find_if(
+ path1.begin(), path1.end(),
+ bind2nd(equal_to<ContigNode>(), pivot));
+ it1 != path1.end();
+ it1 = find_if(it1+1, path1.end(),
+ bind2nd(equal_to<ContigNode>(), pivot))) {
+ if (&*it1 == &*it2) {
+ // We are aligning a path to itself, and this is the
+ // trivial alignment, which we'll ignore.
+ continue;
+ }
+ consensus = align(lengths,
+ path1, path2, it1, it2, orientation);
+ if (!consensus.empty())
+ return consensus;
+ }
+ return consensus;
+}
+
+/** Find an equivalent region of the two specified paths.
+ * @return the consensus sequence
+ */
+static ContigPath align(const Lengths& lengths,
+ const ContigPath& path1, const ContigPath& path2,
+ ContigNode pivot)
+{
+ dir_type orientation;
+ return align(lengths, path1, path2, pivot, orientation);
+}
diff --git a/MergePaths/PathConsensus.cpp b/MergePaths/PathConsensus.cpp
new file mode 100644
index 0000000..cbafb7f
--- /dev/null
+++ b/MergePaths/PathConsensus.cpp
@@ -0,0 +1,935 @@
+#include "dialign.h"
+#include "config.h"
+#include "Common/Options.h"
+#include "ConstString.h"
+#include "ContigNode.h"
+#include "ContigPath.h"
+#include "Dictionary.h"
+#include "FastaReader.h"
+#include "IOUtil.h"
+#include "StringUtil.h"
+#include "Uncompress.h"
+#include "alignGlobal.h"
+#include "Graph/ConstrainedSearch.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include "Graph/GraphIO.h"
+#include <algorithm>
+#include <cctype>
+#include <climits>
+#include <cstdlib>
+#include <fstream>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <map>
+#include <set>
+#include <string>
+#include <vector>
+
+using namespace std;
+
+#define PROGRAM "PathConsensus"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman and Rong She.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... FASTA ADJ PATH\n"
+"Align sequences of ambiguous paths and output a consensus\n"
+"sequence.\n"
+" FASTA contigs in FASTA format\n"
+" ADJ contig adjacency graph\n"
+" PATH paths of these contigs\n"
+"\n"
+" Options:\n"
+" -k, --kmer=N k-mer size\n"
+" -d, --dist-error=N acceptable error of a distance estimate\n"
+" default: 6 bp\n"
+" -o, --out=FILE output contig paths to FILE\n"
+" -s, --consensus=FILE output consensus sequences to FILE\n"
+" -g, --graph=FILE output the contig adjacency graph to FILE\n"
+" -a, --branches=N maximum number of sequences to align\n"
+" default: 4\n"
+" -p, --identity=REAL minimum identity, default: 0.9\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+" DIALIGN-TX options:\n"
+" -D, --dialign-d=N dialign debug level, default: 0\n"
+" -M, --dialign-m=FILE score matrix, default: dna_matrix.scr\n"
+" -P, --dialign-p=FILE diagonal length probability distribution\n"
+" default: dna_diag_prob_100_exp_550000\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by ContigProperties
+ static string out;
+ static string consensusPath;
+ static string graphPath;
+ static float identity = 0.9;
+ static unsigned numBranches = 4;
+ static int dialign_debug;
+ static string dialign_score;
+ static string dialign_prob;
+
+ /** Output format. */
+ int format; // used by ContigProperties
+
+ /** The the number of bases to continue the constrained search of
+ * the graph beyond the size of the ambiguous gap in the path.
+ */
+ unsigned distanceError = 6;
+}
+
+static const char shortopts[] = "d:k:o:s:g:a:p:vD:M:P:";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "kmer", required_argument, NULL, 'k' },
+ { "dist-error", required_argument, NULL, 'd' },
+ { "out", required_argument, NULL, 'o' },
+ { "consensus", required_argument, NULL, 's' },
+ { "graph", required_argument, NULL, 'g' },
+ { "branches", required_argument, NULL, 'a' },
+ { "identity", required_argument, NULL, 'p' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { "dialign-d", required_argument, NULL, 'D' },
+ { "dialign-m", required_argument, NULL, 'M' },
+ { "dialign-p", required_argument, NULL, 'P' },
+ { NULL, 0, NULL, 0 }
+};
+
+static struct {
+ unsigned numAmbPaths;
+ unsigned numMerged;
+ unsigned numNoSolutions;
+ unsigned numTooManySolutions;
+ unsigned tooComplex;
+ unsigned notMerged;
+} stats;
+
+struct AmbPathConstraint {
+ ContigNode source;
+ ContigNode dest;
+ int dist;
+
+ AmbPathConstraint(const ContigNode& src, const ContigNode& dst,
+ int d)
+ : source(src), dest(dst), dist(d) {}
+
+ bool operator ==(const AmbPathConstraint& a) const
+ {
+ return source == a.source && dest == a.dest
+ && dist == a.dist;
+ }
+
+ bool operator <(const AmbPathConstraint& a) const
+ {
+ return source < a.source
+ || (source == a.source && dest < a.dest)
+ || (source == a.source && dest == a.dest
+ && dist < a.dist);
+ }
+};
+
+typedef ContigPath Path;
+typedef vector<Path> ContigPaths;
+typedef map<AmbPathConstraint, ContigPath> AmbPath2Contig;
+
+typedef vector<const_string> Contigs;
+static Contigs g_contigs;
+AmbPath2Contig g_ambpath_contig;
+
+/** Return the sequence of the specified contig node. The sequence
+ * may be ambiguous or reverse complemented.
+ */
+static const Sequence getSequence(ContigNode id)
+{
+ if (id.ambiguous()) {
+ string s(id.ambiguousSequence());
+ if (s.length() < opt::k)
+ transform(s.begin(), s.end(), s.begin(), ::tolower);
+ return string(opt::k - 1, 'N') + s;
+ } else {
+ string seq(g_contigs[id.id()]);
+ return id.sense() ? reverseComplement(seq) : seq;
+ }
+}
+
+/** Return the distance from vertex u to v. */
+static int getDistance(const Graph& g,
+ graph_traits<Graph>::vertex_descriptor u,
+ graph_traits<Graph>::vertex_descriptor v)
+{
+ typedef graph_traits<Graph>::edge_descriptor E;
+ pair<E, bool> e = edge(u, v, g);
+ assert(e.second);
+ return g[e.first].distance;
+}
+
+/** Read contig paths from the specified file.
+ * @param[in] inPath the filename of the contig paths
+ * @param[out] ids the string ID of the paths
+ * @param[out] isAmb whether the path contains a gap
+ */
+static ContigPaths readPaths(const string& inPath,
+ vector<string>& ids, vector<bool>& isAmb)
+{
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ assert(ids.empty());
+ assert(isAmb.empty());
+ assert(g_ambpath_contig.empty());
+ ifstream fin(inPath.c_str());
+ if (opt::verbose > 0)
+ cerr << "Reading `" << inPath << "'..." << endl;
+ if (inPath != "-")
+ assert_good(fin, inPath);
+ istream& in = inPath == "-" ? cin : fin;
+
+ ContigPaths paths;
+ string id;
+ Path path;
+ while (in >> id >> path) {
+ paths.push_back(path);
+ ids.push_back(id);
+ isAmb.push_back(false);
+
+ if (path.size() <= 2)
+ continue;
+ for (Path::iterator it = path.begin() + 2;
+ it != path.end(); ++it) {
+ ContigPath::value_type t = it[-2], u = it[-1], v = it[0];
+ if (u.ambiguous()) {
+ assert(!t.ambiguous());
+ assert(!v.ambiguous());
+ g_ambpath_contig.insert(AmbPath2Contig::value_type(
+ AmbPathConstraint(t, v, u.length()),
+ ContigPath()));
+ isAmb.back() = true;
+ }
+ }
+ }
+ assert(in.eof());
+ return paths;
+}
+
+/** Mark every contig in path as seen. */
+static void markSeen(vector<bool>& seen, const ContigPath& path,
+ bool flag)
+{
+ for (Path::const_iterator it = path.begin();
+ it != path.end(); ++it)
+ if (!it->ambiguous() && it->id() < seen.size())
+ seen[it->id()] = flag;
+}
+
+/** Mark every contig in paths as seen. */
+static void markSeen(vector<bool>& seen, const vector<Path>& paths,
+ bool flag)
+{
+ for (vector<Path>::const_iterator it = paths.begin();
+ it != paths.end(); ++it)
+ markSeen(seen, *it, flag);
+}
+
+/** A new vertex and two edges that will be added to the graph. */
+struct NewVertex
+{
+ typedef graph_traits<Graph>::vertex_descriptor V;
+ typedef vertex_property<Graph>::type VP;
+ typedef edge_property<Graph>::type EP;
+ V t, u, v;
+ VP vpu;
+ EP eptu, epuv;
+ NewVertex(V t, V u, V v, const VP& vpu,
+ const EP& eptu, const EP& epuv)
+ : t(t), u(u), v(v), vpu(vpu), eptu(eptu), epuv(epuv) { }
+};
+typedef vector<NewVertex> NewVertices;
+
+/** The new vertices that will be added to the graph. */
+static NewVertices g_newVertices;
+
+/** Output a new contig. */
+static ContigNode outputNewContig(const Graph& g,
+ const vector<Path>& solutions,
+ size_t longestPrefix, size_t longestSuffix,
+ const Sequence& seq, const unsigned coverage,
+ ofstream& out)
+{
+ assert(!solutions.empty());
+ assert(longestPrefix > 0);
+ assert(longestSuffix > 0);
+
+ size_t numContigs = num_vertices(g) / 2;
+ ContigNode u(numContigs + g_newVertices.size(), false);
+ string name = createContigName();
+ put(vertex_name, g, u, name);
+ out << '>' << name
+ << ' ' << seq.length() << ' ' << coverage << ' ';
+
+ int dtu = INT_MAX, duv = INT_MAX;
+ for (vector<Path>::const_iterator it = solutions.begin();
+ it != solutions.end(); it++) {
+ if (it != solutions.begin())
+ out << ';';
+ const ContigPath& path = *it;
+ ContigPath::const_iterator
+ first = path.begin() + longestPrefix,
+ last = path.end() - longestSuffix;
+ assert(first <= last);
+ if (first < last) {
+ ContigPath::const_iterator it = first;
+ out << get(vertex_name, g, *it);
+ for (++it; it != last; ++it)
+ out << ',' << get(vertex_name, g, *it);
+ dtu = min(dtu, getDistance(g, first[-1], first[0]));
+ duv = min(duv, getDistance(g, last[-1], last[0]));
+ } else
+ out << '*';
+ }
+ out << '\n' << seq << '\n';
+ assert(dtu < INT_MAX);
+ assert(duv < INT_MAX);
+
+ // Record the newly-created contig to be added to the graph later.
+ g_newVertices.push_back(NewVertex(
+ *(solutions[0].begin() + longestPrefix - 1),
+ u,
+ *(solutions[0].rbegin() + longestSuffix - 1),
+ ContigProperties(seq.length(), coverage),
+ dtu, duv));
+ return u;
+}
+
+/** Return a consensus sequence of a and b.
+ * @return an empty string if a consensus could not be found
+ */
+static string createConsensus(const Sequence& a, const Sequence& b)
+{
+ assert(a.length() == b.length());
+ if (a == b)
+ return a;
+ string s;
+ s.reserve(a.length());
+ for (string::const_iterator ita = a.begin(), itb = b.begin();
+ ita != a.end(); ++ita, ++itb) {
+ bool mask = islower(*ita) || islower(*itb);
+ char ca = toupper(*ita), cb = toupper(*itb);
+ char c = ca == cb ? ca
+ : ca == 'N' ? cb
+ : cb == 'N' ? ca
+ : 'x';
+ if (c == 'x')
+ return string("");
+ s += mask ? tolower(c) : c;
+ }
+ return s;
+}
+
+/** Merge the specified two contigs, default overlap is k-1,
+ * generate a consensus sequence of the overlapping region. The result
+ * is stored in the first argument.
+ */
+static void mergeContigs(const Graph& g,
+ unsigned overlap, Sequence& seq,
+ const Sequence& s, const ContigNode& node, const Path& path)
+{
+ assert(s.length() > overlap);
+ Sequence ao;
+ Sequence bo(s, 0, overlap);
+ Sequence o;
+ do {
+ assert(seq.length() > overlap);
+ ao = seq.substr(seq.length() - overlap);
+ o = createConsensus(ao, bo);
+ } while (o.empty() && chomp(seq, 'n'));
+ if (o.empty()) {
+ cerr << "warning: the head of "
+ << get(vertex_name, g, node)
+ << " does not match the tail of the previous contig\n"
+ << ao << '\n' << bo << '\n' << path << endl;
+ seq += 'n';
+ seq += s;
+ } else {
+ seq.resize(seq.length() - overlap);
+ seq += o;
+ seq += Sequence(s, overlap);
+ }
+}
+
+static Sequence mergePath(const Graph&g, const Path& path)
+{
+ Sequence seq;
+ Path::const_iterator prev_it;
+ for (Path::const_iterator it = path.begin();
+ it != path.end(); ++it) {
+ if (seq.empty()) {
+ seq = getSequence(*it);
+ } else {
+ int d = get(edge_bundle, g, *(it-1), *it).distance;
+ assert(d < 0);
+ unsigned overlap = -d;
+ mergeContigs(g, overlap, seq,
+ getSequence(*it), *it, path);
+ }
+ prev_it = it;
+ }
+ return seq;
+}
+
+/** Calculate the ContigProperties of a path. */
+static ContigProperties calculatePathProperties(const Graph& g,
+ const ContigPath& path)
+{
+ return addProp(g, path.begin(), path.end());
+}
+
+/* Resolve ambiguous region using pairwise alignment
+ * (Needleman-Wunsch) ('solutions' contain exactly two paths, from a
+ * source contig to a dest contig)
+ */
+static ContigPath alignPair(const Graph& g,
+ const ContigPaths& solutions, ofstream& out)
+{
+ assert(solutions.size() == 2);
+ assert(solutions[0].size() > 1);
+ assert(solutions[1].size() > 1);
+ assert(solutions[0].front() == solutions[1].front());
+ assert(solutions[0].back() == solutions[1].back());
+ ContigPath fstSol(solutions[0].begin()+1, solutions[0].end()-1);
+ ContigPath sndSol(solutions[1].begin()+1, solutions[1].end()-1);
+
+ if (fstSol.empty() || sndSol.empty()) {
+ // This entire sequence may be deleted.
+ const ContigPath& sol(fstSol.empty() ? sndSol : fstSol);
+ assert(!sol.empty());
+ Sequence consensus(mergePath(g, sol));
+ assert(consensus.size() > opt::k - 1);
+ string::iterator first = consensus.begin() + opt::k - 1;
+ transform(first, consensus.end(), first, ::tolower);
+
+ unsigned match = opt::k - 1;
+ float identity = (float)match / consensus.size();
+ if (opt::verbose > 2)
+ cerr << consensus << '\n';
+ if (opt::verbose > 1)
+ cerr << identity
+ << (identity < opt::identity ? " (too low)\n" : "\n");
+ if (identity < opt::identity)
+ return ContigPath();
+
+ unsigned coverage = calculatePathProperties(g, sol).coverage;
+ ContigNode u = outputNewContig(g,
+ solutions, 1, 1, consensus, coverage, out);
+ ContigPath path;
+ path.push_back(solutions.front().front());
+ path.push_back(u);
+ path.push_back(solutions.front().back());
+ return path;
+ }
+
+ Sequence fstPathContig(mergePath(g, fstSol));
+ Sequence sndPathContig(mergePath(g, sndSol));
+ if (fstPathContig == sndPathContig) {
+ // These two paths have identical sequence.
+ if (fstSol.size() == sndSol.size()) {
+ // A perfect match must be caused by palindrome.
+ typedef ContigPath::const_iterator It;
+ pair<It, It> it = mismatch(
+ fstSol.begin(), fstSol.end(), sndSol.begin());
+ assert(it.first != fstSol.end());
+ assert(it.second != sndSol.end());
+ assert(*it.first
+ == get(vertex_complement, g, *it.second));
+ assert(equal(it.first+1, It(fstSol.end()), it.second+1));
+ if (opt::verbose > 1)
+ cerr << "Palindrome: "
+ << get(vertex_contig_name, g, *it.first) << '\n';
+ return solutions[0];
+ } else {
+ // The paths are different lengths.
+ cerr << PROGRAM ": warning: "
+ "Two paths have identical sequence, which may be "
+ "caused by a transitive edge in the overlap graph.\n"
+ << '\t' << fstSol << '\n'
+ << '\t' << sndSol << '\n';
+ return solutions[fstSol.size() > sndSol.size() ? 0 : 1];
+ }
+ }
+
+ unsigned minLength = min(
+ fstPathContig.length(), sndPathContig.length());
+ unsigned maxLength = max(
+ fstPathContig.length(), sndPathContig.length());
+ float lengthRatio = (float)minLength / maxLength;
+ if (lengthRatio < opt::identity) {
+ if (opt::verbose > 1)
+ cerr << minLength << '\t' << maxLength
+ << '\t' << lengthRatio << "\t(different length)\n";
+ return ContigPath();
+ }
+
+ NWAlignment align;
+ unsigned match = alignGlobal(fstPathContig, sndPathContig,
+ align);
+ float identity = (float)match / align.size();
+ if (opt::verbose > 2)
+ cerr << align;
+ if (opt::verbose > 1)
+ cerr << identity
+ << (identity < opt::identity ? " (too low)\n" : "\n");
+ if (identity < opt::identity)
+ return ContigPath();
+
+ unsigned coverage = calculatePathProperties(g, fstSol).coverage
+ + calculatePathProperties(g, sndSol).coverage;
+ ContigNode u = outputNewContig(g, solutions, 1, 1,
+ align.consensus(), coverage, out);
+ ContigPath path;
+ path.push_back(solutions.front().front());
+ path.push_back(u);
+ path.push_back(solutions.front().back());
+ return path;
+}
+
+/* Resolve ambiguous region using multiple alignment of all paths in
+ * `solutions'.
+ */
+static ContigPath alignMulti(const Graph& g,
+ const vector<Path>& solutions, ofstream& out)
+{
+ // Find the size of the smallest path.
+ const Path& firstSol = solutions.front();
+ size_t min_len = firstSol.size();
+ for (vector<Path>::const_iterator it = solutions.begin() + 1;
+ it != solutions.end(); ++it)
+ min_len = min(min_len, it->size());
+
+ // Find the longest prefix.
+ Path vppath;
+ size_t longestPrefix;
+ bool commonPrefix = true;
+ for (longestPrefix = 0;
+ longestPrefix < min_len; longestPrefix++) {
+ const ContigNode& common_path_node = firstSol[longestPrefix];
+ for (vector<Path>::const_iterator solIter = solutions.begin();
+ solIter != solutions.end(); ++solIter) {
+ const ContigNode& pathnode = (*solIter)[longestPrefix];
+ if (pathnode != common_path_node) {
+ // Found the longest prefix.
+ commonPrefix = false;
+ break;
+ }
+ }
+ if (!commonPrefix)
+ break;
+ vppath.push_back(common_path_node);
+ }
+
+ // Find the longest suffix.
+ Path vspath;
+ size_t longestSuffix;
+ bool commonSuffix = true;
+ for (longestSuffix = 0; longestSuffix < min_len-longestPrefix;
+ longestSuffix++) {
+ const ContigNode& common_path_node
+ = firstSol[firstSol.size()-longestSuffix-1];
+ for (vector<Path>::const_iterator solIter = solutions.begin();
+ solIter != solutions.end(); ++solIter) {
+ const ContigNode& pathnode
+ = (*solIter)[solIter->size()-longestSuffix-1];
+ if (pathnode != common_path_node) {
+ // Found the longest suffix.
+ commonSuffix = false;
+ break;
+ }
+ }
+ if (!commonSuffix)
+ break;
+ vspath.push_back(common_path_node);
+ }
+ reverse(vspath.begin(), vspath.end());
+
+ if (opt::verbose > 1 && vppath.size() + vspath.size() > 2)
+ cerr << vppath << " * " << vspath << '\n';
+
+ // Get sequence of ambiguous region in paths
+ assert(longestPrefix > 0 && longestSuffix > 0);
+ vector<Sequence> amb_seqs;
+ unsigned coverage = 0;
+ for (vector<Path>::const_iterator solIter = solutions.begin();
+ solIter != solutions.end(); solIter++) {
+ assert(longestPrefix + longestSuffix <= solIter->size());
+ Path path(solIter->begin() + longestPrefix,
+ solIter->end() - longestSuffix);
+ if (!path.empty()) {
+ amb_seqs.push_back(mergePath(g, path));
+ coverage += calculatePathProperties(g, path).coverage;
+ } else {
+ // The prefix and suffix paths overlap by k-1 bp.
+ Sequence s = getSequence(solutions[0][longestPrefix-1]);
+ amb_seqs.push_back(s.substr(s.length() - opt::k + 1));
+ }
+ }
+
+ vector<unsigned> lengths(amb_seqs.size());
+ transform(amb_seqs.begin(), amb_seqs.end(), lengths.begin(),
+ mem_fun_ref(&string::length));
+ unsigned minLength = *min_element(lengths.begin(), lengths.end());
+ unsigned maxLength = *max_element(lengths.begin(), lengths.end());
+ float lengthRatio = (float)minLength / maxLength;
+ if (lengthRatio < opt::identity) {
+ if (opt::verbose > 1)
+ cerr << minLength << '\t' << maxLength
+ << '\t' << lengthRatio << "\t(different length)\n";
+ return ContigPath();
+ }
+
+ string alignment;
+ unsigned matches;
+ Sequence consensus = dialign(amb_seqs, alignment, matches);
+ if (opt::verbose > 2)
+ cerr << alignment << consensus << '\n';
+ float identity = (float)matches / consensus.size();
+ if (opt::verbose > 1)
+ cerr << identity
+ << (identity < opt::identity ? " (too low)\n" : "\n");
+ if (identity < opt::identity)
+ return ContigPath();
+
+ if (identity == 1) {
+ // A perfect match must be caused by two palindromes.
+ ContigID palindrome0
+ = solutions[0][longestPrefix].contigIndex();
+ ContigID palindrome1
+ = solutions[0].rbegin()[longestSuffix].contigIndex();
+ if (opt::verbose > 1)
+ cerr << "Palindrome: "
+ << get(g_contigNames, palindrome0) << '\n'
+ << "Palindrome: "
+ << get(g_contigNames, palindrome1) << '\n';
+#ifndef NDEBUG
+ string s0 = getSequence(ContigNode(palindrome0, false));
+ string s1 = getSequence(ContigNode(palindrome1, false));
+ assert(s0 == reverseComplement(s0));
+ assert(s1 == reverseComplement(s1));
+ for (vector<Path>::const_iterator it = solutions.begin();
+ it != solutions.end(); ++it) {
+ const ContigPath& path = *it;
+ assert(path[longestPrefix].contigIndex() == palindrome0);
+ assert(path.rbegin()[longestSuffix].contigIndex()
+ == palindrome1);
+ assert(path.size() == solutions[0].size());
+ }
+#endif
+ return solutions[0];
+ }
+
+ ContigNode u = outputNewContig(g, solutions,
+ longestPrefix, longestSuffix, consensus, coverage, out);
+ ContigPath path(vppath);
+ path.push_back(u);
+ path.insert(path.end(), vspath.begin(), vspath.end());
+ return path;
+}
+
+/** Align the sequences of the specified paths.
+ * @return the consensus sequence
+ */
+static ContigPath align(const Graph& g, const vector<Path>& sequences,
+ ofstream& out)
+{
+ assert(sequences.size() > 1);
+ return sequences.size() == 2
+ ? alignPair(g, sequences, out)
+ : alignMulti(g, sequences, out);
+}
+
+/** Return the consensus sequence of the specified gap. */
+static ContigPath fillGap(const Graph& g,
+ const AmbPathConstraint& apConstraint,
+ vector<bool>& seen,
+ ofstream& outFasta)
+{
+ if (opt::verbose > 1)
+ cerr << "\n* "
+ << get(vertex_name, g, apConstraint.source) << ' '
+ << apConstraint.dist << "N "
+ << get(vertex_name, g, apConstraint.dest) << '\n';
+
+ Constraints constraints;
+ constraints.push_back(Constraint(apConstraint.dest,
+ apConstraint.dist + opt::distanceError));
+
+ ContigPaths solutions;
+ unsigned numVisited = 0;
+ constrainedSearch(g, apConstraint.source,
+ constraints, solutions, numVisited);
+ bool tooComplex = numVisited >= opt::maxCost;
+
+ for (ContigPaths::iterator solIt = solutions.begin();
+ solIt != solutions.end(); solIt++)
+ solIt->insert(solIt->begin(), apConstraint.source);
+
+ ContigPath consensus;
+ bool tooManySolutions = solutions.size() > opt::numBranches;
+ if (tooComplex) {
+ stats.tooComplex++;
+ if (opt::verbose > 1)
+ cerr << solutions.size() << " paths (too complex)\n";
+ } else if (tooManySolutions) {
+ stats.numTooManySolutions++;
+ if (opt::verbose > 1)
+ cerr << solutions.size() << " paths (too many)\n";
+ } else if (solutions.empty()) {
+ stats.numNoSolutions++;
+ if (opt::verbose > 1)
+ cerr << "no paths\n";
+ } else if (solutions.size() == 1) {
+ if (opt::verbose > 1)
+ cerr << "1 path\n" << solutions.front() << '\n';
+ stats.numMerged++;
+ } else {
+ assert(solutions.size() > 1);
+ if (opt::verbose > 2)
+ copy(solutions.begin(), solutions.end(),
+ ostream_iterator<ContigPath>(cerr, "\n"));
+ else if (opt::verbose > 1)
+ cerr << solutions.size() << " paths\n";
+ consensus = align(g, solutions, outFasta);
+ if (!consensus.empty()) {
+ stats.numMerged++;
+ // Mark contigs that are used in a consensus.
+ markSeen(seen, solutions, true);
+ if (opt::verbose > 1)
+ cerr << consensus << '\n';
+ } else
+ stats.notMerged++;
+ }
+ return consensus;
+}
+
+int main(int argc, char** argv)
+{
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'd': arg >> opt::distanceError; break;
+ case 'k': arg >> opt::k; break;
+ case 'o': arg >> opt::out; break;
+ case 'p': arg >> opt::identity; break;
+ case 'a': arg >> opt::numBranches; break;
+ case 's': arg >> opt::consensusPath; break;
+ case 'g': arg >> opt::graphPath; break;
+ case 'D': arg >> opt::dialign_debug; break;
+ case 'M': arg >> opt::dialign_score; break;
+ case 'P': arg >> opt::dialign_prob; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (opt::out.empty()) {
+ cerr << PROGRAM ": " << "missing -o,--out option\n";
+ die = true;
+ }
+
+ if (opt::consensusPath.empty()) {
+ cerr << PROGRAM ": " << "missing -s,--consensus option\n";
+ die = true;
+ }
+
+ if (argc - optind < 3) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ const char *contigFile = argv[optind++];
+ string adjFile(argv[optind++]);
+ string allPaths(argv[optind++]);
+
+ // Read the contig overlap graph.
+ if (opt::verbose > 0)
+ cerr << "Reading `" << adjFile << "'..." << endl;
+ ifstream fin(adjFile.c_str());
+ assert_good(fin, adjFile);
+ Graph g;
+ fin >> g;
+ assert(fin.eof());
+ g_contigNames.lock();
+
+ // Read contigs
+ Contigs& contigs = g_contigs;
+ {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << contigFile << "'..." << endl;
+ FastaReader in(contigFile, FastaReader::NO_FOLD_CASE);
+ for (FastaRecord rec; in >> rec;) {
+ assert(contigs.size() == get(g_contigNames, rec.id));
+ contigs.push_back(rec.seq);
+ }
+ assert(in.eof());
+ assert(!contigs.empty());
+ opt::colourSpace = isdigit(contigs[0][0]);
+ }
+
+ vector<string> pathIDs;
+ vector<bool> isAmbPath;
+ ContigPaths paths = readPaths(allPaths, pathIDs, isAmbPath);
+ stats.numAmbPaths = g_ambpath_contig.size();
+ if (opt::verbose > 0)
+ cerr << "Read " << paths.size() << " paths\n";
+
+ // Start numbering new contigs from the last
+ if (!pathIDs.empty())
+ setNextContigName(pathIDs.back());
+
+ // Prepare output fasta file
+ ofstream fa(opt::consensusPath.c_str());
+ assert_good(fa, opt::consensusPath);
+
+ init_parameters();
+ set_parameters_dna();
+ para->DEBUG = opt::dialign_debug;
+ para->SCR_MATRIX_FILE_NAME = (char*)opt::dialign_score.c_str();
+ para->DIAG_PROB_FILE_NAME = (char*)opt::dialign_prob.c_str();
+ initDialign();
+
+ // Contigs that were seen in a consensus.
+ vector<bool> seen(contigs.size());
+
+ // resolve ambiguous paths recorded in g_ambpath_contig
+ g_contigNames.unlock();
+ for (AmbPath2Contig::iterator ambIt = g_ambpath_contig.begin();
+ ambIt != g_ambpath_contig.end(); ambIt++)
+ ambIt->second = fillGap(g, ambIt->first, seen, fa);
+ g_contigNames.lock();
+ assert_good(fa, opt::consensusPath);
+ fa.close();
+ if (opt::verbose > 1)
+ cerr << '\n';
+
+ // Unmark contigs that are used in a path.
+ for (AmbPath2Contig::iterator it = g_ambpath_contig.begin();
+ it != g_ambpath_contig.end(); it++)
+ markSeen(seen, it->second, false);
+ markSeen(seen, paths, false);
+
+ ofstream out(opt::out.c_str());
+ assert_good(out, opt::out);
+
+ // Output those contigs that were not seen in ambiguous path.
+ for (unsigned id = 0; id < contigs.size(); ++id)
+ if (seen[id])
+ out << get(g_contigNames, id) << '\n';
+
+ for (ContigPaths::const_iterator path = paths.begin();
+ path != paths.end(); ++path) {
+ unsigned i = path - paths.begin();
+ if (!isAmbPath[i]) {
+ out << pathIDs[i] << '\t' << *path << '\n';
+ continue;
+ }
+
+ assert(path->size() > 2);
+ Path cur_path;
+ cur_path.push_back(path->front());
+ for (Path::const_iterator prev = path->begin(),
+ it = path->begin() + 1, next = path->begin() + 2;
+ it != path->end(); ++prev, ++it, ++next) {
+ if (!it->ambiguous()) {
+ cur_path.push_back(*it);
+ continue;
+ }
+
+ //replace Ns by resolved new contig
+ assert(next != path->end());
+ AmbPath2Contig::iterator ambIt = g_ambpath_contig.find(
+ AmbPathConstraint(*prev, *next, -it->id()));
+ assert(ambIt != g_ambpath_contig.end());
+ const ContigPath& solution = ambIt->second;
+ if (!solution.empty()) {
+ assert(solution.size() > 1);
+ cur_path.insert(cur_path.end(),
+ solution.begin() + 1, solution.end() - 1);
+ } else
+ cur_path.push_back(*it);
+ }
+ out << pathIDs[i] << '\t' << cur_path << '\n';
+ }
+ assert_good(out, opt::out);
+ out.close();
+
+ free_prob_dist(pdist);
+ free(para);
+
+ cerr <<
+ "Ambiguous paths: " << stats.numAmbPaths << "\n"
+ "Merged: " << stats.numMerged << "\n"
+ "No paths: " << stats.numNoSolutions << "\n"
+ "Too many paths: " << stats.numTooManySolutions << "\n"
+ "Too complex: " << stats.tooComplex << "\n"
+ "Dissimilar: " << stats.notMerged << "\n";
+
+ if (!opt::graphPath.empty()) {
+ ofstream fout(opt::graphPath.c_str());
+ assert_good(fout, opt::graphPath);
+
+ // Add the newly-created consensus contigs to the graph.
+ for (NewVertices::const_iterator it = g_newVertices.begin();
+ it != g_newVertices.end(); ++it) {
+ Graph::vertex_descriptor u = add_vertex(it->vpu, g);
+ assert(u == it->u);
+ add_edge(it->t, it->u, it->eptu, g);
+ add_edge(it->u, it->v, it->epuv, g);
+ }
+ write_graph(fout, g, PROGRAM, commandLine);
+ assert_good(fout, opt::graphPath);
+ }
+
+ return 0;
+}
diff --git a/Overlap/Makefile.am b/Overlap/Makefile.am
new file mode 100644
index 0000000..3d6fd5f
--- /dev/null
+++ b/Overlap/Makefile.am
@@ -0,0 +1,13 @@
+bin_PROGRAMS = Overlap
+
+Overlap_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+Overlap_LDADD = \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+Overlap_SOURCES = \
+ Overlap.cpp
diff --git a/Overlap/Makefile.in b/Overlap/Makefile.in
new file mode 100644
index 0000000..c24e091
--- /dev/null
+++ b/Overlap/Makefile.in
@@ -0,0 +1,531 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = Overlap$(EXEEXT)
+subdir = Overlap
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_Overlap_OBJECTS = Overlap-Overlap.$(OBJEXT)
+Overlap_OBJECTS = $(am_Overlap_OBJECTS)
+Overlap_DEPENDENCIES = $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(Overlap_SOURCES)
+DIST_SOURCES = $(Overlap_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+Overlap_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+Overlap_LDADD = \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Common/libcommon.a
+
+Overlap_SOURCES = \
+ Overlap.cpp
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Overlap/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Overlap/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+Overlap$(EXEEXT): $(Overlap_OBJECTS) $(Overlap_DEPENDENCIES) $(EXTRA_Overlap_DEPENDENCIES)
+ @rm -f Overlap$(EXEEXT)
+ $(CXXLINK) $(Overlap_OBJECTS) $(Overlap_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/Overlap-Overlap.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+Overlap-Overlap.o: Overlap.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(Overlap_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Overlap-Overlap.o -MD -MP -MF $(DEPDIR)/Overlap-Overlap.Tpo -c -o Overlap-Overlap.o `test -f 'Overlap.cpp' || echo '$(srcdir)/'`Overlap.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/Overlap-Overlap.Tpo $(DEPDIR)/Overlap-Overlap.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Overlap.cpp' object='Overlap-Overlap.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(Overlap_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Overlap-Overlap.o `test -f 'Overlap.cpp' || echo '$(srcdir)/'`Overlap.cpp
+
+Overlap-Overlap.obj: Overlap.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(Overlap_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT Overlap-Overlap.obj -MD -MP -MF $(DEPDIR)/Overlap-Overlap.Tpo -c -o Overlap-Overlap.obj `if test -f 'Overlap.cpp'; then $(CYGPATH_W) 'Overlap.cpp'; else $(CYGPATH_W) '$(srcdir)/Overlap.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/Overlap-Overlap.Tpo $(DEPDIR)/Overlap-Overlap.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Overlap.cpp' object='Overlap-Overlap.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(Overlap_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o Overlap-Overlap.obj `if test -f 'Overlap.cpp'; then $(CYGPATH_W) 'Overlap.cpp'; else $(CYGPATH_W) '$(srcdir)/Overlap.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Overlap/Overlap.cpp b/Overlap/Overlap.cpp
new file mode 100644
index 0000000..9695dc2
--- /dev/null
+++ b/Overlap/Overlap.cpp
@@ -0,0 +1,572 @@
+/**
+ * Find contigs that overlap and end due to a lack of coverage.
+ * Written by Shaun Jackman <sjackman at bcgsc.ca>.
+ */
+
+#include "config.h"
+#include "Common/Options.h"
+#include "ContigProperties.h"
+#include "Estimate.h"
+#include "FastaReader.h"
+#include "IOUtil.h"
+#include "Uncompress.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/GraphIO.h"
+#include "Graph/GraphUtil.h"
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/ref.hpp>
+#include <algorithm>
+#include <cassert>
+#include <cctype>
+#include <climits> // for UINT_MAX
+#include <cstdlib>
+#include <fstream>
+#include <getopt.h>
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <vector>
+
+using namespace std;
+using namespace boost::lambda;
+#if !__GXX_EXPERIMENTAL_CXX0X__
+using boost::cref;
+using boost::ref;
+#endif
+
+#define PROGRAM "Overlap"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... CONTIGS ADJ DIST\n"
+"Find overlaps between blunt contigs that have negative distance\n"
+"estimates. Add edges to the overlap graph.\n"
+"\n"
+" -k, --kmer=KMER_SIZE k-mer size\n"
+" -m, --min=OVERLAP require a minimum of OVERLAP bases\n"
+" default is 5 bases\n"
+" --scaffold join contigs with Ns [default]\n"
+" --no-scaffold do not scaffold\n"
+" --mask-repeat join contigs at a simple repeat and mask\n"
+" the repeat sequence [default]\n"
+" --no-merge-repeat don't join contigs at a repeat\n"
+" -g, --graph=FILE write the contig adjacency graph to FILE\n"
+" -o, --out=FILE write result to FILE\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by ContigGraph
+ static unsigned minimum_overlap = 5;
+ static int mask = 1;
+ static int scaffold = 1;
+
+ /** The acceptable error of a distance estimate. */
+ unsigned distanceError = 6;
+
+ /** Write the contig adjacency graph to this file. */
+ static string graphPath;
+
+ /** Write the new contigs to this file. */
+ static string out;
+
+ /** Output format */
+ int format = ADJ; // used by ContigProperties
+}
+
+static const char shortopts[] = "g:k:m:o:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "kmer", required_argument, NULL, 'k' },
+ { "min", required_argument, NULL, 'm' },
+ { "scaffold", no_argument, &opt::scaffold, 1 },
+ { "no-scaffold", no_argument, &opt::scaffold, 0 },
+ { "mask-repeat", no_argument, &opt::mask, 1 },
+ { "no-merge-repeat", no_argument, &opt::mask, 0 },
+ { "out", required_argument, NULL, 'o' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** Contig sequences. */
+static vector<string> g_contigs;
+
+/** Contig adjacency graph. */
+typedef ContigGraph<DirectedGraph<ContigProperties, Distance> > Graph;
+
+static struct {
+ unsigned overlap;
+ unsigned scaffold;
+ unsigned none;
+ unsigned tooshort;
+ unsigned homopolymer;
+ unsigned motif;
+ unsigned ambiguous;
+} stats;
+
+/** Return the sequence of the specified contig. */
+static string sequence(const ContigNode& id)
+{
+ const string& seq = g_contigs[id.id()];
+ return id.sense() ? reverseComplement(seq) : seq;
+}
+
+static unsigned findOverlap(const Graph& g,
+ const ContigNode& t_id,
+ const ContigNode& h_id,
+ bool& mask)
+{
+ mask = false;
+ string t = sequence(t_id);
+ string h = sequence(h_id);
+ unsigned len = min(t.length(), h.length());
+ vector<unsigned> overlaps;
+ overlaps.reserve(len);
+ for (unsigned overlap = len; overlap >= 1; overlap--) {
+ if (t.substr(t.length()-overlap, overlap)
+ == h.substr(0, overlap))
+ overlaps.push_back(overlap);
+ }
+
+ if (opt::verbose > 0) {
+ cout << get(vertex_name, g, t_id)
+ << '\t' << get(vertex_name, g, h_id);
+ for (vector<unsigned>::const_iterator i = overlaps.begin();
+ i != overlaps.end(); ++i)
+ cout << '\t' << *i;
+ cout << '\n';
+ }
+
+ if (overlaps.empty()) {
+ stats.none++;
+ return 0;
+ }
+
+ if (overlaps[0] < opt::minimum_overlap) {
+ stats.tooshort++;
+ return 0;
+ }
+
+ if (overlaps.size() >= 3
+ && overlaps[0]-overlaps[1] == overlaps[1]-overlaps[2]) {
+ // Homopolymer run or motif.
+ if (overlaps[0]-overlaps[1] == 1)
+ stats.homopolymer++;
+ else
+ stats.motif++;
+ mask = true;
+ }
+
+ return overlaps[0];
+}
+
+static FastaRecord newContig(const Graph& g,
+ const ContigNode& t, const ContigNode& v,
+ int dist, const string& seq)
+{
+ ostringstream comment;
+ comment << seq.length() << " 0 "
+ << get(vertex_name, g, t) << ' '
+ << get(vertex_name, g, v) << ' ' << dist;
+ return FastaRecord(createContigName(), comment.str(), seq);
+}
+
+/** An overlap of two sequences. */
+struct Overlap : public DistanceEst {
+ unsigned overlap;
+ bool mask;
+
+ Overlap() : overlap(UINT_MAX), mask(false) { }
+ Overlap(int) { assert(false); }
+ Overlap(const DistanceEst& est, unsigned overlap, bool mask)
+ : DistanceEst(est), overlap(overlap), mask(mask) { }
+
+ bool operator==(const Overlap& o) const
+ {
+ return overlap == o.overlap;
+ }
+
+ operator Distance() const
+ {
+ assert(overlap > 0);
+ return -overlap;
+ }
+
+ friend ostream& operator<<(ostream& out, const Overlap& o)
+ {
+ return out << "d="
+ << (o.overlap > 0 ? -(int)o.overlap : o.distance);
+ }
+};
+
+/** Create a contig representing the gap between contigs u and v. */
+static FastaRecord createGapContig(const Graph& g,
+ const ContigNode& u, const ContigNode& v,
+ const Overlap& o)
+{
+ assert(opt::scaffold);
+ assert(o.overlap == 0);
+ stats.scaffold++;
+ int distance = o.distance;
+ if (opt::verbose > 0)
+ cout << get(vertex_name, g, u)
+ << '\t' << get(vertex_name, g, v)
+ << "\t(" << distance << ")\n";
+ assert(distance < 100000);
+ string gap = distance <= 0 ? string("n")
+ : string(distance, 'N');
+ const string& useq = sequence(u);
+ const string& vseq = sequence(v);
+ unsigned overlap = opt::k - 1; // by convention
+ return newContig(g, u, v, distance,
+ useq.substr(useq.length() - overlap) + gap
+ + vseq.substr(0, overlap));
+}
+
+/** The scaffold graph. Edges join two blunt contigs that are joined
+ * by a distance estimate. */
+typedef ContigGraph<DirectedGraph<NoProperty, Overlap> > OverlapGraph;
+
+/**
+ * Check for an overlap between the specified pair of contigs.
+ * Add the size of the overlap to the edge properties. Add the
+ * complementary edge if it does not exist in the graph.
+ * @param goverlap the contig overlap graph
+ * @param g the scaffold graph
+ * @return true if the contigs overlap
+ */
+static bool checkEdgeForOverlap(const Graph& goverlap,
+ OverlapGraph& g,
+ graph_traits<OverlapGraph>::edge_descriptor e)
+{
+ typedef graph_traits<Graph>::vertex_descriptor V;
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef edge_bundle_type<OverlapGraph>::type EP;
+
+ V u = source(e, g), v = target(e, g);
+ V uc = get(vertex_complement, g, u);
+ V vc = get(vertex_complement, g, v);
+ assert(u != v);
+ assert(u != vc);
+ EP& ep = g[e];
+ if (ep.overlap != UINT_MAX) {
+ // Found the complementary overlap.
+ return ep.overlap > 0 || opt::scaffold;
+ }
+ if (ep.distance >= 0 && !opt::scaffold) {
+ // Positive distance estimate and not scaffolding.
+ return false;
+ }
+ if (out_degree(u, goverlap) > 0 || in_degree(v, goverlap) > 0) {
+ // Not blunt.
+ return false;
+ }
+
+ bool mask = false;
+ unsigned overlap
+ = ep.distance - (int)allowedError(ep.stdDev) <= 0
+ ? findOverlap(goverlap, u, v, mask) : 0;
+ if (mask && !opt::mask) {
+ // Ambiguous overlap.
+ return false;
+ }
+ if (overlap == 0 && !opt::scaffold) {
+ // No overlap and not scaffolding.
+ return false;
+ }
+ ep.overlap = overlap;
+ ep.mask = mask;
+ pair<E, bool> ecomplement = edge(vc, uc, g);
+ if (ecomplement.second) {
+ // Modify the complementary edge.
+ g[ecomplement.first] = ep;
+ } else {
+ // Add the complementary edge.
+ assert(vc != u);
+ add_edge(vc, uc, ep,
+ static_cast<OverlapGraph::base_type&>(g));
+ }
+ return true;
+}
+
+static void findOverlap(const Graph& g,
+ ContigID refID, bool rc,
+ const ContigNode& pair,
+ const DistanceEst& est,
+ OverlapGraph& out)
+{
+ if (refID == pair.id()
+ || (est.distance >= 0 && !opt::scaffold))
+ return;
+ ContigNode ref(refID, false);
+ const ContigNode& t = rc ? pair : ref;
+ const ContigNode& h = rc ? ref : pair;
+ if (out_degree(t, g) > 0 || in_degree(h, g) > 0
+ || edge(t, h, out).second)
+ return;
+
+ bool mask = false;
+ unsigned overlap
+ = est.distance - (int)allowedError(est.stdDev) <= 0
+ ? findOverlap(g, t, h, mask) : 0;
+ if (mask && !opt::mask)
+ return;
+ if (overlap > 0 || opt::scaffold)
+ add_edge(t, h, Overlap(est, overlap, mask), out);
+}
+
+static void readContigs(const char *contigPath)
+{
+ FastaReader in(contigPath, FastaReader::FOLD_CASE);
+ for (FastaRecord rec; in >> rec;)
+ g_contigs.push_back(rec.seq);
+ assert(in.eof());
+ assert(!g_contigs.empty());
+ opt::colourSpace = isdigit(g_contigs[0][0]);
+}
+
+int main(int argc, char** argv)
+{
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'g': arg >> opt::graphPath; break;
+ case 'k': arg >> opt::k; break;
+ case 'm': arg >> opt::minimum_overlap; break;
+ case 'o': arg >> opt::out; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": " << "missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (opt::out.empty()) {
+ cerr << PROGRAM ": " << "missing -o,--out option\n";
+ die = true;
+ }
+
+ if (argc - optind < 3) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (argc - optind > 3) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ const char* contigPath(argv[optind++]);
+ string adjPath(argv[optind++]);
+ string estPath(argv[optind++]);
+
+ readContigs(contigPath);
+
+ // Read the contig adjacency graph.
+ ifstream fin(adjPath.c_str());
+ assert_good(fin, adjPath);
+ Graph graph;
+ fin >> graph;
+ assert(fin.eof());
+ g_contigNames.lock();
+
+ // Open the output file.
+ ofstream out(opt::out.c_str());
+ assert_good(out, opt::out);
+
+ // Read the scaffold graph.
+ ifstream in(estPath.c_str());
+ assert_good(in, estPath);
+
+ // Find overlapping contigs.
+ OverlapGraph scaffoldGraph(graph.num_vertices() / 2);
+ if (in.peek() == 'd') {
+ // dot graph format
+ in >> scaffoldGraph;
+ assert(in.eof());
+ if (opt::verbose > 0)
+ printGraphStats(cout, scaffoldGraph);
+ remove_edge_if(
+ !bind(checkEdgeForOverlap,
+ cref(graph), ref(scaffoldGraph), _1),
+ static_cast<OverlapGraph::base_type&>(scaffoldGraph));
+ } else {
+ // dist graph format
+ for (EstimateRecord er; in >> er;) {
+ for (int sense = false; sense <= true; ++sense) {
+ typedef vector<
+ pair<ContigNode, DistanceEst> > Estimates;
+ const Estimates& ests = er.estimates[sense];
+ for (Estimates::const_iterator it = ests.begin();
+ it != ests.end(); ++it)
+ findOverlap(graph, er.refID, sense,
+ it->first, it->second,
+ scaffoldGraph);
+ }
+ }
+ assert(in.eof());
+ }
+ in.close();
+
+ if (opt::verbose > 1)
+ cout << dot_writer(scaffoldGraph);
+
+ typedef graph_traits<OverlapGraph>::vertex_descriptor
+ vertex_descriptor;
+ typedef graph_traits<OverlapGraph>::vertex_iterator
+ vertex_iterator;
+ typedef graph_traits<OverlapGraph>::edge_descriptor
+ edge_descriptor;
+ typedef graph_traits<OverlapGraph>::out_edge_iterator
+ out_edge_iterator;
+
+ /** The overlapping edges (d<0) of scaffoldGraph. */
+ OverlapGraph overlapGraph(num_vertices(graph) / 2);
+
+ /** The canonical edges of scaffoldGraph. */
+ unsigned numOverlaps = num_edges(scaffoldGraph) / 2;
+ typedef vector<edge_descriptor> Edges;
+ Edges edges;
+ edges.reserve(numOverlaps);
+
+ // Create the set of canonical edges and the overlap subgraph.
+ std::pair<vertex_iterator, vertex_iterator>
+ uit = vertices(scaffoldGraph);
+ for (vertex_iterator u = uit.first; u != uit.second; ++u) {
+ std::pair<out_edge_iterator, out_edge_iterator>
+ vit = out_edges(*u, scaffoldGraph);
+ for (out_edge_iterator e = vit.first; e != vit.second; ++e) {
+ vertex_descriptor v = target(*e, scaffoldGraph);
+ assert(*u != v);
+ if (v < *u)
+ continue;
+ edges.push_back(*e);
+ const Overlap& ep = get(edge_bundle, scaffoldGraph, e);
+ if (ep.overlap > 0)
+ add_edge(*u, v, ep, overlapGraph);
+ }
+ }
+ assert(edges.size() == numOverlaps);
+
+ // First, give priority to overlapping edges (not scaffolded).
+ for (Edges::const_iterator it = edges.begin();
+ it != edges.end(); ++it) {
+ const ContigNode& t = source(*it, overlapGraph),
+ h = target(*it, overlapGraph);
+ if (!edge(t, h, overlapGraph).second) {
+ // This edge is scaffolded.
+ continue;
+ }
+ const Overlap& overlap = get(edge_bundle, overlapGraph, *it);
+ assert(overlap.overlap > 0);
+ if (contiguous_out(overlapGraph, t)) {
+ stats.overlap++;
+ assert(*adjacent_vertices(t, overlapGraph).first == h);
+ add_edge(t, h, overlap, graph);
+
+ // Clear the out-edges of t and the in-edges of h.
+ clear_out_edges(t, scaffoldGraph);
+ clear_in_edges(h, scaffoldGraph);
+ } else
+ stats.ambiguous++;
+ }
+ overlapGraph.clear();
+
+ // Second, handle scaffolded edges.
+ g_contigNames.unlock();
+ for (Edges::const_iterator it = edges.begin();
+ it != edges.end(); ++it) {
+ const ContigNode& t = source(*it, scaffoldGraph),
+ h = target(*it, scaffoldGraph);
+ if (!edge(t, h, scaffoldGraph).second) {
+ // This edge involved a vertex that has already been used
+ // and removed.
+ continue;
+ }
+ const Overlap& overlap = get(edge_bundle,
+ scaffoldGraph, *it);
+ if (overlap.overlap > 0) {
+ // This edge is not scaffolded.
+ } else if (contiguous_out(scaffoldGraph, t)) {
+ assert(*adjacent_vertices(t, scaffoldGraph).first == h);
+ FastaRecord contig = createGapContig(graph,
+ t, h, overlap);
+ out << contig;
+ assert(out.good());
+
+ // Add the new contig to the adjacency graph.
+ vertex_descriptor v = add_vertex(
+ ContigProperties(contig.seq.length(), 0), graph);
+ put(vertex_name, graph, v, contig.id);
+ add_edge(t, v, graph);
+ add_edge(v, h, graph);
+ } else
+ stats.ambiguous++;
+ }
+ g_contigNames.lock();
+ out.close();
+
+ if (!opt::graphPath.empty()) {
+ // Output the updated adjacency graph.
+ ofstream fout(opt::graphPath.c_str());
+ assert_good(fout, opt::graphPath);
+ write_graph(fout, graph, PROGRAM, commandLine);
+ assert_good(fout, opt::graphPath);
+ }
+
+ cout << "Overlap: " << stats.overlap << "\n"
+ "Scaffold: " << stats.scaffold << "\n"
+ "No overlap: " << stats.none << "\n"
+ "Insignificant (<" << opt::minimum_overlap << "bp): "
+ << stats.tooshort << "\n"
+ "Homopolymer: " << stats.homopolymer << "\n"
+ "Motif: " << stats.motif << "\n"
+ "Ambiguous: " << stats.ambiguous << "\n";
+ return 0;
+}
diff --git a/Parallel/CommLayer.cpp b/Parallel/CommLayer.cpp
new file mode 100644
index 0000000..7e07008
--- /dev/null
+++ b/Parallel/CommLayer.cpp
@@ -0,0 +1,272 @@
+#include "config.h"
+#include "CommLayer.h"
+#include "Common/Options.h"
+#include "Log.h"
+#include "MessageBuffer.h"
+#include <mpi.h>
+#include <cstring>
+#include <vector>
+
+using namespace std;
+
+static const unsigned RX_BUFSIZE = 16*1024;
+
+CommLayer::CommLayer()
+ : m_msgID(0),
+ m_rxBuffer(new uint8_t[RX_BUFSIZE]),
+ m_request(MPI_REQUEST_NULL),
+ m_rxPackets(0), m_rxMessages(0), m_rxBytes(0),
+ m_txPackets(0), m_txMessages(0), m_txBytes(0)
+{
+ assert(m_request == MPI_REQUEST_NULL);
+ MPI_Irecv(m_rxBuffer, RX_BUFSIZE,
+ MPI_BYTE, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD,
+ &m_request);
+}
+
+CommLayer::~CommLayer()
+{
+ MPI_Cancel(&m_request);
+ delete[] m_rxBuffer;
+ logger(1) << "Sent " << m_msgID << " control, "
+ << m_txPackets << " packets, "
+ << m_txMessages << " messages, "
+ << m_txBytes << " bytes. "
+ << "Received " << m_rxPackets << " packets, "
+ << m_rxMessages << " messages, "
+ << m_rxBytes << " bytes.\n";
+}
+
+/** Return the status of an MPI request.
+ * Wraps MPI_Request_get_status.
+ */
+static bool request_get_status(const MPI_Request& req,
+ MPI_Status& status)
+{
+ int flag;
+ MPI_Request_get_status(req, &flag, &status);
+ // Work around a bug present in Open MPI 1.3.3 and earlier.
+ // MPI_Request_get_status may return false on the first call even
+ // though a message is waiting. The second call should work.
+ if (!flag)
+ MPI_Request_get_status(req, &flag, &status);
+ return flag;
+}
+
+/** Return the tag of the received message or APM_NONE if no message
+ * has been received. If a message has been received, this call should
+ * be followed by a call to either ReceiveControlMessage or
+ * ReceiveBufferedMessage.
+ */
+APMessage CommLayer::checkMessage(int& sendID)
+{
+ MPI_Status status;
+ bool flag = request_get_status(m_request, status);
+ if (flag)
+ sendID = status.MPI_SOURCE;
+ return flag ? (APMessage)status.MPI_TAG : APM_NONE;
+}
+
+/** Return true if no message has been received. */
+bool CommLayer::receiveEmpty()
+{
+ MPI_Status status;
+ return !request_get_status(m_request, status);
+}
+
+/** Block until all processes have reached this routine. */
+void CommLayer::barrier()
+{
+ logger(4) << "entering barrier\n";
+ MPI_Barrier(MPI_COMM_WORLD);
+ logger(4) << "left barrier\n";
+}
+
+/** Broadcast a message. */
+void CommLayer::broadcast(int message)
+{
+ assert(opt::rank == 0);
+ MPI_Bcast(&message, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ barrier();
+}
+
+/** Receive a broadcast message. */
+int CommLayer::receiveBroadcast()
+{
+ assert(opt::rank != 0);
+ int message;
+ MPI_Bcast(&message, 1, MPI_INT, 0, MPI_COMM_WORLD);
+ barrier();
+ return message;
+}
+
+/** Block until all processes have reached this routine.
+ * @return the sum of count from all processors
+ */
+long long unsigned CommLayer::reduce(long long unsigned count)
+{
+ logger(4) << "entering reduce: " << count << '\n';
+ long long unsigned sum;
+ MPI_Allreduce(&count, &sum, 1, MPI_UNSIGNED_LONG_LONG, MPI_SUM,
+ MPI_COMM_WORLD);
+ logger(4) << "left reduce: " << sum << '\n';
+ return sum;
+}
+
+/** Reduce the specified vector. */
+vector<unsigned> CommLayer::reduce(const vector<unsigned>& v)
+{
+ logger(4) << "entering reduce\n";
+ vector<unsigned> sum(v.size());
+ MPI_Allreduce(const_cast<unsigned*>(&v[0]),
+ &sum[0], v.size(), MPI_UNSIGNED, MPI_SUM,
+ MPI_COMM_WORLD);
+ logger(4) << "left reduce\n";
+ return sum;
+}
+
+/** Reduce the specified vector. */
+vector<long unsigned> CommLayer::reduce(
+ const vector<long unsigned>& v)
+{
+ logger(4) << "entering reduce\n";
+ vector<long unsigned> sum(v.size());
+ MPI_Allreduce(const_cast<long unsigned*>(&v[0]),
+ &sum[0], v.size(), MPI_UNSIGNED_LONG, MPI_SUM,
+ MPI_COMM_WORLD);
+ logger(4) << "left reduce\n";
+ return sum;
+}
+
+uint64_t CommLayer::sendCheckPointMessage(int argument)
+{
+ logger(4) << "checkpoint: " << argument << '\n';
+ assert(opt::rank != 0);
+ ControlMessage msg;
+ msg.id = m_msgID++;
+ msg.msgType = APC_CHECKPOINT;
+ msg.argument = argument;
+
+ MPI_Send(&msg, sizeof msg,
+ MPI_BYTE, 0, APM_CONTROL, MPI_COMM_WORLD);
+ return msg.id;
+}
+
+/** Send a control message to every other process. */
+void CommLayer::sendControlMessage(APControl m, int argument)
+{
+ for (int i = 0; i < opt::numProc; i++)
+ if (i != opt::rank) // Don't send the message to myself.
+ sendControlMessageToNode(i, m, argument);
+}
+
+/** Send a control message to a specific node. */
+uint64_t CommLayer::sendControlMessageToNode(int nodeID,
+ APControl m, int argument)
+{
+ assert(opt::rank == 0);
+ ControlMessage msg;
+ msg.id = m_msgID++;
+ msg.msgType = m;
+ msg.argument = argument;
+
+ MPI_Send(&msg, sizeof msg,
+ MPI_BYTE, nodeID, APM_CONTROL, MPI_COMM_WORLD);
+ return msg.id;
+}
+
+/** Receive a control message. */
+ControlMessage CommLayer::receiveControlMessage()
+{
+ int flag;
+ MPI_Status status;
+ MPI_Test(&m_request, &flag, &status);
+ assert(flag);
+ assert((APMessage)status.MPI_TAG == APM_CONTROL);
+
+ int count;
+ MPI_Get_count(&status, MPI_BYTE, &count);
+ ControlMessage msg;
+ assert(count == sizeof msg);
+ memcpy(&msg, m_rxBuffer, sizeof msg);
+ assert(m_request == MPI_REQUEST_NULL);
+ MPI_Irecv(m_rxBuffer, RX_BUFSIZE,
+ MPI_BYTE, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD,
+ &m_request);
+ return msg;
+}
+
+/** Send a buffered collection of messages. */
+void CommLayer::sendBufferedMessage(int destID,
+ char* msg, size_t size)
+{
+ MPI_Send(msg, size, MPI_BYTE, destID, APM_BUFFERED,
+ MPI_COMM_WORLD);
+}
+
+/** Receive a buffered message. */
+void CommLayer::receiveBufferedMessage(MessagePtrVector& outmessages)
+{
+ assert(outmessages.empty());
+ int flag;
+ MPI_Status status;
+ MPI_Test(&m_request, &flag, &status);
+ assert(flag);
+ assert((APMessage)status.MPI_TAG == APM_BUFFERED);
+
+ int size;
+ MPI_Get_count(&status, MPI_BYTE, &size);
+
+ int offset = 0;
+ while (offset < size) {
+ MessageType type = Message::readMessageType(
+ (char*)m_rxBuffer + offset);
+
+ Message* pNewMessage;
+ switch(type)
+ {
+ case MT_ADD:
+ pNewMessage = new SeqAddMessage();
+ break;
+ case MT_REMOVE:
+ pNewMessage = new SeqRemoveMessage();
+ break;
+ case MT_SET_FLAG:
+ pNewMessage = new SetFlagMessage();
+ break;
+ case MT_REMOVE_EXT:
+ pNewMessage = new RemoveExtensionMessage();
+ break;
+ case MT_SEQ_DATA_REQUEST:
+ pNewMessage = new SeqDataRequest();
+ break;
+ case MT_SEQ_DATA_RESPONSE:
+ pNewMessage = new SeqDataResponse();
+ break;
+ case MT_SET_BASE:
+ pNewMessage = new SetBaseMessage();
+ break;
+ default:
+ assert(false);
+ break;
+ }
+
+ // Unserialize the new message from the buffer
+ offset += pNewMessage->unserialize(
+ (char*)m_rxBuffer + offset);
+
+ // Constructed message will be deleted in the
+ // NetworkSequenceCollection calling function.
+ outmessages.push_back(pNewMessage);
+ }
+ assert(offset == size);
+
+ assert(m_request == MPI_REQUEST_NULL);
+ MPI_Irecv(m_rxBuffer, RX_BUFSIZE,
+ MPI_BYTE, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD,
+ &m_request);
+
+ m_rxPackets++;
+ m_rxMessages += outmessages.size();
+ m_rxBytes += size;
+}
diff --git a/Parallel/CommLayer.h b/Parallel/CommLayer.h
new file mode 100644
index 0000000..d316a7d
--- /dev/null
+++ b/Parallel/CommLayer.h
@@ -0,0 +1,100 @@
+#ifndef COMMLAYER_H
+#define COMMLAYER_H 1
+
+#include "Messages.h"
+#include <mpi.h>
+#include <vector>
+
+enum APMessage
+{
+ APM_NONE,
+ APM_CONTROL,
+ APM_BUFFERED
+};
+
+enum APControl
+{
+ APC_SET_STATE,
+ APC_ERODE_COMPLETE,
+ APC_TRIM,
+ APC_POPBUBBLE,
+ APC_ASSEMBLE,
+ APC_CHECKPOINT,
+ APC_WAIT,
+ APC_BARRIER,
+};
+
+typedef std::vector<Message*> MessagePtrVector;
+
+struct ControlMessage
+{
+ int64_t id;
+ APControl msgType;
+ int argument;
+};
+
+/** Interprocess communication and synchronization primitives. */
+class CommLayer
+{
+ public:
+ CommLayer();
+ ~CommLayer();
+
+ // Check if a message exists, if it does return the type
+ APMessage checkMessage(int &sendID);
+
+ // Return whether a message has been received.
+ bool receiveEmpty();
+
+ // Block until all processes have reached this routine.
+ void barrier();
+
+ void broadcast(int message);
+ int receiveBroadcast();
+
+ // Block until all processes have reached this routine.
+ long long unsigned reduce(long long unsigned count);
+ std::vector<unsigned> reduce(const std::vector<unsigned>& v);
+ std::vector<long unsigned> reduce(
+ const std::vector<long unsigned>& v);
+
+ // Send a control message
+ void sendControlMessage(APControl m, int argument = 0);
+
+ // Send a control message to a specific node
+ uint64_t sendControlMessageToNode(int nodeID,
+ APControl command, int argument = 0);
+
+ // Receive a control message
+ ControlMessage receiveControlMessage();
+
+ // Send a message that the checkpoint has been reached
+ uint64_t sendCheckPointMessage(int argument = 0);
+
+ // Send a buffered message
+ void sendBufferedMessage(int destID, char* msg, size_t size);
+
+ // Receive a buffered sequence of messages
+ void receiveBufferedMessage(MessagePtrVector& outmessages);
+
+ uint64_t reduceInflight()
+ {
+ return reduce(m_txPackets - m_rxPackets);
+ }
+
+ private:
+ uint64_t m_msgID;
+ uint8_t* m_rxBuffer;
+ MPI_Request m_request;
+
+ protected:
+ // Counters
+ uint64_t m_rxPackets;
+ uint64_t m_rxMessages;
+ uint64_t m_rxBytes;
+ uint64_t m_txPackets;
+ uint64_t m_txMessages;
+ uint64_t m_txBytes;
+};
+
+#endif
diff --git a/Parallel/Makefile.am b/Parallel/Makefile.am
new file mode 100644
index 0000000..6181bac
--- /dev/null
+++ b/Parallel/Makefile.am
@@ -0,0 +1,19 @@
+bin_PROGRAMS = ABYSS-P
+
+ABYSS_P_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Assembly \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+ABYSS_P_LDADD = \
+ $(top_builddir)/Assembly/libassembly.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(MPI_LIBS)
+
+ABYSS_P_SOURCES = \
+ parallelAbyss.cpp \
+ CommLayer.cpp CommLayer.h \
+ NetworkSequenceCollection.cpp NetworkSequenceCollection.h \
+ MessageBuffer.cpp MessageBuffer.h \
+ Messages.cpp Messages.h
diff --git a/Parallel/Makefile.in b/Parallel/Makefile.in
new file mode 100644
index 0000000..ecf5dd9
--- /dev/null
+++ b/Parallel/Makefile.in
@@ -0,0 +1,605 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = ABYSS-P$(EXEEXT)
+subdir = Parallel
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_ABYSS_P_OBJECTS = ABYSS_P-parallelAbyss.$(OBJEXT) \
+ ABYSS_P-CommLayer.$(OBJEXT) \
+ ABYSS_P-NetworkSequenceCollection.$(OBJEXT) \
+ ABYSS_P-MessageBuffer.$(OBJEXT) ABYSS_P-Messages.$(OBJEXT)
+ABYSS_P_OBJECTS = $(am_ABYSS_P_OBJECTS)
+am__DEPENDENCIES_1 =
+ABYSS_P_DEPENDENCIES = $(top_builddir)/Assembly/libassembly.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/DataLayer/libdatalayer.a $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(ABYSS_P_SOURCES)
+DIST_SOURCES = $(ABYSS_P_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+ABYSS_P_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Assembly \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+ABYSS_P_LDADD = \
+ $(top_builddir)/Assembly/libassembly.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(MPI_LIBS)
+
+ABYSS_P_SOURCES = \
+ parallelAbyss.cpp \
+ CommLayer.cpp CommLayer.h \
+ NetworkSequenceCollection.cpp NetworkSequenceCollection.h \
+ MessageBuffer.cpp MessageBuffer.h \
+ Messages.cpp Messages.h
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Parallel/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Parallel/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+ABYSS-P$(EXEEXT): $(ABYSS_P_OBJECTS) $(ABYSS_P_DEPENDENCIES) $(EXTRA_ABYSS_P_DEPENDENCIES)
+ @rm -f ABYSS-P$(EXEEXT)
+ $(CXXLINK) $(ABYSS_P_OBJECTS) $(ABYSS_P_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ABYSS_P-CommLayer.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ABYSS_P-MessageBuffer.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ABYSS_P-Messages.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ABYSS_P-NetworkSequenceCollection.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ABYSS_P-parallelAbyss.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ABYSS_P-parallelAbyss.o: parallelAbyss.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS_P-parallelAbyss.o -MD -MP -MF $(DEPDIR)/ABYSS_P-parallelAbyss.Tpo -c -o ABYSS_P-parallelAbyss.o `test -f 'parallelAbyss.cpp' || echo '$(srcdir)/'`parallelAbyss.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS_P-parallelAbyss.Tpo $(DEPDIR)/ABYSS_P-parallelAbyss.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parallelAbyss.cpp' object='ABYSS_P-parallelAbyss.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS_P-parallelAbyss.o `test -f 'parallelAbyss.cpp' || echo '$(srcdir)/'`parallelAbyss.cpp
+
+ABYSS_P-parallelAbyss.obj: parallelAbyss.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS_P-parallelAbyss.obj -MD -MP -MF $(DEPDIR)/ABYSS_P-parallelAbyss.Tpo -c -o ABYSS_P-parallelAbyss.obj `if test -f 'parallelAbyss.cpp'; then $(CYGPATH_W) 'parallelAbyss.cpp'; else $(CYGPATH_W) '$(srcdir)/parallelAbyss.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS_P-parallelAbyss.Tpo $(DEPDIR)/ABYSS_P-parallelAbyss.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='parallelAbyss.cpp' object='ABYSS_P-parallelAbyss.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS_P-parallelAbyss.obj `if test -f 'parallelAbyss.cpp'; then $(CYGPATH_W) 'parallelAbyss.cpp'; else $(CYGPATH_W) '$(srcdir)/parallelAbyss.cpp'; fi`
+
+ABYSS_P-CommLayer.o: CommLayer.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS_P-CommLayer.o -MD -MP -MF $(DEPDIR)/ABYSS_P-CommLayer.Tpo -c -o ABYSS_P-CommLayer.o `test -f 'CommLayer.cpp' || echo '$(srcdir)/'`CommLayer.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS_P-CommLayer.Tpo $(DEPDIR)/ABYSS_P-CommLayer.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CommLayer.cpp' object='ABYSS_P-CommLayer.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS_P-CommLayer.o `test -f 'CommLayer.cpp' || echo '$(srcdir)/'`CommLayer.cpp
+
+ABYSS_P-CommLayer.obj: CommLayer.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS_P-CommLayer.obj -MD -MP -MF $(DEPDIR)/ABYSS_P-CommLayer.Tpo -c -o ABYSS_P-CommLayer.obj `if test -f 'CommLayer.cpp'; then $(CYGPATH_W) 'CommLayer.cpp'; else $(CYGPATH_W) '$(srcdir)/CommLayer.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS_P-CommLayer.Tpo $(DEPDIR)/ABYSS_P-CommLayer.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='CommLayer.cpp' object='ABYSS_P-CommLayer.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS_P-CommLayer.obj `if test -f 'CommLayer.cpp'; then $(CYGPATH_W) 'CommLayer.cpp'; else $(CYGPATH_W) '$(srcdir)/CommLayer.cpp'; fi`
+
+ABYSS_P-NetworkSequenceCollection.o: NetworkSequenceCollection.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS_P-NetworkSequenceCollection.o -MD -MP -MF $(DEPDIR)/ABYSS_P-NetworkSequenceCollection.Tpo -c -o ABYSS_P-NetworkSequenceCollection.o `test -f 'NetworkSequenceCollection.cpp' || echo '$(srcdir)/'`NetworkSequenceCollection.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS_P-NetworkSequenceCollection.Tpo $(DEPDIR)/ABYSS_P-NetworkSequenceCollection.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NetworkSequenceCollection.cpp' object='ABYSS_P-NetworkSequenceCollection.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS_P-NetworkSequenceCollection.o `test -f 'NetworkSequenceCollection.cpp' || echo '$(srcdir)/'`NetworkSequenceCollection.cpp
+
+ABYSS_P-NetworkSequenceCollection.obj: NetworkSequenceCollection.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS_P-NetworkSequenceCollection.obj -MD -MP -MF $(DEPDIR)/ABYSS_P-NetworkSequenceCollection.Tpo -c -o ABYSS_P-NetworkSequenceCollection.obj `if test -f 'NetworkSequenceCollection.cpp'; then $(CYGPATH_W) 'NetworkSequenceCollection.cpp'; else $(CYGPATH_W) '$(srcdir)/NetworkSequenceCollection.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS_P-NetworkSequenceCollection.Tpo $(DEPDIR)/ABYSS_P-NetworkSequenceCollection.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='NetworkSequenceCollection.cpp' object='ABYSS_P-NetworkSequenceCollection.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS_P-NetworkSequenceCollection.obj `if test -f 'NetworkSequenceCollection.cpp'; then $(CYGPATH_W) 'NetworkSequenceCollection.cpp'; else $(CYGPATH_W) '$(srcdir)/NetworkSequenceCollection.cpp'; fi`
+
+ABYSS_P-MessageBuffer.o: MessageBuffer.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS_P-MessageBuffer.o -MD -MP -MF $(DEPDIR)/ABYSS_P-MessageBuffer.Tpo -c -o ABYSS_P-MessageBuffer.o `test -f 'MessageBuffer.cpp' || echo '$(srcdir)/'`MessageBuffer.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS_P-MessageBuffer.Tpo $(DEPDIR)/ABYSS_P-MessageBuffer.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MessageBuffer.cpp' object='ABYSS_P-MessageBuffer.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS_P-MessageBuffer.o `test -f 'MessageBuffer.cpp' || echo '$(srcdir)/'`MessageBuffer.cpp
+
+ABYSS_P-MessageBuffer.obj: MessageBuffer.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS_P-MessageBuffer.obj -MD -MP -MF $(DEPDIR)/ABYSS_P-MessageBuffer.Tpo -c -o ABYSS_P-MessageBuffer.obj `if test -f 'MessageBuffer.cpp'; then $(CYGPATH_W) 'MessageBuffer.cpp'; else $(CYGPATH_W) '$(srcdir)/MessageBuffer.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS_P-MessageBuffer.Tpo $(DEPDIR)/ABYSS_P-MessageBuffer.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='MessageBuffer.cpp' object='ABYSS_P-MessageBuffer.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS_P-MessageBuffer.obj `if test -f 'MessageBuffer.cpp'; then $(CYGPATH_W) 'MessageBuffer.cpp'; else $(CYGPATH_W) '$(srcdir)/MessageBuffer.cpp'; fi`
+
+ABYSS_P-Messages.o: Messages.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS_P-Messages.o -MD -MP -MF $(DEPDIR)/ABYSS_P-Messages.Tpo -c -o ABYSS_P-Messages.o `test -f 'Messages.cpp' || echo '$(srcdir)/'`Messages.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS_P-Messages.Tpo $(DEPDIR)/ABYSS_P-Messages.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Messages.cpp' object='ABYSS_P-Messages.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS_P-Messages.o `test -f 'Messages.cpp' || echo '$(srcdir)/'`Messages.cpp
+
+ABYSS_P-Messages.obj: Messages.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ABYSS_P-Messages.obj -MD -MP -MF $(DEPDIR)/ABYSS_P-Messages.Tpo -c -o ABYSS_P-Messages.obj `if test -f 'Messages.cpp'; then $(CYGPATH_W) 'Messages.cpp'; else $(CYGPATH_W) '$(srcdir)/Messages.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ABYSS_P-Messages.Tpo $(DEPDIR)/ABYSS_P-Messages.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='Messages.cpp' object='ABYSS_P-Messages.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ABYSS_P_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ABYSS_P-Messages.obj `if test -f 'Messages.cpp'; then $(CYGPATH_W) 'Messages.cpp'; else $(CYGPATH_W) '$(srcdir)/Messages.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Parallel/MessageBuffer.cpp b/Parallel/MessageBuffer.cpp
new file mode 100644
index 0000000..630e68b
--- /dev/null
+++ b/Parallel/MessageBuffer.cpp
@@ -0,0 +1,151 @@
+#include "MessageBuffer.h"
+#include "Common/Options.h"
+#include <iostream>
+
+using namespace std;
+
+MessageBuffer::MessageBuffer()
+ : m_msgQueues(opt::numProc)
+{
+ for (unsigned i = 0; i < m_msgQueues.size(); i++)
+ m_msgQueues[i].reserve(MAX_MESSAGES);
+}
+
+void MessageBuffer::sendSeqAddMessage(int nodeID, const Kmer& seq)
+{
+ queueMessage(nodeID, new SeqAddMessage(seq), SM_BUFFERED);
+}
+
+void MessageBuffer::sendSeqRemoveMessage(int nodeID, const Kmer& seq)
+{
+ queueMessage(nodeID, new SeqRemoveMessage(seq), SM_BUFFERED);
+}
+
+// Send a set flag message
+void MessageBuffer::sendSetFlagMessage(int nodeID,
+ const Kmer& seq, SeqFlag flag)
+{
+ queueMessage(nodeID, new SetFlagMessage(seq, flag), SM_BUFFERED);
+}
+
+// Send a remove extension message
+void MessageBuffer::sendRemoveExtension(int nodeID,
+ const Kmer& seq, extDirection dir, SeqExt ext)
+{
+ queueMessage(nodeID, new RemoveExtensionMessage(seq, dir, ext),
+ SM_BUFFERED);
+}
+
+// Send a sequence data request
+void MessageBuffer::sendSeqDataRequest(int nodeID,
+ IDType group, IDType id, const Kmer& seq)
+{
+ queueMessage(nodeID,
+ new SeqDataRequest(seq, group, id), SM_IMMEDIATE);
+}
+
+// Send a sequence data response
+void MessageBuffer::sendSeqDataResponse(int nodeID,
+ IDType group, IDType id, const Kmer& seq,
+ ExtensionRecord extRec, int multiplicity)
+{
+ queueMessage(nodeID,
+ new SeqDataResponse(seq, group, id, extRec, multiplicity),
+ SM_IMMEDIATE);
+}
+
+// Send a set base message
+void MessageBuffer::sendSetBaseExtension(int nodeID,
+ const Kmer& seq, extDirection dir, uint8_t base)
+{
+ queueMessage(nodeID,
+ new SetBaseMessage(seq, dir, base), SM_BUFFERED);
+}
+
+void MessageBuffer::queueMessage(
+ int nodeID, Message* message, SendMode mode)
+{
+ if (opt::verbose >= 9)
+ cout << opt::rank << " to " << nodeID << ": " << *message;
+ m_msgQueues[nodeID].push_back(message);
+ checkQueueForSend(nodeID, mode);
+}
+
+void MessageBuffer::checkQueueForSend(int nodeID, SendMode mode)
+{
+ size_t numMsgs = m_msgQueues[nodeID].size();
+ // check if the messages should be sent
+ if ((numMsgs == MAX_MESSAGES || mode == SM_IMMEDIATE)
+ && numMsgs > 0) {
+ // Calculate the total size of the message
+ size_t totalSize = 0;
+ for(size_t i = 0; i < numMsgs; i++)
+ {
+ totalSize += m_msgQueues[nodeID][i]->getNetworkSize();
+ }
+
+ // Generate a buffer for all the messages
+ char* buffer = new char[totalSize];
+
+ // Copy the messages into the buffer
+ size_t offset = 0;
+ for(size_t i = 0; i < numMsgs; i++)
+ offset += m_msgQueues[nodeID][i]->serialize(
+ buffer + offset);
+
+ assert(offset == totalSize);
+ sendBufferedMessage(nodeID, buffer, totalSize);
+
+ delete [] buffer;
+ clearQueue(nodeID);
+
+ m_txPackets++;
+ m_txMessages += numMsgs;
+ m_txBytes += totalSize;
+ }
+}
+
+// Clear a queue of messages
+void MessageBuffer::clearQueue(int nodeID)
+{
+ size_t numMsgs = m_msgQueues[nodeID].size();
+ for(size_t i = 0; i < numMsgs; i++)
+ {
+ // Delete the messages
+ delete m_msgQueues[nodeID][i];
+ m_msgQueues[nodeID][i] = 0;
+ }
+ m_msgQueues[nodeID].clear();
+}
+
+// Flush the message buffer by sending all messages that are queued
+void MessageBuffer::flush()
+{
+ // Send all messages in all queues
+ for(size_t id = 0; id < m_msgQueues.size(); ++id)
+ {
+ // force the queue to send any pending messages
+ checkQueueForSend(id, SM_IMMEDIATE);
+ }
+}
+
+// Check if all the queues are empty
+bool MessageBuffer::transmitBufferEmpty() const
+{
+ bool isEmpty = true;
+ for (MessageQueues::const_iterator it = m_msgQueues.begin();
+ it != m_msgQueues.end(); ++it) {
+ if (!it->empty()) {
+ cerr
+ << opt::rank << ": error: tx buffer should be empty: "
+ << it->size() << " messages from "
+ << opt::rank << " to " << it - m_msgQueues.begin()
+ << '\n';
+ for (MsgBuffer::const_iterator j = it->begin();
+ j != it->end(); ++j)
+ cerr << **j << '\n';
+ isEmpty = false;
+ }
+ }
+ return isEmpty;
+}
diff --git a/Parallel/MessageBuffer.h b/Parallel/MessageBuffer.h
new file mode 100644
index 0000000..69c501b
--- /dev/null
+++ b/Parallel/MessageBuffer.h
@@ -0,0 +1,77 @@
+#ifndef MESSAGE_BUFFER_H
+#define MESSAGE_BUFFER_H 1
+
+class MessageBuffer;
+
+#include "CommLayer.h"
+#include "Messages.h"
+#include <vector>
+
+typedef std::vector<Message*> MsgBuffer;
+typedef std::vector<MsgBuffer> MessageQueues;
+
+enum SendMode
+{
+ SM_BUFFERED,
+ SM_IMMEDIATE
+};
+
+/** A buffer of Message. */
+class MessageBuffer : public CommLayer
+{
+ public:
+ MessageBuffer();
+
+ void sendCheckPointMessage(int argument = 0)
+ {
+ assert(transmitBufferEmpty());
+ CommLayer::sendCheckPointMessage(argument);
+ }
+
+ void sendControlMessage(APControl command, int argument = 0)
+ {
+ assert(transmitBufferEmpty());
+ CommLayer::sendControlMessage(command, argument);
+ }
+
+ void sendControlMessageToNode(int dest,
+ APControl command, int argument = 0)
+ {
+ assert(transmitBufferEmpty());
+ CommLayer::sendControlMessageToNode(dest,
+ command, argument);
+ }
+
+ void sendSeqAddMessage(int nodeID, const Kmer& seq);
+ void sendSeqRemoveMessage(int nodeID, const Kmer& seq);
+ void sendSetFlagMessage(int nodeID,
+ const Kmer& seq, SeqFlag flag);
+ void sendRemoveExtension(int nodeID,
+ const Kmer& seq, extDirection dir, SeqExt ext);
+ void sendSeqDataRequest(int nodeID,
+ IDType group, IDType id, const Kmer& seq);
+ void sendSeqDataResponse(int nodeID,
+ IDType group, IDType id, const Kmer& seq,
+ ExtensionRecord extRec, int multiplicity);
+ void sendSetBaseExtension(int nodeID,
+ const Kmer& seq, extDirection dir, uint8_t base);
+
+ void flush();
+ void queueMessage
+ (int nodeID, Message* message, SendMode mode);
+
+ // clear out a queue
+ void clearQueue(int nodeID);
+ bool transmitBufferEmpty() const;
+
+ // check if a queue is full, if so, send the messages if the
+ // immediate mode flag is set, send even if the queue is not
+ // full.
+ void checkQueueForSend(int nodeID, SendMode mode);
+
+ private:
+ static const size_t MAX_MESSAGES = 100;
+ MessageQueues m_msgQueues;
+};
+
+#endif
diff --git a/Parallel/Messages.cpp b/Parallel/Messages.cpp
new file mode 100644
index 0000000..23eceec
--- /dev/null
+++ b/Parallel/Messages.cpp
@@ -0,0 +1,197 @@
+#include "Messages.h"
+#include "NetworkSequenceCollection.h"
+#include <cstring>
+
+static size_t serializeData(const void* ptr, char* buffer,
+ size_t size)
+{
+ memcpy(buffer, ptr, size);
+ return size;
+}
+
+static size_t unserializeData(void* ptr, const char* buffer,
+ size_t size)
+{
+ memcpy(ptr, buffer, size);
+ return size;
+}
+
+MessageType Message::readMessageType(char* buffer)
+{
+ return (MessageType)*(uint8_t*)buffer;
+}
+
+size_t Message::unserialize(const char* buffer)
+{
+ size_t offset = 0;
+ offset++; // MessageType
+ offset += m_seq.unserialize(buffer + offset);
+ return offset;
+}
+
+size_t SeqAddMessage::serialize(char* buffer)
+{
+ size_t offset = 0;
+ buffer[offset++] = TYPE;
+ offset += m_seq.serialize(buffer + offset);
+ return offset;
+}
+
+void SeqAddMessage::handle(int senderID,
+ NetworkSequenceCollection& handler)
+{
+ handler.handle(senderID, *this);
+}
+
+size_t SeqRemoveMessage::serialize(char* buffer)
+{
+ size_t offset = 0;
+ buffer[offset++] = TYPE;
+ offset += m_seq.serialize(buffer + offset);
+ return offset;
+}
+
+void SeqRemoveMessage::handle(int senderID,
+ NetworkSequenceCollection& handler)
+{
+ handler.handle(senderID, *this);
+}
+
+size_t SetFlagMessage::serialize(char* buffer)
+{
+ size_t offset = 0;
+ buffer[offset++] = TYPE;
+ offset += m_seq.serialize(buffer + offset);
+ offset += serializeData(&m_flag, buffer + offset, sizeof(m_flag));
+ return offset;
+}
+
+size_t SetFlagMessage::unserialize(const char* buffer)
+{
+ size_t offset = 0;
+ offset += Message::unserialize(buffer);
+ offset += unserializeData(
+ &m_flag, buffer + offset, sizeof(m_flag));
+ return offset;
+}
+
+void SetFlagMessage::handle(
+ int senderID, NetworkSequenceCollection& handler)
+{
+ handler.handle(senderID, *this);
+}
+
+size_t RemoveExtensionMessage::serialize(char* buffer)
+{
+ size_t offset = 0;
+ buffer[offset++] = TYPE;
+ offset += m_seq.serialize(buffer + offset);
+ offset += serializeData(&m_dir, buffer + offset, sizeof m_dir);
+ offset += serializeData(&m_ext, buffer + offset, sizeof m_ext);
+ return offset;
+}
+
+size_t RemoveExtensionMessage::unserialize(const char* buffer)
+{
+ size_t offset = 0;
+ offset += Message::unserialize(buffer);
+ offset += unserializeData(&m_dir, buffer + offset, sizeof m_dir);
+ offset += unserializeData(&m_ext, buffer + offset, sizeof m_ext);
+ return offset;
+}
+
+void RemoveExtensionMessage::handle(
+ int senderID, NetworkSequenceCollection& handler)
+{
+ handler.handle(senderID, *this);
+}
+
+size_t SetBaseMessage::serialize(char* buffer)
+{
+ size_t offset = 0;
+ buffer[offset++] = TYPE;
+ offset += m_seq.serialize(buffer + offset);
+ offset += serializeData(&m_dir, buffer + offset, sizeof(m_dir));
+ offset += serializeData(&m_base, buffer + offset, sizeof(m_base));
+ return offset;
+}
+
+size_t SetBaseMessage::unserialize(const char* buffer)
+{
+ size_t offset = 0;
+ offset += Message::unserialize(buffer);
+ offset += unserializeData(&m_dir, buffer + offset, sizeof(m_dir));
+ offset += unserializeData(
+ &m_base, buffer + offset, sizeof(m_base));
+ return offset;
+}
+
+void SetBaseMessage::handle(
+ int senderID, NetworkSequenceCollection& handler)
+{
+ handler.handle(senderID, *this);
+}
+
+size_t SeqDataRequest::serialize(char* buffer)
+{
+ size_t offset = 0;
+ buffer[offset++] = TYPE;
+ offset += m_seq.serialize(buffer + offset);
+ offset += serializeData(
+ &m_group, buffer + offset, sizeof(m_group));
+ offset += serializeData(&m_id, buffer + offset, sizeof(m_id));
+ return offset;
+}
+
+size_t SeqDataRequest::unserialize(const char* buffer)
+{
+ size_t offset = 0;
+ offset += Message::unserialize(buffer);
+ offset += unserializeData(
+ &m_group, buffer + offset, sizeof(m_group));
+ offset += unserializeData(&m_id, buffer + offset, sizeof(m_id));
+ return offset;
+}
+
+void SeqDataRequest::handle(
+ int senderID, NetworkSequenceCollection& handler)
+{
+ handler.handle(senderID, *this);
+}
+
+size_t SeqDataResponse::serialize(char* buffer)
+{
+ size_t offset = 0;
+ buffer[offset++] = TYPE;
+ offset += m_seq.serialize(buffer + offset);
+ offset += serializeData(
+ &m_group, buffer + offset, sizeof(m_group));
+ offset += serializeData(
+ &m_id, buffer + offset, sizeof(m_id));
+ offset += serializeData(
+ &m_extRecord, buffer + offset, sizeof(m_extRecord));
+ offset += serializeData(
+ &m_multiplicity, buffer + offset, sizeof(m_multiplicity));
+ return offset;
+}
+
+size_t SeqDataResponse::unserialize(const char* buffer)
+{
+ size_t offset = 0;
+ offset += Message::unserialize(buffer);
+ offset += unserializeData(
+ &m_group, buffer + offset, sizeof(m_group));
+ offset += unserializeData(
+ &m_id, buffer + offset, sizeof(m_id));
+ offset += unserializeData(
+ &m_extRecord, buffer + offset, sizeof(m_extRecord));
+ offset += unserializeData(
+ &m_multiplicity, buffer + offset, sizeof(m_multiplicity));
+ return offset;
+}
+
+void SeqDataResponse::handle(
+ int senderID, NetworkSequenceCollection& handler)
+{
+ handler.handle(senderID, *this);
+}
diff --git a/Parallel/Messages.h b/Parallel/Messages.h
new file mode 100644
index 0000000..833c952
--- /dev/null
+++ b/Parallel/Messages.h
@@ -0,0 +1,207 @@
+#ifndef MESSAGES_H
+#define MESSAGES_H 1
+
+#include "Kmer.h"
+#include "KmerData.h"
+#include <ostream>
+
+class NetworkSequenceCollection;
+
+enum MessageType
+{
+ MT_VOID,
+ MT_ADD,
+ MT_REMOVE,
+ MT_SET_FLAG,
+ MT_REMOVE_EXT,
+ MT_SEQ_DATA_REQUEST,
+ MT_SEQ_DATA_RESPONSE,
+ MT_SET_BASE
+};
+
+enum MessageOp
+{
+ MO_VOID,
+ MO_ADD,
+ MO_REMOVE,
+};
+
+typedef uint32_t IDType;
+
+/** The base class of all interprocess messages. */
+class Message
+{
+ public:
+ Message() { }
+ Message(const Kmer& seq) : m_seq(seq) { }
+ virtual ~Message() { }
+
+ virtual void handle(
+ int senderID, NetworkSequenceCollection& handler) = 0;
+
+ virtual size_t getNetworkSize() const
+ {
+ return sizeof (uint8_t) // MessageType
+ + Kmer::serialSize();
+ }
+
+ static MessageType readMessageType(char* buffer);
+ virtual size_t serialize(char* buffer) = 0;
+ virtual size_t unserialize(const char* buffer);
+
+ friend std::ostream& operator <<(std::ostream& out,
+ const Message& message)
+ {
+ return out << message.m_seq.str() << '\n';
+ }
+
+ Kmer m_seq;
+};
+
+/** Add a Kmer. */
+class SeqAddMessage : public Message
+{
+ public:
+ SeqAddMessage() { }
+ SeqAddMessage(const Kmer& seq) : Message(seq) { }
+
+ void handle(int senderID, NetworkSequenceCollection& handler);
+ size_t serialize(char* buffer);
+
+ static const MessageType TYPE = MT_ADD;
+};
+
+/** Remove a Kmer. */
+class SeqRemoveMessage : public Message
+{
+ public:
+ SeqRemoveMessage() { }
+ SeqRemoveMessage(const Kmer& seq) : Message(seq) { }
+
+ void handle(int senderID, NetworkSequenceCollection& handler);
+ size_t serialize(char* buffer);
+
+ static const MessageType TYPE = MT_REMOVE;
+};
+
+/** Set a flag. */
+class SetFlagMessage : public Message
+{
+ public:
+ SetFlagMessage() { }
+ SetFlagMessage(const Kmer& seq, SeqFlag flag)
+ : Message(seq), m_flag(flag) { }
+
+ size_t getNetworkSize() const
+ {
+ return Message::getNetworkSize() + sizeof m_flag;
+ }
+
+ void handle(int senderID, NetworkSequenceCollection& handler);
+ size_t serialize(char* buffer);
+ size_t unserialize(const char* buffer);
+
+ static const MessageType TYPE = MT_SET_FLAG;
+ uint8_t m_flag; // SeqFlag
+};
+
+/** Remove an edge. */
+class RemoveExtensionMessage : public Message
+{
+ public:
+ RemoveExtensionMessage() { }
+ RemoveExtensionMessage(const Kmer& seq,
+ extDirection dir, SeqExt ext)
+ : Message(seq), m_dir(dir), m_ext(ext) { }
+
+ size_t getNetworkSize() const
+ {
+ return Message::getNetworkSize()
+ + sizeof m_dir + sizeof m_ext;
+ }
+
+ void handle(int senderID, NetworkSequenceCollection& handler);
+ size_t serialize(char* buffer);
+ size_t unserialize(const char* buffer);
+
+ static const MessageType TYPE = MT_REMOVE_EXT;
+ uint8_t m_dir; // extDirection
+ SeqExt m_ext;
+};
+
+/** Request vertex properties. */
+class SeqDataRequest : public Message
+{
+ public:
+ SeqDataRequest() { }
+ SeqDataRequest(const Kmer& seq, IDType group, IDType id)
+ : Message(seq), m_group(group), m_id(id) { }
+
+ size_t getNetworkSize() const
+ {
+ return Message::getNetworkSize()
+ + sizeof m_group + sizeof m_id;
+ }
+
+ void handle(int senderID, NetworkSequenceCollection& handler);
+ size_t serialize(char* buffer);
+ size_t unserialize(const char* buffer);
+
+ static const MessageType TYPE = MT_SEQ_DATA_REQUEST;
+ IDType m_group;
+ IDType m_id;
+};
+
+/** The response to a request for vertex properties. */
+class SeqDataResponse : public Message
+{
+ public:
+ SeqDataResponse() { }
+ SeqDataResponse(const Kmer& seq, IDType group, IDType id,
+ ExtensionRecord& extRecord, int multiplicity) :
+ Message(seq), m_group(group), m_id(id),
+ m_extRecord(extRecord), m_multiplicity(multiplicity) { }
+
+ size_t getNetworkSize() const
+ {
+ return Message::getNetworkSize()
+ + sizeof m_group + sizeof m_id
+ + sizeof m_extRecord + sizeof m_multiplicity;
+ }
+
+ void handle(int senderID, NetworkSequenceCollection& handler);
+ size_t serialize(char* buffer);
+ size_t unserialize(const char* buffer);
+
+ static const MessageType TYPE = MT_SEQ_DATA_RESPONSE;
+ IDType m_group;
+ IDType m_id;
+ ExtensionRecord m_extRecord;
+ uint16_t m_multiplicity;
+};
+
+/** Add an edge. */
+class SetBaseMessage : public Message
+{
+ public:
+ SetBaseMessage() { }
+ SetBaseMessage(const Kmer& seq,
+ extDirection dir, uint8_t base)
+ : Message(seq), m_dir(dir), m_base(base) { }
+
+ size_t getNetworkSize() const
+ {
+ return Message::getNetworkSize()
+ + sizeof m_dir + sizeof m_base;
+ }
+
+ void handle(int senderID, NetworkSequenceCollection& handler);
+ size_t serialize(char* buffer);
+ size_t unserialize(const char* buffer);
+
+ static const MessageType TYPE = MT_SET_BASE;
+ uint8_t m_dir; // extDirection
+ uint8_t m_base;
+};
+
+#endif
diff --git a/Parallel/NetworkSequenceCollection.cpp b/Parallel/NetworkSequenceCollection.cpp
new file mode 100644
index 0000000..9c24d42
--- /dev/null
+++ b/Parallel/NetworkSequenceCollection.cpp
@@ -0,0 +1,1396 @@
+#include "NetworkSequenceCollection.h"
+#include "Assembly/Options.h"
+#include "AssemblyAlgorithms.h"
+#include "Common/Options.h"
+#include "FastaWriter.h"
+#include "Histogram.h"
+#include "Log.h"
+#include "StringUtil.h"
+#include <climits> // for UINT_MAX
+#include <cstdlib>
+#include <fstream>
+#include <iostream>
+#include <utility>
+
+using namespace std;
+
+void NetworkSequenceCollection::loadSequences()
+{
+ Timer timer("LoadSequences");
+ for (unsigned i = opt::rank; i < opt::inFiles.size();
+ i += opt::numProc)
+ AssemblyAlgorithms::loadSequences(this, opt::inFiles[i]);
+}
+
+/** Receive, process, send, and synchronize.
+ * @return the number of inflight messages
+ */
+size_t NetworkSequenceCollection::pumpFlushReduce()
+{
+ pumpNetwork();
+ m_comm.flush();
+ return m_comm.reduceInflight();
+}
+
+/** Receive packets and process them until no more work exists for any
+ * slave processor.
+ */
+void NetworkSequenceCollection::completeOperation()
+{
+ Timer timer("completeOperation");
+
+ while (pumpFlushReduce() > 0)
+ ;
+
+ assert(m_comm.transmitBufferEmpty()); // Nothing to send.
+ m_comm.barrier(); // Synchronize.
+ assert(m_comm.receiveEmpty()); // Nothing to receive.
+ assert(m_comm.reduceInflight() == 0);
+}
+
+/** Run the assembly state machine. */
+void NetworkSequenceCollection::run()
+{
+ /** The number of contigs and k-mer assembled. */
+ pair<size_t, size_t> numAssembled;
+
+ ofstream bubbleFile;
+
+ SetState(NAS_LOADING);
+ while (m_state != NAS_DONE) {
+ switch (m_state) {
+ case NAS_LOADING:
+ m_data.setColourSpace(
+ m_comm.receiveBroadcast());
+ loadSequences();
+ EndState();
+ SetState(NAS_WAITING);
+ m_comm.sendCheckPointMessage();
+ break;
+ case NAS_LOAD_COMPLETE:
+ {
+ m_comm.barrier();
+ pumpNetwork();
+ logger(0) << "Loaded " << m_data.size()
+ << " k-mer.\n";
+ assert(!m_data.empty());
+ m_data.shrink();
+ m_comm.reduce(m_data.size());
+
+ Histogram myh
+ = AssemblyAlgorithms::coverageHistogram(m_data);
+ Histogram h(m_comm.reduce(myh.toVector()));
+ AssemblyAlgorithms::setCoverageParameters(h);
+ EndState();
+ SetState(NAS_WAITING);
+ break;
+ }
+ case NAS_GEN_ADJ:
+ m_comm.barrier();
+ m_numBasesAdjSet = 0;
+ AssemblyAlgorithms::generateAdjacency(this);
+ EndState();
+ SetState(NAS_WAITING);
+ m_comm.sendCheckPointMessage();
+ break;
+ case NAS_ADJ_COMPLETE:
+ m_comm.barrier();
+ pumpNetwork();
+ logger(0) << "Added " << m_numBasesAdjSet
+ << " edges.\n";
+ m_comm.reduce(m_numBasesAdjSet);
+ EndState();
+ SetState(NAS_WAITING);
+ break;
+ case NAS_ERODE:
+ {
+ m_comm.barrier();
+ size_t numEroded
+ = AssemblyAlgorithms::erodeEnds(this);
+ EndState();
+ SetState(NAS_ERODE_WAITING);
+ m_comm.sendCheckPointMessage(numEroded);
+ break;
+ }
+ case NAS_ERODE_WAITING:
+ pumpNetwork();
+ break;
+ case NAS_ERODE_COMPLETE:
+ completeOperation();
+ m_comm.reduce(AssemblyAlgorithms::getNumEroded());
+
+ m_comm.reduce(m_data.cleanup());
+ m_comm.barrier();
+
+ SetState(NAS_WAITING);
+ break;
+ case NAS_TRIM:
+ {
+ assert(m_trimStep != 0);
+ m_comm.barrier();
+ size_t numRemoved = performNetworkTrim(this);
+ EndState();
+ SetState(NAS_WAITING);
+ m_comm.sendCheckPointMessage(numRemoved);
+ break;
+ }
+ case NAS_REMOVE_MARKED: {
+ m_comm.barrier();
+ size_t count
+ = AssemblyAlgorithms::removeMarked(this);
+ EndState();
+ SetState(NAS_WAITING);
+ m_comm.sendCheckPointMessage(count);
+ break;
+ }
+
+ case NAS_COVERAGE:
+ {
+ m_comm.reduce(m_data.cleanup());
+ m_lowCoverageContigs = 0;
+ m_lowCoverageKmer = 0;
+ numAssembled = performNetworkAssembly(this);
+ EndState();
+ SetState(NAS_WAITING);
+ m_comm.sendCheckPointMessage();
+ break;
+ }
+ case NAS_COVERAGE_COMPLETE:
+ m_comm.barrier();
+ pumpNetwork();
+ m_comm.reduce(numAssembled.first);
+ m_comm.reduce(numAssembled.second);
+ m_comm.reduce(m_lowCoverageContigs);
+ m_comm.reduce(m_lowCoverageKmer);
+ opt::coverage = 0;
+ EndState();
+ SetState(NAS_WAITING);
+ break;
+
+ case NAS_DISCOVER_BUBBLES:
+ {
+ size_t numDiscovered
+ = performNetworkDiscoverBubbles(this);
+ EndState();
+ SetState(NAS_WAITING);
+ m_comm.sendCheckPointMessage(numDiscovered);
+ break;
+ }
+ case NAS_POPBUBBLE:
+ {
+ if (!bubbleFile.is_open())
+ AssemblyAlgorithms::openBubbleFile(bubbleFile);
+ size_t numPopped
+ = performNetworkPopBubbles(bubbleFile);
+ EndState();
+ SetState(NAS_WAITING);
+ m_comm.sendCheckPointMessage(numPopped);
+ break;
+ }
+ case NAS_MARK_AMBIGUOUS:
+ {
+ m_comm.barrier();
+ pumpNetwork();
+ size_t count
+ = AssemblyAlgorithms::markAmbiguous(this);
+ EndState();
+ SetState(NAS_WAITING);
+ m_comm.sendCheckPointMessage(count);
+ break;
+ }
+ case NAS_SPLIT_AMBIGUOUS:
+ {
+ m_comm.barrier();
+ assert(m_comm.receiveEmpty());
+ m_comm.barrier();
+ size_t count
+ = AssemblyAlgorithms::splitAmbiguous(this);
+ EndState();
+ SetState(NAS_WAITING);
+ m_comm.sendCheckPointMessage(count);
+ break;
+ }
+ case NAS_CLEAR_FLAGS:
+ m_comm.barrier();
+ pumpNetwork();
+ m_data.wipeFlag(
+ SeqFlag(SF_MARK_SENSE | SF_MARK_ANTISENSE));
+ m_comm.reduce(m_data.cleanup());
+ EndState();
+ SetState(NAS_WAITING);
+ break;
+ case NAS_ASSEMBLE:
+ {
+ m_comm.barrier();
+ pumpNetwork();
+ FastaWriter writer(opt::contigsTempPath.c_str());
+ numAssembled = performNetworkAssembly(this, &writer);
+ EndState();
+ SetState(NAS_WAITING);
+ m_comm.sendCheckPointMessage();
+ break;
+ }
+ case NAS_ASSEMBLE_COMPLETE:
+ m_comm.reduce(numAssembled.first);
+ m_comm.reduce(numAssembled.second);
+ EndState();
+ SetState(NAS_DONE);
+ break;
+ case NAS_WAITING:
+ pumpNetwork();
+ break;
+ case NAS_DONE:
+ break;
+ }
+ }
+}
+
+size_t NetworkSequenceCollection::controlErode()
+{
+ SetState(NAS_ERODE);
+ m_comm.sendControlMessage(APC_SET_STATE, NAS_ERODE);
+ m_comm.barrier();
+ size_t numEroded = AssemblyAlgorithms::erodeEnds(this);
+ EndState();
+
+ // Do not call SetState, because it clears the
+ // checkpoint information.
+ //SetState(NAS_ERODE_WAITING);
+ m_state = NAS_ERODE_WAITING;
+
+ m_numReachedCheckpoint++;
+ while (!checkpointReached())
+ pumpNetwork();
+ numEroded += m_checkpointSum;
+ EndState();
+
+ if (numEroded == 0) {
+ SetState(NAS_WAITING);
+ m_comm.sendControlMessage(APC_WAIT);
+ m_comm.barrier();
+ return 0;
+ }
+
+ SetState(NAS_ERODE_COMPLETE);
+ m_comm.sendControlMessage(APC_ERODE_COMPLETE);
+ completeOperation();
+ numEroded += m_comm.reduce(
+ AssemblyAlgorithms::getNumEroded());
+ cout << "Eroded " << numEroded << " tips.\n";
+
+ size_t removed = m_comm.reduce(m_data.cleanup());
+ m_comm.barrier();
+ assert(removed == numEroded);
+ (void)removed;
+
+ SetState(NAS_WAITING);
+ return numEroded;
+}
+
+/** Remove marked k-mer.
+ * @return the number of k-mer removed
+ */
+size_t NetworkSequenceCollection::controlRemoveMarked()
+{
+ if (opt::verbose > 0)
+ cout << "Sweeping...\n";
+ SetState(NAS_REMOVE_MARKED);
+ m_comm.sendControlMessage(APC_SET_STATE, NAS_REMOVE_MARKED);
+ m_comm.barrier();
+ size_t count = AssemblyAlgorithms::removeMarked(this);
+ m_checkpointSum += count;
+ EndState();
+
+ m_numReachedCheckpoint++;
+ while (!checkpointReached())
+ pumpNetwork();
+ return m_checkpointSum;
+}
+
+/** Perform a single round of trimming at the specified length. */
+size_t NetworkSequenceCollection::controlTrimRound(unsigned trimLen)
+{
+ assert(trimLen > 0);
+ m_trimStep = trimLen;
+ cout << "Pruning tips shorter than " << trimLen << " bp...\n";
+ SetState(NAS_TRIM);
+ m_comm.sendControlMessage(APC_TRIM, trimLen);
+ m_comm.barrier();
+ size_t numRemoved = performNetworkTrim(this);
+ EndState();
+
+ m_numReachedCheckpoint++;
+ while (!checkpointReached())
+ pumpNetwork();
+ numRemoved += m_checkpointSum;
+
+ size_t numSweeped = controlRemoveMarked();
+
+ if (numRemoved > 0)
+ cout << "Pruned " << numSweeped << " k-mer in "
+ << numRemoved << " tips.\n";
+ return numRemoved;
+}
+
+/** Perform multiple rounds of trimming until complete. */
+void NetworkSequenceCollection::controlTrim(unsigned start)
+{
+ if (opt::trimLen == 0)
+ return;
+ unsigned rounds = 0, total = 0;
+ for (unsigned trim = start; trim < opt::trimLen; trim *= 2) {
+ rounds++;
+ total += controlTrimRound(trim);
+ }
+ size_t count;
+ while ((count = controlTrimRound(opt::trimLen)) > 0) {
+ rounds++;
+ total += count;
+ }
+ cout << "Pruned " << total << " tips in "
+ << rounds << " rounds.\n";
+}
+
+/** Remove low-coverage contigs. */
+void NetworkSequenceCollection::controlCoverage()
+{
+ assert(opt::coverage > 0);
+
+ // Split ambiguous branches.
+ SetState(NAS_MARK_AMBIGUOUS);
+ controlMarkAmbiguous();
+
+ // Remove low-coverage contigs.
+ cout << "Removing low-coverage contigs "
+ "(mean k-mer coverage < " << opt::coverage << ")...\n";
+ SetState(NAS_COVERAGE);
+ m_comm.sendControlMessage(APC_SET_STATE, NAS_COVERAGE);
+ m_comm.reduce(m_data.cleanup());
+ m_lowCoverageContigs = 0;
+ m_lowCoverageKmer = 0;
+ pair<size_t, size_t> numAssembled
+ = performNetworkAssembly(this);
+ EndState();
+
+ m_numReachedCheckpoint++;
+ while (!checkpointReached())
+ pumpNetwork();
+
+ // Count the number of low-coverage contigs.
+ SetState(NAS_COVERAGE_COMPLETE);
+ m_comm.sendControlMessage(APC_SET_STATE, NAS_COVERAGE_COMPLETE);
+ m_comm.barrier();
+ pumpNetwork();
+
+ numAssembled.first = m_comm.reduce(numAssembled.first);
+ numAssembled.second = m_comm.reduce(numAssembled.second);
+ cout << "Found " << numAssembled.second << " k-mer in "
+ << numAssembled.first << " contigs "
+ "before removing low-coverage contigs.\n";
+
+ size_t lowCoverageContigs = m_comm.reduce(m_lowCoverageContigs);
+ size_t lowCoverageKmer = m_comm.reduce(m_lowCoverageKmer);
+ cout << "Removed " << lowCoverageKmer << " k-mer in "
+ << lowCoverageContigs << " low-coverage contigs.\n";
+ EndState();
+
+ SetState(NAS_SPLIT_AMBIGUOUS);
+ controlSplitAmbiguous();
+
+ SetState(NAS_CLEAR_FLAGS);
+ m_comm.sendControlMessage(APC_SET_STATE, NAS_CLEAR_FLAGS);
+ m_comm.barrier();
+ pumpNetwork();
+ m_data.wipeFlag(SeqFlag(SF_MARK_SENSE | SF_MARK_ANTISENSE));
+ size_t removed = m_comm.reduce(m_data.cleanup());
+ cout << "Removed " << removed << " marked k-mer.\n";
+ EndState();
+
+ opt::coverage = 0;
+}
+
+/** Run the assembly state machine for the controller (rank = 0). */
+void NetworkSequenceCollection::runControl()
+{
+ SetState(NAS_LOADING);
+ while (m_state != NAS_DONE) {
+ switch (m_state) {
+ case NAS_LOADING:
+ {
+ loadSequences();
+ EndState();
+
+ m_numReachedCheckpoint++;
+ while (!checkpointReached())
+ pumpNetwork();
+
+ SetState(NAS_LOAD_COMPLETE);
+ m_comm.sendControlMessage(APC_SET_STATE,
+ NAS_LOAD_COMPLETE);
+ m_comm.barrier();
+ pumpNetwork();
+ logger(0) << "Loaded " << m_data.size()
+ << " k-mer.\n";
+ assert(!m_data.empty());
+ m_data.shrink();
+ size_t numLoaded = m_comm.reduce(m_data.size());
+ cout << "Loaded " << numLoaded << " k-mer. "
+ "At least "
+ << toSI(numLoaded * sizeof (value_type))
+ << "B of RAM is required.\n";
+
+ Histogram myh
+ = AssemblyAlgorithms::coverageHistogram(m_data);
+ Histogram h(m_comm.reduce(myh.toVector()));
+ AssemblyAlgorithms::setCoverageParameters(h);
+ EndState();
+
+ SetState(m_data.isAdjacencyLoaded()
+ ? NAS_ERODE : NAS_GEN_ADJ);
+ break;
+ }
+ case NAS_GEN_ADJ:
+ cout << "Finding adjacenct k-mer...\n";
+ m_comm.sendControlMessage(APC_SET_STATE, NAS_GEN_ADJ);
+ m_comm.barrier();
+ m_numBasesAdjSet = 0;
+ AssemblyAlgorithms::generateAdjacency(this);
+ EndState();
+
+ m_numReachedCheckpoint++;
+ while (!checkpointReached())
+ pumpNetwork();
+
+ SetState(NAS_ADJ_COMPLETE);
+ m_comm.sendControlMessage(APC_SET_STATE,
+ NAS_ADJ_COMPLETE);
+ m_comm.barrier();
+ pumpNetwork();
+ logger(0) << "Added " << m_numBasesAdjSet
+ << " edges.\n";
+ cout << "Added " << m_comm.reduce(m_numBasesAdjSet)
+ << " edges.\n";
+ EndState();
+
+ SetState(opt::erode > 0 ? NAS_ERODE : NAS_TRIM);
+ break;
+ case NAS_ERODE:
+ assert(opt::erode > 0);
+ cout << "Eroding tips...\n";
+ controlErode();
+ SetState(NAS_TRIM);
+ break;
+
+ case NAS_LOAD_COMPLETE:
+ case NAS_ADJ_COMPLETE:
+ case NAS_REMOVE_MARKED:
+ case NAS_ERODE_WAITING:
+ case NAS_ERODE_COMPLETE:
+ case NAS_COVERAGE_COMPLETE:
+ case NAS_SPLIT_AMBIGUOUS:
+ case NAS_CLEAR_FLAGS:
+ case NAS_DISCOVER_BUBBLES:
+ case NAS_ASSEMBLE_COMPLETE:
+ case NAS_WAITING:
+ // These states are used only by the slaves.
+ assert(false);
+ exit(EXIT_FAILURE);
+
+ case NAS_TRIM:
+ controlTrim();
+ SetState(opt::coverage > 0 ? NAS_COVERAGE
+ : opt::bubbleLen > 0 ? NAS_POPBUBBLE
+ : NAS_MARK_AMBIGUOUS);
+ break;
+
+ case NAS_COVERAGE:
+ controlCoverage();
+ SetState(opt::erode > 0 ? NAS_ERODE : NAS_TRIM);
+ break;
+
+ case NAS_POPBUBBLE:
+ {
+ assert(opt::bubbleLen > 0);
+ ofstream out;
+ AssemblyAlgorithms::openBubbleFile(out);
+
+ cout << "Popping bubbles...\n";
+ size_t numPopped = controlPopBubbles(out);
+ assert(numPopped == m_numPopped);
+ assert(out.good());
+ out.close();
+ cout << "Removed " << numPopped << " bubbles.\n";
+
+ SetState(NAS_MARK_AMBIGUOUS);
+ break;
+ }
+ case NAS_MARK_AMBIGUOUS:
+ controlMarkAmbiguous();
+ SetState(NAS_ASSEMBLE);
+ break;
+ case NAS_ASSEMBLE:
+ {
+ cout << "Assembling...\n";
+ m_comm.sendControlMessage(APC_ASSEMBLE);
+ m_comm.barrier();
+ pumpNetwork();
+ FastaWriter writer(opt::contigsTempPath.c_str());
+ pair<size_t, size_t> numAssembled
+ = performNetworkAssembly(this, &writer);
+ EndState();
+
+ m_numReachedCheckpoint++;
+ while (!checkpointReached())
+ pumpNetwork();
+
+ SetState(NAS_ASSEMBLE_COMPLETE);
+ m_comm.sendControlMessage(APC_SET_STATE,
+ NAS_ASSEMBLE_COMPLETE);
+
+ numAssembled.first = m_comm.reduce(
+ numAssembled.first);
+ numAssembled.second = m_comm.reduce(
+ numAssembled.second);
+ cout << "Assembled " << numAssembled.second
+ << " k-mer in " << numAssembled.first
+ << " contigs.\n";
+
+ SetState(NAS_DONE);
+ break;
+ }
+ case NAS_DONE:
+ break;
+ }
+ }
+}
+
+void NetworkSequenceCollection::EndState()
+{
+ // Flush the message buffer
+ m_comm.flush();
+}
+
+//
+// Set the state
+//
+void NetworkSequenceCollection::SetState(
+ NetworkAssemblyState newState)
+{
+ logger(2) << "SetState " << newState
+ << " (was " << m_state << ")\n";
+
+ // Ensure there are no pending messages
+ assert(m_comm.transmitBufferEmpty());
+
+ m_state = newState;
+
+ // Reset the checkpoint counter
+ m_numReachedCheckpoint = 0;
+ m_checkpointSum = 0;
+}
+
+/** Receive and dispatch packets.
+ * @return the number of packets received
+ */
+size_t NetworkSequenceCollection::pumpNetwork()
+{
+ for (size_t count = 0; ; count++) {
+ int senderID;
+ APMessage msg = m_comm.checkMessage(senderID);
+ switch(msg)
+ {
+ case APM_CONTROL:
+ parseControlMessage(senderID);
+ // Deal with the control packet before we continue
+ // processing further packets.
+ return ++count;
+ case APM_BUFFERED:
+ {
+ MessagePtrVector msgs;
+ m_comm.receiveBufferedMessage(msgs);
+ for (MessagePtrVector::iterator
+ iter = msgs.begin();
+ iter != msgs.end(); iter++) {
+ // Handle each message based on its type
+ (*iter)->handle(senderID, *this);
+ // Delete the message
+ delete (*iter);
+ *iter = 0;
+ }
+ break;
+ }
+ case APM_NONE:
+ return count;
+ }
+ }
+}
+
+/** Call the observers of the specified sequence. */
+void NetworkSequenceCollection::notify(const Kmer& key)
+{
+ switch (m_state) {
+ case NAS_ERODE:
+ case NAS_ERODE_WAITING:
+ case NAS_ERODE_COMPLETE:
+ AssemblyAlgorithms::erode(this,
+ m_data.getSeqAndData(key));
+ break;
+ default:
+ // Nothing to do.
+ break;
+ }
+}
+
+void NetworkSequenceCollection::handle(
+ int /*senderID*/, const SeqAddMessage& message)
+{
+ assert(isLocal(message.m_seq));
+ m_data.add(message.m_seq);
+}
+
+void NetworkSequenceCollection::handle(
+ int /*senderID*/, const SeqRemoveMessage& message)
+{
+ assert(isLocal(message.m_seq));
+ m_data.remove(message.m_seq);
+}
+
+void NetworkSequenceCollection::handle(
+ int /*senderID*/, const SetFlagMessage& message)
+{
+ assert(isLocal(message.m_seq));
+ m_data.setFlag(message.m_seq, (SeqFlag)message.m_flag);
+}
+
+void NetworkSequenceCollection::handle(
+ int /*senderID*/, const SetBaseMessage& message)
+{
+ assert(isLocal(message.m_seq));
+ setBaseExtension(message.m_seq, (extDirection)message.m_dir,
+ message.m_base);
+}
+
+void NetworkSequenceCollection::handle(
+ int /*senderID*/, const RemoveExtensionMessage& message)
+{
+ assert(isLocal(message.m_seq));
+ m_data.removeExtension(message.m_seq,
+ (extDirection)message.m_dir, message.m_ext);
+ notify(message.m_seq);
+}
+
+void NetworkSequenceCollection::parseControlMessage(int source)
+{
+ ControlMessage controlMsg = m_comm.receiveControlMessage();
+ switch(controlMsg.msgType)
+ {
+ case APC_SET_STATE:
+ SetState(NetworkAssemblyState(controlMsg.argument));
+ break;
+ case APC_CHECKPOINT:
+ logger(4) << "checkpoint from " << source << ": "
+ << controlMsg.argument << '\n';
+ m_numReachedCheckpoint++;
+ m_checkpointSum += controlMsg.argument;
+ break;
+ case APC_WAIT:
+ SetState(NAS_WAITING);
+ m_comm.barrier();
+ break;
+ case APC_BARRIER:
+ assert(m_state == NAS_WAITING);
+ m_comm.barrier();
+ break;
+ case APC_TRIM:
+ m_trimStep = controlMsg.argument;
+ SetState(NAS_TRIM);
+ break;
+ case APC_ERODE_COMPLETE:
+ assert(m_state == NAS_ERODE_WAITING);
+ m_comm.flush();
+ SetState(NAS_ERODE_COMPLETE);
+ break;
+ case APC_POPBUBBLE:
+ m_numPopped = controlMsg.argument;
+ SetState(NAS_POPBUBBLE);
+ break;
+ case APC_ASSEMBLE:
+ m_numAssembled = controlMsg.argument;
+ SetState(NAS_ASSEMBLE);
+ break;
+ }
+}
+
+void NetworkSequenceCollection::handle(
+ int senderID, const SeqDataRequest& message)
+{
+ const Kmer& kmer = message.m_seq;
+ assert(isLocal(kmer));
+ ExtensionRecord extRec;
+ int multiplicity = -1;
+ bool found = m_data.getSeqData(kmer, extRec, multiplicity);
+ assert(found);
+ (void)found;
+ m_comm.sendSeqDataResponse(
+ senderID, message.m_group, message.m_id,
+ kmer, extRec, multiplicity);
+}
+
+void NetworkSequenceCollection::handle(
+ int /*senderID*/, const SeqDataResponse& message)
+{
+ processSequenceExtension(
+ message.m_group, message.m_id, message.m_seq,
+ message.m_extRecord, message.m_multiplicity);
+}
+
+/** Distributed trimming function. */
+size_t NetworkSequenceCollection::performNetworkTrim(
+ ISequenceCollection* seqCollection)
+{
+ Timer timer("NetworkTrim");
+ size_t numBranchesRemoved = 0;
+
+ // The branch ids
+ uint64_t branchGroupID = 0;
+
+ for (ISequenceCollection::iterator iter = seqCollection->begin();
+ iter != seqCollection->end(); ++iter) {
+ if (iter->second.deleted())
+ continue;
+
+ extDirection dir;
+ // dir will be set to the trimming direction if the sequence
+ // can be trimmed.
+ SeqContiguity status = AssemblyAlgorithms::checkSeqContiguity(
+ *iter, dir);
+ if (status == SC_CONTIGUOUS)
+ continue;
+ else if(status == SC_ISLAND)
+ {
+ seqCollection->mark(iter->first);
+ numBranchesRemoved++;
+ continue;
+ }
+
+ bool inserted = m_activeBranchGroups.insert(
+ BranchGroupMap::value_type(branchGroupID,
+ BranchGroup(dir, 1, iter->first,
+ BranchRecord(dir))))
+ .second;
+ assert(inserted);
+ (void)inserted;
+
+ generateExtensionRequest(branchGroupID, 0, iter->first);
+ branchGroupID++;
+ numBranchesRemoved += processBranchesTrim();
+ seqCollection->pumpNetwork();
+
+ // Primitive load balancing
+ if(m_activeBranchGroups.size() > MAX_ACTIVE)
+ {
+ while(m_activeBranchGroups.size() > LOW_ACTIVE)
+ {
+ seqCollection->pumpNetwork();
+ numBranchesRemoved += processBranchesTrim();
+ }
+ }
+ }
+
+ // Clear out the remaining branches
+ while(!m_activeBranchGroups.empty())
+ {
+ numBranchesRemoved += processBranchesTrim();
+ seqCollection->pumpNetwork();
+ }
+
+ logger(0) << "Pruned " << numBranchesRemoved << " tips.\n";
+ return numBranchesRemoved;
+}
+
+//
+// Process current branches, removing those that are finished
+// returns true if the branch list has branches remaining
+//
+size_t NetworkSequenceCollection::processBranchesTrim()
+{
+ size_t numBranchesRemoved = 0;
+ vector<BranchGroupMap::iterator> removeBranches;
+ // Check if any of the current branches have gone inactive
+ for (BranchGroupMap::iterator iter = m_activeBranchGroups.begin();
+ iter != m_activeBranchGroups.end(); iter++) {
+ if(!iter->second.isActive())
+ {
+ assert(iter->second.size() == 1);
+ if (AssemblyAlgorithms::processTerminatedBranchTrim(
+ this, iter->second[0]))
+ numBranchesRemoved++;
+
+ // Mark the group for removal
+ removeBranches.push_back(iter);
+ }
+ }
+
+ // Remove all the finished branches
+ for (vector<BranchGroupMap::iterator>::iterator rmIter
+ = removeBranches.begin();
+ rmIter != removeBranches.end(); rmIter++)
+ m_activeBranchGroups.erase(*rmIter);
+ return numBranchesRemoved;
+}
+
+/** Discover bubbles to pop. */
+size_t NetworkSequenceCollection::
+performNetworkDiscoverBubbles(ISequenceCollection* seqCollection)
+{
+ Timer timer("NetworkDiscoverBubbles");
+
+ // The branch ids
+ uint64_t branchGroupID = 0;
+ m_finishedGroups.clear();
+
+ // make sure the branch group structure is initially empty
+ assert(m_activeBranchGroups.empty());
+
+ size_t count = 0;
+
+ // Set the cutoffs
+ const unsigned maxNumBranches = 3;
+
+ for (ISequenceCollection::iterator iter = seqCollection->begin();
+ iter != seqCollection->end(); ++iter) {
+ if (iter->second.deleted())
+ continue;
+
+ if (++count % 100000 == 0)
+ logger(1) << "Popping bubbles: " << count << '\n';
+
+ ExtensionRecord extRec = iter->second.extension();
+ for (extDirection dir = SENSE; dir <= ANTISENSE; ++dir) {
+ if (extRec.dir[dir].isAmbiguous()) {
+ BranchGroupMap::iterator groupIter
+ = m_activeBranchGroups.insert(
+ BranchGroupMap::value_type(branchGroupID,
+ BranchGroup(dir, maxNumBranches,
+ iter->first))).first;
+ BranchGroup& group = groupIter->second;
+ AssemblyAlgorithms::initiateBranchGroup(
+ group, iter->first, extRec.dir[dir]);
+ generateExtensionRequests(branchGroupID++,
+ group.begin(), group.end());
+ }
+ }
+
+ // Primitive load balancing
+ if (m_activeBranchGroups.size() > MAX_ACTIVE) {
+ while (m_activeBranchGroups.size() > LOW_ACTIVE) {
+ seqCollection->pumpNetwork();
+ processBranchesDiscoverBubbles();
+ }
+ }
+
+ processBranchesDiscoverBubbles();
+ seqCollection->pumpNetwork();
+ }
+
+ // Wait until the groups finish extending.
+ while (processBranchesDiscoverBubbles())
+ seqCollection->pumpNetwork();
+ assert(m_activeBranchGroups.empty());
+
+ size_t numDiscovered = m_bubbles.size();
+ logger(1) << "Discovered " << numDiscovered << " bubbles.\n";
+ return numDiscovered;
+}
+
+/** Pop bubbles discovered previously. */
+size_t NetworkSequenceCollection::
+performNetworkPopBubbles(ostream& out)
+{
+ Timer timer("NetworkPopBubbles");
+
+ // Deal with any packets still in the queue. The barrier
+ // synchronization guarantees that the packets have been
+ // delivered, but we may not have dealt with them yet.
+ pumpNetwork();
+ assert(m_comm.receiveEmpty());
+
+ size_t numPopped = 0;
+ for (BranchGroupMap::iterator iter = m_bubbles.begin();
+ iter != m_bubbles.end(); iter++) {
+ assert(iter->second.getStatus() == BGS_JOINED);
+ // Check whether this bubble has already been popped.
+ if (!iter->second.isAmbiguous(m_data))
+ continue;
+ numPopped++;
+ AssemblyAlgorithms::writeBubble(out,
+ iter->second, m_numPopped + numPopped);
+ AssemblyAlgorithms::collapseJoinedBranches(
+ this, iter->second);
+ assert(!iter->second.isAmbiguous(m_data));
+ assert(m_comm.receiveEmpty());
+ }
+ m_bubbles.clear();
+ out.flush();
+ assert(out.good());
+
+ logger(0) << "Removed " << numPopped << " bubbles.\n";
+ return numPopped;
+}
+
+//
+// Process groups that are finished searching for bubbles
+//
+bool NetworkSequenceCollection::processBranchesDiscoverBubbles()
+{
+ bool active = false;
+ // Check if any of the current branches have gone inactive
+ BranchGroupMap::iterator iter = m_activeBranchGroups.begin();
+ while (iter != m_activeBranchGroups.end()) {
+ // All branches have been extended one sequence. Check the
+ // stop conditions. updateStatus() is called in
+ // processSequenceExtensionPop().
+ BranchGroupStatus status = iter->second.isNoExt() ? BGS_NOEXT
+ : iter->second.getStatus();
+ bool finished = false;
+ switch (status) {
+ case BGS_TOOLONG:
+ case BGS_TOOMANYBRANCHES:
+ case BGS_NOEXT:
+ finished = true;
+ break;
+ case BGS_JOINED:
+ m_bubbles.insert(*iter);
+ finished = true;
+ break;
+ case BGS_ACTIVE:
+ active = true;
+ break;
+ default:
+ assert(false);
+ }
+ if (finished) {
+ m_finishedGroups.insert(iter->first);
+ m_activeBranchGroups.erase(iter++);
+ } else
+ iter++;
+ }
+ return active;
+}
+
+/** Discover bubbles to pop. */
+size_t NetworkSequenceCollection::controlDiscoverBubbles()
+{
+ SetState(NAS_DISCOVER_BUBBLES);
+ m_comm.sendControlMessage(APC_SET_STATE, NAS_DISCOVER_BUBBLES);
+
+ size_t numDiscovered = performNetworkDiscoverBubbles(this);
+ EndState();
+
+ m_numReachedCheckpoint++;
+ while (!checkpointReached())
+ pumpNetwork();
+ numDiscovered += m_checkpointSum;
+ if (numDiscovered > 0 && opt::verbose > 0)
+ cout << "Discovered " << numDiscovered << " bubbles.\n";
+ return numDiscovered;
+}
+
+/** Pop the bubbles discovered previously. */
+size_t NetworkSequenceCollection::controlPopBubbles(ostream& out)
+{
+ controlDiscoverBubbles();
+ m_comm.sendControlMessage(APC_BARRIER);
+ m_comm.barrier();
+ pumpNetwork();
+
+ // Perform a round-robin bubble pop to avoid concurrency issues
+ SetState(NAS_POPBUBBLE);
+ m_checkpointSum = performNetworkPopBubbles(out);
+ EndState();
+
+ // Now tell all the slave nodes to perform the pop one by one
+ for(int i = 1; i < opt::numProc; i++) {
+ m_comm.sendControlMessage(APC_BARRIER);
+ m_comm.barrier();
+ m_numReachedCheckpoint = 0;
+ m_comm.sendControlMessageToNode(i, APC_POPBUBBLE,
+ m_numPopped + m_checkpointSum);
+ while (!checkpointReached(1))
+ pumpNetwork();
+ }
+
+ size_t numPopped = m_checkpointSum;
+ m_numPopped += numPopped;
+ if (numPopped > 0)
+ cout << "Removed " << numPopped << " bubbles.\n";
+ return numPopped;
+}
+
+/** Mark ambiguous branches. */
+size_t NetworkSequenceCollection::controlMarkAmbiguous()
+{
+ cout << "Marking ambiguous branches...\n";
+ m_comm.sendControlMessage(APC_SET_STATE, NAS_MARK_AMBIGUOUS);
+ m_comm.barrier();
+ pumpNetwork();
+ size_t count = AssemblyAlgorithms::markAmbiguous(this);
+ m_checkpointSum += count;
+ EndState();
+ m_numReachedCheckpoint++;
+ while (!checkpointReached())
+ pumpNetwork();
+ cout << "Marked " << m_checkpointSum << " ambiguous branches.\n";
+ return m_checkpointSum;
+}
+
+/** Remove ambiguous branches. */
+size_t NetworkSequenceCollection::controlSplitAmbiguous()
+{
+ cout << "Splitting ambiguous branches...\n";
+ m_comm.sendControlMessage(APC_SET_STATE, NAS_SPLIT_AMBIGUOUS);
+ m_comm.barrier();
+ assert(m_comm.receiveEmpty());
+ m_comm.barrier();
+ size_t count = AssemblyAlgorithms::splitAmbiguous(this);
+ m_checkpointSum += count;
+ EndState();
+ m_numReachedCheckpoint++;
+ while (!checkpointReached())
+ pumpNetwork();
+ cout << "Split " << m_checkpointSum << " ambiguous branches.\n";
+ return m_checkpointSum;
+}
+
+/** Assemble a contig. */
+void NetworkSequenceCollection::assembleContig(
+ ISequenceCollection* seqCollection, FastaWriter* writer,
+ BranchRecord& branch, unsigned id)
+{
+ size_t removed = AssemblyAlgorithms::assembleContig(
+ seqCollection, writer, branch, id);
+ if (removed > 0) {
+ m_lowCoverageContigs++;
+ m_lowCoverageKmer += removed;
+ }
+}
+
+namespace std {
+ /** Add a pair of numbers. */
+ pair<size_t, size_t>& operator+=(
+ pair<size_t, size_t>& a, pair<size_t, size_t> b)
+ {
+ a.first += b.first;
+ a.second += b.second;
+ return a;
+ }
+}
+
+/** Assemble contigs.
+ * @return the number of contigs and k-mer assembled
+ */
+pair<size_t, size_t> NetworkSequenceCollection::
+performNetworkAssembly(ISequenceCollection* seqCollection,
+ FastaWriter* fileWriter)
+{
+ Timer timer("NetworkAssembly");
+ pair<size_t, size_t> numAssembled(0, 0);
+ uint64_t branchGroupID = 0;
+ assert(m_activeBranchGroups.empty());
+
+ for (ISequenceCollection::iterator iter = seqCollection->begin();
+ iter != seqCollection->end(); ++iter) {
+ if (iter->second.deleted())
+ continue;
+
+ extDirection dir;
+ // dir will be set to the assembly direction if the sequence
+ // can be assembled.
+ SeqContiguity status = AssemblyAlgorithms::checkSeqContiguity(
+ *iter, dir, true);
+ if (status == SC_CONTIGUOUS)
+ continue;
+ else if(status == SC_ISLAND)
+ {
+ // Output the singleton contig.
+ BranchRecord currBranch(SENSE);
+ currBranch.push_back(*iter);
+ currBranch.terminate(BS_NOEXT);
+ assembleContig(seqCollection, fileWriter, currBranch,
+ m_numAssembled + numAssembled.first);
+ numAssembled.first++;
+ numAssembled.second += currBranch.size();
+ continue;
+ }
+
+ BranchGroup group(dir, 1, iter->first);
+ group.addBranch(BranchRecord(dir));
+ pair<BranchGroupMap::iterator, bool>
+ inserted = m_activeBranchGroups.insert(
+ BranchGroupMap::value_type(branchGroupID, group));
+ assert(inserted.second);
+
+ // Generate the first extension request
+ BranchRecord& branch = inserted.first->second[0];
+ branch.push_back(*iter);
+ Kmer kmer = iter->first;
+ AssemblyAlgorithms::extendBranch(branch,
+ kmer, iter->second.getExtension(dir));
+ assert(branch.isActive());
+ generateExtensionRequest(branchGroupID++, 0, kmer);
+
+ numAssembled += processBranchesAssembly(seqCollection,
+ fileWriter, numAssembled.first);
+ seqCollection->pumpNetwork();
+
+ if(m_activeBranchGroups.size() > MAX_ACTIVE)
+ {
+ while(m_activeBranchGroups.size() > LOW_ACTIVE)
+ {
+ seqCollection->pumpNetwork();
+ numAssembled += processBranchesAssembly(seqCollection,
+ fileWriter, numAssembled.first);
+ }
+ }
+ }
+
+ // Clear out the remaining branches
+ while(!m_activeBranchGroups.empty())
+ {
+ numAssembled += processBranchesAssembly(seqCollection,
+ fileWriter, numAssembled.first);
+ seqCollection->pumpNetwork();
+ }
+
+ if (opt::coverage > 0) {
+ logger(0) << "Found " << numAssembled.second << " k-mer in "
+ << numAssembled.first
+ << " contigs before removing low-coverage contigs.\n"
+ "Removed " << m_lowCoverageKmer << " k-mer in "
+ << m_lowCoverageContigs << " low-coverage contigs.\n";
+ } else
+ logger(0) << "Assembled " << numAssembled.second
+ << " k-mer in " << numAssembled.first << " contigs.\n";
+ return numAssembled;
+}
+
+/** Processes branches that are in progress, removing those that have
+ * completed.
+ * @return the number of contigs and k-mer assembled
+ */
+pair<size_t, size_t> NetworkSequenceCollection::
+processBranchesAssembly(ISequenceCollection* seqCollection,
+ FastaWriter* fileWriter, unsigned currContigID)
+{
+ size_t assembledContigs = 0, assembledKmer = 0;
+ for (BranchGroupMap::iterator it = m_activeBranchGroups.begin();
+ it != m_activeBranchGroups.end();) {
+ if (!it->second.isActive()) {
+ assert(it->second.size() == 1);
+ BranchRecord& branch = it->second[0];
+ assert(branch.getState() == BS_NOEXT
+ || branch.getState() == BS_AMBI_SAME
+ || branch.getState() == BS_AMBI_OPP);
+ if (branch.isCanonical()) {
+ assembledContigs++;
+ assembledKmer += branch.size();
+ assembleContig(seqCollection, fileWriter, branch,
+ m_numAssembled + currContigID++);
+ }
+ m_activeBranchGroups.erase(it++);
+ } else
+ ++it;
+ }
+ return make_pair(assembledContigs, assembledKmer);
+}
+
+/** Send a request for the edges of vertex kmer. */
+void NetworkSequenceCollection::generateExtensionRequest(
+ uint64_t groupID, uint64_t branchID, const Kmer& kmer)
+{
+ if (isLocal(kmer)) {
+ ExtensionRecord extRec;
+ int multiplicity = -1;
+ bool success = m_data.getSeqData(kmer, extRec, multiplicity);
+ assert(success);
+ (void)success;
+ processSequenceExtension(groupID, branchID,
+ kmer, extRec, multiplicity);
+ } else
+ m_comm.sendSeqDataRequest(computeNodeID(kmer),
+ groupID, branchID, kmer);
+}
+
+/** Generate an extension request for each branch of this group. */
+void NetworkSequenceCollection::generateExtensionRequests(
+ uint64_t groupID,
+ BranchGroup::const_iterator first,
+ BranchGroup::const_iterator last)
+{
+ assert(first != last);
+#if !NDEBUG
+ size_t length = first->size();
+#endif
+ unsigned branchID = 0;
+ for (BranchGroup::const_iterator it = first; it != last; ++it) {
+ assert(it->size() == length);
+ generateExtensionRequest(groupID, branchID++,
+ it->back().first);
+ }
+}
+
+void NetworkSequenceCollection::processSequenceExtension(
+ uint64_t groupID, uint64_t branchID, const Kmer& seq,
+ const ExtensionRecord& extRec, int multiplicity)
+{
+ switch(m_state)
+ {
+ case NAS_TRIM:
+ return processLinearSequenceExtension(groupID, branchID,
+ seq, extRec, multiplicity, m_trimStep);
+ case NAS_ASSEMBLE:
+ case NAS_COVERAGE:
+ return processLinearSequenceExtension(groupID, branchID,
+ seq, extRec, multiplicity, UINT_MAX);
+ case NAS_DISCOVER_BUBBLES:
+ return processSequenceExtensionPop(groupID, branchID,
+ seq, extRec, multiplicity,
+ opt::bubbleLen - opt::kmerSize + 1);
+ case NAS_WAITING:
+ if (m_finishedGroups.count(groupID) == 0) {
+ logger(0) << "error: unexpected seqext message: "
+ "state: " << m_state << " "
+ "gid: " << groupID << " bid: " << branchID << " "
+ "seq: " << seq.str() << '\n';
+ assert(false);
+ }
+ break;
+ default:
+ logger(0) << "error: unexpected seqext message: "
+ "state: " << m_state << " "
+ "gid: " << groupID << " bid: " << branchID << " "
+ "seq: " << seq.str() << '\n';
+ assert(false);
+ break;
+ }
+}
+
+/** Process a sequence extension for trimming. */
+void NetworkSequenceCollection::processLinearSequenceExtension(
+ uint64_t groupID, uint64_t branchID, const Kmer& seq,
+ const ExtensionRecord& extRec, int multiplicity,
+ unsigned maxLength)
+{
+ BranchGroupMap::iterator iter
+ = m_activeBranchGroups.find(groupID);
+ assert(iter != m_activeBranchGroups.end());
+ Kmer currSeq = seq;
+ bool active = AssemblyAlgorithms::processLinearExtensionForBranch(
+ iter->second[branchID], currSeq, extRec, multiplicity,
+ maxLength);
+ if (active)
+ generateExtensionRequest(groupID, branchID, currSeq);
+}
+
+/** Process a sequence extension for popping. */
+void NetworkSequenceCollection::processSequenceExtensionPop(
+ uint64_t groupID, uint64_t branchID, const Kmer& seq,
+ const ExtensionRecord& extRec, int multiplicity,
+ unsigned maxLength)
+{
+ BranchGroupMap::iterator groupIt
+ = m_activeBranchGroups.find(groupID);
+ if (groupIt == m_activeBranchGroups.end()) {
+ // This branch is already complete. Double check that that is
+ // the case.
+ assert(m_finishedGroups.count(groupID) > 0);
+ return;
+ }
+
+ BranchGroup& group = groupIt->second;
+ bool extendable = AssemblyAlgorithms::processBranchGroupExtension(
+ group, branchID, seq, extRec, multiplicity, maxLength);
+ if (extendable && group.updateStatus(maxLength) == BGS_ACTIVE)
+ generateExtensionRequests(groupID,
+ group.begin(), group.end());
+}
+
+/** Add a k-mer to this collection. */
+void NetworkSequenceCollection::add(const Kmer& seq,
+ unsigned coverage)
+{
+ if (isLocal(seq)) {
+ m_data.add(seq, coverage);
+ } else {
+ assert(coverage == 1);
+ m_comm.sendSeqAddMessage(computeNodeID(seq), seq);
+ }
+}
+
+/** Remove a k-mer from this collection. */
+void NetworkSequenceCollection::remove(const Kmer& seq)
+{
+ if (isLocal(seq))
+ m_data.remove(seq);
+ else
+ m_comm.sendSeqRemoveMessage(computeNodeID(seq), seq);
+}
+
+bool NetworkSequenceCollection::checkpointReached() const
+{
+ return m_numReachedCheckpoint == (unsigned)opt::numProc;
+}
+
+bool NetworkSequenceCollection::
+checkpointReached(unsigned numRequired) const
+{
+ return m_numReachedCheckpoint == numRequired;
+}
+
+void NetworkSequenceCollection::setFlag(const Kmer& seq, SeqFlag flag)
+{
+ if (isLocal(seq))
+ m_data.setFlag(seq, flag);
+ else
+ m_comm.sendSetFlagMessage(computeNodeID(seq), seq, flag);
+}
+
+bool NetworkSequenceCollection::setBaseExtension(
+ const Kmer& seq, extDirection dir, uint8_t base)
+{
+ if (isLocal(seq)) {
+ if (m_data.setBaseExtension(seq, dir, base))
+ m_numBasesAdjSet++;
+ } else {
+ int nodeID = computeNodeID(seq);
+ m_comm.sendSetBaseExtension(nodeID, seq, dir, base);
+ }
+
+ // As this call delegates, the return value is meaningless.
+ return false;
+}
+
+/** Remove the specified extensions from this k-mer. */
+void NetworkSequenceCollection::removeExtension(
+ const Kmer& seq, extDirection dir, SeqExt ext)
+{
+ if (isLocal(seq)) {
+ m_data.removeExtension(seq, dir, ext);
+ notify(seq);
+ } else {
+ int nodeID = computeNodeID(seq);
+ m_comm.sendRemoveExtension(nodeID, seq, dir, ext);
+ }
+}
+
+/** Return whether this sequence belongs to this process. */
+bool NetworkSequenceCollection::isLocal(const Kmer& seq) const
+{
+ return computeNodeID(seq) == opt::rank;
+}
+
+/** Return the process ID to which the specified kmer belongs. */
+int NetworkSequenceCollection::computeNodeID(const Kmer& seq) const
+{
+ return seq.getCode() % (unsigned)opt::numProc;
+}
diff --git a/Parallel/NetworkSequenceCollection.h b/Parallel/NetworkSequenceCollection.h
new file mode 100644
index 0000000..e63838c
--- /dev/null
+++ b/Parallel/NetworkSequenceCollection.h
@@ -0,0 +1,231 @@
+#ifndef NETWORKSEQUENCECOLLECTION_H
+#define NETWORKSEQUENCECOLLECTION_H 1
+
+#include "SequenceCollection.h"
+#include "BranchGroup.h"
+#include "BranchRecord.h"
+#include "CommLayer.h"
+#include "FastaWriter.h"
+#include "MessageBuffer.h"
+#include "Timer.h"
+#include <ostream>
+#include <set>
+#include <utility>
+
+enum NetworkAssemblyState
+{
+ NAS_LOADING, // loading sequences
+ NAS_LOAD_COMPLETE, // loading is complete
+ NAS_GEN_ADJ, // generating the sequence data
+ NAS_ADJ_COMPLETE, // adjacency generation is complete
+ NAS_ERODE, // erode the branch ends one sequence at a time
+ NAS_ERODE_WAITING,
+ NAS_ERODE_COMPLETE,
+ NAS_TRIM, // trimming the data
+ NAS_REMOVE_MARKED, // remove marked sequences
+ NAS_COVERAGE, // remove low-coverage contigs
+ NAS_COVERAGE_COMPLETE,
+ NAS_DISCOVER_BUBBLES, // discover read errors/SNPs
+ NAS_POPBUBBLE, // remove read errors/SNPs
+ NAS_MARK_AMBIGUOUS, // mark ambiguous branches
+ NAS_SPLIT_AMBIGUOUS, // split ambiguous branches
+ NAS_CLEAR_FLAGS, // clear the flags
+ NAS_ASSEMBLE, // assembling the data
+ NAS_ASSEMBLE_COMPLETE, // assembling is complete
+ NAS_WAITING, // non-control process is waiting
+ NAS_DONE // finished, clean up and exit
+};
+
+typedef std::map<uint64_t, BranchGroup> BranchGroupMap;
+
+/** A distributed map of Kmer to KmerData. */
+class NetworkSequenceCollection : public ISequenceCollection
+{
+ public:
+ NetworkSequenceCollection()
+ : m_state(NAS_WAITING), m_trimStep(0),
+ m_numPopped(0), m_numAssembled(0) { }
+
+ size_t performNetworkTrim(ISequenceCollection* seqCollection);
+
+ size_t performNetworkDiscoverBubbles(ISequenceCollection* c);
+ size_t performNetworkPopBubbles(std::ostream& out);
+
+ size_t controlErode();
+ size_t controlTrimRound(unsigned trimLen);
+ void controlTrim(unsigned start = 1);
+ size_t controlRemoveMarked();
+ void controlCoverage();
+ size_t controlDiscoverBubbles();
+ size_t controlPopBubbles(std::ostream& out);
+ size_t controlMarkAmbiguous();
+ size_t controlSplitAmbiguous();
+ size_t controlSplit();
+
+ // Perform a network assembly
+ std::pair<size_t, size_t> performNetworkAssembly(
+ ISequenceCollection* seqCollection,
+ FastaWriter* fileWriter = NULL);
+
+ void add(const Kmer& seq, unsigned coverage = 1);
+ void remove(const Kmer& seq);
+ void setFlag(const Kmer& seq, SeqFlag flag);
+
+ /** Return true if this container is empty. */
+ bool empty() const { return m_data.empty(); }
+
+ void printLoad() const { m_data.printLoad(); }
+
+ void removeExtension(const Kmer& seq, extDirection dir,
+ SeqExt ext);
+ bool setBaseExtension(const Kmer& seq, extDirection dir,
+ uint8_t base);
+
+ // Receive and dispatch packets.
+ size_t pumpNetwork();
+ size_t pumpFlushReduce();
+
+ void completeOperation();
+
+ // run the assembly
+ void run();
+
+ // run the assembly from the controller's point of view
+ void runControl();
+
+ // test if the checkpoint has been reached
+ bool checkpointReached() const;
+ bool checkpointReached(unsigned numRequired) const;
+
+ void handle(int senderID, const SeqAddMessage& message);
+ void handle(int senderID, const SeqRemoveMessage& message);
+ void handle(int senderID, const SetBaseMessage& message);
+ void handle(int senderID, const SetFlagMessage& message);
+ void handle(int senderID, const RemoveExtensionMessage& m);
+ void handle(int senderID, const SeqDataRequest& message);
+ void handle(int senderID, const SeqDataResponse& message);
+
+ // Observer pattern, not implemented.
+ void attach(SeqObserver f) { (void)f; }
+ void detach(SeqObserver f) { (void)f; }
+
+ /** Load this collection from disk. */
+ void load(const char *path)
+ {
+ m_data.load(path);
+ }
+
+ /** Indicate that this is a colour-space collection. */
+ void setColourSpace(bool flag)
+ {
+ m_data.setColourSpace(flag);
+ m_comm.broadcast(flag);
+ }
+
+ iterator begin() { return m_data.begin(); }
+ const_iterator begin() const { return m_data.begin(); }
+ iterator end() { return m_data.end(); }
+ const_iterator end() const { return m_data.end(); }
+
+ private:
+ // Observer pattern
+ void notify(const Kmer& seq);
+
+ void loadSequences();
+
+ std::pair<size_t, size_t> processBranchesAssembly(
+ ISequenceCollection* seqCollection,
+ FastaWriter* fileWriter, unsigned currContigID);
+ size_t processBranchesTrim();
+ bool processBranchesDiscoverBubbles();
+
+ void generateExtensionRequest(
+ uint64_t groupID, uint64_t branchID, const Kmer& seq);
+ void generateExtensionRequests(uint64_t groupID,
+ BranchGroup::const_iterator first,
+ BranchGroup::const_iterator last);
+ void processSequenceExtension(
+ uint64_t groupID, uint64_t branchID, const Kmer& seq,
+ const ExtensionRecord& extRec, int multiplicity);
+ void processLinearSequenceExtension(
+ uint64_t groupID, uint64_t branchID, const Kmer& seq,
+ const ExtensionRecord& extRec, int multiplicity,
+ unsigned maxLength);
+ void processSequenceExtensionPop(
+ uint64_t groupID, uint64_t branchID, const Kmer& seq,
+ const ExtensionRecord& extRec, int multiplicity,
+ unsigned maxLength);
+
+ void assembleContig(ISequenceCollection* seqCollection,
+ FastaWriter* fileWriter,
+ BranchRecord& branch, unsigned id);
+
+ // Check if a branch is redundant with a previously output
+ // branch.
+ bool isBranchRedundant(const BranchRecord& branch);
+
+ void parseControlMessage(int source);
+
+ bool isLocal(const Kmer& seq) const;
+ int computeNodeID(const Kmer& seq) const;
+
+ void EndState();
+
+ // Set the state of the network assembly
+ void SetState(NetworkAssemblyState newState);
+
+ SequenceCollectionHash m_data;
+
+ // The communications layer implements the functions over the
+ // network.
+ MessageBuffer m_comm;
+
+ // The number of nodes in the network
+ unsigned m_numDataNodes;
+
+ // the state of the assembly
+ NetworkAssemblyState m_state;
+
+ // The number of processes that have sent a checkpoint reached
+ // message, this is used by the control process to determine
+ // the state flow.
+ unsigned m_numReachedCheckpoint;
+
+ /** The sum of the values returned by the slave nodes in their
+ * checkpoint messages.
+ */
+ size_t m_checkpointSum;
+
+ // the number of bases of adjacency set
+ size_t m_numBasesAdjSet;
+
+ // the current length to trim on (comes from the control node)
+ unsigned m_trimStep;
+
+ /** The number of low-coverage contigs removed. */
+ size_t m_lowCoverageContigs;
+
+ /** The number of low-coverage k-mer removed. */
+ size_t m_lowCoverageKmer;
+
+ /** The number of bubbles popped so far. */
+ size_t m_numPopped;
+
+ // the number of sequences assembled so far
+ size_t m_numAssembled;
+
+ // The current branches that are active
+ BranchGroupMap m_activeBranchGroups;
+
+ /** Bubbles, which are branch groups that have joined. */
+ BranchGroupMap m_bubbles;
+
+ // List of IDs of finished groups, used for sanity checking
+ // during bubble popping.
+ std::set<uint64_t> m_finishedGroups;
+
+ static const size_t MAX_ACTIVE = 50;
+ static const size_t LOW_ACTIVE = 10;
+};
+
+#endif
diff --git a/Parallel/parallelAbyss.cpp b/Parallel/parallelAbyss.cpp
new file mode 100644
index 0000000..45232bd
--- /dev/null
+++ b/Parallel/parallelAbyss.cpp
@@ -0,0 +1,104 @@
+#include "config.h"
+#include "Log.h"
+#include "NetworkSequenceCollection.h"
+#include "Assembly/Options.h"
+#include "Common/Options.h"
+#include "Timer.h"
+#include "Uncompress.h"
+#include <cerrno>
+#include <climits> // for HOST_NAME_MAX
+#include <cstdio> // for setvbuf
+#include <cstdlib>
+#include <cstring> // for strerror
+#include <iostream>
+#include <mpi.h>
+#include <sstream>
+#include <unistd.h> // for gethostname
+#include <vector>
+
+using namespace std;
+
+/** Execute a shell command and check its return status. */
+static void systemx(const string& command)
+{
+ if (opt::verbose > 0)
+ cout << command << endl;
+ int ret = system(command.c_str());
+ if (ret == 0)
+ return;
+ cerr << "error: command failed: `" << command << "'\n";
+ if (ret == -1)
+ cerr << "system() failed: " << strerror(errno) << endl;
+ exit(ret == -1 ? EXIT_FAILURE : ret);
+}
+
+/** Concatenate files using the specified command and remove them. */
+static void concatenateFiles(const string& dest,
+ const string& prefix, const string& suffix,
+ const string& command = "cat")
+{
+ cout << "Concatenating to " << dest << endl;
+ ostringstream s;
+ s << command;
+ for (int i = 0; i < opt::numProc; i++)
+ s << ' ' << prefix << i << suffix;
+ s << " >'" << dest << '\'';
+ systemx(s.str());
+
+ bool die = false;
+ for (int i = 0; i < opt::numProc; i++) {
+ s.str("");
+ s << prefix << i << suffix;
+ const char* path = s.str().c_str();
+ if (unlink(path) == -1) {
+ cerr << "error: removing `" << path << "': "
+ << strerror(errno) << endl;
+ die = true;
+ }
+ }
+ if (die)
+ exit(EXIT_FAILURE);
+}
+
+int main(int argc, char** argv)
+{
+ Timer timer("Total");
+
+ // Set stdout to be line buffered.
+ setvbuf(stdout, NULL, _IOLBF, 0);
+
+ MPI_Init(&argc,&argv);
+ MPI_Comm_rank(MPI_COMM_WORLD, &opt::rank);
+ MPI_Comm_size(MPI_COMM_WORLD, &opt::numProc);
+
+ opt::parse(argc, argv);
+ if (opt::rank == 0)
+ cout << "Running on " << opt::numProc << " processors\n";
+
+ MPI_Barrier(MPI_COMM_WORLD);
+ char hostname[HOST_NAME_MAX];
+ gethostname(hostname, sizeof hostname);
+ logger(0) << "Running on host " << hostname << endl;
+ MPI_Barrier(MPI_COMM_WORLD);
+
+ if (opt::rank == 0) {
+ NetworkSequenceCollection networkSeqs;
+ networkSeqs.runControl();
+ } else {
+ NetworkSequenceCollection networkSeqs;
+ networkSeqs.run();
+ }
+
+ MPI_Barrier(MPI_COMM_WORLD);
+ MPI_Finalize();
+
+ if (opt::rank == 0) {
+ concatenateFiles(opt::contigsPath, "contigs-", ".fa",
+ "awk '/^>/ { $1=\">\" i++ } { print }'");
+ if (!opt::snpPath.empty())
+ concatenateFiles(opt::snpPath, "snp-", ".fa");
+ cout << "Done." << endl;
+ }
+
+ return 0;
+}
diff --git a/ParseAligns/Makefile.am b/ParseAligns/Makefile.am
new file mode 100644
index 0000000..dfb7ca2
--- /dev/null
+++ b/ParseAligns/Makefile.am
@@ -0,0 +1,18 @@
+bin_PROGRAMS = abyss-fixmate ParseAligns
+
+abyss_fixmate_CPPFLAGS= -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_fixmate_LDADD= \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_fixmate_SOURCES=abyss-fixmate.cc
+
+ParseAligns_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+ParseAligns_LDADD = \
+ $(top_builddir)/Common/libcommon.a
+
+ParseAligns_SOURCES = \
+ ParseAligns.cpp
diff --git a/ParseAligns/Makefile.in b/ParseAligns/Makefile.in
new file mode 100644
index 0000000..565d6c8
--- /dev/null
+++ b/ParseAligns/Makefile.in
@@ -0,0 +1,568 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = abyss-fixmate$(EXEEXT) ParseAligns$(EXEEXT)
+subdir = ParseAligns
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_ParseAligns_OBJECTS = ParseAligns-ParseAligns.$(OBJEXT)
+ParseAligns_OBJECTS = $(am_ParseAligns_OBJECTS)
+ParseAligns_DEPENDENCIES = $(top_builddir)/Common/libcommon.a
+am_abyss_fixmate_OBJECTS = abyss_fixmate-abyss-fixmate.$(OBJEXT)
+abyss_fixmate_OBJECTS = $(am_abyss_fixmate_OBJECTS)
+abyss_fixmate_DEPENDENCIES = $(top_builddir)/Common/libcommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(ParseAligns_SOURCES) $(abyss_fixmate_SOURCES)
+DIST_SOURCES = $(ParseAligns_SOURCES) $(abyss_fixmate_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+abyss_fixmate_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_fixmate_LDADD = \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_fixmate_SOURCES = abyss-fixmate.cc
+ParseAligns_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+ParseAligns_LDADD = \
+ $(top_builddir)/Common/libcommon.a
+
+ParseAligns_SOURCES = \
+ ParseAligns.cpp
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign ParseAligns/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign ParseAligns/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+ParseAligns$(EXEEXT): $(ParseAligns_OBJECTS) $(ParseAligns_DEPENDENCIES) $(EXTRA_ParseAligns_DEPENDENCIES)
+ @rm -f ParseAligns$(EXEEXT)
+ $(CXXLINK) $(ParseAligns_OBJECTS) $(ParseAligns_LDADD) $(LIBS)
+abyss-fixmate$(EXEEXT): $(abyss_fixmate_OBJECTS) $(abyss_fixmate_DEPENDENCIES) $(EXTRA_abyss_fixmate_DEPENDENCIES)
+ @rm -f abyss-fixmate$(EXEEXT)
+ $(CXXLINK) $(abyss_fixmate_OBJECTS) $(abyss_fixmate_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/ParseAligns-ParseAligns.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_fixmate-abyss-fixmate.Po at am__quote@
+
+.cc.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ParseAligns-ParseAligns.o: ParseAligns.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ParseAligns_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ParseAligns-ParseAligns.o -MD -MP -MF $(DEPDIR)/ParseAligns-ParseAligns.Tpo -c -o ParseAligns-ParseAligns.o `test -f 'ParseAligns.cpp' || echo '$(srcdir)/'`ParseAligns.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ParseAligns-ParseAligns.Tpo $(DEPDIR)/ParseAligns-ParseAligns.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ParseAligns.cpp' object='ParseAligns-ParseAligns.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ParseAligns_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ParseAligns-ParseAligns.o `test -f 'ParseAligns.cpp' || echo '$(srcdir)/'`ParseAligns.cpp
+
+ParseAligns-ParseAligns.obj: ParseAligns.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ParseAligns_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT ParseAligns-ParseAligns.obj -MD -MP -MF $(DEPDIR)/ParseAligns-ParseAligns.Tpo -c -o ParseAligns-ParseAligns.obj `if test -f 'ParseAligns.cpp'; then $(CYGPATH_W) 'ParseAligns.cpp'; else $(CYGPATH_W) '$(srcdir)/ParseAligns.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/ParseAligns-ParseAligns.Tpo $(DEPDIR)/ParseAligns-ParseAligns.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='ParseAligns.cpp' object='ParseAligns-ParseAligns.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(ParseAligns_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o ParseAligns-ParseAligns.obj `if test -f 'ParseAligns.cpp'; then $(CYGPATH_W) 'ParseAligns.cpp'; else $(CYGPATH_W) '$(srcdir)/ParseAligns.cpp'; fi`
+
+abyss_fixmate-abyss-fixmate.o: abyss-fixmate.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_fixmate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_fixmate-abyss-fixmate.o -MD -MP -MF $(DEPDIR)/abyss_fixmate-abyss-fixmate.Tpo -c -o abyss_fixmate-abyss-fixmate.o `test -f 'abyss-fixmate.cc' || echo '$(srcdir)/'`abyss-fixmate.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_fixmate-abyss-fixmate.Tpo $(DEPDIR)/abyss_fixmate-abyss-fixmate.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='abyss-fixmate.cc' object='abyss_fixmate-abyss-fixmate.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_fixmate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_fixmate-abyss-fixmate.o `test -f 'abyss-fixmate.cc' || echo '$(srcdir)/'`abyss-fixmate.cc
+
+abyss_fixmate-abyss-fixmate.obj: abyss-fixmate.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_fixmate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_fixmate-abyss-fixmate.obj -MD -MP -MF $(DEPDIR)/abyss_fixmate-abyss-fixmate.Tpo -c -o abyss_fixmate-abyss-fixmate.obj `if test -f 'abyss-fixmate.cc'; then $(CYGPATH_W) 'abyss-fixmate.cc'; else $(CYGPATH_W) '$(srcdir)/abyss-fixmate.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_fixmate-abyss-fixmate.Tpo $(DEPDIR)/abyss_fixmate-abyss-fixmate.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='abyss-fixmate.cc' object='abyss_fixmate-abyss-fixmate.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_fixmate_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_fixmate-abyss-fixmate.obj `if test -f 'abyss-fixmate.cc'; then $(CYGPATH_W) 'abyss-fixmate.cc'; else $(CYGPATH_W) '$(srcdir)/abyss-fixmate.cc'; fi`
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/ParseAligns/ParseAligns.cpp b/ParseAligns/ParseAligns.cpp
new file mode 100644
index 0000000..327c65e
--- /dev/null
+++ b/ParseAligns/ParseAligns.cpp
@@ -0,0 +1,680 @@
+#include "Alignment.h"
+#include "Estimate.h"
+#include "Histogram.h"
+#include "IOUtil.h"
+#include "MemoryUtil.h"
+#include "SAM.h"
+#include "StringUtil.h"
+#include "Uncompress.h"
+#include "UnorderedMap.h"
+#include <algorithm>
+#include <climits>
+#include <cmath>
+#include <cstdlib>
+#include <cstring>
+#include <fstream>
+#include <functional>
+#include <getopt.h>
+#include <iomanip>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <string>
+#include <vector>
+
+using namespace std;
+
+#define PROGRAM "ParseAligns"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Jared Simpson and Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... [FILE]...\n"
+"Write pairs that map to the same contig to the file SAME.\n"
+"Write pairs that map to different contigs to standard output.\n"
+"Alignments may be read from FILE(s) or standard input.\n"
+"\n"
+" -l, --min-align=N minimum alignment length\n"
+" -d, --dist=DISTANCE write distance estimates to this file\n"
+" -f, --frag=SAME write fragment sizes to this file\n"
+" -h, --hist=FILE write the fragment size histogram to FILE\n"
+" --sam alignments are in SAM format\n"
+" --kaligner alignments are in KAligner format\n"
+" -c, --cover=COVERAGE coverage cut-off for distance estimates\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by DistanceEst
+ static unsigned c;
+ static int verbose;
+ static string distPath;
+ static string fragPath;
+ static string histPath;
+
+ /** Input alignment format. */
+ static int inputFormat;
+ enum { KALIGNER, SAM };
+
+ /** Output format */
+ int format = ADJ; // used by Estimate
+}
+
+static const char shortopts[] = "d:l:f:h:c:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "dist", required_argument, NULL, 'd' },
+ { "min-align", required_argument, NULL, 'l' },
+ { "frag", required_argument, NULL, 'f' },
+ { "hist", required_argument, NULL, 'h' },
+ { "kaligner",no_argument, &opt::inputFormat, opt::KALIGNER },
+ { "sam", no_argument, &opt::inputFormat, opt::SAM },
+ { "cover", required_argument, NULL, 'c' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+static struct {
+ size_t alignments;
+ size_t bothUnaligned;
+ size_t oneUnaligned;
+ size_t numDifferent;
+ size_t numFF;
+ size_t numMulti;
+ size_t numSplit;
+} stats;
+
+static ofstream fragFile;
+static Histogram histogram;
+
+typedef vector<Alignment> AlignmentVector;
+
+/** A map of read IDs to alignments. */
+typedef unordered_map<string, AlignmentVector> ReadAlignMap;
+
+/** A map of contig IDs to distance estimates. */
+typedef unordered_map<string, EstimateRecord> EstimateMap;
+static EstimateMap estMap;
+
+static bool checkUniqueAlignments(const AlignmentVector& alignVec);
+static string makePairID(string id);
+
+/**
+ * Return the size of the fragment demarcated by the specified
+ * alignments.
+ */
+static int fragmentSize(const Alignment& a0, const Alignment& a1)
+{
+ assert(a0.contig == a1.contig);
+ assert(a0.isRC != a1.isRC);
+ const Alignment& f = a0.isRC ? a1 : a0;
+ const Alignment& r = a0.isRC ? a0 : a1;
+ return r - f;
+}
+
+typedef pair<ContigNode, DistanceEst> Estimate;
+typedef vector<Estimate> Estimates;
+
+static void addEstimate(EstimateMap& map, const Alignment& a,
+ Estimate& est, bool reverse)
+{
+ //count up the number of estimates that agree
+ bool placed = false;
+ bool a_isRC = a.isRC != reverse;
+ EstimateMap::iterator estimatesIt = map.find(a.contig);
+ if (estimatesIt != map.end()) {
+ Estimates& estimates = estimatesIt->second.estimates[a_isRC];
+ for (Estimates::iterator estIt = estimates.begin();
+ estIt != estimates.end(); ++estIt) {
+ if (estIt->first.id() == est.first.id()) {
+ estIt->second.numPairs++;
+ estIt->second.distance += est.second.distance;
+ placed = true;
+ break;
+ }
+ }
+ }
+ if (!placed)
+ map[a.contig].estimates[a_isRC].push_back(est);
+
+}
+
+static void doReadIntegrity(const ReadAlignMap::value_type& a)
+{
+ AlignmentVector::const_iterator refAlignIter = a.second.begin();
+ unsigned firstStart, lastEnd, largestSize;
+ Alignment first, last, largest;
+
+ firstStart = refAlignIter->read_start_pos;
+ lastEnd = firstStart + refAlignIter->align_length;
+ largestSize = refAlignIter->align_length;
+ first = last = largest = *refAlignIter;
+ ++refAlignIter;
+
+ //for each alignment in the vector a.second
+ for (; refAlignIter != a.second.end(); ++refAlignIter) {
+ if ((unsigned)refAlignIter->read_start_pos < firstStart) {
+ firstStart = refAlignIter->read_start_pos;
+ first = *refAlignIter;
+ }
+ if ((unsigned)(refAlignIter->read_start_pos +
+ refAlignIter->align_length) > lastEnd) {
+ lastEnd = refAlignIter->read_start_pos +
+ refAlignIter->align_length;
+ last = *refAlignIter;
+ }
+ if ((unsigned)refAlignIter->align_length > largestSize) {
+ largestSize = refAlignIter->align_length;
+ largest = *refAlignIter;
+ }
+ }
+
+ if (largest.contig != last.contig) {
+ Estimate est;
+ unsigned largest_end =
+ largest.read_start_pos + largest.align_length - opt::k;
+ int distance = last.read_start_pos - largest_end;
+ est.first = find_vertex(
+ last.contig, largest.isRC != last.isRC,
+ g_contigNames);
+ est.second.distance = distance - opt::k;
+ est.second.numPairs = 1;
+ est.second.stdDev = 0;
+ addEstimate(estMap, largest, est, false);
+ }
+
+ if (largest.contig != first.contig &&
+ largest.contig != last.contig) {
+ Estimate est;
+ unsigned first_end =
+ first.read_start_pos + first.align_length - opt::k;
+ int distance = last.read_start_pos - first_end;
+ est.first = find_vertex(
+ last.contig, first.isRC != last.isRC,
+ g_contigNames);
+ est.second.distance = distance - opt::k;
+ est.second.numPairs = 1;
+ est.second.stdDev = 0;
+ addEstimate(estMap, first, est, false);
+ }
+
+ if (largest.contig != first.contig) {
+ largest.flipQuery();
+ first.flipQuery();
+ Estimate est;
+ unsigned largest_end =
+ largest.read_start_pos + largest.align_length - opt::k;
+ int distance = first.read_start_pos - largest_end;
+ est.first = find_vertex(
+ first.contig, largest.isRC != first.isRC,
+ g_contigNames);
+ est.second.distance = distance - opt::k;
+ est.second.numPairs = 1;
+ est.second.stdDev = 0;
+ addEstimate(estMap, largest, est, false);
+ }
+
+#if 0
+ //for each alignment in the vector a.second
+ for (AlignmentVector::const_iterator refAlignIter = a.second.begin();
+ refAlignIter != a.second.end(); ++refAlignIter) {
+ //for each alignment after the current one
+ for (AlignmentVector::const_iterator alignIter = a.second.begin();
+ alignIter != a.second.end(); ++alignIter) {
+ //make sure both alignments aren't for the same contig
+ if (alignIter->contig != refAlignIter->contig) {
+ Estimate est;
+ //Make sure the distance is read as 0 if the two contigs are
+ //directly adjacent to each other. A -ve number suggests an
+ //overlap.
+ assert(refAlignIter->read_start_pos != alignIter->read_start_pos);
+ const Alignment& a = refAlignIter->read_start_pos < alignIter->read_start_pos ? *refAlignIter : *alignIter;
+ const Alignment& b = refAlignIter->read_start_pos > alignIter->read_start_pos ? *refAlignIter : *alignIter;
+ unsigned a_end = a.read_start_pos + a.align_length - opt::k;
+ int distance = b.read_start_pos - a_end;
+ est.nID = ContigID(b.contig);
+ est.distance = distance - opt::k;
+ est.numPairs = 1;
+ est.stdDev = 0;
+ //weird file format...
+ est.isRC = a.isRC != b.isRC;
+
+ addEstimate(estMap, a, est, false);
+ }
+ }
+ }
+#endif
+}
+
+static void generateDistFile()
+{
+ ofstream distFile(opt::distPath.c_str());
+ assert(distFile.is_open());
+ for (EstimateMap::iterator mapIt = estMap.begin();
+ mapIt != estMap.end(); ++mapIt) {
+ //Skip empty iterators
+ assert(!mapIt->second.estimates[0].empty() || !mapIt->second.estimates[1].empty());
+ distFile << mapIt->first;
+ for (int refIsRC = 0; refIsRC <= 1; refIsRC++) {
+ if (refIsRC)
+ distFile << " ;";
+
+ for (Estimates::iterator vecIt
+ = mapIt->second.estimates[refIsRC].begin();
+ vecIt != mapIt->second.estimates[refIsRC].end(); ++vecIt) {
+ vecIt->second.distance
+ = (int)round((double)vecIt->second.distance /
+ (double)vecIt->second.numPairs);
+ if (vecIt->second.numPairs >= opt::c
+ && vecIt->second.numPairs != 0
+ /*&& vecIt->distance > 1 - opt::k*/)
+ distFile
+ << ' ' << get(g_contigNames, vecIt->first)
+ << ',' << vecIt->second;
+ }
+ }
+ distFile << '\n';
+ assert_good(distFile, opt::distPath);
+ }
+ distFile.close();
+}
+
+static bool isSingleEnd(const string& id);
+static bool needsFlipping(const string& id);
+
+/**
+ * Return an alignment flipped as necessary to produce an alignment
+ * pair whose expected orientation is forward-reverse. If the
+ * expected orientation is forward-forward, then reverse the first
+ * alignment, so that the alignment is forward-reverse, which is
+ * required by DistanceEst.
+ */
+static const Alignment flipAlignment(const Alignment& a,
+ const string& id)
+{
+ return needsFlipping(id) ? a.flipQuery() : a;
+}
+
+static void handleAlignmentPair(const ReadAlignMap::value_type& curr,
+ const ReadAlignMap::value_type& pair)
+{
+ const string& currID = curr.first;
+ const string& pairID = pair.first;
+
+ // Both reads must align to a unique location.
+ // The reads are allowed to span more than one contig, but
+ // at least one of the two reads must span no more than
+ // two contigs.
+ const unsigned MAX_SPAN = 2;
+ if (curr.second.empty() && pair.second.empty()) {
+ stats.bothUnaligned++;
+ } else if (curr.second.empty() || pair.second.empty()) {
+ stats.oneUnaligned++;
+ } else if (!checkUniqueAlignments(curr.second)
+ || !checkUniqueAlignments(pair.second)) {
+ stats.numMulti++;
+ } else if (curr.second.size() > MAX_SPAN
+ && pair.second.size() > MAX_SPAN) {
+ stats.numSplit++;
+ } else {
+ // Iterate over the vectors, outputting the aligments
+ bool counted = false;
+ for (AlignmentVector::const_iterator refAlignIter
+ = curr.second.begin();
+ refAlignIter != curr.second.end(); ++refAlignIter) {
+ for (AlignmentVector::const_iterator pairAlignIter
+ = pair.second.begin();
+ pairAlignIter != pair.second.end();
+ ++pairAlignIter) {
+ const Alignment& a0 = flipAlignment(*refAlignIter,
+ currID);
+ const Alignment& a1 = flipAlignment(*pairAlignIter,
+ pairID);
+
+ bool sameTarget = a0.contig == a1.contig;
+ if (sameTarget
+ && curr.second.size() == 1
+ && pair.second.size() == 1) {
+ // Same target and the only alignment.
+ if (a0.isRC != a1.isRC) {
+ // Correctly oriented. Add this alignment to
+ // the distribution of fragment sizes.
+ int size = fragmentSize(a0, a1);
+ histogram.insert(size);
+ if (!opt::fragPath.empty()) {
+ fragFile << size << '\n';
+ assert(fragFile.good());
+ }
+ } else
+ stats.numFF++;
+ counted = true;
+ }
+
+ bool outputSameTarget = opt::fragPath.empty()
+ && opt::histPath.empty();
+ if (!sameTarget || outputSameTarget) {
+ cout << SAMRecord(a0, a1) << '\n'
+ << SAMRecord(a1, a0) << '\n';
+ assert(cout.good());
+ }
+ }
+ }
+ if (!counted)
+ stats.numDifferent++;
+ }
+}
+
+static void printProgress(const ReadAlignMap& map)
+{
+ if (opt::verbose == 0)
+ return;
+
+ static size_t prevBuckets;
+ if (prevBuckets == 0)
+ prevBuckets = map.bucket_count();
+
+ size_t buckets = map.bucket_count();
+ if (stats.alignments % 1000000 == 0 || buckets != prevBuckets) {
+ prevBuckets = buckets;
+ size_t size = map.size();
+ cerr << "Read " << stats.alignments << " alignments. "
+ "Hash load: " << size << " / " << buckets
+ << " = " << (float)size / buckets
+ << " using " << toSI(getMemoryUsage()) << "B." << endl;
+ }
+}
+
+static void handleAlignment(
+ const ReadAlignMap::value_type& alignments,
+ ReadAlignMap& out)
+{
+ if (!isSingleEnd(alignments.first)) {
+ string pairID = makePairID(alignments.first);
+ ReadAlignMap::iterator pairIter = out.find(pairID);
+ if (pairIter != out.end()) {
+ handleAlignmentPair(*pairIter, alignments);
+ out.erase(pairIter);
+ } else if (!out.insert(alignments).second) {
+ cerr << "error: duplicate read ID `" << alignments.first
+ << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (!opt::distPath.empty() && alignments.second.size() >= 2)
+ doReadIntegrity(alignments);
+
+ stats.alignments++;
+ printProgress(out);
+}
+
+static void readAlignment(const string& line, ReadAlignMap& out)
+{
+ istringstream s(line);
+ pair<string, AlignmentVector> v;
+ switch (opt::inputFormat) {
+ case opt::SAM:
+ {
+ SAMRecord sam;
+ s >> sam;
+ assert(s);
+ v.first = sam.qname;
+ if (sam.isRead1())
+ v.first += "/1";
+ else if (sam.isRead2())
+ v.first += "/2";
+ if (!sam.isUnmapped())
+ v.second.push_back(sam);
+ break;
+ }
+ case opt::KALIGNER:
+ {
+ s >> v.first;
+ assert(s);
+ v.second.reserve(count(line.begin(), line.end(), '\t'));
+ v.second.assign(
+ istream_iterator<Alignment>(s),
+ istream_iterator<Alignment>());
+ assert(s.eof());
+ break;
+ }
+ }
+ handleAlignment(v, out);
+}
+
+static void readAlignments(istream& in, ReadAlignMap* pout)
+{
+ for (string line; getline(in, line);)
+ if (line.empty() || line[0] == '@')
+ cout << line << '\n';
+ else
+ readAlignment(line, *pout);
+ assert(in.eof());
+}
+
+static void readAlignmentsFile(string path, ReadAlignMap* pout)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading `" << path << "'..." << endl;
+ ifstream fin(path.c_str());
+ assert_good(fin, path);
+ readAlignments(fin, pout);
+ fin.close();
+}
+
+/** Return the specified number formatted as a percent. */
+static string percent(size_t x, size_t n)
+{
+ ostringstream ss;
+ ss << setw((int)log10(n) + 1) << x;
+ if (x > 0)
+ ss << " " << setprecision(3) << (float)100*x/n << '%';
+ return ss.str();
+}
+
+int main(int argc, char* const* argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'l': arg >> opt::k; break;
+ case 'c': arg >> opt::c; break;
+ case 'd': arg >> opt::distPath; break;
+ case 'f': arg >> opt::fragPath; break;
+ case 'h': arg >> opt::histPath; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0 && opt::inputFormat == opt::KALIGNER) {
+ cerr << PROGRAM ": " << "missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ if (!opt::fragPath.empty()) {
+ fragFile.open(opt::fragPath.c_str());
+ assert(fragFile.is_open());
+ }
+
+ ReadAlignMap alignTable(1);
+ if (optind < argc) {
+ for_each(argv + optind, argv + argc,
+ bind2nd(ptr_fun(readAlignmentsFile), &alignTable));
+ } else {
+ if (opt::verbose > 0)
+ cerr << "Reading from standard input..." << endl;
+ readAlignments(cin, &alignTable);
+ }
+ if (opt::verbose > 0)
+ cerr << "Read " << stats.alignments << " alignments" << endl;
+
+ unsigned numRF = histogram.count(INT_MIN, 0);
+ unsigned numFR = histogram.count(1, INT_MAX);
+ size_t sum = alignTable.size()
+ + stats.bothUnaligned + stats.oneUnaligned
+ + numFR + numRF + stats.numFF
+ + stats.numDifferent + stats.numMulti + stats.numSplit;
+ cerr <<
+ "Mateless " << percent(alignTable.size(), sum) << "\n"
+ "Unaligned " << percent(stats.bothUnaligned, sum) << "\n"
+ "Singleton " << percent(stats.oneUnaligned, sum) << "\n"
+ "FR " << percent(numFR, sum) << "\n"
+ "RF " << percent(numRF, sum) << "\n"
+ "FF " << percent(stats.numFF, sum) << "\n"
+ "Different " << percent(stats.numDifferent, sum) << "\n"
+ "Multimap " << percent(stats.numMulti, sum) << "\n"
+ "Split " << percent(stats.numSplit, sum) << "\n"
+ "Total " << sum << endl;
+
+ if (!opt::distPath.empty())
+ generateDistFile();
+
+ if (!opt::fragPath.empty())
+ fragFile.close();
+
+ if (!opt::histPath.empty()) {
+ ofstream histFile(opt::histPath.c_str());
+ assert(histFile.is_open());
+ histFile << histogram;
+ assert(histFile.good());
+ histFile.close();
+ }
+
+ if (numFR < numRF)
+ histogram = histogram.negate();
+ histogram.eraseNegative();
+ histogram.removeNoise();
+ histogram.removeOutliers();
+ Histogram h = histogram.trimFraction(0.0001);
+ if (opt::verbose > 0)
+ cerr << "Stats mean: " << setprecision(4) << h.mean() << " "
+ "median: " << setprecision(4) << h.median() << " "
+ "sd: " << setprecision(4) << h.sd() << " "
+ "n: " << h.size() << " "
+ "min: " << h.minimum() << " max: " << h.maximum() << '\n'
+ << h.barplot() << endl;
+
+ if (stats.numFF > numFR && stats.numFF > numRF) {
+ cerr << "error: The mate pairs of this library are oriented "
+ "forward-forward (FF), which is not supported by ABySS."
+ << endl;
+ exit(EXIT_FAILURE);
+ }
+
+ return 0;
+}
+
+/** Return whether any k-mer in the query is aligned more than once.
+ */
+static bool checkUniqueAlignments(const AlignmentVector& alignVec)
+{
+ assert(!alignVec.empty());
+ if (alignVec.size() == 1)
+ return true;
+
+ unsigned nKmer = alignVec.front().read_length - opt::k + 1;
+ vector<unsigned> coverage(nKmer);
+
+ for (AlignmentVector::const_iterator iter = alignVec.begin();
+ iter != alignVec.end(); ++iter) {
+ assert((unsigned)iter->align_length >= opt::k);
+ unsigned end = iter->read_start_pos
+ + iter->align_length - opt::k + 1;
+ assert(end <= nKmer);
+ for (unsigned i = iter->read_start_pos; i < end; i++)
+ coverage[i]++;
+ }
+
+ for (unsigned i = 0; i < nKmer; ++i)
+ if (coverage[i] > 1)
+ return false;
+ return true;
+}
+
+static bool replaceSuffix(string& s,
+ const string& suffix0, const string& suffix1)
+{
+ if (endsWith(s, suffix0)) {
+ s.replace(s.length() - suffix0.length(), string::npos,
+ suffix1);
+ return true;
+ } else if (endsWith(s, suffix1)) {
+ s.replace(s.length() - suffix1.length(), string::npos,
+ suffix0);
+ return true;
+ } else
+ return false;
+}
+
+/** Return true if the specified read ID is of a single-end read. */
+static bool isSingleEnd(const string& id)
+{
+ unsigned l = id.length();
+ return endsWith(id, ".fn")
+ || (l > 6 && id.substr(l-6, 5) == ".part");
+}
+
+/** Return the mate ID of the specified read ID. */
+static string makePairID(string id)
+{
+ if (equal(id.begin(), id.begin() + 3, "SRR"))
+ return id;
+
+ assert(!id.empty());
+ char& c = id[id.length() - 1];
+ switch (c) {
+ case '1': c = '2'; return id;
+ case '2': c = '1'; return id;
+ case 'A': c = 'B'; return id;
+ case 'B': c = 'A'; return id;
+ case 'F': c = 'R'; return id;
+ case 'R': c = 'F'; return id;
+ case 'f': c = 'r'; return id;
+ case 'r': c = 'f'; return id;
+ }
+
+ if (replaceSuffix(id, "forward", "reverse")
+ || replaceSuffix(id, "F3", "R3"))
+ return id;
+
+ cerr << "error: read ID `" << id << "' must end in one of\n"
+ "\t1 and 2 or A and B or F and R or"
+ " F3 and R3 or forward and reverse\n";
+ exit(EXIT_FAILURE);
+}
+
+static bool needsFlipping(const string& id)
+{
+ return endsWith(id, "F3");
+}
diff --git a/ParseAligns/abyss-fixmate.cc b/ParseAligns/abyss-fixmate.cc
new file mode 100644
index 0000000..1a169cf
--- /dev/null
+++ b/ParseAligns/abyss-fixmate.cc
@@ -0,0 +1,330 @@
+#include "Histogram.h"
+#include "IOUtil.h"
+#include "MemoryUtil.h"
+#include "SAM.h"
+#include "StringUtil.h"
+#include "Uncompress.h"
+#include "UnorderedMap.h"
+#include <algorithm>
+#include <climits>
+#include <cstdlib>
+#include <fstream>
+#include <functional>
+#include <getopt.h>
+#include <iomanip>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <string>
+
+using namespace std;
+
+#define PROGRAM "abyss-fixmate"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... [FILE]...\n"
+"Write read pairs that map to the same contig to the file SAME.\n"
+"Write read pairs that map to different contigs to stdout.\n"
+"Alignments may be in FILE(s) or standard input.\n"
+"\n"
+" --no-qname set the qname to * [default]\n"
+" --qname do not alter the qname\n"
+" -s, --same=SAME write properly-paired reads to this file\n"
+" -h, --hist=FILE write the fragment size histogram to FILE\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ static string fragPath;
+ static string histPath;
+ static int qname;
+ static int verbose;
+}
+
+static const char shortopts[] = "h:s:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "qname", no_argument, &opt::qname, 1 },
+ { "no-qname", no_argument, &opt::qname, 0 },
+ { "hist", required_argument, NULL, 'h' },
+ { "same", required_argument, NULL, 's' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+static struct {
+ size_t alignments;
+ size_t bothUnaligned;
+ size_t oneUnaligned;
+ size_t numDifferent;
+ size_t numFF;
+} stats;
+
+static ofstream g_fragFile;
+static Histogram g_histogram;
+
+static void handlePair(SAMRecord& a0, SAMRecord& a1)
+{
+ if ((a0.isRead1() && a1.isRead1())
+ || (a0.isRead2() && a1.isRead2())) {
+ cerr << "error: duplicate read ID `" << a0.qname
+ << (a0.isRead1() ? "/1" : "")
+ << (a0.isRead2() ? "/2" : "")
+ << "'\n";
+ exit(EXIT_FAILURE);
+ }
+
+ if (!opt::qname)
+ a0.qname = a1.qname = "*";
+
+ if (a0.isUnmapped() && a1.isUnmapped()) {
+ // Both reads are unaligned.
+ stats.bothUnaligned++;
+ } else if (a0.isUnmapped() || a1.isUnmapped()) {
+ // One read is unaligned.
+ stats.oneUnaligned++;
+ } else if (a0.rname != a1.rname) {
+ // Different targets.
+ stats.numDifferent++;
+ fixMate(a0, a1);
+ // Set the mapping quality of both reads to their minimum.
+ a0.mapq = a1.mapq = min(a0.mapq, a1.mapq);
+ cout << a0 << '\n' << a1 << '\n';
+ } else if (a0.isReverse() == a1.isReverse()) {
+ // Same target, FF orientation.
+ stats.numFF++;
+ } else {
+ // Same target, FR or RF orientation.
+ fixMate(a0, a1);
+ g_histogram.insert(a0.isReverse() ? a1.isize : a0.isize);
+ if (!opt::fragPath.empty()) {
+ g_fragFile << a0 << '\n' << a1 << '\n';
+ assert(g_fragFile.good());
+ } else if (opt::histPath.empty()) {
+ cout << a0 << '\n' << a1 << '\n';
+ assert(cout.good());
+ }
+ }
+}
+
+#if SAM_SEQ_QUAL
+typedef unordered_map<string, SAMRecord> Alignments;
+#else
+typedef unordered_map<string, SAMAlignment> Alignments;
+#endif
+
+static void printProgress(const Alignments& map)
+{
+ if (opt::verbose == 0)
+ return;
+
+ static size_t prevBuckets;
+ if (prevBuckets == 0)
+ prevBuckets = map.bucket_count();
+
+ size_t buckets = map.bucket_count();
+ if (stats.alignments % 1000000 == 0 || buckets != prevBuckets) {
+ prevBuckets = buckets;
+ size_t size = map.size();
+ cerr << "Read " << stats.alignments << " alignments. "
+ << "Hash load: " << size << " / " << buckets
+ << " = " << (float)size / buckets
+ << " using " << toSI(getMemoryUsage()) << "B." << endl;
+ }
+}
+
+static void handleAlignment(SAMRecord& sam, Alignments& map)
+{
+ pair<Alignments::iterator, bool> it = map.insert(
+ make_pair(sam.qname, sam));
+ if (!it.second) {
+#if SAM_SEQ_QUAL
+ SAMRecord& a0 = it.first->second;
+#else
+ SAMRecord a0(it.first->second, it.first->first);
+#endif
+ handlePair(a0, sam);
+ map.erase(it.first);
+ }
+ stats.alignments++;
+ printProgress(map);
+}
+
+static void assert_eof(istream& in)
+{
+ if (in.eof())
+ return;
+ in.clear();
+ string line;
+ getline(in, line);
+ cerr << "error: `" << line << "'\n";
+ exit(EXIT_FAILURE);
+}
+
+static void readAlignments(istream& in, Alignments* pMap)
+{
+ for (SAMRecord sam; in >> ws;) {
+ if (in.peek() == '@') {
+ string line;
+ getline(in, line);
+ assert(in);
+ cout << line << '\n';
+ } else if (in >> sam)
+ handleAlignment(sam, *pMap);
+ }
+ assert_eof(in);
+}
+
+static void readAlignmentsFile(string path, Alignments* pMap)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading `" << path << "'..." << endl;
+ ifstream fin(path.c_str());
+ assert_good(fin, path);
+ readAlignments(fin, pMap);
+ fin.close();
+}
+
+/** Return the specified number formatted as a percent. */
+static string percent(size_t x, size_t n)
+{
+ ostringstream ss;
+ ss << setw((int)log10(n) + 1) << x;
+ if (x > 0)
+ ss << " " << setprecision(3) << (float)100*x/n << '%';
+ return ss.str();
+}
+
+/** Print statistics of the specified histogram. */
+static void printHistogramStats(const Histogram& h)
+{
+ cerr << "Stats mean: " << setprecision(4) << h.mean() << " "
+ "median: " << setprecision(4) << h.median() << " "
+ "sd: " << setprecision(4) << h.sd() << " "
+ "n: " << h.size() << " "
+ "min: " << h.minimum() << " "
+ "max: " << h.maximum() << '\n'
+ << h.barplot() << endl;
+}
+
+int main(int argc, char* const* argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 's': arg >> opt::fragPath; break;
+ case 'h': arg >> opt::histPath; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ if (!opt::fragPath.empty()) {
+ g_fragFile.open(opt::fragPath.c_str());
+ assert(g_fragFile.is_open());
+ }
+
+ Alignments alignments(1);
+ if (optind < argc) {
+ for_each(argv + optind, argv + argc,
+ bind2nd(ptr_fun(readAlignmentsFile), &alignments));
+ } else {
+ if (opt::verbose > 0)
+ cerr << "Reading from standard input..." << endl;
+ readAlignments(cin, &alignments);
+ }
+ if (opt::verbose > 0)
+ cerr << "Read " << stats.alignments << " alignments" << endl;
+
+ unsigned numRF = g_histogram.count(INT_MIN, 0);
+ unsigned numFR = g_histogram.count(1, INT_MAX);
+ size_t sum = alignments.size()
+ + stats.bothUnaligned + stats.oneUnaligned
+ + numFR + numRF + stats.numFF
+ + stats.numDifferent;
+ cerr <<
+ "Mateless " << percent(alignments.size(), sum) << "\n"
+ "Unaligned " << percent(stats.bothUnaligned, sum) << "\n"
+ "Singleton " << percent(stats.oneUnaligned, sum) << "\n"
+ "FR " << percent(numFR, sum) << "\n"
+ "RF " << percent(numRF, sum) << "\n"
+ "FF " << percent(stats.numFF, sum) << "\n"
+ "Different " << percent(stats.numDifferent, sum) << "\n"
+ "Total " << sum << endl;
+
+ if (!opt::fragPath.empty())
+ g_fragFile.close();
+
+ if (!opt::histPath.empty()) {
+ ofstream histFile(opt::histPath.c_str());
+ assert(histFile.is_open());
+ histFile << g_histogram;
+ assert(histFile.good());
+ histFile.close();
+ }
+
+ if (opt::verbose > 0) {
+ size_t numTotal = numFR + numRF;
+
+ // Print the statistics of the forward-reverse distribution.
+ if ((float)numFR / numTotal > 0.001) {
+ Histogram h = g_histogram;
+ h.eraseNegative();
+ h.removeNoise();
+ h.removeOutliers();
+ cerr << "FR ";
+ printHistogramStats(h.trimFraction(0.0001));
+ }
+
+ // Print the statistics of the reverse-forward distribution.
+ if ((float)numRF / numTotal > 0.001) {
+ Histogram h = g_histogram.negate();
+ h.eraseNegative();
+ h.removeNoise();
+ h.removeOutliers();
+ cerr << "RF ";
+ printHistogramStats(h.trimFraction(0.0001));
+ }
+ }
+
+ if (stats.numFF > numFR && stats.numFF > numRF) {
+ cerr << "error: The mate pairs of this library are oriented "
+ "forward-forward (FF), which is not supported by ABySS."
+ << endl;
+ exit(EXIT_FAILURE);
+ }
+
+ return 0;
+}
diff --git a/PathOverlap/Makefile.am b/PathOverlap/Makefile.am
new file mode 100644
index 0000000..13f4bc8
--- /dev/null
+++ b/PathOverlap/Makefile.am
@@ -0,0 +1,13 @@
+bin_PROGRAMS = PathOverlap
+
+PathOverlap_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+PathOverlap_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Common/libcommon.a
+
+PathOverlap_SOURCES = \
+ PathOverlap.cpp
diff --git a/PathOverlap/Makefile.in b/PathOverlap/Makefile.in
new file mode 100644
index 0000000..02818b6
--- /dev/null
+++ b/PathOverlap/Makefile.in
@@ -0,0 +1,531 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = PathOverlap$(EXEEXT)
+subdir = PathOverlap
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_PathOverlap_OBJECTS = PathOverlap-PathOverlap.$(OBJEXT)
+PathOverlap_OBJECTS = $(am_PathOverlap_OBJECTS)
+PathOverlap_DEPENDENCIES = $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Common/libcommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(PathOverlap_SOURCES)
+DIST_SOURCES = $(PathOverlap_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+PathOverlap_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+PathOverlap_LDADD = \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Common/libcommon.a
+
+PathOverlap_SOURCES = \
+ PathOverlap.cpp
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign PathOverlap/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign PathOverlap/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+PathOverlap$(EXEEXT): $(PathOverlap_OBJECTS) $(PathOverlap_DEPENDENCIES) $(EXTRA_PathOverlap_DEPENDENCIES)
+ @rm -f PathOverlap$(EXEEXT)
+ $(CXXLINK) $(PathOverlap_OBJECTS) $(PathOverlap_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/PathOverlap-PathOverlap.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+PathOverlap-PathOverlap.o: PathOverlap.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PathOverlap_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT PathOverlap-PathOverlap.o -MD -MP -MF $(DEPDIR)/PathOverlap-PathOverlap.Tpo -c -o PathOverlap-PathOverlap.o `test -f 'PathOverlap.cpp' || echo '$(srcdir)/'`PathOverlap.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/PathOverlap-PathOverlap.Tpo $(DEPDIR)/PathOverlap-PathOverlap.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='PathOverlap.cpp' object='PathOverlap-PathOverlap.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PathOverlap_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o PathOverlap-PathOverlap.o `test -f 'PathOverlap.cpp' || echo '$(srcdir)/'`PathOverlap.cpp
+
+PathOverlap-PathOverlap.obj: PathOverlap.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PathOverlap_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT PathOverlap-PathOverlap.obj -MD -MP -MF $(DEPDIR)/PathOverlap-PathOverlap.Tpo -c -o PathOverlap-PathOverlap.obj `if test -f 'PathOverlap.cpp'; then $(CYGPATH_W) 'PathOverlap.cpp'; else $(CYGPATH_W) '$(srcdir)/PathOverlap.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/PathOverlap-PathOverlap.Tpo $(DEPDIR)/PathOverlap-PathOverlap.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='PathOverlap.cpp' object='PathOverlap-PathOverlap.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PathOverlap_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o PathOverlap-PathOverlap.obj `if test -f 'PathOverlap.cpp'; then $(CYGPATH_W) 'PathOverlap.cpp'; else $(CYGPATH_W) '$(srcdir)/PathOverlap.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/PathOverlap/PathOverlap.cpp b/PathOverlap/PathOverlap.cpp
new file mode 100644
index 0000000..dd607d3
--- /dev/null
+++ b/PathOverlap/PathOverlap.cpp
@@ -0,0 +1,663 @@
+#include "config.h"
+#include "ContigID.h"
+#include "ContigPath.h"
+#include "ContigProperties.h"
+#include "Functional.h"
+#include "IOUtil.h"
+#include "Uncompress.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/GraphIO.h"
+#include <algorithm>
+#include <cassert>
+#include <cerrno>
+#include <cstring> // for strerror
+#include <cstdlib>
+#include <functional>
+#include <string>
+#include <sstream>
+#include <iostream>
+#include <iterator>
+#include <fstream>
+#include <getopt.h>
+#include <map>
+#include <vector>
+
+using namespace std;
+
+#define PROGRAM "PathOverlap"
+
+static const char *VERSION_MESSAGE =
+PROGRAM " (ABySS) " VERSION "\n"
+"Written by Shaun Jackman and Tony Raymond.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char *USAGE_MESSAGE =
+"Usage: " PROGRAM " [OPTION]... ADJ PATH\n"
+"Find paths that overlap. Either output the graph of overlapping\n"
+"paths, assemble overlapping paths into larger paths, or trim the\n"
+"overlapping paths.\n"
+" ADJ contig adjacency graph\n"
+" PATH sequences of contig IDs\n"
+"\n"
+" -k, --kmer=N k-mer size\n"
+" -g, --graph=FILE write the contig adjacency graph to FILE\n"
+" -r, --repeats=FILE write repeat contigs to FILE\n"
+" --overlap find overlapping paths [default]\n"
+" --assemble assemble overlapping paths\n"
+" --trim trim overlapping paths\n"
+" --adj output the graph in adj format [default]\n"
+" --dot output the graph in dot format\n"
+" --sam output the graph in SAM format\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k;
+
+ /** Output format. */
+ int format; // used by ContigProperties
+
+ /** Write the contig adjacency graph to this file. */
+ static string graphPath;
+
+ /** Output the IDs of contigs in overlaps to this file. */
+ static string repeatContigs;
+
+ /** Mode of operation. */
+ enum {
+ /** Find overlapping paths, do not assemble. */
+ OVERLAP,
+ /** Assemble overlapping paths. */
+ ASSEMBLE,
+ /** Trim overlapping paths. */
+ TRIM,
+ };
+ static int mode;
+
+ static int verbose;
+}
+
+static const char* shortopts = "g:k:r:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "graph", required_argument, NULL, 'g' },
+ { "kmer", required_argument, NULL, 'k' },
+ { "assemble", no_argument, &opt::mode, opt::ASSEMBLE },
+ { "overlap", no_argument, &opt::mode, opt::OVERLAP },
+ { "trim", no_argument, &opt::mode, opt::TRIM },
+ { "adj", no_argument, &opt::format, ADJ, },
+ { "dot", no_argument, &opt::format, DOT, },
+ { "sam", no_argument, &opt::format, SAM, },
+ { "repeats", required_argument, NULL, 'r' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** A vertex of the overlap graph. */
+struct Vertex {
+ unsigned id;
+ bool sense;
+
+ /** The number of single-end contigs. */
+ static unsigned s_offset;
+
+ Vertex(unsigned id, bool sense)
+ : id(id), sense(sense) { }
+
+ bool operator ==(const Vertex& v) const
+ {
+ return id == v.id && sense == v.sense;
+ }
+
+ ContigNode descriptor() const
+ {
+ return ContigNode(s_offset + id, sense);
+ }
+};
+
+unsigned Vertex::s_offset;
+
+/** An alignment of two overlapping contigs. */
+struct Overlap {
+ Vertex source;
+ Vertex target;
+
+ /** Overlap measured in number of contigs. */
+ unsigned overlap;
+
+ /** Overlap measured in bp. */
+ int distance;
+
+ Overlap(const Vertex& source, const Vertex& target,
+ unsigned overlap, int distance)
+ : source(source), target(target),
+ overlap(overlap), distance(distance) { }
+};
+
+/** The contig IDs that have been removed from paths. */
+static vector<ContigID> s_trimmedContigs;
+
+/** The contig graph. */
+typedef DirectedGraph<ContigProperties, Distance> DG;
+typedef ContigGraph<DG> Graph;
+
+typedef vector<ContigPath> Paths;
+
+/** Return whether this vertex is a path or a contig. */
+static bool isPath(const ContigNode& u)
+{
+ return u.id() >= Vertex::s_offset;
+}
+
+/** Return a path, complemented if necessary. */
+static ContigPath getPath(const Paths& paths, const ContigNode& u)
+{
+ if (isPath(u)) {
+ unsigned i = u.id() - Vertex::s_offset;
+ return u.sense() ? reverseComplement(paths[i]) : paths[i];
+ } else
+ return ContigPath(1, u);
+}
+
+/** Read contig paths from the specified file.
+ * @param g the contig adjacency graph
+ * @param inPath the file of contig paths
+ * @param[out] pathIDs the path IDs
+ * @return the paths
+ */
+static Paths readPaths(Graph& g,
+ const string& inPath, vector<string>& pathIDs)
+{
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ assert(pathIDs.empty());
+ ifstream fin(inPath.c_str());
+ if (opt::verbose > 0)
+ cerr << "Reading `" << inPath << "'..." << endl;
+ if (inPath != "-")
+ assert_good(fin, inPath);
+ istream& in = inPath == "-" ? cin : fin;
+
+ assert_good(in, inPath);
+ Paths paths;
+ string id;
+ ContigPath path;
+ while (in >> id >> path) {
+ if (path.empty()) {
+ // Remove this contig from the graph.
+ V u = find_vertex(id, false, g);
+ clear_vertex(u, g);
+ remove_vertex(u, g);
+ } else {
+ pathIDs.push_back(id);
+ paths.push_back(path);
+ }
+ }
+ assert(in.eof());
+ return paths;
+}
+
+typedef multimap<ContigNode, Vertex> SeedMap;
+
+/** Index the first and last contig of each path to facilitate finding
+ * overlaps between paths. */
+static SeedMap makeSeedMap(const Paths& paths)
+{
+ SeedMap seedMap;
+ for (Paths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ if (it->empty())
+ continue;
+ assert(!it->front().ambiguous());
+ seedMap.insert(make_pair(it->front(),
+ Vertex(it - paths.begin(), false)));
+ assert(!it->back().ambiguous());
+ seedMap.insert(make_pair(it->back() ^ 1,
+ Vertex(it - paths.begin(), true)));
+ }
+ return seedMap;
+}
+
+/** Check whether path starts with the sequence [first, last). */
+static bool startsWith(ContigPath path, bool rc,
+ ContigPath::const_iterator first,
+ ContigPath::const_iterator last)
+{
+ if (rc)
+ reverseComplement(path.begin(), path.end());
+ assert(*first == path.front());
+ assert(first < last);
+ return unsigned(last - first) > path.size() ? false
+ : equal(first, last, path.begin());
+}
+
+/** Check whether path starts with the sequence [first, last). */
+static unsigned findOverlap(const Graph& g,
+ const Paths& paths,
+ ContigPath::const_iterator first,
+ ContigPath::const_iterator last,
+ const Vertex& v, int &distance)
+{
+ if (!startsWith(paths[v.id], v.sense, first, last))
+ return 0;
+ distance = -addProp(g, first, last).length;
+ return last - first;
+}
+
+typedef vector<Overlap> Overlaps;
+
+/** Find every path that overlaps with the specified path. */
+static void findOverlaps(const Graph& g,
+ const Paths& paths, const SeedMap& seedMap,
+ const Vertex& v, Overlaps& overlaps)
+{
+ ContigPath rc;
+ if (v.sense) {
+ rc = paths[v.id];
+ reverseComplement(rc.begin(), rc.end());
+ }
+ const ContigPath& path = v.sense ? rc : paths[v.id];
+
+ for (ContigPath::const_iterator it = path.begin();
+ it != path.end(); ++it) {
+ if (it->ambiguous())
+ continue;
+
+ pair<SeedMap::const_iterator, SeedMap::const_iterator>
+ range = seedMap.equal_range(*it);
+ for (SeedMap::const_iterator seed = range.first;
+ seed != range.second; ++seed) {
+ if (v == seed->second)
+ continue;
+ int distance = 0;
+ unsigned overlap = findOverlap(g, paths, it, path.end(),
+ seed->second, distance);
+ if (overlap > 0)
+ overlaps.push_back(Overlap(v, seed->second,
+ overlap, distance));
+
+ }
+ }
+}
+
+/** Find every pair of overlapping paths. */
+static Overlaps findOverlaps(const Graph& g, const Paths& paths)
+{
+ SeedMap seedMap = makeSeedMap(paths);
+
+ Overlaps overlaps;
+ for (Paths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ unsigned i = it - paths.begin();
+ findOverlaps(g, paths, seedMap, Vertex(i, false), overlaps);
+ findOverlaps(g, paths, seedMap, Vertex(i, true), overlaps);
+ }
+ return overlaps;
+}
+
+/** Record the trimmed contigs. */
+static void recordTrimmedContigs(
+ ContigPath::const_iterator first,
+ ContigPath::const_iterator last)
+{
+ for (ContigPath::const_iterator it = first; it != last; ++it)
+ if (!it->ambiguous())
+ s_trimmedContigs.push_back(it->contigIndex());
+}
+
+/** Remove ambiguous contigs from the ends of the path. */
+static void removeAmbiguousContigs(ContigPath& path)
+{
+ if (!path.empty() && path.back().ambiguous())
+ path.erase(path.end() - 1);
+ if (!path.empty() && path.front().ambiguous())
+ path.erase(path.begin());
+}
+
+/** Remove the overlapping portion of the specified contig. */
+static void removeContigs(ContigPath& path,
+ unsigned first, unsigned last)
+{
+ assert(first <= path.size());
+ assert(last <= path.size());
+ if (first < last) {
+ recordTrimmedContigs(path.begin(), path.begin() + first);
+ recordTrimmedContigs(path.begin() + last, path.end());
+ path.erase(path.begin() + last, path.end());
+ path.erase(path.begin(), path.begin() + first);
+ } else {
+ recordTrimmedContigs(path.begin(), path.end());
+ path.clear();
+ }
+ removeAmbiguousContigs(path);
+}
+
+/** Find the largest overlap for each contig and remove it. */
+static void trimOverlaps(Paths& paths, const Overlaps& overlaps)
+{
+ vector<unsigned> removed[2];
+ removed[0].resize(paths.size());
+ removed[1].resize(paths.size());
+
+ for (Overlaps::const_iterator it = overlaps.begin();
+ it != overlaps.end(); ++it) {
+ unsigned& a = removed[!it->source.sense][it->source.id];
+ unsigned& b = removed[it->target.sense][it->target.id];
+ a = max(a, it->overlap);
+ b = max(b, it->overlap);
+ }
+
+ for (Paths::iterator it = paths.begin(); it != paths.end(); ++it)
+ removeContigs(*it, removed[0][it - paths.begin()],
+ it->size() - removed[1][it - paths.begin()]);
+}
+
+/** Trim the ends of paths that overlap another path. */
+static void trimOverlaps(const Graph& g, Paths& paths)
+{
+ for (Overlaps overlaps = findOverlaps(g, paths);
+ !overlaps.empty();
+ overlaps = findOverlaps(g, paths)) {
+ cerr << "Found " << overlaps.size() / 2 << " overlaps.\n";
+ trimOverlaps(paths, overlaps);
+ }
+}
+
+static inline
+ContigProperties get(vertex_bundle_t, const Graph& g, ContigNode u)
+{
+ return u.ambiguous()
+ ? ContigProperties(u.length() + opt::k - 1, 0)
+ : g[u];
+}
+
+/** Add the path overlap edges to the specified graph. */
+static void addPathOverlapEdges(Graph& g,
+ const Paths& paths, const vector<string>& pathIDs,
+ const Overlaps& overlaps)
+{
+ typedef graph_traits<Graph>::vertex_descriptor V;
+ const bool allowParallelEdge = opt::mode == opt::ASSEMBLE;
+
+ // Add the path vertices.
+ g_contigNames.unlock();
+ for (Paths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ const ContigPath& path = *it;
+ const string& id = pathIDs[it - paths.begin()];
+ if (!path.empty()) {
+ V u = merge(g, path.begin(), path.end());
+ put(vertex_name, g, u, id);
+ }
+ }
+ g_contigNames.lock();
+
+ // Remove the single-end contigs that are in paths.
+ for (Paths::const_iterator it = paths.begin();
+ it != paths.end(); ++it)
+ remove_vertex_if(g, it->begin(), it->end(),
+ not1(std::mem_fun_ref(&ContigNode::ambiguous)));
+
+ // Add the path edges.
+ for (Overlaps::const_iterator it = overlaps.begin();
+ it != overlaps.end(); ++it) {
+ V u = it->source.descriptor();
+ V v = it->target.descriptor();
+ if (allowParallelEdge || !edge(u, v, g).second)
+ add_edge(u, v, it->distance, static_cast<DG&>(g));
+ else if (opt::verbose > 0)
+ cerr << "ambiguous overlap: " << get(vertex_name, g, u)
+ << " -> " << get(vertex_name, g, v) << '\n';
+ }
+}
+
+typedef graph_traits<Graph>::edge_descriptor edge_descriptor;
+
+/** A property map giving the number of contigs by which two paths
+ * overlap. */
+typedef map<edge_descriptor, unsigned> OverlapMap;
+
+/** Return the number of contigs by which the two paths overlap. */
+static unsigned getOverlap(const OverlapMap& pmap,
+ graph_traits<Graph>::vertex_descriptor u,
+ graph_traits<Graph>::vertex_descriptor v)
+{
+ if (isPath(u) && isPath(v)) {
+ // Both vertices are paths.
+ OverlapMap::const_iterator it = pmap.find(
+ edge_descriptor(u, v));
+ return it == pmap.end() ? 0 : it->second;
+ } else {
+ // One of the two vertices is a contig.
+ return 0;
+ }
+}
+
+/** Merge a sequence of overlapping paths. */
+static ContigPath mergePaths(const Paths& paths,
+ const OverlapMap& overlaps, const ContigPath& merge)
+{
+ assert(!merge.empty());
+ ContigNode u = merge.front();
+ ContigPath path(getPath(paths, u));
+ for (ContigPath::const_iterator it = merge.begin() + 1;
+ it != merge.end(); ++it) {
+ ContigNode v = *it;
+ ContigPath vpath(getPath(paths, v));
+ unsigned overlap = getOverlap(overlaps, u, v);
+ assert(path.size() > overlap);
+ assert(vpath.size() > overlap);
+ assert(equal(path.end() - overlap, path.end(),
+ vpath.begin()));
+ path.insert(path.end(), vpath.begin() + overlap, vpath.end());
+ u = v;
+ }
+ return path;
+}
+
+/** Return true if the edge e is a path overlap. */
+struct IsPathOverlap : unary_function<edge_descriptor, bool> {
+ IsPathOverlap(const Graph& g, const OverlapMap& pmap)
+ : m_g(g), m_pmap(pmap) { }
+ bool operator()(edge_descriptor e) const
+ {
+ return getOverlap(m_pmap, source(e, m_g), target(e, m_g));
+ }
+ private:
+ const Graph& m_g;
+ const OverlapMap& m_pmap;
+};
+
+/** Assemble overlapping paths. */
+static void assembleOverlappingPaths(Graph& g,
+ Paths& paths, vector<string>& pathIDs)
+{
+ if (paths.empty())
+ return;
+
+ // Find overlapping paths.
+ Overlaps overlaps = findOverlaps(g, paths);
+ addPathOverlapEdges(g, paths, pathIDs, overlaps);
+
+ // Create a property map of path overlaps.
+ OverlapMap overlapMap;
+ for (Overlaps::const_iterator it = overlaps.begin();
+ it != overlaps.end(); ++it)
+ overlapMap.insert(OverlapMap::value_type(
+ OverlapMap::key_type(
+ it->source.descriptor(),
+ it->target.descriptor()),
+ it->overlap));
+
+ // Assemble unambiguously overlapping paths.
+ Paths merges;
+ assemble_if(g, back_inserter(merges),
+ IsPathOverlap(g, overlapMap));
+
+ // Merge overlapping paths.
+ g_contigNames.unlock();
+ assert(!pathIDs.empty());
+ setNextContigName(pathIDs.back());
+ for (Paths::const_iterator it = merges.begin();
+ it != merges.end(); ++it) {
+ string name = createContigName();
+ if (opt::verbose > 0)
+ cerr << name << '\t' << *it << '\n';
+ Vertex u(paths.size(), false);
+ put(vertex_name, g, u.descriptor(), name);
+ pathIDs.push_back(name);
+ paths.push_back(mergePaths(paths, overlapMap, *it));
+
+ // Remove the merged paths.
+ for (ContigPath::const_iterator it2 = it->begin();
+ it2 != it->end(); ++it2) {
+ if (isPath(*it2))
+ paths[it2->id() - Vertex::s_offset].clear();
+ }
+ }
+ g_contigNames.lock();
+}
+
+int main(int argc, char** argv)
+{
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'g': arg >> opt::graphPath; break;
+ case 'k': arg >> opt::k; break;
+ case 'r': arg >> opt::repeatContigs; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (argc - optind < 2) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ } else if (argc - optind > 2) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ const char *adjPath = argv[optind++];
+ if (opt::verbose > 0)
+ cerr << "Reading `" << adjPath << "'..." << endl;
+ ifstream fin(adjPath);
+ assert_good(fin, adjPath);
+ Graph g;
+ fin >> g;
+ Vertex::s_offset = g.num_vertices() / 2;
+
+ string pathsFile(argv[optind++]);
+ vector<string> pathIDs;
+ Paths paths = readPaths(g, pathsFile, pathIDs);
+
+ switch (opt::mode) {
+ case opt::OVERLAP:
+ // Find overlapping paths, do not assemble.
+ addPathOverlapEdges(g, paths, pathIDs,
+ findOverlaps(g, paths));
+ paths.clear();
+ if (opt::graphPath.empty())
+ opt::graphPath = "-";
+ break;
+
+ case opt::ASSEMBLE:
+ // Assemble overlapping paths.
+ assembleOverlappingPaths(g, paths, pathIDs);
+ break;
+
+ case opt::TRIM:
+ // Trim overlapping paths.
+ trimOverlaps(g, paths);
+ // Remove paths consisting of a single contig.
+ for_each_if(paths.begin(), paths.end(),
+ mem_fun_ref(&ContigPath::clear),
+ compose1(
+ bind2nd(equal_to<ContigPath::size_type>(), 1),
+ mem_fun_ref(&ContigPath::size)));
+ // Add the paths to the graph.
+ addPathOverlapEdges(g, paths, pathIDs, Overlaps());
+ break;
+ }
+
+ // Output the paths.
+ for (Paths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ if (it->empty())
+ continue;
+ assert(it->size() != 1);
+ cout << pathIDs[it - paths.begin()] << '\t' << *it << '\n';
+ }
+ assert(cout.good());
+
+ // Output the graph.
+ if (!opt::graphPath.empty()) {
+ ofstream fout;
+ ostream& out = opt::graphPath == "-" ? cout
+ : (fout.open(opt::graphPath.c_str()), fout);
+ assert_good(out, opt::graphPath);
+ write_graph(out, g, PROGRAM, commandLine);
+ assert_good(out, opt::graphPath);
+ }
+
+ // Output the repeat contigs.
+ if (!opt::repeatContigs.empty()) {
+ sort(s_trimmedContigs.begin(), s_trimmedContigs.end());
+ s_trimmedContigs.erase(
+ unique(s_trimmedContigs.begin(),
+ s_trimmedContigs.end()), s_trimmedContigs.end());
+ ofstream out(opt::repeatContigs.c_str());
+ assert_good(out, opt::repeatContigs);
+ for (vector<ContigID>::const_iterator it
+ = s_trimmedContigs.begin();
+ it != s_trimmedContigs.end(); ++it)
+ out << get(g_contigNames, *it) << '\n';
+ assert_good(out, opt::repeatContigs);
+ }
+
+ return 0;
+}
diff --git a/PopBubbles/Makefile.am b/PopBubbles/Makefile.am
new file mode 100644
index 0000000..aaed14b
--- /dev/null
+++ b/PopBubbles/Makefile.am
@@ -0,0 +1,17 @@
+bin_PROGRAMS = PopBubbles
+
+PopBubbles_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Align \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+PopBubbles_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+
+PopBubbles_LDADD = \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Align/libalign.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/dialign/libdialign.a
+
+PopBubbles_SOURCES = PopBubbles.cpp
diff --git a/PopBubbles/Makefile.in b/PopBubbles/Makefile.in
new file mode 100644
index 0000000..394bcf6
--- /dev/null
+++ b/PopBubbles/Makefile.in
@@ -0,0 +1,537 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = PopBubbles$(EXEEXT)
+subdir = PopBubbles
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_PopBubbles_OBJECTS = PopBubbles-PopBubbles.$(OBJEXT)
+PopBubbles_OBJECTS = $(am_PopBubbles_OBJECTS)
+PopBubbles_DEPENDENCIES = $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Align/libalign.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/dialign/libdialign.a
+PopBubbles_LINK = $(CXXLD) $(PopBubbles_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(PopBubbles_SOURCES)
+DIST_SOURCES = $(PopBubbles_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+PopBubbles_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Align \
+ -I$(top_srcdir)/Common \
+ -I$(top_srcdir)/DataLayer
+
+PopBubbles_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+PopBubbles_LDADD = \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/DataLayer/libdatalayer.a \
+ $(top_builddir)/Align/libalign.a \
+ $(top_builddir)/Common/libcommon.a \
+ $(top_builddir)/dialign/libdialign.a
+
+PopBubbles_SOURCES = PopBubbles.cpp
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign PopBubbles/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign PopBubbles/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+PopBubbles$(EXEEXT): $(PopBubbles_OBJECTS) $(PopBubbles_DEPENDENCIES) $(EXTRA_PopBubbles_DEPENDENCIES)
+ @rm -f PopBubbles$(EXEEXT)
+ $(PopBubbles_LINK) $(PopBubbles_OBJECTS) $(PopBubbles_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/PopBubbles-PopBubbles.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+PopBubbles-PopBubbles.o: PopBubbles.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PopBubbles_CPPFLAGS) $(CPPFLAGS) $(PopBubbles_CXXFLAGS) $(CXXFLAGS) -MT PopBubbles-PopBubbles.o -MD -MP -MF $(DEPDIR)/PopBubbles-PopBubbles.Tpo -c -o PopBubbles-PopBubbles.o `test -f 'PopBubbles.cpp' || echo '$(srcdir)/'`PopBubbles.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/PopBubbles-PopBubbles.Tpo $(DEPDIR)/PopBubbles-PopBubbles.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='PopBubbles.cpp' object='PopBubbles-PopBubbles.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PopBubbles_CPPFLAGS) $(CPPFLAGS) $(PopBubbles_CXXFLAGS) $(CXXFLAGS) -c -o PopBubbles-PopBubbles.o `test -f 'PopBubbles.cpp' || echo '$(srcdir)/'`PopBubbles.cpp
+
+PopBubbles-PopBubbles.obj: PopBubbles.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PopBubbles_CPPFLAGS) $(CPPFLAGS) $(PopBubbles_CXXFLAGS) $(CXXFLAGS) -MT PopBubbles-PopBubbles.obj -MD -MP -MF $(DEPDIR)/PopBubbles-PopBubbles.Tpo -c -o PopBubbles-PopBubbles.obj `if test -f 'PopBubbles.cpp'; then $(CYGPATH_W) 'PopBubbles.cpp'; else $(CYGPATH_W) '$(srcdir)/PopBubbles.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/PopBubbles-PopBubbles.Tpo $(DEPDIR)/PopBubbles-PopBubbles.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='PopBubbles.cpp' object='PopBubbles-PopBubbles.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(PopBubbles_CPPFLAGS) $(CPPFLAGS) $(PopBubbles_CXXFLAGS) $(CXXFLAGS) -c -o PopBubbles-PopBubbles.obj `if test -f 'PopBubbles.cpp'; then $(CYGPATH_W) 'PopBubbles.cpp'; else $(CYGPATH_W) '$(srcdir)/PopBubbles.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/PopBubbles/PopBubbles.cpp b/PopBubbles/PopBubbles.cpp
new file mode 100644
index 0000000..c60e2b4
--- /dev/null
+++ b/PopBubbles/PopBubbles.cpp
@@ -0,0 +1,735 @@
+/**
+ * Identify and pop simple bubbles.
+ * Written by Shaun Jackman <sjackman at bcgsc.ca>.
+ */
+
+#include "dialign.h"
+#include "config.h"
+#include "Common/Options.h"
+#include "ConstString.h"
+#include "ContigPath.h"
+#include "ContigProperties.h"
+#include "FastaReader.h"
+#include "IOUtil.h"
+#include "Sequence.h"
+#include "Uncompress.h"
+#include "alignGlobal.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include "Graph/DepthFirstSearch.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/GraphIO.h"
+#include "Graph/GraphUtil.h"
+#include "Graph/PopBubbles.h"
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <algorithm>
+#include <climits> // for UINT_MAX
+#include <fstream>
+#include <functional>
+#include <getopt.h>
+#include <map>
+#include <iostream>
+#include <iterator>
+#include <set>
+#include <sstream>
+#include <string>
+#include <utility>
+#include <vector>
+#if _OPENMP
+# include <omp.h>
+#endif
+
+using namespace std;
+using namespace boost::lambda;
+using boost::tie;
+#if !__GXX_EXPERIMENTAL_CXX0X__
+using boost::cref;
+#endif
+
+#define PROGRAM "PopBubbles"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... FASTA ADJ\n"
+"Identify and pop simple bubbles.\n"
+" FASTA contigs in FASTA format\n"
+" ADJ contig adjacency graph\n"
+"\n"
+" -k, --kmer=N k-mer size\n"
+" -a, --branches=N maximum number of branches, default: 2\n"
+" -b, --bubble-length=N pop bubbles shorter than N bp\n"
+" default is 10000\n"
+" -p, --identity=REAL minimum identity, default: 0.9\n"
+" -c, --coverage=REAL remove contigs with mean k-mer coverage\n"
+" less than this threshold [0]\n"
+" --scaffold scaffold over bubbles that have\n"
+" insufficient identity\n"
+" --no-scaffold disable scaffolding [default]\n"
+" -g, --graph=FILE write the contig adjacency graph to FILE\n"
+" --dot output bubbles in dot format\n"
+" -j, --threads=N use N parallel threads [1]\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by ContigProperties
+
+ /** Maximum number of branches. */
+ static unsigned maxBranches = 2;
+
+ /** Pop bubbles shorter than this threshold. */
+ static unsigned maxLength = 10000;
+
+ /** Minimum identity. */
+ static float identity = 0.9;
+
+ /** Minimum mean k-mer coverage. */
+ static float minCoverage;
+
+ /** Scaffold over bubbles that have insufficient identity. */
+ static int scaffold;
+
+ /** Write the contig adjacency graph to this file. */
+ static string graphPath;
+
+ /** Output bubbles in dot format. */
+ static int dot;
+
+ int format; // used by ContigProperties
+
+ /** Number of threads. */
+ static int threads = 1;
+ static int dialign_debug;
+ static string dialign_score;
+ static string dialign_prob;
+}
+
+static const char shortopts[] = "a:b:c:g:j:k:p:vD:M:P:";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "branches", required_argument, NULL, 'a' },
+ { "bubble-length", required_argument, NULL, 'b' },
+ { "coverage", required_argument, NULL, 'c' },
+ { "dot", no_argument, &opt::dot, 1, },
+ { "graph", required_argument, NULL, 'g' },
+ { "kmer", required_argument, NULL, 'k' },
+ { "identity", required_argument, NULL, 'p' },
+ { "scaffold", no_argument, &opt::scaffold, 1},
+ { "no-scaffold", no_argument, &opt::scaffold, 0},
+ { "threads", required_argument, NULL, 'j' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { "dialign-d", required_argument, NULL, 'D' },
+ { "dialign-m", required_argument, NULL, 'M' },
+ { "dialign-p", required_argument, NULL, 'P' },
+ { NULL, 0, NULL, 0 }
+};
+
+/** Popped branches. */
+static vector<ContigID> g_popped;
+
+/** Contig adjacency graph. */
+typedef ContigGraph<DirectedGraph<ContigProperties, Distance> > Graph;
+typedef Graph::vertex_descriptor vertex_descriptor;
+typedef Graph::adjacency_iterator adjacency_iterator;
+
+/** Return the distance from vertex u to v. */
+static int getDistance(const Graph& g,
+ vertex_descriptor u, vertex_descriptor v)
+{
+ typedef graph_traits<Graph>::edge_descriptor edge_descriptor;
+ pair<edge_descriptor, bool> e = edge(u, v, g);
+ assert(e.second);
+ return g[e.first].distance;
+}
+
+struct CompareCoverage {
+ const Graph& g;
+ CompareCoverage(const Graph& g) : g(g) { }
+ bool operator()(vertex_descriptor u, vertex_descriptor v)
+ {
+ return g[u].coverage > g[v].coverage;
+ }
+};
+
+/** Pop the bubble between vertices v and tail. */
+static void popBubble(Graph& g,
+ vertex_descriptor v, vertex_descriptor tail)
+{
+ unsigned nbranches = g.out_degree(v);
+ assert(nbranches > 1);
+ assert(nbranches == g.in_degree(tail));
+ vector<vertex_descriptor> sorted(nbranches);
+ pair<adjacency_iterator, adjacency_iterator>
+ adj = g.adjacent_vertices(v);
+ copy(adj.first, adj.second, sorted.begin());
+ sort(sorted.begin(), sorted.end(), CompareCoverage(g));
+ if (opt::dot)
+#pragma omp critical(cout)
+ {
+ cout << '"' << get(vertex_name, g, v) << "\" -> {";
+ for (vector<vertex_descriptor>::const_iterator
+ it = sorted.begin(); it != sorted.end(); ++it)
+ cout << " \"" << get(vertex_name, g, *it) << '"';
+ cout << " } -> \"" << get(vertex_name, g, tail) << "\"\n";
+ }
+#pragma omp critical(g_popped)
+ transform(sorted.begin() + 1, sorted.end(),
+ back_inserter(g_popped),
+ mem_fun_ref(&ContigNode::contigIndex));
+}
+
+static struct {
+ unsigned bubbles;
+ unsigned popped;
+ unsigned scaffold;
+ unsigned notSimple;
+ unsigned tooLong;
+ unsigned tooMany;
+ unsigned dissimilar;
+} g_count;
+
+/** Contig sequences. */
+typedef vector<const_string> Contigs;
+static Contigs g_contigs;
+
+/** Return the sequence of vertex u. */
+static string getSequence(const Graph* g, vertex_descriptor u)
+{
+ size_t i = get(vertex_contig_index, *g, u);
+ assert(i < g_contigs.size());
+ string seq(g_contigs[i]);
+ return get(vertex_sense, *g, u) ? reverseComplement(seq) : seq;
+}
+
+/** Return the length of vertex v. */
+static unsigned getLength(const Graph* g, vertex_descriptor v)
+{
+ return (*g)[v].length;
+}
+
+/** Align the specified pair of sequences.
+ * @return the number of matches and size of the consensus
+ */
+static pair<unsigned, unsigned> alignPair(
+ const string& seqa, const string& seqb)
+{
+ NWAlignment alignment;
+ unsigned matches = alignGlobal(seqa, seqb, alignment);
+ if (opt::verbose > 2)
+#pragma omp critical(cerr)
+ cerr << alignment;
+ return make_pair(matches, alignment.size());
+}
+
+/** Align the specified sequences.
+ * @return the number of matches and size of the consensus
+ */
+static pair<unsigned, unsigned> alignMulti(const vector<string>& seqs)
+{
+ string alignment;
+ unsigned matches;
+ string consensus = dialign(seqs, alignment, matches);
+ if (opt::verbose > 2)
+#pragma omp critical(cerr)
+ cerr << alignment << consensus << '\n';
+ return make_pair(matches, consensus.size());
+}
+
+/** Align the specified sequences.
+ * @return the number of matches and size of the consensus
+ */
+static pair<unsigned, unsigned> align(const vector<string>& seqs)
+{
+ assert(seqs.size() > 1);
+ if (seqs.size() == 2)
+ return alignPair(seqs[0], seqs[1]);
+ else
+ return alignMulti(seqs);
+}
+
+/** Align the sequences of [first,last).
+ * @param t the vertex to the left of the bubble
+ * @param v the vertex to the right of the bubble
+ * @return the identity of the global alignment
+ */
+template <typename It>
+static float getAlignmentIdentity(const Graph& g,
+ vertex_descriptor t, vertex_descriptor v,
+ It first, It last)
+{
+ unsigned nbranches = distance(first, last);
+ vector<int> inDists(nbranches);
+ transform(first, last, inDists.begin(),
+ bind(getDistance, cref(g), t, _1));
+ vector<int> outDists(nbranches);
+ transform(first, last, outDists.begin(),
+ bind(getDistance, cref(g), _1, v));
+ vector<int> insertLens(nbranches);
+ transform(first, last, insertLens.begin(),
+ bind(getDistance, cref(g), t, _1)
+ + bind(getLength, &g, _1)
+ + bind(getDistance, cref(g), _1, v));
+
+ int max_in_overlap = -(*min_element(inDists.begin(),
+ inDists.end()));
+ assert(max_in_overlap >= 0);
+ int max_out_overlap = -(*min_element(outDists.begin(),
+ outDists.end()));
+ assert(max_out_overlap >= 0);
+ int min_insert_len = *min_element(insertLens.begin(),
+ insertLens.end());
+ int max_insert_len = *max_element(insertLens.begin(),
+ insertLens.end());
+
+ float max_identity =
+ (float)(min_insert_len + max_in_overlap + max_out_overlap) /
+ (max_insert_len + max_in_overlap + max_out_overlap);
+ if (min_insert_len <= 0 || max_identity < opt::identity)
+ return max_identity;
+
+ vector<string> seqs(nbranches);
+ transform(first, last, seqs.begin(), bind(getSequence, &g, _1));
+ for (unsigned i = 0; i < seqs.size(); i++) {
+ // Remove the overlapping sequence.
+ int n = seqs[i].size();
+ int l = -inDists[i], r = -outDists[i];
+ assert(n > l + r);
+ seqs[i] = seqs[i].substr(l, n - l - r);
+ }
+
+ unsigned matches, consensusSize;
+ tie(matches, consensusSize) = align(seqs);
+ return (float)(matches + max_in_overlap + max_out_overlap) /
+ (consensusSize + max_in_overlap + max_out_overlap);
+}
+
+/** Pop the specified bubble if it is a simple bubble.
+ * @return whether the bubble is popped
+ */
+static bool popSimpleBubble(Graph* pg, vertex_descriptor v)
+{
+ Graph& g = *pg;
+ unsigned nbranches = g.out_degree(v);
+ assert(nbranches >= 2);
+ vertex_descriptor v1 = *g.adjacent_vertices(v).first;
+ if (g.out_degree(v1) != 1) {
+#pragma omp atomic
+ g_count.notSimple++;
+ return false;
+ }
+ vertex_descriptor tail = *g.adjacent_vertices(v1).first;
+ if (v == get(vertex_complement, g, tail) // Palindrome
+ || g.in_degree(tail) != nbranches) {
+#pragma omp atomic
+ g_count.notSimple++;
+ return false;
+ }
+
+ // Check that every branch is simple and ends at the same node.
+ pair<adjacency_iterator, adjacency_iterator>
+ adj = g.adjacent_vertices(v);
+ for (adjacency_iterator it = adj.first; it != adj.second; ++it) {
+ if (g.out_degree(*it) != 1 || g.in_degree(*it) != 1) {
+#pragma omp atomic
+ g_count.notSimple++;
+ return false;
+ }
+ if (*g.adjacent_vertices(*it).first != tail) {
+ // The branches do not merge back to the same node.
+#pragma omp atomic
+ g_count.notSimple++;
+ return false;
+ }
+ }
+
+ if (opt::verbose > 2)
+#pragma omp critical(cerr)
+ {
+ cerr << "\n* " << get(vertex_name, g, v) << " ->";
+ for (adjacency_iterator it = adj.first;
+ it != adj.second; ++it)
+ cerr << ' ' << get(vertex_name, g, *it);
+ cerr << " -> " << get(vertex_name, g, tail) << '\n';
+ }
+
+ if (nbranches > opt::maxBranches) {
+ // Too many branches.
+#pragma omp atomic
+ g_count.tooMany++;
+ if (opt::verbose > 1)
+#pragma omp critical(cerr)
+ cerr << nbranches << " paths (too many)\n";
+ return false;
+ }
+
+ vector<unsigned> lengths(nbranches);
+ transform(adj.first, adj.second, lengths.begin(),
+ bind1st(ptr_fun(getLength), &g));
+ unsigned minLength = *min_element(lengths.begin(), lengths.end());
+ unsigned maxLength = *max_element(lengths.begin(), lengths.end());
+ if (maxLength >= opt::maxLength) {
+ // This branch is too long.
+#pragma omp atomic
+ g_count.tooLong++;
+ if (opt::verbose > 1)
+#pragma omp critical(cerr)
+ cerr << minLength << '\t' << maxLength
+ << "\t0\t(too long)\n";
+ return false;
+ }
+
+ float identity = opt::identity == 0 ? 0
+ : getAlignmentIdentity(g, v, tail, adj.first, adj.second);
+ bool dissimilar = identity < opt::identity;
+ if (opt::verbose > 1)
+#pragma omp critical(cerr)
+ cerr << minLength << '\t' << maxLength << '\t' << identity
+ << (dissimilar ? "\t(dissimilar)" : "") << '\n';
+ if (dissimilar) {
+ // Insufficient identity.
+#pragma omp atomic
+ g_count.dissimilar++;
+ return false;
+ }
+
+#pragma omp atomic
+ g_count.popped++;
+ popBubble(g, v, tail);
+ return true;
+}
+
+/** Add distances to a path. */
+static ContigPath addDistance(const Graph& g, const ContigPath& path)
+{
+ ContigPath out;
+ out.reserve(path.size());
+ ContigNode u = path.front();
+ out.push_back(u);
+ for (ContigPath::const_iterator it = path.begin() + 1;
+ it != path.end(); ++it) {
+ ContigNode v = *it;
+ int distance = getDistance(g, u, v);
+ if (distance >= 0) {
+ int numN = distance + opt::k - 1; // by convention
+ assert(numN >= 0);
+ numN = max(numN, 1);
+ out.push_back(ContigNode(numN, 'N'));
+ }
+ out.push_back(v);
+ u = v;
+ }
+ return out;
+}
+
+/** Return the length of the longest path through the bubble. */
+static int longestPath(const Graph& g, const Bubble& topo)
+{
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef graph_traits<Graph>::out_edge_iterator Eit;
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ EdgeWeightMap<Graph> weight(g);
+ map<ContigNode, int> distance;
+ distance[topo.front()] = 0;
+ for (Bubble::const_iterator it = topo.begin();
+ it != topo.end(); ++it) {
+ V u = *it;
+ Eit eit, elast;
+ for (tie(eit, elast) = out_edges(u, g); eit != elast; ++eit) {
+ E e = *eit;
+ V v = target(e, g);
+ distance[v] = max(distance[v], distance[u] + weight[e]);
+ }
+ }
+ V v = topo.back();
+ return distance[v] - g[v].length;
+}
+
+/** Scaffold over the bubble between vertices u and w.
+ * Add an edge (u,w) with the distance property set to the length of
+ * the largest branch of the bubble.
+ */
+static void scaffoldBubble(Graph& g, const Bubble& bubble)
+{
+ typedef graph_traits<Graph>::adjacency_iterator Ait;
+ typedef graph_traits<Graph>::vertex_descriptor V;
+ assert(opt::scaffold);
+ assert(bubble.size() > 2);
+
+ V u = bubble.front(), w = bubble.back();
+ if (edge(u, w, g).second) {
+ // Already scaffolded.
+ return;
+ }
+ assert(isBubble(g, bubble.begin(), bubble.end()));
+
+ assert(bubble.size() > 2);
+ size_t n = bubble.size() - 2;
+ g_popped.reserve(g_popped.size() + n);
+ for (Bubble::const_iterator it = bubble.begin() + 1;
+ it != bubble.end() - 1; ++it)
+ g_popped.push_back(it->contigIndex());
+
+ add_edge(u, w, max(longestPath(g, bubble), 1), g);
+}
+
+/** Pop the specified bubble if it is simple, otherwise scaffold. */
+static void popOrScaffoldBubble(Graph& g, const Bubble& bubble)
+{
+#pragma omp atomic
+ g_count.bubbles++;
+ if (!popSimpleBubble(&g, bubble.front()) && opt::scaffold) {
+#pragma omp atomic
+ g_count.scaffold++;
+ scaffoldBubble(g, bubble);
+ }
+}
+
+/** Return the length of the specified vertex in k-mer. */
+static unsigned getKmerLength(const ContigProperties& vp)
+{
+ assert(vp.length >= opt::k);
+ return vp.length - opt::k + 1;
+}
+
+/** Return the mean k-mer coverage of the specified vertex. */
+static float getMeanCoverage(const ContigProperties& vp)
+{
+ return (float)vp.coverage / getKmerLength(vp);
+}
+
+/** Remove contigs with insufficient coverage. */
+static void filterGraph(Graph& g)
+{
+ typedef graph_traits<Graph> GTraits;
+ typedef GTraits::vertex_descriptor V;
+ typedef GTraits::vertex_iterator Vit;
+
+ unsigned removedContigs = 0, removedKmer = 0;
+ std::pair<Vit, Vit> urange = vertices(g);
+ for (Vit uit = urange.first; uit != urange.second; ++uit) {
+ V u = *uit;
+ if (get(vertex_removed, g, u))
+ continue;
+ const ContigProperties& vp = g[u];
+ if (getMeanCoverage(vp) < opt::minCoverage) {
+ removedContigs++;
+ removedKmer += getKmerLength(vp);
+ clear_vertex(u, g);
+ remove_vertex(u, g);
+ g_popped.push_back(get(vertex_contig_index, g, u));
+ }
+ }
+ if (opt::verbose > 0) {
+ cerr << "Removed " << removedKmer << " k-mer in "
+ << removedContigs << " contigs with mean k-mer coverage "
+ "less than " << opt::minCoverage << ".\n";
+ printGraphStats(cerr, g);
+ }
+}
+
+/** Remove the specified contig from the adjacency graph. */
+static void removeContig(Graph* g, ContigID id)
+{
+ ContigNode v(id, false);
+ g->clear_vertex(v);
+ g->remove_vertex(v);
+}
+
+int main(int argc, char** argv)
+{
+ string commandLine;
+ {
+ ostringstream ss;
+ char** last = argv + argc - 1;
+ copy(argv, last, ostream_iterator<const char *>(ss, " "));
+ ss << *last;
+ commandLine = ss.str();
+ }
+
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'a': arg >> opt::maxBranches; break;
+ case 'b': arg >> opt::maxLength; break;
+ case 'c': arg >> opt::minCoverage; break;
+ case 'g': arg >> opt::graphPath; break;
+ case 'j': arg >> opt::threads; break;
+ case 'k': arg >> opt::k; break;
+ case 'D': arg >> opt::dialign_debug; break;
+ case 'M': arg >> opt::dialign_score; break;
+ case 'P': arg >> opt::dialign_prob; break;
+ case 'p': arg >> opt::identity; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": " << "missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (argc - optind < 2) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (argc - optind > 2) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ init_parameters();
+ set_parameters_dna();
+ para->DEBUG = opt::dialign_debug;
+ para->SCR_MATRIX_FILE_NAME = (char*)opt::dialign_score.c_str();
+ para->DIAG_PROB_FILE_NAME = (char*)opt::dialign_prob.c_str();
+ initDialign();
+
+ const char* contigsPath(argv[optind++]);
+ string adjPath(argv[optind++]);
+
+ // Read the contig adjacency graph.
+ if (opt::verbose > 0)
+ cerr << "Reading `" << adjPath << "'...\n";
+ ifstream fin(adjPath.c_str());
+ assert_good(fin, adjPath);
+ Graph g;
+ fin >> g;
+ assert(fin.eof());
+ g_contigNames.lock();
+ if (opt::verbose > 0)
+ printGraphStats(cerr, g);
+
+ // Read the contigs.
+ Contigs& contigs = g_contigs;
+ if (opt::identity > 0) {
+ if (opt::verbose > 0)
+ cerr << "Reading `" << contigsPath << "'...\n";
+ FastaReader in(contigsPath, FastaReader::NO_FOLD_CASE);
+ for (FastaRecord rec; in >> rec;) {
+ if (g_contigNames.count(rec.id) == 0)
+ continue;
+ assert(contigs.size() == get(g_contigNames, rec.id));
+ contigs.push_back(rec.seq);
+ }
+ assert(in.eof());
+ assert(!contigs.empty());
+ opt::colourSpace = isdigit(contigs.front()[0]);
+ }
+
+ // Remove contigs with insufficient coverage.
+ if (opt::minCoverage > 0)
+ filterGraph(g);
+
+ if (opt::dot)
+ cout << "digraph bubbles {\n";
+
+ Bubbles bubbles = discoverBubbles(g);
+ for (Bubbles::const_iterator it = bubbles.begin();
+ it != bubbles.end(); ++it)
+ popOrScaffoldBubble(g, *it);
+
+ // Each bubble should be identified twice. Remove the duplicate.
+ sort(g_popped.begin(), g_popped.end());
+ g_popped.erase(unique(g_popped.begin(), g_popped.end()),
+ g_popped.end());
+
+ if (opt::dot) {
+ cout << "}\n";
+ } else {
+ for (vector<ContigID>::const_iterator it = g_popped.begin();
+ it != g_popped.end(); ++it)
+ cout << get(g_contigNames, *it) << '\n';
+ }
+ free_prob_dist(pdist);
+ free(para);
+
+ if (opt::verbose > 0)
+ cerr << "Bubbles: " << (g_count.bubbles + 1) / 2
+ << " Popped: " << (g_count.popped + 1) / 2
+ << " Scaffolds: " << (g_count.scaffold + 1) / 2
+ << " Complex: " << (g_count.notSimple + 1) / 2
+ << " Too long: " << (g_count.tooLong + 1) / 2
+ << " Too many: " << (g_count.tooMany + 1) / 2
+ << " Dissimilar: " << (g_count.dissimilar + 1) / 2
+ << '\n';
+
+ if (!opt::graphPath.empty()) {
+ // Remove the popped contigs from the adjacency graph.
+ for_each(g_popped.begin(), g_popped.end(),
+ bind1st(ptr_fun(removeContig), &g));
+
+ // Assemble unambiguous paths.
+ g_contigNames.unlock();
+ typedef vector<ContigPath> ContigPaths;
+ ContigPaths paths;
+ size_t numContigs = num_vertices(g) / 2;
+ if (opt::scaffold) {
+ Graph gorig = g;
+ assemble(g, back_inserter(paths));
+ for (ContigPaths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ ContigNode u(numContigs + it - paths.begin(), false);
+ string name = createContigName();
+ put(vertex_name, g, u, name);
+ cout << name << '\t'
+ << addDistance(gorig, *it) << '\n';
+ }
+ } else {
+ assemble(g, back_inserter(paths));
+ for (ContigPaths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ ContigNode u(numContigs + it - paths.begin(), false);
+ string name = createContigName();
+ put(vertex_name, g, u, name);
+ cout << name << '\t' << *it << '\n';
+ }
+ }
+ g_contigNames.lock();
+ paths.clear();
+
+ // Output the updated adjacency graph.
+ ofstream fout(opt::graphPath.c_str());
+ assert_good(fout, opt::graphPath);
+ write_graph(fout, g, PROGRAM, commandLine);
+ assert_good(fout, opt::graphPath);
+ if (opt::verbose > 0)
+ printGraphStats(cerr, g);
+ }
+
+ return 0;
+}
diff --git a/README.css b/README.css
new file mode 100644
index 0000000..2ed6ef2
--- /dev/null
+++ b/README.css
@@ -0,0 +1,39 @@
+/* Font */
+body { font: 12pt Georgia, Palatino, Times, serif; }
+h1, h2, h3, h4 {
+ font-family: Verdana, Helvetica, Arial, sans-serif;
+ font-weight: normal;
+}
+h1 { font-size: 18pt; }
+h2, h3, h4 { font-size: 14pt; }
+a { text-decoration: none; }
+code { font: 12pt Courier, monospace; }
+pre { font: 12pt Courier, monospace; }
+
+/* Colour and border */
+a {
+ color: #222222;
+ border-bottom: 1pt dashed #888888;
+}
+a:hover {
+ color: #ffffff;
+ background: #222222;
+}
+pre {
+ background-color: #dddddd;
+ border: #777777 1pt solid;
+}
+
+/* Layout */
+p {
+ text-align: justify;
+ min-width: 18pc;
+ max-width: 42pc;
+}
+pre {
+ word-wrap: break-word;
+ max-width: 42pc;
+ margin: 1pc;
+ padding-left: 1pc;
+ padding-right: 1pc;
+}
diff --git a/README.html b/README.html
new file mode 100644
index 0000000..f3ec08e
--- /dev/null
+++ b/README.html
@@ -0,0 +1,354 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <meta charset="utf-8"/>
+ <title>ABySS README</title>
+ <meta name="author" content="Shaun Jackman"/>
+ <meta name="affiliation" content="Canada's Michael Smith Genome Science Centre"/>
+ <link type="text/css" rel="stylesheet" href="README.css"/>
+</head>
+<body>
+<h1 id="abyss">ABySS</h1>
+
+<p>ABySS is a <em>de novo</em> sequence assembler intended for short paired-end
+reads and large genomes.</p>
+
+<h1 id="contents">Contents</h1>
+
+<ul>
+<li><a href="#quickstart">Quick Start</a>
+
+<ul>
+<li><a href="#installabyssondebianorubuntu">Install ABySS on Debian or Ubuntu</a></li>
+<li><a href="#installabyssonmacosx">Install ABySS on Mac OS X</a></li>
+</ul></li>
+<li><a href="#dependencies">Dependencies</a></li>
+<li><a href="#compilingabyssfromsource">Compiling ABySS from source</a></li>
+<li><a href="#assemblingapaired-endlibrary">Assembling a paired-end library</a></li>
+<li><a href="#assemblingmultiplelibraries">Assembling multiple libraries</a></li>
+<li><a href="#scaffolding">Scaffolding</a></li>
+<li><a href="#optimizingtheparameterk">Optimizing the parameter k</a></li>
+<li><a href="#parallelprocessing">Parallel processing</a></li>
+<li><a href="#runningabyssonacluster">Running ABySS on a cluster</a></li>
+<li><a href="#assemblyparameters">Assembly Parameters</a></li>
+<li><a href="#abyssprograms">ABySS programs</a></li>
+<li><a href="#mailinglist">Mailing List</a></li>
+<li><a href="#authors">Authors</a></li>
+</ul>
+
+<h1 id="quickstart">Quick Start</h1>
+
+<h2 id="installabyssondebianorubuntu">Install ABySS on Debian or Ubuntu</h2>
+
+<p>Run the command</p>
+
+<pre><code>sudo apt-get install abyss
+</code></pre>
+
+<p>or download and install the
+<a href="http://www.bcgsc.ca/platform/bioinfo/software/abyss">Debian package</a>.</p>
+
+<h2 id="installabyssonmacosx">Install ABySS on Mac OS X</h2>
+
+<p>Download and install the
+<a href="http://www.bcgsc.ca/platform/bioinfo/software/abyss">Mac OS X app</a>.</p>
+
+<h2 id="assembleasmallsyntheticdataset">Assemble a small synthetic data set</h2>
+
+<pre><code>abyss-pe k=25 name=test \
+se=https://raw.github.com/dzerbino/velvet/master/data/test_reads.fa
+</code></pre>
+
+<h2 id="calculateassemblycontiguitystatistics">Calculate assembly contiguity statistics</h2>
+
+<pre><code>abyss-fac test-unitigs.fa
+</code></pre>
+
+<h1 id="dependencies">Dependencies</h1>
+
+<p>ABySS requires the following libraries:</p>
+
+<ul>
+<li><a href="http://www.boost.org">Boost</a></li>
+<li><a href="http://code.google.com/p/sparsehash">sparsehash</a></li>
+<li><a href="http://www.open-mpi.org">Open MPI</a></li>
+</ul>
+
+<p>ABySS requires a C++ compiler that supports
+<a href="http://www.openmp.org">OpenMP</a> such as <a href="http://gcc.gnu.org">GCC</a>.</p>
+
+<h1 id="compilingabyssfromsource">Compiling ABySS from source</h1>
+
+<p>To compile and install ABySS in <code>/usr/local</code>:</p>
+
+<pre><code>./configure
+make
+sudo make install
+</code></pre>
+
+<p>To install ABySS in a specified directory:</p>
+
+<pre><code>./configure --prefix=/opt/abyss
+make
+sudo make install
+</code></pre>
+
+<p>ABySS uses OpenMP for parallelization, which requires a modern
+compiler such as GCC 4.2 or greater. If you have an older compiler, it
+is best to upgrade your compiler if possible. If you have multiple
+versions of GCC installed, you can specify a different compiler:</p>
+
+<pre><code>./configure CC=gcc-4.6 CXX=g++-4.6
+</code></pre>
+
+<p>ABySS requires the Boost C++ libraries. Many systems come with Boost
+installed. If yours does not, you can download
+<a href="http://www.boost.org/users/download">Boost</a>.
+It is not necessary to compile Boost before installing it. The Boost
+header file directory should be found at <code>/usr/include/boost</code>, in the
+ABySS source directory, or its location specified to <code>configure</code>:</p>
+
+<pre><code>./configure --with-boost=/usr/local/include
+</code></pre>
+
+<p>If you wish to build the parallel assembler with MPI support,
+MPI should be found in <code>/usr/include</code> and <code>/usr/lib</code> or its location
+specified to <code>configure</code>:</p>
+
+<pre><code>./configure --with-mpi=/usr/lib/openmpi
+</code></pre>
+
+<p>ABySS should be built using the sparsehash library to reduce memory
+usage, although it will build without. sparsehash should be found in
+<code>/usr/include</code> or its location specified to <code>configure</code>:</p>
+
+<pre><code>./configure CPPFLAGS=-I/usr/local/include
+</code></pre>
+
+<p>The default maximum k-mer size is 64 and may be decreased to reduce
+memory usage or increased at compile time:</p>
+
+<pre><code>./configure --enable-maxk=96
+</code></pre>
+
+<p>If you encounter compiler warnings, you may ignore them like so:</p>
+
+<pre><code>make AM_CXXFLAGS=-Wall
+</code></pre>
+
+<p>To run ABySS, its executables should be found in your <code>PATH</code>. If you
+installed ABySS in <code>/opt/abyss</code>, add <code>/opt/abyss/bin</code> to your <code>PATH</code>:</p>
+
+<pre><code>PATH=/opt/abyss/bin:$PATH
+</code></pre>
+
+<h1 id="assemblingapaired-endlibrary">Assembling a paired-end library</h1>
+
+<p>To assemble paired reads in two files named <code>reads1.fa</code> and
+<code>reads2.fa</code> into contigs in a file named <code>ecoli-contigs.fa</code>, run the
+command:</p>
+
+<pre><code>abyss-pe name=ecoli k=64 in='reads1.fa reads2.fa'
+</code></pre>
+
+<p>The parameter <code>in</code> specifies the input files to read, which may be in
+FASTA, FASTQ, qseq, export, SRA, SAM or BAM format and compressed with
+gz, bz2 or xz and may be tarred. The assembled contigs will be stored
+in <code>${name}-contigs.fa</code>.</p>
+
+<p>A pair of reads must be named with the suffixes <code>/1</code> and <code>/2</code> to
+identify the first and second read, or the reads may be named
+identically. The paired reads may be in separate files or interleaved
+in a single file.</p>
+
+<p>Reads without mates should be placed in a file specified by the
+parameter <code>se</code> (single-end). Reads without mates in the paired-end
+files will slow down the paired-end assembler considerably during the
+<code>abyss-fixmate</code> stage.</p>
+
+<h1 id="assemblingmultiplelibraries">Assembling multiple libraries</h1>
+
+<p>The distribution of fragment sizes of each library is calculated
+empirically by aligning paired reads to the contigs produced by the
+single-end assembler, and the distribution is stored in a file with
+the extension <code>.hist</code>, such as <code>ecoli-3.hist</code>. The N50 of the
+single-end assembly must be well over the fragment-size to obtain an
+accurate empirical distribution.</p>
+
+<p>Here’s an example scenario of assembling a data set with two different
+fragment libraries and single-end reads:</p>
+
+<ul>
+<li>Library <code>pe200</code> has reads in two files,
+ <code>pe200_1.fa</code> and <code>pe200_2.fa</code>.</li>
+<li>Library <code>pe500</code> has reads in two files,
+ <code>pe500_1.fa</code> and <code>pe500_2.fa</code>.</li>
+<li>Single-end reads are stored in two files, <code>se1.fa</code> and <code>se2.fa</code>.</li>
+</ul>
+
+<p>The command line to assemble this example data set is:</p>
+
+<pre><code>abyss-pe k=64 name=ecoli lib='pe200 pe500' \
+ pe200='pe200_1.fa pe200_2.fa' pe500='pe500_1.fa pe500_2.fa' \
+ se='se1.fa se2.fa'
+</code></pre>
+
+<p>The empirical distribution of fragment sizes will be stored in two
+files named <code>pe200-3.hist</code> and <code>pe500-3.hist</code>. These files may be
+plotted to check that the empirical distribution agrees with the
+expected distribution. The assembled contigs will be stored in
+<code>${name}-contigs.fa</code>.</p>
+
+<h1 id="scaffolding">Scaffolding</h1>
+
+<p>Long-distance mate-pair libraries may be used to scaffold an assembly.
+Specify the names of the mate-pair libraries using the parameter <code>mp</code>.
+The scaffolds will be stored in the file <code>${name}-scaffolds.fa</code>.
+Here’s an example of assembling a data set with two paired-end
+libraries and two mate-pair libraries:</p>
+
+<pre><code>abyss-pe k=64 name=ecoli lib='pe1 pe2' mp='mp1 mp2' \
+ pe1='pe1_1.fa pe1_2.fa' pe2='pe2_1.fa pe2_2.fa' \
+ mp1='mp1_1.fa mp1_2.fa' mp2='mp2_1.fa mp2_2.fa'
+</code></pre>
+
+<p>The mate-pair libraries are used only for scaffolding and do not
+contribute towards the consensus sequence.</p>
+
+<h1 id="optimizingtheparameterk">Optimizing the parameter k</h1>
+
+<p>To find the optimal value of <code>k</code>, run multiple assemblies and inspect
+the assembly contiguity statistics. The following shell snippet will
+assemble for every value of <code>k</code> from 20 to 40.</p>
+
+<pre><code>export k
+for k in {20..40}; do
+ mkdir k$k
+ abyss-pe -C k$k name=ecoli in=../reads.fa
+done
+abyss-fac k*/ecoli-contigs.fa
+</code></pre>
+
+<p>The default maximum value for <code>k</code> is 64. This limit may be changed at
+compile time using the <code>--enable-maxk</code> option of configure. It may be
+decreased to 32 to decrease memory usage or increased to 96.</p>
+
+<h1 id="parallelprocessing">Parallel processing</h1>
+
+<p>The <code>np</code> option of <code>abyss-pe</code> specifies the number of processes to
+use for the parallel MPI job. Without any MPI configuration, this will
+allow you to use multiple cores on a single machine. To use multiple
+machines for assembly, you must create a <code>hostfile</code> for <code>mpirun</code>,
+which is described in the <code>mpirun</code> man page.</p>
+
+<p><em>Do not</em> run <code>mpirun -np 8 abyss-pe</code>. To run ABySS with 8 threads, use
+<code>abyss-pe np=8</code>. The <code>abyss-pe</code> driver script will start the MPI
+process, like so: <code>mpirun -np 8 ABYSS-P</code>.</p>
+
+<p>The paired-end assembly stage is multithreaded, but must run on a
+single machine. The number of threads to use may be specified with the
+parameter <code>j</code>. The default value for <code>j</code> is the value of <code>np</code>.</p>
+
+<h1 id="runningabyssonacluster">Running ABySS on a cluster</h1>
+
+<p>ABySS integrates well with cluster job schedulers, such as:</p>
+
+<ul>
+<li>SGE (Sun Grid Engine)</li>
+<li>Portable Batch System (PBS)</li>
+<li>Load Sharing Facility (LSF)</li>
+<li>IBM LoadLeveler</li>
+</ul>
+
+<p>For example, to submit an array of jobs to assemble every odd value of
+<code>k</code> between 51 and 63 using 64 processes for each job:</p>
+
+<pre><code>mkdir k{51..63}
+qsub -N ecoli -pe openmpi 64 -t 51-63:2 \
+ <<<'abyss-pe -C k$SGE_TASK_ID in=/data/reads.fa'
+</code></pre>
+
+<h1 id="assemblyparameters">Assembly Parameters</h1>
+
+<p>Parameters of the driver script, <code>abyss-pe</code></p>
+
+<ul>
+<li><code>a</code>: maximum number of branches of a bubble [<code>2</code>]</li>
+<li><code>b</code>: maximum length of a bubble (bp) [<code>10000</code>]</li>
+<li><code>c</code>: minimum mean k-mer coverage of a unitig [<code>sqrt(median)</code>]</li>
+<li><code>d</code>: allowable error of a distance estimate (bp) [<code>6</code>]</li>
+<li><code>e</code>: minimum erosion k-mer coverage [<code>sqrt(median)</code>]</li>
+<li><code>E</code>: minimum erosion k-mer coverage per strand [<code>1</code>]</li>
+<li><code>j</code>: number of threads [<code>2</code>]</li>
+<li><code>k</code>: size of k-mer (bp)</li>
+<li><code>l</code>: minimum alignment length of a read (bp) [<code>k</code>]</li>
+<li><code>m</code>: minimum overlap of two unitigs (bp) [<code>30</code>]</li>
+<li><code>n</code>: minimum number of pairs required for building contigs [<code>10</code>]</li>
+<li><code>N</code>: minimum number of pairs required for building scaffolds [<code>n</code>]</li>
+<li><code>p</code>: minimum sequence identity of a bubble [<code>0.9</code>]</li>
+<li><code>q</code>: minimum base quality [<code>3</code>]</li>
+<li><code>s</code>: minimum unitig size required for building contigs (bp) [<code>200</code>]</li>
+<li><code>S</code>: minimum contig size required for building scaffolds (bp) [<code>s</code>]</li>
+<li><code>t</code>: minimum tip size (bp) [<code>2k</code>]</li>
+<li><code>v</code>: use <code>v=-v</code> to enable verbose logging [<code>disabled</code>]</li>
+</ul>
+
+<p>Please see the
+<a href="http://manpages.ubuntu.com/abyss-pe.1.html">abyss-pe</a>
+manual page for more information on assembly parameters.</p>
+
+<h1 id="abyssprograms">ABySS programs</h1>
+
+<p><code>abyss-pe</code> is a driver script implemented as a Makefile. Any option of
+<code>make</code> may be used with <code>abyss-pe</code>. Particularly useful options are:</p>
+
+<ul>
+<li><code>-C dir</code>, <code>--directory=dir</code><br/>
+ Change to the directory <code>dir</code> and store the results there.</li>
+<li><code>-n</code>, <code>--dry-run</code><br/>
+ Print the commands that would be executed, but do not execute
+ them.</li>
+</ul>
+
+<p><code>abyss-pe</code> uses the following programs, which must be found in your
+<code>PATH</code>:</p>
+
+<ul>
+<li><code>ABYSS</code>: de Bruijn graph assembler</li>
+<li><code>ABYSS-P</code>: parallel (MPI) de Bruijn graph assembler</li>
+<li><code>AdjList</code>: find overlapping sequences</li>
+<li><code>DistanceEst</code>: estimate the distance between sequences</li>
+<li><code>MergeContigs</code>: merge sequences</li>
+<li><code>MergePaths</code>: merge overlapping paths</li>
+<li><code>Overlap</code>: find overlapping sequences using paired-end reads</li>
+<li><code>PathConsensus</code>: find a consensus sequence of ambiguous paths</li>
+<li><code>PathOverlap</code>: find overlapping paths</li>
+<li><code>PopBubbles</code>: remove bubbles from the sequence overlap graph</li>
+<li><code>SimpleGraph</code>: find paths through the overlap graph</li>
+<li><code>abyss-fac</code>: calculate assembly contiguity statistics</li>
+<li><code>abyss-filtergraph</code>: remove shim contigs from the overlap graph</li>
+<li><code>abyss-fixmate</code>: fill the paired-end fields of SAM alignments</li>
+<li><code>abyss-map</code>: map reads to a reference sequence</li>
+<li><code>abyss-scaffold</code>: scaffold contigs using distance estimates</li>
+<li><code>abyss-todot</code>: convert graph formats and merge graphs</li>
+</ul>
+
+<h1 id="mailinglist">Mailing List</h1>
+
+<p>Subscribe to the
+<a href="http://groups.google.com/group/abyss-users">ABySS mailing list</a>,
+<a href="mailto:abyss-users@googlegroups.com">abyss-users@googlegroups.com</a>.</p>
+
+<p>For questions related to transcriptome assembly, contact the
+<a href="http://groups.google.com/group/trans-abyss">Trans-ABySS mailing list</a>,
+<a href="mailto:trans-abyss@googlegroups.com">trans-abyss@googlegroups.com</a>.</p>
+
+<h1 id="authors">Authors</h1>
+
+<p>This document is written by Shaun Jackman.</p>
+
+<p>ABySS is written by Shaun Jackman, Tony Raymond and Jared Simpson.</p>
+
+<p>Copyright 2012 Canada’s Michael Smith Genome Science Centre</p>
+</body>
+</html>
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..7e7aa85
--- /dev/null
+++ b/README.md
@@ -0,0 +1,330 @@
+Title: ABySS README
+Author: Shaun Jackman
+Affiliation: Canada's Michael Smith Genome Science Centre
+CSS: README.css
+
+ABySS
+=====
+
+ABySS is a *de novo* sequence assembler intended for short paired-end
+reads and large genomes.
+
+Contents
+========
+
+* [Quick Start]
+ * [Install ABySS on Debian or Ubuntu]
+ * [Install ABySS on Mac OS X]
+* [Dependencies]
+* [Compiling ABySS from source]
+* [Assembling a paired-end library]
+* [Assembling multiple libraries]
+* [Scaffolding]
+* [Optimizing the parameter k]
+* [Parallel processing]
+* [Running ABySS on a cluster]
+* [Assembly Parameters]
+* [ABySS programs]
+* [Mailing List]
+* [Authors]
+
+Quick Start
+===========
+
+## Install ABySS on Debian or Ubuntu
+
+Run the command
+
+ sudo apt-get install abyss
+
+or download and install the
+[Debian package](http://www.bcgsc.ca/platform/bioinfo/software/abyss).
+
+## Install ABySS on Mac OS X
+
+Download and install the
+[Mac OS X app](http://www.bcgsc.ca/platform/bioinfo/software/abyss).
+
+## Assemble a small synthetic data set
+
+ abyss-pe k=25 name=test \
+ se=https://raw.github.com/dzerbino/velvet/master/data/test_reads.fa
+
+## Calculate assembly contiguity statistics
+
+ abyss-fac test-unitigs.fa
+
+Dependencies
+============
+
+ABySS requires the following libraries:
+
+* [Boost](http://www.boost.org)
+* [sparsehash](http://code.google.com/p/sparsehash)
+* [Open MPI](http://www.open-mpi.org)
+
+ABySS requires a C++ compiler that supports
+[OpenMP](http://www.openmp.org) such as [GCC](http://gcc.gnu.org).
+
+Compiling ABySS from source
+===========================
+
+To compile and install ABySS in `/usr/local`:
+
+ ./configure
+ make
+ sudo make install
+
+To install ABySS in a specified directory:
+
+ ./configure --prefix=/opt/abyss
+ make
+ sudo make install
+
+ABySS uses OpenMP for parallelization, which requires a modern
+compiler such as GCC 4.2 or greater. If you have an older compiler, it
+is best to upgrade your compiler if possible. If you have multiple
+versions of GCC installed, you can specify a different compiler:
+
+ ./configure CC=gcc-4.6 CXX=g++-4.6
+
+ABySS requires the Boost C++ libraries. Many systems come with Boost
+installed. If yours does not, you can download
+[Boost](http://www.boost.org/users/download).
+It is not necessary to compile Boost before installing it. The Boost
+header file directory should be found at `/usr/include/boost`, in the
+ABySS source directory, or its location specified to `configure`:
+
+ ./configure --with-boost=/usr/local/include
+
+If you wish to build the parallel assembler with MPI support,
+MPI should be found in `/usr/include` and `/usr/lib` or its location
+specified to `configure`:
+
+ ./configure --with-mpi=/usr/lib/openmpi
+
+ABySS should be built using the sparsehash library to reduce memory
+usage, although it will build without. sparsehash should be found in
+`/usr/include` or its location specified to `configure`:
+
+ ./configure CPPFLAGS=-I/usr/local/include
+
+The default maximum k-mer size is 64 and may be decreased to reduce
+memory usage or increased at compile time:
+
+ ./configure --enable-maxk=96
+
+If you encounter compiler warnings, you may ignore them like so:
+
+ make AM_CXXFLAGS=-Wall
+
+To run ABySS, its executables should be found in your `PATH`. If you
+installed ABySS in `/opt/abyss`, add `/opt/abyss/bin` to your `PATH`:
+
+ PATH=/opt/abyss/bin:$PATH
+
+Assembling a paired-end library
+===============================
+
+To assemble paired reads in two files named `reads1.fa` and
+`reads2.fa` into contigs in a file named `ecoli-contigs.fa`, run the
+command:
+
+ abyss-pe name=ecoli k=64 in='reads1.fa reads2.fa'
+
+The parameter `in` specifies the input files to read, which may be in
+FASTA, FASTQ, qseq, export, SRA, SAM or BAM format and compressed with
+gz, bz2 or xz and may be tarred. The assembled contigs will be stored
+in `${name}-contigs.fa`.
+
+A pair of reads must be named with the suffixes `/1` and `/2` to
+identify the first and second read, or the reads may be named
+identically. The paired reads may be in separate files or interleaved
+in a single file.
+
+Reads without mates should be placed in a file specified by the
+parameter `se` (single-end). Reads without mates in the paired-end
+files will slow down the paired-end assembler considerably during the
+`abyss-fixmate` stage.
+
+Assembling multiple libraries
+=============================
+
+The distribution of fragment sizes of each library is calculated
+empirically by aligning paired reads to the contigs produced by the
+single-end assembler, and the distribution is stored in a file with
+the extension `.hist`, such as `ecoli-3.hist`. The N50 of the
+single-end assembly must be well over the fragment-size to obtain an
+accurate empirical distribution.
+
+Here's an example scenario of assembling a data set with two different
+fragment libraries and single-end reads:
+
+ * Library `pe200` has reads in two files,
+ `pe200_1.fa` and `pe200_2.fa`.
+ * Library `pe500` has reads in two files,
+ `pe500_1.fa` and `pe500_2.fa`.
+ * Single-end reads are stored in two files, `se1.fa` and `se2.fa`.
+
+The command line to assemble this example data set is:
+
+ abyss-pe k=64 name=ecoli lib='pe200 pe500' \
+ pe200='pe200_1.fa pe200_2.fa' pe500='pe500_1.fa pe500_2.fa' \
+ se='se1.fa se2.fa'
+
+The empirical distribution of fragment sizes will be stored in two
+files named `pe200-3.hist` and `pe500-3.hist`. These files may be
+plotted to check that the empirical distribution agrees with the
+expected distribution. The assembled contigs will be stored in
+`${name}-contigs.fa`.
+
+Scaffolding
+===========
+
+Long-distance mate-pair libraries may be used to scaffold an assembly.
+Specify the names of the mate-pair libraries using the parameter `mp`.
+The scaffolds will be stored in the file `${name}-scaffolds.fa`.
+Here's an example of assembling a data set with two paired-end
+libraries and two mate-pair libraries:
+
+ abyss-pe k=64 name=ecoli lib='pe1 pe2' mp='mp1 mp2' \
+ pe1='pe1_1.fa pe1_2.fa' pe2='pe2_1.fa pe2_2.fa' \
+ mp1='mp1_1.fa mp1_2.fa' mp2='mp2_1.fa mp2_2.fa'
+
+The mate-pair libraries are used only for scaffolding and do not
+contribute towards the consensus sequence.
+
+Optimizing the parameter k
+==========================
+
+To find the optimal value of `k`, run multiple assemblies and inspect
+the assembly contiguity statistics. The following shell snippet will
+assemble for every value of `k` from 20 to 40.
+
+ export k
+ for k in {20..40}; do
+ mkdir k$k
+ abyss-pe -C k$k name=ecoli in=../reads.fa
+ done
+ abyss-fac k*/ecoli-contigs.fa
+
+The default maximum value for `k` is 64. This limit may be changed at
+compile time using the `--enable-maxk` option of configure. It may be
+decreased to 32 to decrease memory usage or increased to 96.
+
+Parallel processing
+===================
+
+The `np` option of `abyss-pe` specifies the number of processes to
+use for the parallel MPI job. Without any MPI configuration, this will
+allow you to use multiple cores on a single machine. To use multiple
+machines for assembly, you must create a `hostfile` for `mpirun`,
+which is described in the `mpirun` man page.
+
+*Do not* run `mpirun -np 8 abyss-pe`. To run ABySS with 8 threads, use
+`abyss-pe np=8`. The `abyss-pe` driver script will start the MPI
+process, like so: `mpirun -np 8 ABYSS-P`.
+
+The paired-end assembly stage is multithreaded, but must run on a
+single machine. The number of threads to use may be specified with the
+parameter `j`. The default value for `j` is the value of `np`.
+
+Running ABySS on a cluster
+==========================
+
+ABySS integrates well with cluster job schedulers, such as:
+
+ * SGE (Sun Grid Engine)
+ * Portable Batch System (PBS)
+ * Load Sharing Facility (LSF)
+ * IBM LoadLeveler
+
+For example, to submit an array of jobs to assemble every odd value of
+`k` between 51 and 63 using 64 processes for each job:
+
+ mkdir k{51..63}
+ qsub -N ecoli -pe openmpi 64 -t 51-63:2 \
+ <<<'abyss-pe -C k$SGE_TASK_ID in=/data/reads.fa'
+
+Assembly Parameters
+===================
+
+Parameters of the driver script, `abyss-pe`
+
+ * `a`: maximum number of branches of a bubble [`2`]
+ * `b`: maximum length of a bubble (bp) [`10000`]
+ * `c`: minimum mean k-mer coverage of a unitig [`sqrt(median)`]
+ * `d`: allowable error of a distance estimate (bp) [`6`]
+ * `e`: minimum erosion k-mer coverage [`sqrt(median)`]
+ * `E`: minimum erosion k-mer coverage per strand [`1`]
+ * `j`: number of threads [`2`]
+ * `k`: size of k-mer (bp)
+ * `l`: minimum alignment length of a read (bp) [`k`]
+ * `m`: minimum overlap of two unitigs (bp) [`30`]
+ * `n`: minimum number of pairs required for building contigs [`10`]
+ * `N`: minimum number of pairs required for building scaffolds [`n`]
+ * `p`: minimum sequence identity of a bubble [`0.9`]
+ * `q`: minimum base quality [`3`]
+ * `s`: minimum unitig size required for building contigs (bp) [`200`]
+ * `S`: minimum contig size required for building scaffolds (bp) [`s`]
+ * `t`: minimum tip size (bp) [`2k`]
+ * `v`: use `v=-v` to enable verbose logging [`disabled`]
+
+Please see the
+[abyss-pe](http://manpages.ubuntu.com/abyss-pe.1.html)
+manual page for more information on assembly parameters.
+
+ABySS programs
+==============
+
+`abyss-pe` is a driver script implemented as a Makefile. Any option of
+`make` may be used with `abyss-pe`. Particularly useful options are:
+
+ * `-C dir`, `--directory=dir`
+ Change to the directory `dir` and store the results there.
+ * `-n`, `--dry-run`
+ Print the commands that would be executed, but do not execute
+ them.
+
+`abyss-pe` uses the following programs, which must be found in your
+`PATH`:
+
+ * `ABYSS`: de Bruijn graph assembler
+ * `ABYSS-P`: parallel (MPI) de Bruijn graph assembler
+ * `AdjList`: find overlapping sequences
+ * `DistanceEst`: estimate the distance between sequences
+ * `MergeContigs`: merge sequences
+ * `MergePaths`: merge overlapping paths
+ * `Overlap`: find overlapping sequences using paired-end reads
+ * `PathConsensus`: find a consensus sequence of ambiguous paths
+ * `PathOverlap`: find overlapping paths
+ * `PopBubbles`: remove bubbles from the sequence overlap graph
+ * `SimpleGraph`: find paths through the overlap graph
+ * `abyss-fac`: calculate assembly contiguity statistics
+ * `abyss-filtergraph`: remove shim contigs from the overlap graph
+ * `abyss-fixmate`: fill the paired-end fields of SAM alignments
+ * `abyss-map`: map reads to a reference sequence
+ * `abyss-scaffold`: scaffold contigs using distance estimates
+ * `abyss-todot`: convert graph formats and merge graphs
+
+Mailing List
+============
+
+Subscribe to the
+[ABySS mailing list]
+(http://groups.google.com/group/abyss-users),
+<abyss-users at googlegroups.com>.
+
+For questions related to transcriptome assembly, contact the
+[Trans-ABySS mailing list]
+(http://groups.google.com/group/trans-abyss),
+<trans-abyss at googlegroups.com>.
+
+Authors
+=======
+
+This document is written by Shaun Jackman.
+
+ABySS is written by Shaun Jackman, Tony Raymond and Jared Simpson.
+
+Copyright 2012 Canada's Michael Smith Genome Science Centre
diff --git a/Scaffold/Makefile.am b/Scaffold/Makefile.am
new file mode 100644
index 0000000..b6ca98d
--- /dev/null
+++ b/Scaffold/Makefile.am
@@ -0,0 +1,26 @@
+bin_PROGRAMS = abyss-scaffold abyss-junction
+noinst_PROGRAMS = abyss-drawgraph
+
+abyss_scaffold_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_scaffold_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+
+abyss_scaffold_LDADD = \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_scaffold_SOURCES = scaffold.cc
+
+abyss_junction_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_junction_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+
+abyss_junction_LDADD = \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_junction_SOURCES = junction.cc
+
+abyss_drawgraph_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/Common
+abyss_drawgraph_LDADD = $(top_builddir)/Common/libcommon.a
+abyss_drawgraph_SOURCES = drawgraph.cc
diff --git a/Scaffold/Makefile.in b/Scaffold/Makefile.in
new file mode 100644
index 0000000..ea9e543
--- /dev/null
+++ b/Scaffold/Makefile.in
@@ -0,0 +1,589 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = abyss-scaffold$(EXEEXT) abyss-junction$(EXEEXT)
+noinst_PROGRAMS = abyss-drawgraph$(EXEEXT)
+subdir = Scaffold
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS)
+am_abyss_drawgraph_OBJECTS = abyss_drawgraph-drawgraph.$(OBJEXT)
+abyss_drawgraph_OBJECTS = $(am_abyss_drawgraph_OBJECTS)
+abyss_drawgraph_DEPENDENCIES = $(top_builddir)/Common/libcommon.a
+am_abyss_junction_OBJECTS = abyss_junction-junction.$(OBJEXT)
+abyss_junction_OBJECTS = $(am_abyss_junction_OBJECTS)
+abyss_junction_DEPENDENCIES = $(top_builddir)/Common/libcommon.a
+abyss_junction_LINK = $(CXXLD) $(abyss_junction_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+am_abyss_scaffold_OBJECTS = abyss_scaffold-scaffold.$(OBJEXT)
+abyss_scaffold_OBJECTS = $(am_abyss_scaffold_OBJECTS)
+abyss_scaffold_DEPENDENCIES = $(top_builddir)/Common/libcommon.a
+abyss_scaffold_LINK = $(CXXLD) $(abyss_scaffold_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(abyss_drawgraph_SOURCES) $(abyss_junction_SOURCES) \
+ $(abyss_scaffold_SOURCES)
+DIST_SOURCES = $(abyss_drawgraph_SOURCES) $(abyss_junction_SOURCES) \
+ $(abyss_scaffold_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+abyss_scaffold_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_scaffold_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+abyss_scaffold_LDADD = \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_scaffold_SOURCES = scaffold.cc
+abyss_junction_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+abyss_junction_CXXFLAGS = $(AM_CXXFLAGS) $(OPENMP_CXXFLAGS)
+abyss_junction_LDADD = \
+ $(top_builddir)/Common/libcommon.a
+
+abyss_junction_SOURCES = junction.cc
+abyss_drawgraph_CPPFLAGS = -I$(top_srcdir) -I$(top_srcdir)/Common
+abyss_drawgraph_LDADD = $(top_builddir)/Common/libcommon.a
+abyss_drawgraph_SOURCES = drawgraph.cc
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Scaffold/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign Scaffold/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+abyss-drawgraph$(EXEEXT): $(abyss_drawgraph_OBJECTS) $(abyss_drawgraph_DEPENDENCIES) $(EXTRA_abyss_drawgraph_DEPENDENCIES)
+ @rm -f abyss-drawgraph$(EXEEXT)
+ $(CXXLINK) $(abyss_drawgraph_OBJECTS) $(abyss_drawgraph_LDADD) $(LIBS)
+abyss-junction$(EXEEXT): $(abyss_junction_OBJECTS) $(abyss_junction_DEPENDENCIES) $(EXTRA_abyss_junction_DEPENDENCIES)
+ @rm -f abyss-junction$(EXEEXT)
+ $(abyss_junction_LINK) $(abyss_junction_OBJECTS) $(abyss_junction_LDADD) $(LIBS)
+abyss-scaffold$(EXEEXT): $(abyss_scaffold_OBJECTS) $(abyss_scaffold_DEPENDENCIES) $(EXTRA_abyss_scaffold_DEPENDENCIES)
+ @rm -f abyss-scaffold$(EXEEXT)
+ $(abyss_scaffold_LINK) $(abyss_scaffold_OBJECTS) $(abyss_scaffold_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_drawgraph-drawgraph.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_junction-junction.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/abyss_scaffold-scaffold.Po at am__quote@
+
+.cc.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+abyss_drawgraph-drawgraph.o: drawgraph.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_drawgraph_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_drawgraph-drawgraph.o -MD -MP -MF $(DEPDIR)/abyss_drawgraph-drawgraph.Tpo -c -o abyss_drawgraph-drawgraph.o `test -f 'drawgraph.cc' || echo '$(srcdir)/'`drawgraph.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_drawgraph-drawgraph.Tpo $(DEPDIR)/abyss_drawgraph-drawgraph.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='drawgraph.cc' object='abyss_drawgraph-drawgraph.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_drawgraph_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_drawgraph-drawgraph.o `test -f 'drawgraph.cc' || echo '$(srcdir)/'`drawgraph.cc
+
+abyss_drawgraph-drawgraph.obj: drawgraph.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_drawgraph_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT abyss_drawgraph-drawgraph.obj -MD -MP -MF $(DEPDIR)/abyss_drawgraph-drawgraph.Tpo -c -o abyss_drawgraph-drawgraph.obj `if test -f 'drawgraph.cc'; then $(CYGPATH_W) 'drawgraph.cc'; else $(CYGPATH_W) '$(srcdir)/drawgraph.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_drawgraph-drawgraph.Tpo $(DEPDIR)/abyss_drawgraph-drawgraph.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='drawgraph.cc' object='abyss_drawgraph-drawgraph.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_drawgraph_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o abyss_drawgraph-drawgraph.obj `if test -f 'drawgraph.cc'; then $(CYGPATH_W) 'drawgraph.cc'; else $(CYGPATH_W) '$(srcdir)/drawgraph.cc'; fi`
+
+abyss_junction-junction.o: junction.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_junction_CPPFLAGS) $(CPPFLAGS) $(abyss_junction_CXXFLAGS) $(CXXFLAGS) -MT abyss_junction-junction.o -MD -MP -MF $(DEPDIR)/abyss_junction-junction.Tpo -c -o abyss_junction-junction.o `test -f 'junction.cc' || echo '$(srcdir)/'`junction.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_junction-junction.Tpo $(DEPDIR)/abyss_junction-junction.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='junction.cc' object='abyss_junction-junction.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_junction_CPPFLAGS) $(CPPFLAGS) $(abyss_junction_CXXFLAGS) $(CXXFLAGS) -c -o abyss_junction-junction.o `test -f 'junction.cc' || echo '$(srcdir)/'`junction.cc
+
+abyss_junction-junction.obj: junction.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_junction_CPPFLAGS) $(CPPFLAGS) $(abyss_junction_CXXFLAGS) $(CXXFLAGS) -MT abyss_junction-junction.obj -MD -MP -MF $(DEPDIR)/abyss_junction-junction.Tpo -c -o abyss_junction-junction.obj `if test -f 'junction.cc'; then $(CYGPATH_W) 'junction.cc'; else $(CYGPATH_W) '$(srcdir)/junction.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_junction-junction.Tpo $(DEPDIR)/abyss_junction-junction.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='junction.cc' object='abyss_junction-junction.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_junction_CPPFLAGS) $(CPPFLAGS) $(abyss_junction_CXXFLAGS) $(CXXFLAGS) -c -o abyss_junction-junction.obj `if test -f 'junction.cc'; then $(CYGPATH_W) 'junction.cc'; else $(CYGPATH_W) '$(srcdir)/junction.cc'; fi`
+
+abyss_scaffold-scaffold.o: scaffold.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_scaffold_CPPFLAGS) $(CPPFLAGS) $(abyss_scaffold_CXXFLAGS) $(CXXFLAGS) -MT abyss_scaffold-scaffold.o -MD -MP -MF $(DEPDIR)/abyss_scaffold-scaffold.Tpo -c -o abyss_scaffold-scaffold.o `test -f 'scaffold.cc' || echo '$(srcdir)/'`scaffold.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_scaffold-scaffold.Tpo $(DEPDIR)/abyss_scaffold-scaffold.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scaffold.cc' object='abyss_scaffold-scaffold.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_scaffold_CPPFLAGS) $(CPPFLAGS) $(abyss_scaffold_CXXFLAGS) $(CXXFLAGS) -c -o abyss_scaffold-scaffold.o `test -f 'scaffold.cc' || echo '$(srcdir)/'`scaffold.cc
+
+abyss_scaffold-scaffold.obj: scaffold.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_scaffold_CPPFLAGS) $(CPPFLAGS) $(abyss_scaffold_CXXFLAGS) $(CXXFLAGS) -MT abyss_scaffold-scaffold.obj -MD -MP -MF $(DEPDIR)/abyss_scaffold-scaffold.Tpo -c -o abyss_scaffold-scaffold.obj `if test -f 'scaffold.cc'; then $(CYGPATH_W) 'scaffold.cc'; else $(CYGPATH_W) '$(srcdir)/scaffold.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/abyss_scaffold-scaffold.Tpo $(DEPDIR)/abyss_scaffold-scaffold.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='scaffold.cc' object='abyss_scaffold-scaffold.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(abyss_scaffold_CPPFLAGS) $(CPPFLAGS) $(abyss_scaffold_CXXFLAGS) $(CXXFLAGS) -c -o abyss_scaffold-scaffold.obj `if test -f 'scaffold.cc'; then $(CYGPATH_W) 'scaffold.cc'; else $(CYGPATH_W) '$(srcdir)/scaffold.cc'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-noinstPROGRAMS cscopelist ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-binPROGRAMS install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/Scaffold/drawgraph.cc b/Scaffold/drawgraph.cc
new file mode 100644
index 0000000..ccce65b
--- /dev/null
+++ b/Scaffold/drawgraph.cc
@@ -0,0 +1,268 @@
+/**
+ * Place each contig on a one-dimesional coordinate system using
+ * distance estimates.
+ * Written by Shaun Jackman.
+ */
+
+/** Disable Boost uBLAS runtime sanity checks. */
+#define BOOST_UBLAS_NDEBUG 1
+
+#include "ContigProperties.h"
+#include "Estimate.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/GraphIO.h"
+#include "Graph/GraphUtil.h"
+#include "cholesky.hpp"
+#include <boost/numeric/ublas/matrix.hpp>
+#include <boost/numeric/ublas/vector.hpp>
+#include <algorithm>
+#include <cassert>
+#include <fstream>
+#include <getopt.h>
+#include <iostream>
+#include <limits>
+#include <string>
+
+using namespace std;
+using boost::tie;
+namespace ublas = boost::numeric::ublas;
+
+#define PROGRAM "abyss-drawgraph"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... FASTA|OVERLAP DIST...\n"
+"Place each contig on a one-dimesional coordinate system using\n"
+"distance estimates and output a DOT graph with coordinates.\n"
+" FASTA contigs in FASTA format\n"
+" OVERLAP the contig overlap graph\n"
+" DIST estimates of the distance between contigs\n"
+"\n"
+" -x, --xscale=N set the x scale to N nt/inch [100e3]\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by ContigProperties
+
+ /** The x scale. */
+ double xscale = 100e3; // nt/inch
+
+ /** Verbose output. */
+ int verbose; // used by PopBubbles
+
+ /** Output format */
+ int format = DOT; // used by DistanceEst
+}
+
+static const char shortopts[] = "x:v";
+
+enum { OPT_HELP = 1, OPT_VERSION };
+
+static const struct option longopts[] = {
+ { "xscale", required_argument, NULL, 'x' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** A distance estimate graph. */
+typedef DirectedGraph<Length, DistanceEst> DG;
+typedef ContigGraph<DG> Graph;
+
+/** A matrix. */
+typedef ublas::matrix<double> Matrix;
+
+/** A vector. */
+typedef ublas::vector<double> Vector;
+
+/** Read a graph from the specified file. */
+static void readGraph(const string& path, Graph& g)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading `" << path << "'...\n";
+ ifstream fin(path.c_str());
+ istream& in = path == "-" ? cin : fin;
+ assert_good(in, path);
+ read_graph(in, g, BetterDistanceEst());
+ assert(in.eof());
+ if (opt::verbose > 0)
+ printGraphStats(cerr, g);
+ g_contigNames.lock();
+}
+
+/** Solve Ax = b for x using Cholesky decomposition.
+ * The matrix A is symmetric and positive-definite.
+ * @param[in,out] a input matrix A, which is clobbered
+ * @param[in,out] b input vector b and output vector x
+ */
+static void solve(Matrix& a, Vector& b)
+{
+ int ret = cholesky_decompose(a);
+ if (ret > 0) {
+ cerr << PROGRAM ": error: "
+ "The graph has multiple connected components.\n";
+ exit(EXIT_FAILURE);
+ }
+ cholesky_solve(a, b, ublas::lower());
+}
+
+/** Run abyss-drawgraph. */
+int main(int argc, char** argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?':
+ die = true;
+ break;
+ case 'x':
+ arg >> opt::xscale;
+ break;
+ case 'v':
+ opt::verbose++;
+ break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (argc - optind < 0) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef graph_traits<Graph>::edge_iterator Eit;
+ typedef graph_traits<Graph>::vertex_descriptor V;
+ typedef graph_traits<Graph>::vertex_iterator Vit;
+ typedef edge_bundle_type<Graph>::type EP;
+
+ Graph g;
+ if (optind < argc) {
+ for (; optind < argc; optind++)
+ readGraph(argv[optind], g);
+ } else
+ readGraph("-", g);
+
+ // Add any missing complementary edges.
+ addComplementaryEdges(g);
+
+ size_t n = num_vertices(g);
+ Matrix a(n, n);
+ Vector b = ublas::zero_vector<double>(n);
+
+ // Set the origin.
+ a(0, 0) = 1;
+
+ // Build the information matrix.
+ Eit eit, elast;
+ for (tie(eit, elast) = edges(g); eit != elast; ++eit) {
+ E e = *eit;
+ V u = source(e, g);
+ V v = target(e, g);
+ size_t ui = get(vertex_index, g, u);
+ size_t vi = get(vertex_index, g, v);
+ int d = get(edge_weight, g, e);
+ double err = max(0.1, (double)g[e].stdDev);
+ double weight = 1 / err;
+ a(ui, ui) += weight;
+ a(ui, vi) -= weight;
+ a(vi, ui) -= weight;
+ a(vi, vi) += weight;
+ b[ui] -= d * weight;
+ b[vi] += d * weight;
+ }
+
+ // Solve the equation Ax = b for x.
+ solve(a, b);
+
+ // Output the coordinates of each contig.
+ if (opt::verbose > 1) {
+ Vit uit, ulast;
+ for (tie(uit, ulast) = vertices(g); uit != ulast; ++uit) {
+ V u = *uit;
+ size_t ui = get(vertex_index, g, u);
+ ssize_t x1 = (ssize_t)b[ui];
+ ssize_t x0 = x1 - g[u].length;
+ cerr << get(vertex_name, g, u)
+ << '\t' << x0 << '\t' << x1 << '\n';
+ }
+ }
+
+ // Sort the contigs by their right coordinate.
+ std::vector< std::pair<double, V> > sorted;
+ sorted.reserve(n);
+ Vit uit, ulast;
+ for (tie(uit, ulast) = vertices(g); uit != ulast; ++uit) {
+ V u = *uit;
+ size_t ui = get(vertex_index, g, u);
+ sorted.push_back(std::make_pair(b[ui], u));
+ }
+ sort(sorted.begin(), sorted.end());
+
+ // Write the graph.
+ cout << "digraph g {\n"
+ "node [shape=\"box\" height=0.3 fixedsize=1]\n";
+ assert_good(cout, "stdout");
+
+ // Write the vertices.
+ double pos0 = -numeric_limits<double>::max();
+ size_t yi = 0;
+ for (size_t i = 0; i < n; ++i) {
+ V u = sorted[i].second;
+ double pos = b[get(vertex_index, g, u)];
+ size_t l = g[u].length;
+
+ if (pos - l < pos0)
+ yi++;
+ pos0 = pos;
+
+ double dpi = 72;
+ const double W = dpi / opt::xscale; // pt/nt
+ const double H = 32; // pt
+ double w = l * W;
+ double x = pos * W - w / 2;
+ double y = yi * H;
+ cout << '"' << get(vertex_name, g, u) << "\""
+ " [pos=\"" << x << ",-" << y << "\""
+ " width=" << w / dpi << "]\n";
+ }
+
+ // Write the edges.
+ for (tie(eit, elast) = edges(g); eit != elast; ++eit)
+ cout << get(edge_name, g, *eit) << '\n';
+
+ cout << "}\n";
+ assert_good(cout, "stdout");
+
+ return 0;
+}
diff --git a/Scaffold/junction.cc b/Scaffold/junction.cc
new file mode 100644
index 0000000..6ad417c
--- /dev/null
+++ b/Scaffold/junction.cc
@@ -0,0 +1,223 @@
+#include "config.h"
+#include "Common/ContigPath.h"
+#include "Common/IOUtil.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/GraphIO.h"
+#include "Graph/GraphUtil.h"
+#include "Uncompress.h"
+#include <boost/graph/graph_traits.hpp>
+#include <boost/lambda/bind.hpp>
+#include <boost/lambda/lambda.hpp>
+#include <boost/ref.hpp>
+#include <algorithm>
+#include <cassert>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <sstream>
+#include <string>
+#include <vector>
+#include <utility>
+
+using namespace std;
+using namespace boost::lambda;
+using boost::tie;
+#if !__GXX_EXPERIMENTAL_CXX0X__
+using boost::cref;
+using boost::ref;
+#endif
+
+#define PROGRAM "abyss-junction"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... OVERLAP [SCAFFOLD]...\n"
+"Extend junction contigs that are supported by the scaffold graph.\n"
+" OVERLAP the overlap graph\n"
+" SCAFFOLD a scaffold graph\n"
+"\n"
+" -i, --ignore=FILE ignore junctions seen in FILE\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by DotIO
+
+ /** Do not check for evidence in the scaffold graph. */
+ bool noScaffoldGraph;
+
+ /** Junction contigs to ignore. */
+ string ignorePath;
+
+ /** Verbose output. */
+ int verbose; // used by PopBubbles
+
+ /** Output format */
+ int format = DOT; // used by DistanceEst
+}
+
+static const char shortopts[] = "i:v";
+
+enum { OPT_HELP = 1, OPT_VERSION, };
+
+static const struct option longopts[] = {
+ { "ignore", no_argument, NULL, 'i' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** Counts. */
+static struct {
+ unsigned junctions;
+ unsigned supported;
+} g_count;
+
+/** An overlap graph. */
+typedef DirectedGraph<NoProperty, NoProperty> DG;
+typedef ContigGraph<DG> Graph;
+typedef Graph OverlapGraph;
+
+/** A scaffold graph. */
+typedef Graph ScaffoldGraph;
+
+/** Extend junction contigs. */
+void extendJunction(
+ const OverlapGraph& overlapG,
+ const ScaffoldGraph& scaffoldG,
+ graph_traits<OverlapGraph>::vertex_descriptor v)
+{
+ if (get(vertex_sense, overlapG, v)
+ || in_degree(v, overlapG) != 1
+ || out_degree(v, overlapG) != 1)
+ return;
+ typedef graph_traits<OverlapGraph>::vertex_descriptor V;
+ V u = source(*in_edges(v, overlapG).first, overlapG);
+ V w = *adjacent_vertices(v, overlapG).first;
+ if (opt::noScaffoldGraph
+ || edge(u, w, scaffoldG).second) {
+ // This junction contig is supported by the scaffold graph.
+ ContigPath path;
+ path.reserve(3);
+ extend(overlapG, get(vertex_complement, overlapG, v),
+ back_inserter(path));
+ reverseComplement(path.begin(), path.end());
+ path.push_back(v);
+ extend(overlapG, v, back_inserter(path));
+ assert(path.size() >= 3);
+ cout << createContigName() << '\t' << path << '\n';
+ g_count.supported++;
+ }
+ g_count.junctions++;
+}
+
+/** Allow parallel edges. */
+struct AllowParallelEdges {
+ template <typename EP>
+ EP operator()(const EP& a, const EP&) const
+ {
+ return a;
+ }
+};
+
+/** Read a graph from the specified file. */
+static void readGraph(const string& path, Graph& g)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading `" << path << "'...\n";
+ ifstream fin(path.c_str());
+ istream& in = path == "-" ? cin : fin;
+ assert_good(in, path);
+ read_graph(in, g, AllowParallelEdges());
+ assert(in.eof());
+ if (opt::verbose > 1)
+ printGraphStats(cerr, g);
+ g_contigNames.lock();
+}
+
+int main(int argc, char** argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'i': arg >> opt::ignorePath; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (argc - optind < 1) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ OverlapGraph overlapG;
+ readGraph(argv[optind++], overlapG);
+
+ ScaffoldGraph scaffoldG(overlapG.num_vertices() / 2);
+ if (optind < argc) {
+ for_each(argv + optind, argv + argc,
+ bind(readGraph, _1, ref(scaffoldG)));
+ // Add any missing complementary edges.
+ size_t numAdded = addComplementaryEdges(scaffoldG);
+ if (opt::verbose > 0)
+ cerr << "Added " << numAdded << " complementary edges.\n";
+ if (opt::verbose > 1)
+ printGraphStats(cerr, scaffoldG);
+ } else
+ opt::noScaffoldGraph = true;
+
+ // Read the set of contigs to ignore.
+ vector<bool> seen(num_vertices(overlapG) / 2);
+ if (!opt::ignorePath.empty()) {
+ ifstream in(opt::ignorePath.c_str());
+ assert_good(in, opt::ignorePath);
+ markSeenInPath(in, seen);
+ }
+
+ // Extend the junction contigs.
+ graph_traits<OverlapGraph>::vertex_iterator uit, ulast;
+ for (tie(uit, ulast) = vertices(overlapG); uit != ulast; ++uit)
+ if (!seen[get(vertex_contig_index, overlapG, *uit)])
+ extendJunction(overlapG, scaffoldG, *uit);
+
+ assert_good(cout, "stdout");
+
+ if (opt::verbose > 0) {
+ cerr << "Junctions: " << g_count.junctions << '\n';
+ if (!opt::noScaffoldGraph)
+ cerr << "Supported: " << g_count.supported << '\n';
+ }
+
+ return 0;
+}
diff --git a/Scaffold/scaffold.cc b/Scaffold/scaffold.cc
new file mode 100644
index 0000000..8bd5102
--- /dev/null
+++ b/Scaffold/scaffold.cc
@@ -0,0 +1,741 @@
+#include "config.h"
+#include "ContigNode.h"
+#include "ContigPath.h"
+#include "ContigProperties.h"
+#include "Estimate.h"
+#include "IOUtil.h"
+#include "Iterator.h"
+#include "Uncompress.h"
+#include "Graph/Assemble.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include "Graph/DirectedGraph.h"
+#include "Graph/GraphAlgorithms.h"
+#include "Graph/GraphIO.h"
+#include "Graph/GraphUtil.h"
+#include "Graph/PopBubbles.h"
+#include <cassert>
+#include <climits>
+#include <cmath>
+#include <cstdlib>
+#include <fstream>
+#include <functional>
+#include <getopt.h>
+#include <iostream>
+#include <sstream>
+#include <string>
+#include <utility>
+
+using namespace std;
+using namespace std::rel_ops;
+using boost::edge_bundle_type;
+using boost::tie;
+
+#define PROGRAM "abyss-scaffold"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... FASTA|OVERLAP DIST...\n"
+"Scaffold contigs using the distance estimate graph.\n"
+" FASTA contigs in FASTA format\n"
+" OVERLAP the contig overlap graph\n"
+" DIST estimates of the distance between contigs\n"
+"\n"
+" -n, --npairs=N minimum number of pairs [0]\n"
+" -s, --seed-length=N minimum contig length [200]\n"
+" or -s N0-N1 Find the value of s in [N0,N1]\n"
+" that maximizes the scaffold N50.\n"
+" -k, --kmer=N length of a k-mer\n"
+" --min-gap=N minimum scaffold gap length to output [50]\n"
+" -o, --out=FILE write the paths to FILE\n"
+" -g, --graph=FILE write the graph to FILE\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by ContigProperties
+
+ /** Minimum number of pairs. */
+ static unsigned minNumPairs;
+
+ /** Minimum contig length. */
+ static unsigned minContigLength = 200;
+ static unsigned minContigLengthEnd;
+
+ /** Minimum scaffold gap length to output. */
+ static int minGap = 50;
+
+ /** Write the paths to this file. */
+ static string out;
+
+ /** Write the graph to this file. */
+ static string graphPath;
+
+ /** Verbose output. */
+ int verbose; // used by PopBubbles
+
+ /** Output format */
+ int format = DOT; // used by DistanceEst
+}
+
+static const char shortopts[] = "g:k:n:o:s:v";
+
+enum { OPT_HELP = 1, OPT_VERSION, OPT_MIN_GAP };
+
+static const struct option longopts[] = {
+ { "graph", no_argument, NULL, 'g' },
+ { "kmer", required_argument, NULL, 'k' },
+ { "min-gap", required_argument, NULL, OPT_MIN_GAP },
+ { "npairs", required_argument, NULL, 'n' },
+ { "out", required_argument, NULL, 'o' },
+ { "seed-length", required_argument, NULL, 's' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+/** A distance estimate graph. */
+typedef DirectedGraph<Length, DistanceEst> DG;
+typedef ContigGraph<DG> Graph;
+
+/** Return whether the specified edges has sufficient support. */
+struct PoorSupport {
+ PoorSupport(Graph& g) : m_g(g) { }
+ bool operator()(graph_traits<Graph>::edge_descriptor e) const
+ {
+ return m_g[e].numPairs < opt::minNumPairs;
+ }
+ const Graph& m_g;
+};
+
+/** Remove short vertices and unsupported edges from the graph. */
+static void filterGraph(Graph& g, unsigned minContigLength)
+{
+ typedef graph_traits<Graph> GTraits;
+ typedef GTraits::edge_descriptor E;
+ typedef GTraits::edge_iterator Eit;
+ typedef GTraits::vertex_descriptor V;
+ typedef GTraits::vertex_iterator Vit;
+
+ // Remove short contigs.
+ unsigned numRemovedV = 0;
+ std::pair<Vit, Vit> urange = vertices(g);
+ for (Vit uit = urange.first; uit != urange.second; ++uit) {
+ V u = *uit;
+ if (g[u].length < minContigLength)
+ clear_vertex(u, g);
+ if (out_degree(u, g) == 0 && in_degree(u, g) == 0) {
+ remove_vertex(u, g);
+ numRemovedV++;
+ }
+ }
+ if (opt::verbose > 0)
+ cerr << "Removed " << numRemovedV << " vertices.\n";
+
+ // Remove poorly-supported edges.
+ unsigned numBefore = num_edges(g);
+ remove_edge_if(PoorSupport(g), static_cast<DG&>(g));
+ unsigned numRemovedE = numBefore - num_edges(g);
+ if (opt::verbose > 0)
+ cerr << "Removed " << numRemovedE << " edges.\n";
+}
+
+/** Return true if the specified edge is a cycle. */
+static bool isCycle(Graph& g, graph_traits<Graph>::edge_descriptor e)
+{
+ return edge(target(e, g), source(e, g), g).second;
+}
+
+/** Remove simple cycles of length two from the graph. */
+static void removeCycles(Graph& g)
+{
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef graph_traits<Graph>::edge_iterator Eit;
+
+ // Identify the cycles.
+ vector<E> cycles;
+ Eit eit, elast;
+ for (tie(eit, elast) = edges(g); eit != elast; ++eit) {
+ E e = *eit;
+ if (isCycle(g, e))
+ cycles.push_back(e);
+ }
+
+ /** Remove the cycles. */
+ remove_edges(g, cycles.begin(), cycles.end());
+ if (opt::verbose > 0) {
+ cerr << "Removed " << cycles.size() << " cyclic edges.\n";
+ printGraphStats(cerr, g);
+ }
+}
+
+/** Find edges in g0 that resolve forks in g.
+ * For a pair of edges (u,v1) and (u,v2) in g, if exactly one of the
+ * edges (v1,v2) or (v2,v1) exists in g0, add that edge to g.
+ */
+static void resolveForks(Graph& g, const Graph& g0)
+{
+ typedef graph_traits<Graph>::adjacency_iterator Vit;
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef graph_traits<Graph>::vertex_iterator Uit;
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ unsigned numEdges = 0;
+ pair<Uit, Uit> urange = vertices(g);
+ for (Uit uit = urange.first; uit != urange.second; ++uit) {
+ V u = *uit;
+ if (out_degree(u, g) < 2)
+ continue;
+ pair<Vit, Vit> vrange = adjacent_vertices(u, g);
+ for (Vit vit1 = vrange.first; vit1 != vrange.second;) {
+ V v1 = *vit1;
+ ++vit1;
+ assert(v1 != u);
+ for (Vit vit2 = vit1; vit2 != vrange.second; ++vit2) {
+ V v2 = *vit2;
+ assert(v2 != u);
+ assert(v1 != v2);
+ if (edge(v1, v2, g).second || edge(v2, v1, g).second)
+ continue;
+ pair<E, bool> e12 = edge(v1, v2, g0);
+ pair<E, bool> e21 = edge(v2, v1, g0);
+ if (e12.second && e21.second) {
+ if (opt::verbose > 1)
+ cerr << "cycle: " << get(vertex_name, g, v1)
+ << ' ' << get(vertex_name, g, v2) << '\n';
+ } else if (e12.second || e21.second) {
+ E e = e12.second ? e12.first : e21.first;
+ V v = source(e, g0), w = target(e, g0);
+ add_edge(v, w, g0[e], g);
+ numEdges++;
+ if (opt::verbose > 1)
+ cerr << get(vertex_name, g, u)
+ << " -> " << get(vertex_name, g, v)
+ << " -> " << get(vertex_name, g, w)
+ << " [" << g0[e] << "]\n";
+ }
+ }
+ }
+ }
+ if (opt::verbose > 0)
+ cerr << "Added " << numEdges
+ << " edges to ambiguous vertices.\n";
+}
+
+/** Remove tips.
+ * For an edge (u,v), remove the vertex v if deg+(u) > 1
+ * and deg-(v) = 1 and deg+(v) = 0.
+ */
+static void pruneTips(Graph& g)
+{
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ /** Identify the tips. */
+ size_t n = 0;
+ pruneTips(g, CountingOutputIterator(n));
+
+ if (opt::verbose > 0) {
+ cerr << "Removed " << n << " tips.\n";
+ printGraphStats(cerr, g);
+ }
+}
+
+/** Remove repetitive vertices from this graph.
+ * input: digraph g { t1->v1 t2->v2 t1->u t2->u u->v1 u->v2 }
+ * operation: remove vertex u
+ * output: digraph g { t1->v1 t2->v2 }
+ */
+static void removeRepeats(Graph& g)
+{
+ typedef graph_traits<Graph>::adjacency_iterator Ait;
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ vector<V> repeats;
+ vector<E> transitive;
+ find_transitive_edges(g, back_inserter(transitive));
+ for (vector<E>::const_iterator it = transitive.begin();
+ it != transitive.end(); ++it) {
+ // Iterate through the transitive edges, u->w1.
+ V u = source(*it, g), w1 = target(*it, g);
+ Ait vit, vlast;
+ for (tie(vit, vlast) = adjacent_vertices(u, g);
+ vit != vlast; ++vit) {
+ V v = *vit;
+ assert(u != v); // no self loops
+ if (!edge(v, w1, g).second)
+ continue;
+ // u->w1 is a transitive edge spanning u->v->w1.
+ Ait wit, wlast;
+ for (tie(wit, wlast) = adjacent_vertices(v, g);
+ wit != wlast; ++wit) {
+ // For each edge v->w2, check that an edge
+ // w1->w2 or w2->w1 exists. If not, v is a repeat.
+ V w2 = *wit;
+ assert(v != w2); // no self loops
+ if (w1 != w2
+ && !edge(w1, w2, g).second
+ && !edge(w2, w1, g).second) {
+ repeats.push_back(v);
+ break;
+ }
+ }
+ }
+ }
+
+ sort(repeats.begin(), repeats.end());
+ repeats.erase(unique(repeats.begin(), repeats.end()),
+ repeats.end());
+ if (opt::verbose > 1) {
+ cerr << "Ambiguous:";
+ for (vector<V>::const_iterator it = repeats.begin();
+ it != repeats.end(); ++it)
+ cerr << ' ' << get(vertex_name, g, *it);
+ cerr << '\n';
+ }
+
+ // Remove the repetitive vertices.
+ unsigned numRemoved = 0;
+ for (vector<V>::const_iterator it = repeats.begin();
+ it != repeats.end(); ++it) {
+ V u = *it;
+ V uc = get(vertex_complement, g, u);
+ clear_out_edges(u, g);
+ if (it != repeats.begin() && it[-1] == uc) {
+ remove_vertex(u, g);
+ numRemoved++;
+ }
+ }
+
+ if (opt::verbose > 0) {
+ cerr << "Cleared "
+ << repeats.size() << " ambiguous vertices.\n"
+ << "Removed "
+ << numRemoved << " ambiguous vertices.\n";
+ printGraphStats(cerr, g);
+ }
+}
+
+/** Remove weak edges from this graph.
+ * input: digraph g { u1->v2 u1->v1 u2->v2 }
+ * (u1,v2).n < (u1,v1).n and (u1,v2).n < (u2,v2).n
+ * operation: remove edge u1->v2
+ * output: digraph g {u1->v1 u2->v2 }
+ */
+static void removeWeakEdges(Graph& g)
+{
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef graph_traits<Graph>::edge_iterator Eit;
+ typedef graph_traits<Graph>::in_edge_iterator Iit;
+ typedef graph_traits<Graph>::out_edge_iterator Oit;
+ typedef graph_traits<Graph>::vertex_descriptor V;
+
+ vector<E> weak;
+ Eit eit, elast;
+ for (tie(eit, elast) = edges(g); eit != elast; ++eit) {
+ E u1v2 = *eit;
+ V u1 = source(u1v2, g), v2 = target(u1v2, g);
+ if (out_degree(u1, g) != 2 || in_degree(v2, g) != 2)
+ continue;
+
+ Oit oit, olast;
+ tie(oit, olast) = out_edges(u1, g);
+ E u1v1;
+ if (target(*oit, g) == v2) {
+ ++oit;
+ u1v1 = *oit;
+ } else {
+ u1v1 = *oit;
+ ++oit;
+ }
+ assert(++oit == olast);
+ V v1 = target(u1v1, g);
+ assert(v1 != v2);
+ if (in_degree(v1, g) != 1)
+ continue;
+
+ Iit iit, ilast;
+ tie(iit, ilast) = in_edges(v2, g);
+ E u2v2;
+ if (source(*iit, g) == u1) {
+ ++iit;
+ assert(iit != ilast);
+ u2v2 = *iit;
+ } else {
+ assert(iit != ilast);
+ u2v2 = *iit;
+ ++iit;
+ }
+ assert(++iit == ilast);
+ V u2 = source(u2v2, g);
+ assert(u1 != u2);
+ if (out_degree(u2, g) != 1)
+ continue;
+
+ unsigned n = g[u1v2].numPairs;
+ if (n < g[u1v1].numPairs && n < g[u2v2].numPairs)
+ weak.push_back(u1v2);
+ }
+
+ if (opt::verbose > 1) {
+ cerr << "Weak edges:\n";
+ for (vector<E>::const_iterator it = weak.begin();
+ it != weak.end(); ++it) {
+ E e = *it;
+ cerr << '\t' << get(edge_name, g, e)
+ << " [" << g[e] << "]\n";
+ }
+ }
+
+ /** Remove the weak edges. */
+ remove_edges(g, weak.begin(), weak.end());
+ if (opt::verbose > 0) {
+ cerr << "Removed " << weak.size() << " weak edges.\n";
+ printGraphStats(cerr, g);
+ }
+}
+
+/** Return whether the specified distance estimate is an exact
+ * overlap.
+ */
+static bool isOverlap(const DistanceEst& d)
+{
+ if (d.stdDev == 0) {
+ assert(d.distance < 0);
+ return true;
+ } else
+ return false;
+}
+
+/** Add distance estimates to a path.
+ * @param g0 the original graph
+ * @param g1 the transformed graph
+ */
+static ContigPath addDistEst(const Graph& g0, const Graph& g1,
+ const ContigPath& path)
+{
+ typedef graph_traits<Graph>::edge_descriptor E;
+ typedef edge_bundle_type<Graph>::type EP;
+
+ ContigPath out;
+ out.reserve(2 * path.size());
+ ContigNode u = path.front();
+ out.push_back(u);
+ for (ContigPath::const_iterator it = path.begin() + 1;
+ it != path.end(); ++it) {
+ ContigNode v = *it;
+ assert(!v.ambiguous());
+ pair<E, bool> e0 = edge(u, v, g0);
+ pair<E, bool> e1 = edge(u, v, g1);
+ assert(e0.second || e1.second);
+ const EP& ep = e0.second ? g0[e0.first] : g1[e1.first];
+ if (!isOverlap(ep)) {
+ int distance = max(ep.distance, (int)opt::minGap);
+ int numN = distance + opt::k - 1; // by convention
+ assert(numN >= 0);
+ numN = max(numN, 1);
+ out.push_back(ContigNode(numN, 'N'));
+ }
+ out.push_back(v);
+ u = v;
+ }
+ return out;
+}
+
+/** Read a graph from the specified file. */
+static void readGraph(const string& path, Graph& g)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading `" << path << "'...\n";
+ ifstream fin(path.c_str());
+ istream& in = path == "-" ? cin : fin;
+ assert_good(in, path);
+ read_graph(in, g, BetterDistanceEst());
+ assert(in.eof());
+ if (opt::verbose > 0)
+ printGraphStats(cerr, g);
+ g_contigNames.lock();
+}
+
+/** Return the scaffold length of [first, last), not counting gaps. */
+template<typename It>
+unsigned addLength(const Graph& g, It first, It last)
+{
+ typedef typename graph_traits<Graph>::vertex_descriptor V;
+ assert(first != last);
+ unsigned length = g[*first].length;
+ for (It it = first + 1; it != last; ++it) {
+ V u = *(it - 1);
+ V v = *it;
+ length += min(0, get(edge_bundle, g, u, v).distance);
+ length += g[v].length;
+ }
+ return length;
+}
+
+/** A container of contig paths. */
+typedef vector<ContigPath> ContigPaths;
+
+/** Build the scaffold length histogram. */
+static Histogram buildScaffoldLengthHistogram(
+ Graph& g, const ContigPaths& paths)
+{
+ Histogram h;
+
+ // Clear the removed flag.
+ typedef graph_traits<Graph>::vertex_iterator Vit;
+ Vit uit, ulast;
+ for (tie(uit, ulast) = vertices(g); uit != ulast; ++uit)
+ put(vertex_removed, g, *uit, false);
+
+ // Remove the vertices that are used in paths
+ // and add the lengths of the scaffolds.
+ for (ContigPaths::const_iterator it = paths.begin();
+ it != paths.end(); ++it) {
+ h.insert(addLength(g, it->begin(), it->end()));
+ remove_vertex_if(g, it->begin(), it->end(),
+ not1(std::mem_fun_ref(&ContigNode::ambiguous)));
+ }
+
+ // Add the contigs that were not used in paths.
+ for (tie(uit, ulast) = vertices(g); uit != ulast; ++++uit) {
+ typedef graph_traits<Graph>::vertex_descriptor V;
+ V u = *uit;
+ if (!get(vertex_removed, g, u))
+ h.insert(g[u].length);
+ }
+
+ return h;
+}
+
+/** Build scaffold paths.
+ * @param output write the results
+ * @return the scaffold N50
+ */
+unsigned scaffold(const Graph& g0, unsigned minContigLength,
+ bool output)
+{
+ Graph g(g0);
+
+ // Filter the graph.
+ filterGraph(g, minContigLength);
+ if (opt::verbose > 0)
+ printGraphStats(cerr, g);
+
+ // Remove cycles.
+ removeCycles(g);
+
+ // Resolve forks.
+ resolveForks(g, g0);
+
+ // Prune tips.
+ pruneTips(g);
+
+ // Remove repeats.
+ removeRepeats(g);
+
+ // Remove transitive edges.
+ unsigned numTransitive = remove_transitive_edges(g);
+ if (opt::verbose > 0) {
+ cerr << "Removed " << numTransitive << " transitive edges.\n";
+ printGraphStats(cerr, g);
+ }
+
+ // Prune tips.
+ pruneTips(g);
+
+ // Pop bubbles.
+ typedef graph_traits<Graph>::vertex_descriptor V;
+ vector<V> popped = popBubbles(g);
+ if (opt::verbose > 0) {
+ cerr << "Removed " << popped.size()
+ << " vertices in bubbles.\n";
+ printGraphStats(cerr, g);
+ }
+ if (opt::verbose > 1) {
+ cerr << "Popped:";
+ for (vector<V>::const_iterator it = popped.begin();
+ it != popped.end(); ++it)
+ cerr << ' ' << get(vertex_name, g, *it);
+ cerr << '\n';
+ }
+
+ // Remove weak edges.
+ removeWeakEdges(g);
+
+ // Assemble the paths.
+ ContigPaths paths;
+ assembleDFS(g, back_inserter(paths));
+ sort(paths.begin(), paths.end());
+ if (opt::verbose > 0) {
+ unsigned n = 0;
+ for (ContigPaths::const_iterator it = paths.begin();
+ it != paths.end(); ++it)
+ n += it->size();
+ cerr << "Assembled " << n << " contigs in "
+ << paths.size() << " scaffolds.\n";
+ printGraphStats(cerr, g);
+ }
+
+ const unsigned STATS_MIN_LENGTH = opt::minContigLength;
+ if (!output) {
+ static bool printHeader = true;
+ Histogram h = buildScaffoldLengthHistogram(g, paths);
+ printContiguityStats(cerr, h, STATS_MIN_LENGTH,
+ printHeader)
+ << "\ts=" << minContigLength << '\n';
+ if (opt::verbose == 0)
+ printHeader = false;
+ return h.trimLow(STATS_MIN_LENGTH).n50();
+ }
+
+ // Output the paths.
+ ofstream fout(opt::out.c_str());
+ ostream& out = opt::out.empty() || opt::out == "-" ? cout : fout;
+ assert_good(out, opt::out);
+ g_contigNames.unlock();
+ for (vector<ContigPath>::const_iterator it = paths.begin();
+ it != paths.end(); ++it)
+ out << createContigName() << '\t'
+ << addDistEst(g0, g, *it) << '\n';
+ assert_good(out, opt::out);
+
+ // Output the graph.
+ if (!opt::graphPath.empty()) {
+ ofstream out(opt::graphPath.c_str());
+ assert_good(out, opt::graphPath);
+ write_dot(out, g);
+ assert_good(out, opt::graphPath);
+ }
+
+ // Print assembly contiguity statistics.
+ Histogram h = buildScaffoldLengthHistogram(g, paths);
+ printContiguityStats(cerr, h, STATS_MIN_LENGTH) << '\n';
+ return h.trimLow(STATS_MIN_LENGTH).n50();
+}
+
+/** Run abyss-scaffold. */
+int main(int argc, char** argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?':
+ die = true;
+ break;
+ case 'k':
+ arg >> opt::k;
+ break;
+ case 'g':
+ arg >> opt::graphPath;
+ break;
+ case 'n':
+ arg >> opt::minNumPairs;
+ break;
+ case 'o':
+ arg >> opt::out;
+ break;
+ case 's':
+ arg >> opt::minContigLength;
+ if (arg.peek() == '-') {
+ opt::minContigLengthEnd = 100 * opt::minContigLength;
+ arg >> expect("-") >> opt::minContigLengthEnd;
+ assert(opt::minContigLength
+ <= opt::minContigLengthEnd);
+ }
+ break;
+ case 'v':
+ opt::verbose++;
+ break;
+ case OPT_MIN_GAP:
+ arg >> opt::minGap;
+ break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": " << "missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (argc - optind < 0) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ Graph g;
+ if (optind < argc) {
+ for (; optind < argc; optind++)
+ readGraph(argv[optind], g);
+ } else
+ readGraph("-", g);
+
+ // Add any missing complementary edges.
+ size_t numAdded = addComplementaryEdges(g);
+ if (opt::verbose > 0) {
+ cerr << "Added " << numAdded << " complementary edges.\n";
+ printGraphStats(cerr, g);
+ }
+
+ if (opt::minContigLengthEnd == 0) {
+ scaffold(g, opt::minContigLength, true);
+ return 0;
+ }
+
+ // Find the value of s that maximizes the scaffold N50.
+ unsigned bests = 0, bestN50 = 0;
+ const double STEP = cbrt(10); // Three steps per decade.
+ unsigned ilast = (unsigned)round(
+ log(opt::minContigLengthEnd) / log(STEP));
+ for (unsigned i = (unsigned)round(
+ log(opt::minContigLength) / log(STEP));
+ i <= ilast; ++i) {
+ unsigned s = (unsigned)pow(STEP, (int)i);
+
+ // Round to 1 figure.
+ double nearestDecade = pow(10, floor(log10(s)));
+ s = unsigned(round(s / nearestDecade) * nearestDecade);
+
+ unsigned n50 = scaffold(g, s, false);
+ if (opt::verbose > 0)
+ cerr << '\n';
+ if (n50 > bestN50) {
+ bestN50 = n50;
+ bests = s;
+ }
+ }
+
+ bestN50 = scaffold(g, bests, true);
+ cerr << "Best scaffold N50 is " << bestN50
+ << " at s=" << bests << ".\n";
+
+ return 0;
+}
diff --git a/SimpleGraph/Makefile.am b/SimpleGraph/Makefile.am
new file mode 100644
index 0000000..52ea487
--- /dev/null
+++ b/SimpleGraph/Makefile.am
@@ -0,0 +1,14 @@
+bin_PROGRAMS = SimpleGraph
+
+SimpleGraph_CPPFLAGS = -pthread -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+SimpleGraph_CXXFLAGS = -Wno-strict-aliasing
+
+SimpleGraph_LDADD = \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Common/libcommon.a
+
+SimpleGraph_LDFLAGS = -pthread
+
+SimpleGraph_SOURCES = SimpleGraph.cpp
diff --git a/SimpleGraph/Makefile.in b/SimpleGraph/Makefile.in
new file mode 100644
index 0000000..943b645
--- /dev/null
+++ b/SimpleGraph/Makefile.in
@@ -0,0 +1,530 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+bin_PROGRAMS = SimpleGraph$(EXEEXT)
+subdir = SimpleGraph
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)"
+PROGRAMS = $(bin_PROGRAMS)
+am_SimpleGraph_OBJECTS = SimpleGraph-SimpleGraph.$(OBJEXT)
+SimpleGraph_OBJECTS = $(am_SimpleGraph_OBJECTS)
+SimpleGraph_DEPENDENCIES = $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Common/libcommon.a
+SimpleGraph_LINK = $(CXXLD) $(SimpleGraph_CXXFLAGS) $(CXXFLAGS) \
+ $(SimpleGraph_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(SimpleGraph_SOURCES)
+DIST_SOURCES = $(SimpleGraph_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+SimpleGraph_CPPFLAGS = -pthread -I$(top_srcdir) \
+ -I$(top_srcdir)/Common
+
+SimpleGraph_CXXFLAGS = -Wno-strict-aliasing
+SimpleGraph_LDADD = \
+ $(top_builddir)/Graph/libgraph.a \
+ $(top_builddir)/Common/libcommon.a
+
+SimpleGraph_LDFLAGS = -pthread
+SimpleGraph_SOURCES = SimpleGraph.cpp
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign SimpleGraph/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign SimpleGraph/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-binPROGRAMS: $(bin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS)
+SimpleGraph$(EXEEXT): $(SimpleGraph_OBJECTS) $(SimpleGraph_DEPENDENCIES) $(EXTRA_SimpleGraph_DEPENDENCIES)
+ @rm -f SimpleGraph$(EXEEXT)
+ $(SimpleGraph_LINK) $(SimpleGraph_OBJECTS) $(SimpleGraph_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/SimpleGraph-SimpleGraph.Po at am__quote@
+
+.cpp.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cpp.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+SimpleGraph-SimpleGraph.o: SimpleGraph.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(SimpleGraph_CPPFLAGS) $(CPPFLAGS) $(SimpleGraph_CXXFLAGS) $(CXXFLAGS) -MT SimpleGraph-SimpleGraph.o -MD -MP -MF $(DEPDIR)/SimpleGraph-SimpleGraph.Tpo -c -o SimpleGraph-SimpleGraph.o `test -f 'SimpleGraph.cpp' || echo '$(srcdir)/'`SimpleGraph.cpp
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/SimpleGraph-SimpleGraph.Tpo $(DEPDIR)/SimpleGraph-SimpleGraph.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SimpleGraph.cpp' object='SimpleGraph-SimpleGraph.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(SimpleGraph_CPPFLAGS) $(CPPFLAGS) $(SimpleGraph_CXXFLAGS) $(CXXFLAGS) -c -o SimpleGraph-SimpleGraph.o `test -f 'SimpleGraph.cpp' || echo '$(srcdir)/'`SimpleGraph.cpp
+
+SimpleGraph-SimpleGraph.obj: SimpleGraph.cpp
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(SimpleGraph_CPPFLAGS) $(CPPFLAGS) $(SimpleGraph_CXXFLAGS) $(CXXFLAGS) -MT SimpleGraph-SimpleGraph.obj -MD -MP -MF $(DEPDIR)/SimpleGraph-SimpleGraph.Tpo -c -o SimpleGraph-SimpleGraph.obj `if test -f 'SimpleGraph.cpp'; then $(CYGPATH_W) 'SimpleGraph.cpp'; else $(CYGPATH_W) '$(srcdir)/SimpleGraph.cpp'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/SimpleGraph-SimpleGraph.Tpo $(DEPDIR)/SimpleGraph-SimpleGraph.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='SimpleGraph.cpp' object='SimpleGraph-SimpleGraph.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(SimpleGraph_CPPFLAGS) $(CPPFLAGS) $(SimpleGraph_CXXFLAGS) $(CXXFLAGS) -c -o SimpleGraph-SimpleGraph.obj `if test -f 'SimpleGraph.cpp'; then $(CYGPATH_W) 'SimpleGraph.cpp'; else $(CYGPATH_W) '$(srcdir)/SimpleGraph.cpp'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-binPROGRAMS
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic cscopelist ctags distclean distclean-compile \
+ distclean-generic distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-binPROGRAMS \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-binPROGRAMS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/SimpleGraph/SimpleGraph.cpp b/SimpleGraph/SimpleGraph.cpp
new file mode 100644
index 0000000..dfe82d9
--- /dev/null
+++ b/SimpleGraph/SimpleGraph.cpp
@@ -0,0 +1,688 @@
+#include "config.h"
+#include "ContigPath.h"
+#include "Estimate.h"
+#include "IOUtil.h"
+#include "Uncompress.h"
+#include "Graph/ConstrainedSearch.h"
+#include "Graph/ContigGraph.h"
+#include "Graph/ContigGraphAlgorithms.h"
+#include "Graph/GraphIO.h"
+#include "Graph/GraphUtil.h"
+#include <algorithm> // for min
+#include <climits> // for UINT_MAX
+#include <cmath>
+#include <fstream>
+#include <getopt.h>
+#include <iostream>
+#include <iterator>
+#include <map>
+#include <pthread.h>
+#include <set>
+#include <sstream>
+#include <string>
+#include <vector>
+
+using namespace std;
+
+#define PROGRAM "SimpleGraph"
+
+static const char VERSION_MESSAGE[] =
+PROGRAM " (" PACKAGE_NAME ") " VERSION "\n"
+"Written by Jared Simpson and Shaun Jackman.\n"
+"\n"
+"Copyright 2012 Canada's Michael Smith Genome Science Centre\n";
+
+static const char USAGE_MESSAGE[] =
+"Usage: " PROGRAM " [OPTION]... ADJ DIST\n"
+"Find paths through contigs using distance estimates.\n"
+" ADJ adjacency of the contigs\n"
+" DIST distance estimates between the contigs\n"
+"\n"
+" -k, --kmer=KMER_SIZE k-mer size\n"
+" -d, --dist-error=N acceptable error of a distance estimate\n"
+" default is 6 bp\n"
+" --max-cost=COST maximum computational cost\n"
+" -o, --out=FILE write result to FILE\n"
+" -j, --threads=THREADS use THREADS parallel threads [1]\n"
+" --extend extend unambiguous paths\n"
+" --no-extend do not extend unambiguous paths [default]\n"
+" --scaffold join contigs with Ns [default]\n"
+" --no-scaffold do not scaffold\n"
+" -v, --verbose display verbose output\n"
+" --help display this help and exit\n"
+" --version output version information and exit\n"
+"\n"
+"Report bugs to <" PACKAGE_BUGREPORT ">.\n";
+
+namespace opt {
+ unsigned k; // used by ContigProperties
+ static unsigned threads = 1;
+ static int extend;
+ static int scaffold = 1;
+ static int verbose;
+ static string out;
+
+ /** The acceptable error of a distance estimate. */
+ unsigned distanceError = 6;
+
+ /** Output format */
+ int format = DIST; // used by Estimate
+}
+
+static const char shortopts[] = "d:j:k:o:v";
+
+enum { OPT_HELP = 1, OPT_VERSION, OPT_MAX_COST };
+
+static const struct option longopts[] = {
+ { "kmer", required_argument, NULL, 'k' },
+ { "dist-error", required_argument, NULL, 'd' },
+ { "max-cost", required_argument, NULL, OPT_MAX_COST },
+ { "out", required_argument, NULL, 'o' },
+ { "extend", no_argument, &opt::extend, 1 },
+ { "no-extend", no_argument, &opt::extend, 0 },
+ { "scaffold", no_argument, &opt::scaffold, 1 },
+ { "no-scaffold", no_argument, &opt::scaffold, 0 },
+ { "threads", required_argument, NULL, 'j' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "help", no_argument, NULL, OPT_HELP },
+ { "version", no_argument, NULL, OPT_VERSION },
+ { NULL, 0, NULL, 0 }
+};
+
+static void generatePathsThroughEstimates(const Graph& g,
+ const string& estPath);
+
+int main(int argc, char** argv)
+{
+ bool die = false;
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': die = true; break;
+ case 'd': arg >> opt::distanceError; break;
+ case 'j': arg >> opt::threads; break;
+ case 'k': arg >> opt::k; break;
+ case OPT_MAX_COST: arg >> opt::maxCost; break;
+ case 'o': arg >> opt::out; break;
+ case 'v': opt::verbose++; break;
+ case OPT_HELP:
+ cout << USAGE_MESSAGE;
+ exit(EXIT_SUCCESS);
+ case OPT_VERSION:
+ cout << VERSION_MESSAGE;
+ exit(EXIT_SUCCESS);
+ }
+ if (optarg != NULL && !arg.eof()) {
+ cerr << PROGRAM ": invalid option: `-"
+ << (char)c << optarg << "'\n";
+ exit(EXIT_FAILURE);
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": missing -k,--kmer option\n";
+ die = true;
+ }
+
+ if (opt::out.empty()) {
+ cerr << PROGRAM ": " << "missing -o,--out option\n";
+ die = true;
+ }
+
+ if (argc - optind < 2) {
+ cerr << PROGRAM ": missing arguments\n";
+ die = true;
+ } else if (argc - optind > 2) {
+ cerr << PROGRAM ": too many arguments\n";
+ die = true;
+ }
+
+ if (die) {
+ cerr << "Try `" << PROGRAM
+ << " --help' for more information.\n";
+ exit(EXIT_FAILURE);
+ }
+
+ string adjFile(argv[optind++]);
+ string estFile(argv[optind++]);
+
+ // Read the contig adjacency graph.
+ if (opt::verbose > 0)
+ cerr << "Reading `" << adjFile << "'..." << endl;
+ ifstream fin(adjFile.c_str());
+ assert_good(fin, adjFile);
+ Graph g;
+ fin >> g;
+ assert(fin.eof());
+
+ if (opt::verbose > 0)
+ printGraphStats(cout, g);
+
+ // try to find paths that match the distance estimates
+ generatePathsThroughEstimates(g, estFile);
+}
+
+/** Print a set of constraints. */
+static ostream& printConstraints(ostream& out,
+ const Graph& g, const Constraints& s)
+{
+ for (Constraints::const_iterator it = s.begin();
+ it != s.end(); ++it)
+ out << ' ' << get(vertex_name, g, it->first)
+ << ',' << it->second;
+ return out;
+}
+
+/** Return the set of contigs that appear more than once in a single
+ * solution.
+ */
+static set<ContigID> findRepeats(ContigID seed,
+ const ContigPaths& solutions)
+{
+ set<ContigID> repeats;
+ for (ContigPaths::const_iterator solIt = solutions.begin();
+ solIt != solutions.end(); ++solIt) {
+ map<ContigID, unsigned> count;
+ count[seed]++;
+ for (ContigPath::const_iterator it = solIt->begin();
+ it != solIt->end(); ++it)
+ count[it->contigIndex()]++;
+ for (map<ContigID, unsigned>::const_iterator
+ it = count.begin(); it != count.end(); ++it)
+ if (it->second > 1)
+ repeats.insert(it->first);
+ }
+ return repeats;
+}
+
+/** The fewest number of pairs in a distance estimate. */
+static unsigned g_minNumPairs = UINT_MAX;
+
+/** The fewest number of pairs used in a path. */
+static unsigned g_minNumPairsUsed = UINT_MAX;
+
+static struct {
+ unsigned totalAttempted;
+ unsigned uniqueEnd;
+ unsigned noPossiblePaths;
+ unsigned noValidPaths;
+ unsigned repeat;
+ unsigned multiEnd;
+ unsigned tooManySolutions;
+ unsigned tooComplex;
+} stats;
+
+typedef graph_traits<Graph>::vertex_descriptor vertex_descriptor;
+
+/** Return the distance from vertex u to v. */
+static int getDistance(const Graph& g,
+ vertex_descriptor u, vertex_descriptor v)
+{
+ typedef graph_traits<Graph>::edge_descriptor edge_descriptor;
+ pair<edge_descriptor, bool> e = edge(u, v, g);
+ assert(e.second);
+ return g[e.first].distance;
+}
+
+/** Return the length of the specified path in k-mer. */
+static unsigned calculatePathLength(const Graph& g,
+ const ContigNode& origin,
+ const ContigPath& path, size_t prefix = 0, size_t suffix = 0)
+{
+ if (prefix + suffix == path.size())
+ return 0;
+ assert(prefix + suffix < path.size());
+ int length = addProp(g, path.begin() + prefix,
+ path.end() - suffix).length;
+
+ // Account for the overlap on the left.
+ vertex_descriptor u = prefix == 0 ? origin : path[prefix - 1];
+ length += getDistance(g, u, path[prefix]);
+ assert(length > 0);
+ return length;
+}
+
+/** Compare the lengths of two paths. */
+struct ComparePathLength
+ : binary_function<ContigPath, ContigPath, bool>
+{
+ ComparePathLength(const Graph& g, const ContigNode& origin)
+ : m_g(g), m_origin(origin) { }
+ bool operator()(const ContigPath& a, const ContigPath& b) const {
+ unsigned lenA = calculatePathLength(m_g, m_origin, a);
+ unsigned lenB = calculatePathLength(m_g, m_origin, b);
+ return lenA < lenB
+ || lenA == lenB && a.size() < b.size();
+ }
+ private:
+ const Graph& m_g;
+ const ContigNode& m_origin;
+};
+
+/** Return an ambiguous path that agrees with all the given paths. */
+static ContigPath constructAmbiguousPath(const Graph &g,
+ const ContigNode& origin, const ContigPaths& paths)
+{
+ assert(!paths.empty());
+
+ // Find the size of the smallest path.
+ const ContigPath& firstSol = paths.front();
+ size_t min_len = firstSol.size();
+ for (ContigPaths::const_iterator it = paths.begin() + 1;
+ it != paths.end(); ++it)
+ min_len = min(min_len, it->size());
+
+ // Find the longest prefix.
+ ContigPath vppath;
+ size_t longestPrefix;
+ bool commonPrefix = true;
+ for (longestPrefix = 0;
+ longestPrefix < min_len; longestPrefix++) {
+ const ContigNode& common_path_node = firstSol[longestPrefix];
+ for (ContigPaths::const_iterator solIter = paths.begin();
+ solIter != paths.end(); ++solIter) {
+ const ContigNode& pathnode = (*solIter)[longestPrefix];
+ if (pathnode != common_path_node) {
+ // Found the longest prefix.
+ commonPrefix = false;
+ break;
+ }
+ }
+ if (!commonPrefix)
+ break;
+ vppath.push_back(common_path_node);
+ }
+
+ // Find the longest suffix.
+ ContigPath vspath;
+ size_t longestSuffix;
+ bool commonSuffix = true;
+ for (longestSuffix = 0;
+ longestSuffix < min_len-longestPrefix; longestSuffix++) {
+ const ContigNode& common_path_node
+ = firstSol[firstSol.size()-longestSuffix-1];
+ for (ContigPaths::const_iterator solIter = paths.begin();
+ solIter != paths.end(); ++solIter) {
+ const ContigNode& pathnode
+ = (*solIter)[solIter->size()-longestSuffix-1];
+ if (pathnode != common_path_node) {
+ // Found the longest suffix.
+ commonSuffix = false;
+ break;
+ }
+ }
+ if (!commonSuffix)
+ break;
+ vspath.push_back(common_path_node);
+ }
+
+ ContigPath out;
+ out.reserve(vppath.size() + 1 + vspath.size());
+ out.insert(out.end(), vppath.begin(), vppath.end());
+ if (longestSuffix > 0) {
+ const ContigPath& longestPath(
+ *max_element(paths.begin(), paths.end(),
+ ComparePathLength(g, origin)));
+ unsigned length = calculatePathLength(g, origin, longestPath,
+ longestPrefix, longestSuffix);
+
+ // Account for the overlap on the right.
+ int dist = length + getDistance(g,
+ longestSuffix == longestPath.size() ? origin
+ : *(longestPath.rbegin() + longestSuffix),
+ *(longestPath.rbegin() + longestSuffix - 1));
+
+ // Add k-1 because it is the convention.
+ int numN = dist + opt::k - 1;
+ assert(numN > 0);
+
+ out.push_back(ContigNode(numN, 'N'));
+ out.insert(out.end(), vspath.rbegin(), vspath.rend());
+ }
+ return out;
+}
+
+/** Return a map of contig IDs to their distance along this path.
+ * Repeat contigs, which would have more than one position, are not
+ * represented in this map.
+ */
+map<ContigNode, int> makeDistanceMap(const Graph& g,
+ const ContigNode& origin, const ContigPath& path)
+{
+ map<ContigNode, int> distances;
+ int distance = 0;
+ for (ContigPath::const_iterator it = path.begin();
+ it != path.end(); ++it) {
+ vertex_descriptor u = it == path.begin() ? origin : *(it - 1);
+ vertex_descriptor v = *it;
+ distance += getDistance(g, u, v);
+
+ bool inserted = distances.insert(
+ make_pair(v, distance)).second;
+ if (!inserted) {
+ // Mark this contig as a repeat.
+ distances[v] = INT_MIN;
+ }
+
+ distance += g[v].length;
+ }
+
+ // Remove the repeats.
+ for (map<ContigNode, int>::iterator it = distances.begin();
+ it != distances.end();)
+ if (it->second == INT_MIN)
+ distances.erase(it++);
+ else
+ ++it;
+ return distances;
+}
+
+/** Print a distance map. */
+static void printDistanceMap(ostream& out, const Graph& g,
+ const ContigNode& u, const ContigPath& path)
+{
+ typedef map<ContigNode, int> DistanceMap;
+ DistanceMap distanceMap = makeDistanceMap(g, u, path);
+ for (DistanceMap::const_iterator it = distanceMap.begin();
+ it != distanceMap.end(); ++it)
+ out << get(edge_name, g, make_pair(u, it->first))
+ << " [d=" << it->second << "]\n";
+}
+
+typedef std::vector<std::pair<ContigNode, DistanceEst> > Estimates;
+
+/** Find a path for the specified distance estimates.
+ * @param out [out] the solution path
+ */
+static void handleEstimate(const Graph& g,
+ const EstimateRecord& er, bool dirIdx,
+ ContigPath& out)
+{
+ if (er.estimates[dirIdx].empty())
+ return;
+
+ ContigNode origin(er.refID, dirIdx);
+ ostringstream vout_ss;
+ ostream bitBucket(NULL);
+ ostream& vout = opt::verbose > 0 ? vout_ss : bitBucket;
+ vout << "\n* " << get(vertex_name, g, origin) << '\n';
+
+ unsigned minNumPairs = UINT_MAX;
+ // generate the reachable set
+ Constraints constraints;
+ for (Estimates::const_iterator iter
+ = er.estimates[dirIdx].begin();
+ iter != er.estimates[dirIdx].end(); ++iter) {
+ ContigNode v = iter->first;
+ const DistanceEst& ep = iter->second;
+ minNumPairs = min(minNumPairs, ep.numPairs);
+ constraints.push_back(Constraint(v,
+ ep.distance + allowedError(ep.stdDev)));
+ }
+
+ vout << "Constraints:";
+ printConstraints(vout, g, constraints) << '\n';
+
+ ContigPaths solutions;
+ unsigned numVisited = 0;
+ constrainedSearch(g, origin, constraints, solutions, numVisited);
+ bool tooComplex = numVisited >= opt::maxCost;
+ bool tooManySolutions = solutions.size() > opt::maxPaths;
+
+ set<ContigID> repeats = findRepeats(er.refID, solutions);
+ if (!repeats.empty()) {
+ vout << "Repeats:";
+ for (set<ContigID>::const_iterator it = repeats.begin();
+ it != repeats.end(); ++it)
+ vout << ' ' << get(g_contigNames, *it);
+ vout << '\n';
+ }
+
+ unsigned numPossiblePaths = solutions.size();
+ if (numPossiblePaths > 0)
+ vout << "Paths: " << numPossiblePaths << '\n';
+
+ for (ContigPaths::iterator solIter = solutions.begin();
+ solIter != solutions.end();) {
+ vout << *solIter << '\n';
+
+ // Calculate the path distance to each node and see if
+ // it is within the estimated distance.
+ map<ContigNode, int> distanceMap
+ = makeDistanceMap(g, origin, *solIter);
+
+ // Remove solutions whose distance estimates are not correct.
+ unsigned validCount = 0, invalidCount = 0, ignoredCount = 0;
+ for (Estimates::const_iterator iter
+ = er.estimates[dirIdx].begin();
+ iter != er.estimates[dirIdx].end(); ++iter) {
+ ContigNode v = iter->first;
+ const DistanceEst& ep = iter->second;
+ vout << get(vertex_name, g, v) << ',' << ep << '\t';
+
+ map<ContigNode, int>::iterator dmIter
+ = distanceMap.find(v);
+ if (dmIter == distanceMap.end()) {
+ // This contig is a repeat.
+ ignoredCount++;
+ vout << "ignored\n";
+ continue;
+ }
+
+ // translate distance by -overlap to match
+ // coordinate space used by the estimate
+ int actualDistance = dmIter->second;
+ int diff = actualDistance - ep.distance;
+ unsigned buffer = allowedError(ep.stdDev);
+ bool invalid = (unsigned)abs(diff) > buffer;
+ bool repeat = repeats.count(v.contigIndex()) > 0;
+ bool ignored = invalid && repeat;
+ if (ignored)
+ ignoredCount++;
+ else if (invalid)
+ invalidCount++;
+ else
+ validCount++;
+ vout << "dist: " << actualDistance
+ << " diff: " << diff
+ << " buffer: " << buffer
+ << " n: " << ep.numPairs
+ << (ignored ? " ignored" : invalid ? " invalid" : "")
+ << '\n';
+ }
+
+ if (invalidCount == 0 && validCount > 0)
+ ++solIter;
+ else
+ solIter = solutions.erase(solIter);
+ }
+
+ vout << "Solutions: " << solutions.size();
+ if (tooComplex)
+ vout << " (too complex)";
+ if (tooManySolutions)
+ vout << " (too many solutions)";
+ vout << '\n';
+
+ ContigPaths::iterator bestSol = solutions.end();
+ int minDiff = 999999;
+ for (ContigPaths::iterator solIter = solutions.begin();
+ solIter != solutions.end(); ++solIter) {
+ map<ContigNode, int> distanceMap
+ = makeDistanceMap(g, origin, *solIter);
+ int sumDiff = 0;
+ for (Estimates::const_iterator iter
+ = er.estimates[dirIdx].begin();
+ iter != er.estimates[dirIdx].end(); ++iter) {
+ ContigNode v = iter->first;
+ const DistanceEst& ep = iter->second;
+ if (repeats.count(v.contigIndex()) > 0)
+ continue;
+ map<ContigNode, int>::iterator dmIter
+ = distanceMap.find(v);
+ assert(dmIter != distanceMap.end());
+ int actualDistance = dmIter->second;
+ int diff = actualDistance - ep.distance;
+ sumDiff += abs(diff);
+ }
+
+ if (sumDiff < minDiff) {
+ minDiff = sumDiff;
+ bestSol = solIter;
+ }
+
+ vout << *solIter
+ << " length: " << calculatePathLength(g, origin, *solIter)
+ << " sumdiff: " << sumDiff << '\n';
+ }
+
+ /** Lock the debugging stream. */
+ static pthread_mutex_t coutMutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&coutMutex);
+ stats.totalAttempted++;
+ g_minNumPairs = min(g_minNumPairs, minNumPairs);
+
+ if (tooComplex) {
+ stats.tooComplex++;
+ } else if (tooManySolutions) {
+ stats.tooManySolutions++;
+ } else if (numPossiblePaths == 0) {
+ stats.noPossiblePaths++;
+ } else if (solutions.empty()) {
+ stats.noValidPaths++;
+ } else if (repeats.count(er.refID) > 0) {
+ vout << "Repeat: " << get(vertex_name, g, origin) << '\n';
+ stats.repeat++;
+ } else if (solutions.size() > 1) {
+ ContigPath path
+ = constructAmbiguousPath(g, origin, solutions);
+ if (!path.empty()) {
+ if (opt::extend)
+ extend(g, path.back(), back_inserter(path));
+ vout << path << '\n';
+ if (opt::scaffold) {
+ out.insert(out.end(), path.begin(), path.end());
+ g_minNumPairsUsed
+ = min(g_minNumPairsUsed, minNumPairs);
+ }
+ }
+ stats.multiEnd++;
+ } else {
+ assert(solutions.size() == 1);
+ assert(bestSol != solutions.end());
+ ContigPath& path = *bestSol;
+ if (opt::verbose > 1)
+ printDistanceMap(vout, g, origin, path);
+ if (opt::extend)
+ extend(g, path.back(), back_inserter(path));
+ out.insert(out.end(), path.begin(), path.end());
+ stats.uniqueEnd++;
+ g_minNumPairsUsed = min(g_minNumPairsUsed, minNumPairs);
+ }
+ cout << vout_ss.str();
+ if (!out.empty())
+ assert(!out.back().ambiguous());
+ pthread_mutex_unlock(&coutMutex);
+}
+
+struct WorkerArg {
+ istream* in;
+ ostream* out;
+ const Graph* graph;
+ WorkerArg(istream* in, ostream* out, const Graph* g)
+ : in(in), out(out), graph(g) { }
+};
+
+static void* worker(void* pArg)
+{
+ WorkerArg& arg = *static_cast<WorkerArg*>(pArg);
+ for (;;) {
+ /** Lock the input stream. */
+ static pthread_mutex_t inMutex = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&inMutex);
+ EstimateRecord er;
+ bool good = (*arg.in) >> er;
+ pthread_mutex_unlock(&inMutex);
+ if (!good)
+ break;
+
+ // Flip the anterior distance estimates.
+ for (Estimates::iterator it = er.estimates[1].begin();
+ it != er.estimates[1].end(); ++it)
+ it->first ^= 1;
+
+ ContigPath path;
+ handleEstimate(*arg.graph, er, true, path);
+ reverseComplement(path.begin(), path.end());
+ path.push_back(ContigNode(er.refID, false));
+ handleEstimate(*arg.graph, er, false, path);
+ if (path.size() > 1) {
+ /** Lock the output stream. */
+ static pthread_mutex_t outMutex
+ = PTHREAD_MUTEX_INITIALIZER;
+ pthread_mutex_lock(&outMutex);
+ *arg.out << get(g_contigNames, er.refID)
+ << '\t' << path << '\n';
+ assert(arg.out->good());
+ pthread_mutex_unlock(&outMutex);
+ }
+ }
+ return NULL;
+}
+
+static void generatePathsThroughEstimates(const Graph& g,
+ const string& estPath)
+{
+ if (opt::verbose > 0)
+ cerr << "Reading `" << estPath << "'..." << endl;
+ ifstream inStream(estPath.c_str());
+ assert_good(inStream, estPath);
+
+ ofstream outStream(opt::out.c_str());
+ assert(outStream.is_open());
+
+ // Create the worker threads.
+ vector<pthread_t> threads;
+ threads.reserve(opt::threads);
+ WorkerArg arg(&inStream, &outStream, &g);
+ for (unsigned i = 0; i < opt::threads; i++) {
+ pthread_t thread;
+ pthread_create(&thread, NULL, worker, &arg);
+ threads.push_back(thread);
+ }
+
+ // Wait for the worker threads to finish.
+ for (vector<pthread_t>::const_iterator it = threads.begin();
+ it != threads.end(); ++it) {
+ void* status;
+ pthread_join(*it, &status);
+ }
+ if (opt::verbose > 0)
+ cout << '\n';
+
+ cout <<
+ "Total paths attempted: " << stats.totalAttempted << "\n"
+ "Unique path: " << stats.uniqueEnd << "\n"
+ "No possible paths: " << stats.noPossiblePaths << "\n"
+ "No valid paths: " << stats.noValidPaths << "\n"
+ "Repetitive: " << stats.repeat << "\n"
+ "Multiple valid paths: " << stats.multiEnd << "\n"
+ "Too many solutions: " << stats.tooManySolutions << "\n"
+ "Too complex: " << stats.tooComplex << "\n";
+
+ inStream.close();
+ outStream.close();
+
+ cout << "\n"
+ "The minimum number of pairs in a distance estimate is "
+ << g_minNumPairs << ".\n";
+ if (g_minNumPairsUsed != UINT_MAX) {
+ cout << "The minimum number of pairs used in a path is "
+ << g_minNumPairsUsed << ".\n";
+ if (g_minNumPairs < g_minNumPairsUsed)
+ cout << "Consider increasing the number of pairs "
+ "threshold paramter, n, to " << g_minNumPairsUsed
+ << ".\n";
+ }
+}
diff --git a/aclocal.m4 b/aclocal.m4
new file mode 100644
index 0000000..63b681e
--- /dev/null
+++ b/aclocal.m4
@@ -0,0 +1,986 @@
+# generated automatically by aclocal 1.12 -*- Autoconf -*-
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
+# Inc.
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
+[m4_warning([this file was generated for autoconf 2.69.
+You have another version of autoconf. It may work, but is not guaranteed to.
+If you have problems, you may need to regenerate the build system entirely.
+To do so, use the procedure documented by the package, typically 'autoreconf'.])])
+
+# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_AUTOMAKE_VERSION(VERSION)
+# ----------------------------
+# Automake X.Y traces this macro to ensure aclocal.m4 has been
+# generated from the m4 files accompanying Automake X.Y.
+# (This private macro should not be called outside this file.)
+AC_DEFUN([AM_AUTOMAKE_VERSION],
+[am__api_version='1.12'
+dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
+dnl require some minimum version. Point them to the right macro.
+m4_if([$1], [1.12], [],
+ [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
+])
+
+# _AM_AUTOCONF_VERSION(VERSION)
+# -----------------------------
+# aclocal traces this macro to find the Autoconf version.
+# This is a private macro too. Using m4_define simplifies
+# the logic in aclocal, which can simply ignore this definition.
+m4_define([_AM_AUTOCONF_VERSION], [])
+
+# AM_SET_CURRENT_AUTOMAKE_VERSION
+# -------------------------------
+# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
+[AM_AUTOMAKE_VERSION([1.12])dnl
+m4_ifndef([AC_AUTOCONF_VERSION],
+ [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+
+# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
+# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to
+# '$srcdir', '$srcdir/..', or '$srcdir/../..'.
+#
+# Of course, Automake must honor this variable whenever it calls a
+# tool from the auxiliary directory. The problem is that $srcdir (and
+# therefore $ac_aux_dir as well) can be either absolute or relative,
+# depending on how configure is run. This is pretty annoying, since
+# it makes $ac_aux_dir quite unusable in subdirectories: in the top
+# source directory, any form will work fine, but in subdirectories a
+# relative path needs to be adjusted first.
+#
+# $ac_aux_dir/missing
+# fails when called from a subdirectory if $ac_aux_dir is relative
+# $top_srcdir/$ac_aux_dir/missing
+# fails if $ac_aux_dir is absolute,
+# fails when called from a subdirectory in a VPATH build with
+# a relative $ac_aux_dir
+#
+# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
+# are both prefixed by $srcdir. In an in-source build this is usually
+# harmless because $srcdir is '.', but things will broke when you
+# start a VPATH build or use an absolute $srcdir.
+#
+# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
+# iff we strip the leading $srcdir from $ac_aux_dir. That would be:
+# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
+# and then we would define $MISSING as
+# MISSING="\${SHELL} $am_aux_dir/missing"
+# This will work as long as MISSING is not called from configure, because
+# unfortunately $(top_srcdir) has no meaning in configure.
+# However there are other variables, like CC, which are often used in
+# configure, and could therefore not use this "fixed" $ac_aux_dir.
+#
+# Another solution, used here, is to always expand $ac_aux_dir to an
+# absolute PATH. The drawback is that using absolute paths prevent a
+# configured tree to be moved without reconfiguration.
+
+AC_DEFUN([AM_AUX_DIR_EXPAND],
+[dnl Rely on autoconf to set up CDPATH properly.
+AC_PREREQ([2.50])dnl
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+])
+
+# AM_CONDITIONAL -*- Autoconf -*-
+
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 10
+
+# AM_CONDITIONAL(NAME, SHELL-CONDITION)
+# -------------------------------------
+# Define a conditional.
+AC_DEFUN([AM_CONDITIONAL],
+[AC_PREREQ([2.52])dnl
+ m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
+ [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
+AC_SUBST([$1_TRUE])dnl
+AC_SUBST([$1_FALSE])dnl
+_AM_SUBST_NOTMAKE([$1_TRUE])dnl
+_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
+if $2; then
+ $1_TRUE=
+ $1_FALSE='#'
+else
+ $1_TRUE='#'
+ $1_FALSE=
+fi
+AC_CONFIG_COMMANDS_PRE(
+[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
+ AC_MSG_ERROR([[conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.]])
+fi])])
+
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 16
+
+# There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
+# written in clear, in which case automake, when reading aclocal.m4,
+# will think it sees a *use*, and therefore will trigger all it's
+# C support machinery. Also note that it means that autoscan, seeing
+# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
+
+
+# _AM_DEPENDENCIES(NAME)
+# ----------------------
+# See how the compiler implements dependency checking.
+# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# We try a few techniques and use that to set a single cache variable.
+#
+# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
+# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
+# dependency, and given that the user is not expected to run this macro,
+# just rely on AC_PROG_CC.
+AC_DEFUN([_AM_DEPENDENCIES],
+[AC_REQUIRE([AM_SET_DEPDIR])dnl
+AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
+AC_REQUIRE([AM_MAKE_INCLUDE])dnl
+AC_REQUIRE([AM_DEP_TRACK])dnl
+
+m4_if([$1], [CC], [depcc="$CC" am_compiler_list=],
+ [$1], [CXX], [depcc="$CXX" am_compiler_list=],
+ [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+ [$1], [UPC], [depcc="$UPC" am_compiler_list=],
+ [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'],
+ [depcc="$$1" am_compiler_list=])
+
+AC_CACHE_CHECK([dependency style of $depcc],
+ [am_cv_$1_dependencies_compiler_type],
+[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_$1_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
+ fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_$1_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_$1_dependencies_compiler_type=none
+fi
+])
+AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
+AM_CONDITIONAL([am__fastdep$1], [
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
+])
+
+
+# AM_SET_DEPDIR
+# -------------
+# Choose a directory name for dependency files.
+# This macro is AC_REQUIREd in _AM_DEPENDENCIES.
+AC_DEFUN([AM_SET_DEPDIR],
+[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
+])
+
+
+# AM_DEP_TRACK
+# ------------
+AC_DEFUN([AM_DEP_TRACK],
+[AC_ARG_ENABLE([dependency-tracking], [dnl
+AS_HELP_STRING(
+ [--enable-dependency-tracking],
+ [do not reject slow dependency extractors])
+AS_HELP_STRING(
+ [--disable-dependency-tracking],
+ [speeds up one-time build])])
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
+AC_SUBST([AMDEPBACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
+AC_SUBST([am__nodep])dnl
+_AM_SUBST_NOTMAKE([am__nodep])dnl
+])
+
+# Generate code to set up dependency tracking. -*- Autoconf -*-
+
+# Copyright (C) 1999-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# _AM_OUTPUT_DEPENDENCY_COMMANDS
+# ------------------------------
+AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
+[{
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`AS_DIRNAME("$mf")`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`AS_DIRNAME(["$file"])`
+ AS_MKDIR_P([$dirpart/$fdir])
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+])# _AM_OUTPUT_DEPENDENCY_COMMANDS
+
+
+# AM_OUTPUT_DEPENDENCY_COMMANDS
+# -----------------------------
+# This macro should only be invoked once -- use via AC_REQUIRE.
+#
+# This code is only required when automatic dependency tracking
+# is enabled. FIXME. This creates each '.P' file that we will
+# need in order to bootstrap the dependency handling code.
+AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
+[AC_CONFIG_COMMANDS([depfiles],
+ [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
+ [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
+])
+
+# Do all the work for Automake. -*- Autoconf -*-
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 18
+
+# This macro actually does too much. Some checks are only needed if
+# your package does certain things. But this isn't really a big deal.
+
+# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
+# AM_INIT_AUTOMAKE([OPTIONS])
+# -----------------------------------------------
+# The call with PACKAGE and VERSION arguments is the old style
+# call (pre autoconf-2.50), which is being phased out. PACKAGE
+# and VERSION should now be passed to AC_INIT and removed from
+# the call to AM_INIT_AUTOMAKE.
+# We support both call styles for the transition. After
+# the next Automake release, Autoconf can make the AC_INIT
+# arguments mandatory, and then we can depend on a new Autoconf
+# release and drop the old call support.
+AC_DEFUN([AM_INIT_AUTOMAKE],
+[AC_PREREQ([2.62])dnl
+dnl Autoconf wants to disallow AM_ names. We explicitly allow
+dnl the ones we care about.
+m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
+AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
+AC_REQUIRE([AC_PROG_INSTALL])dnl
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+AC_SUBST([CYGPATH_W])
+
+# Define the identity of the package.
+dnl Distinguish between old-style and new-style calls.
+m4_ifval([$2],
+[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+ AC_SUBST([PACKAGE], [$1])dnl
+ AC_SUBST([VERSION], [$2])],
+[_AM_SET_OPTIONS([$1])dnl
+dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
+m4_if(
+ m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]),
+ [ok:ok],,
+ [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
+ AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
+ AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
+
+_AM_IF_OPTION([no-define],,
+[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package])
+ AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl
+
+# Some tools Automake needs.
+AC_REQUIRE([AM_SANITY_CHECK])dnl
+AC_REQUIRE([AC_ARG_PROGRAM])dnl
+AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}])
+AM_MISSING_PROG([AUTOCONF], [autoconf])
+AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}])
+AM_MISSING_PROG([AUTOHEADER], [autoheader])
+AM_MISSING_PROG([MAKEINFO], [makeinfo])
+AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AC_REQUIRE([AM_PROG_MKDIR_P])dnl
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+AC_REQUIRE([AC_PROG_AWK])dnl
+AC_REQUIRE([AC_PROG_MAKE_SET])dnl
+AC_REQUIRE([AM_SET_LEADING_DOT])dnl
+_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
+ [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
+ [_AM_PROG_TAR([v7])])])
+_AM_IF_OPTION([no-dependencies],,
+[AC_PROVIDE_IFELSE([AC_PROG_CC],
+ [_AM_DEPENDENCIES([CC])],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [_AM_DEPENDENCIES([CXX])],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+AC_PROVIDE_IFELSE([AC_PROG_OBJC],
+ [_AM_DEPENDENCIES([OBJC])],
+ [define([AC_PROG_OBJC],
+ defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
+dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
+])
+
+dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
+
+# When config.status generates a header, we must update the stamp-h file.
+# This file resides in the same directory as the config header
+# that is generated. The stamp files are numbered to have different names.
+
+# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
+# loop where config.status creates the headers, so we can generate
+# our stamp files there.
+AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
+[# Compute $1's index in $config_headers.
+_am_arg=$1
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 8
+
+# AM_PROG_INSTALL_SH
+# ------------------
+# Define $install_sh.
+AC_DEFUN([AM_PROG_INSTALL_SH],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+AC_SUBST([install_sh])])
+
+# Copyright (C) 2003-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# Check whether the underlying file-system supports filenames
+# with a leading dot. For instance MS-DOS doesn't.
+AC_DEFUN([AM_SET_LEADING_DOT],
+[rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+AC_SUBST([am__leading_dot])])
+
+# Check to see how 'make' treats includes. -*- Autoconf -*-
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 5
+
+# AM_MAKE_INCLUDE()
+# -----------------
+# Check to see how make treats includes.
+AC_DEFUN([AM_MAKE_INCLUDE],
+[am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+AC_MSG_CHECKING([for style of include used by $am_make])
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+AC_SUBST([am__include])
+AC_SUBST([am__quote])
+AC_MSG_RESULT([$_am_result])
+rm -f confinc confmf
+])
+
+# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+
+# Copyright (C) 1997-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 7
+
+# AM_MISSING_PROG(NAME, PROGRAM)
+# ------------------------------
+AC_DEFUN([AM_MISSING_PROG],
+[AC_REQUIRE([AM_MISSING_HAS_RUN])
+$1=${$1-"${am_missing_run}$2"}
+AC_SUBST($1)])
+
+
+# AM_MISSING_HAS_RUN
+# ------------------
+# Define MISSING if not defined so far and test if it supports --run.
+# If it does, set am_missing_run to use it, otherwise, to nothing.
+AC_DEFUN([AM_MISSING_HAS_RUN],
+[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([missing])dnl
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ AC_MSG_WARN(['missing' script is too old or missing])
+fi
+])
+
+# Copyright (C) 2003-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# AM_PROG_MKDIR_P
+# ---------------
+# Check for 'mkdir -p'.
+AC_DEFUN([AM_PROG_MKDIR_P],
+[AC_PREREQ([2.60])dnl
+AC_REQUIRE([AC_PROG_MKDIR_P])dnl
+dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
+dnl while keeping a definition of mkdir_p for backward compatibility.
+dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
+dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
+dnl Makefile.ins that do not define MKDIR_P, so we do our own
+dnl adjustment using top_builddir (which is defined more often than
+dnl MKDIR_P).
+AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
+case $mkdir_p in
+ [[\\/$]]* | ?:[[\\/]]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+])
+
+# Helper functions for option handling. -*- Autoconf -*-
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 6
+
+# _AM_MANGLE_OPTION(NAME)
+# -----------------------
+AC_DEFUN([_AM_MANGLE_OPTION],
+[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
+
+# _AM_SET_OPTION(NAME)
+# --------------------
+# Set option NAME. Presently that only means defining a flag for this option.
+AC_DEFUN([_AM_SET_OPTION],
+[m4_define(_AM_MANGLE_OPTION([$1]), [1])])
+
+# _AM_SET_OPTIONS(OPTIONS)
+# ------------------------
+# OPTIONS is a space-separated list of Automake options.
+AC_DEFUN([_AM_SET_OPTIONS],
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+
+# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
+# -------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+AC_DEFUN([_AM_IF_OPTION],
+[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
+
+# Check to make sure that the build environment is sane. -*- Autoconf -*-
+
+# Copyright (C) 1996-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 9
+
+# AM_SANITY_CHECK
+# ---------------
+AC_DEFUN([AM_SANITY_CHECK],
+[AC_MSG_CHECKING([whether build environment is sane])
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$[*]" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$[*]" != "X $srcdir/configure conftest.file" \
+ && test "$[*]" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+ alias in your environment])
+ fi
+ if test "$[2]" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$[2]" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ AC_MSG_ERROR([newly created file is older than distributed files!
+Check your system clock])
+fi
+AC_MSG_RESULT([yes])
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+AC_CONFIG_COMMANDS_PRE(
+ [AC_MSG_CHECKING([that generated files are newer than configure])
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ AC_MSG_RESULT([done])])
+rm -f conftest.file
+])
+
+# Copyright (C) 2001-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 2
+
+# AM_PROG_INSTALL_STRIP
+# ---------------------
+# One issue with vendor 'install' (even GNU) is that you can't
+# specify the program used to strip binaries. This is especially
+# annoying in cross-compiling environments, where the build's strip
+# is unlikely to handle the host's binaries.
+# Fortunately install-sh will honor a STRIPPROG variable, so we
+# always use install-sh in "make install-strip", and initialize
+# STRIPPROG with the value of the STRIP variable (set by the user).
+AC_DEFUN([AM_PROG_INSTALL_STRIP],
+[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+dnl Don't test for $cross_compiling = yes, because it might be 'maybe'.
+if test "$cross_compiling" != no; then
+ AC_CHECK_TOOL([STRIP], [strip], :)
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+AC_SUBST([INSTALL_STRIP_PROGRAM])])
+
+# Copyright (C) 2006-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
+# This macro is traced by Automake.
+AC_DEFUN([_AM_SUBST_NOTMAKE])
+
+# AM_SUBST_NOTMAKE(VARIABLE)
+# --------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
+# Check how to create a tarball. -*- Autoconf -*-
+
+# Copyright (C) 2004-2012 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 3
+
+# _AM_PROG_TAR(FORMAT)
+# --------------------
+# Check how to create a tarball in format FORMAT.
+# FORMAT should be one of 'v7', 'ustar', or 'pax'.
+#
+# Substitute a variable $(am__tar) that is a command
+# writing to stdout a FORMAT-tarball containing the directory
+# $tardir.
+# tardir=directory && $(am__tar) > result.tar
+#
+# Substitute a variable $(am__untar) that extract such
+# a tarball read from stdin.
+# $(am__untar) < result.tar
+AC_DEFUN([_AM_PROG_TAR],
+[# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AC_SUBST([AMTAR], ['$${TAR-tar}'])
+m4_if([$1], [v7],
+ [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
+ [m4_case([$1], [ustar],, [pax],,
+ [m4_fatal([Unknown tar format])])
+AC_MSG_CHECKING([how to create a $1 tar archive])
+# Loop over all known methods to create a tar archive until one works.
+_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
+_am_tools=${am_cv_prog_tar_$1-$_am_tools}
+# Do not fold the above two line into one, because Tru64 sh and
+# Solaris sh will not grok spaces in the rhs of '-'.
+for _am_tool in $_am_tools
+do
+ case $_am_tool in
+ gnutar)
+ for _am_tar in tar gnutar gtar;
+ do
+ AM_RUN_LOG([$_am_tar --version]) && break
+ done
+ am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
+ am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
+ am__untar="$_am_tar -xf -"
+ ;;
+ plaintar)
+ # Must skip GNU tar: if it does not support --format= it doesn't create
+ # ustar tarball either.
+ (tar --version) >/dev/null 2>&1 && continue
+ am__tar='tar chf - "$$tardir"'
+ am__tar_='tar chf - "$tardir"'
+ am__untar='tar xf -'
+ ;;
+ pax)
+ am__tar='pax -L -x $1 -w "$$tardir"'
+ am__tar_='pax -L -x $1 -w "$tardir"'
+ am__untar='pax -r'
+ ;;
+ cpio)
+ am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
+ am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
+ am__untar='cpio -i -H $1 -d'
+ ;;
+ none)
+ am__tar=false
+ am__tar_=false
+ am__untar=false
+ ;;
+ esac
+
+ # If the value was cached, stop now. We just wanted to have am__tar
+ # and am__untar set.
+ test -n "${am_cv_prog_tar_$1}" && break
+
+ # tar/untar a dummy directory, and stop if the command works
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ echo GrepMe > conftest.dir/file
+ AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
+ rm -rf conftest.dir
+ if test -s conftest.tar; then
+ AM_RUN_LOG([$am__untar <conftest.tar])
+ grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
+ fi
+done
+rm -rf conftest.dir
+
+AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
+AC_MSG_RESULT([$am_cv_prog_tar_$1])])
+AC_SUBST([am__tar])
+AC_SUBST([am__untar])
+]) # _AM_PROG_TAR
+
diff --git a/bin/Makefile.am b/bin/Makefile.am
new file mode 100644
index 0000000..658decd
--- /dev/null
+++ b/bin/Makefile.am
@@ -0,0 +1,14 @@
+dist_bin_SCRIPTS = \
+ abyss-bowtie \
+ abyss-bowtie2 \
+ abyss-bwa \
+ abyss-bwasw \
+ abyss-fatoagp \
+ abyss-kaligner \
+ abyss-pe \
+ abyss-samtoafg
+dist_noinst_SCRIPTS = \
+ abyss-adjtodot.pl \
+ abyss-cstont \
+ abyss-fac.pl \
+ abyss-joindist
diff --git a/bin/Makefile.in b/bin/Makefile.in
new file mode 100644
index 0000000..804aaf7
--- /dev/null
+++ b/bin/Makefile.in
@@ -0,0 +1,438 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = bin
+DIST_COMMON = $(dist_bin_SCRIPTS) $(dist_noinst_SCRIPTS) \
+ $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+am__installdirs = "$(DESTDIR)$(bindir)"
+SCRIPTS = $(dist_bin_SCRIPTS) $(dist_noinst_SCRIPTS)
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_bin_SCRIPTS = \
+ abyss-bowtie \
+ abyss-bowtie2 \
+ abyss-bwa \
+ abyss-bwasw \
+ abyss-fatoagp \
+ abyss-kaligner \
+ abyss-pe \
+ abyss-samtoafg
+
+dist_noinst_SCRIPTS = \
+ abyss-adjtodot.pl \
+ abyss-cstont \
+ abyss-fac.pl \
+ abyss-joindist
+
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign bin/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign bin/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-dist_binSCRIPTS: $(dist_bin_SCRIPTS)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n' \
+ -e 'h;s|.*|.|' \
+ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) { files[d] = files[d] " " $$1; \
+ if (++n[d] == $(am__install_max)) { \
+ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \
+ else { print "f", d "/" $$4, $$1 } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-dist_binSCRIPTS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 's,.*/,,;$(transform)'`; \
+ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(SCRIPTS)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-dist_binSCRIPTS
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_binSCRIPTS
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-dist_binSCRIPTS install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am uninstall uninstall-am \
+ uninstall-dist_binSCRIPTS
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/bin/abyss-adjtodot.pl b/bin/abyss-adjtodot.pl
new file mode 100755
index 0000000..416eafe
--- /dev/null
+++ b/bin/abyss-adjtodot.pl
@@ -0,0 +1,52 @@
+#!/usr/bin/perl
+# Convert an ABySS adjacency file to GraphViz dot format.
+# Written by Shaun Jackman <sjackman at bcgsc.ca>.
+use strict;
+
+print "digraph adj {\n";
+
+while (<>) {
+ chomp;
+ my ($id, $length, $coverage, $a, $b);
+ if (/;.*;/) {
+ ($id, $length, $coverage, $a, $b)
+ = /^([^ ]+)\s+([^ ]+)\s+([^ ]+)\s;\s*(.*)\s;\s*(.*)$/;
+ } elsif (/;/) {
+ ($id, $length, $a, $b)
+ = /^([^ ]+)\s+([^ ]+)\s*(.*)\s;\s*(.*)$/;
+ } else {
+ s/,0/+/g;
+ s/,1/-/g;
+ ($id, $length, $a, $b) = /(.*) (.*) \[(.*)\] \[(.*)\]/;
+ }
+ my @a = split ' ', $a;
+ my @b = split ' ', $b;
+
+ my $attr = "l=$length";
+ $attr .= " C=$coverage" if defined $coverage;
+ print qq{"$id+" \[$attr];\n};
+
+ print qq{"$id+"};
+ if (@a > 0) {
+ print ' -> {';
+ print qq{ "$_"} for @a;
+ print ' }';
+ }
+ print ";\n";
+
+ print qq{"$id-" \[$attr];\n};
+
+ print qq{"$id-"};
+ if (@b > 0) {
+ print ' -> {';
+ for (@b) {
+ my $x = $_;
+ $x =~ y/+-/-+/;
+ print qq{ "$x"};
+ }
+ print ' }';
+ }
+ print ";\n";
+}
+
+print "}\n";
diff --git a/bin/abyss-bowtie b/bin/abyss-bowtie
new file mode 100755
index 0000000..ce60c96
--- /dev/null
+++ b/bin/abyss-bowtie
@@ -0,0 +1,56 @@
+#!/bin/bash
+set -eu
+
+case $1 in
+ --help)
+ cat <<EOF
+Usage: abyss-bowtie [OPTION]... QUERY... TARGET
+Align the sequences of the files QUERY to those of the file
+TARGET using bowtie.
+EOF
+ exit
+ ;;
+ --version)
+ cat <<EOF
+abyss-bowtie (ABySS)
+Written by Shaun Jackman.
+
+EOF
+ bowtie --version
+ exit
+ ;;
+esac
+
+# Parse the command line.
+bowtie='bowtie -S'
+while getopts :j:l:v opt; do
+ case $opt in
+ j) bowtie="$bowtie -p$OPTARG";;
+ l) ;;
+ v) ;;
+ \?) echo >&2 "abyss-bowtie: invalid option: $OPTARG"; exit 1;;
+ esac
+done
+shift $((OPTIND-1))
+
+query=("$@")
+target=${query[${#query[@]}-1]}
+unset query[${#query[@]}-1]
+index=$target.1.ebwt
+
+# Build the index.
+if [ ! -r $index ]; then
+ echo >&2 "Building the index $index..."
+ echo >&2 bowtie-build $target $target
+ bowtie-build $target $target 1>&2
+elif [ $index -ot $target ]; then
+ echo >&2 "The index $index is stale. Rebuilding the index..."
+ echo >&2 bowtie-build $target $target
+ bowtie-build $target $target 1>&2
+else
+ echo >&2 "The index $index is up to date."
+fi
+
+# Map the reads.
+echo >&2 $bowtie $target "${query[@]}"
+exec abyss-tofastq -i "${query[@]}" |$bowtie $target -
diff --git a/bin/abyss-bowtie2 b/bin/abyss-bowtie2
new file mode 100755
index 0000000..ccb20d3
--- /dev/null
+++ b/bin/abyss-bowtie2
@@ -0,0 +1,57 @@
+#!/bin/bash
+set -eu
+
+case $1 in
+ --help)
+ cat <<EOF
+Usage: abyss-bowtie2 [OPTION]... QUERY... TARGET
+Align the sequences of the files QUERY to those of the file
+TARGET using bowtie2.
+EOF
+ exit
+ ;;
+ --version)
+ cat <<EOF
+abyss-bowtie2 (ABySS)
+Written by Shaun Jackman.
+
+EOF
+ bowtie2 --version
+ exit
+ ;;
+esac
+
+# Parse the command line.
+bowtie2_align='bowtie2-align --local'
+while getopts :j:l:v opt; do
+ case $opt in
+ j) bowtie2_align="$bowtie2_align -p$OPTARG";;
+ l) ;;
+ v) ;;
+ \?) echo >&2 "abyss-bowtie2: invalid option: $OPTARG"
+ exit 1;;
+ esac
+done
+shift $((OPTIND-1))
+
+query=("$@")
+target=${query[${#query[@]}-1]}
+unset query[${#query[@]}-1]
+index=$target.1.bt2
+
+# Build the index.
+if [ ! -r $index ]; then
+ echo >&2 "Building the index $index..."
+ echo >&2 bowtie2-build $target $target
+ bowtie2-build $target $target 1>&2
+elif [ $index -ot $target ]; then
+ echo >&2 "The index $index is stale. Rebuilding the index..."
+ echo >&2 bowtie2-build $target $target
+ bowtie2-build $target $target 1>&2
+else
+ echo >&2 "The index $index is up to date."
+fi
+
+# Map the reads.
+echo >&2 $bowtie2_align $target "${query[@]}"
+exec abyss-tofastq -i "${query[@]}" |$bowtie2_align $target -
diff --git a/bin/abyss-bwa b/bin/abyss-bwa
new file mode 100755
index 0000000..1b674c6
--- /dev/null
+++ b/bin/abyss-bwa
@@ -0,0 +1,58 @@
+#!/bin/bash
+set -eu
+
+case $1 in
+ --help)
+ cat <<EOF
+Usage: abyss-bwa [OPTION]... QUERY... TARGET
+Align the sequences of the files QUERY to those of the file
+TARGET using bwa.
+EOF
+ exit
+ ;;
+ --version)
+ cat <<EOF
+abyss-bwa (ABySS)
+Written by Shaun Jackman.
+EOF
+ bwa 2>&1 |head -n4
+ exit
+ ;;
+esac
+
+# Parse the command line.
+bwa_aln='bwa aln'
+bwa_index='bwa index -a bwtsw'
+while getopts :j:l:v opt; do
+ case $opt in
+ j) bwa_aln="$bwa_aln -t$OPTARG";;
+ l) ;;
+ v) ;;
+ \?) echo >&2 "abyss-bwa: invalid option: $OPTARG"; exit 1;;
+ esac
+done
+shift $((OPTIND-1))
+
+query=("$@")
+target=${query[${#query[@]}-1]}
+unset query[${#query[@]}-1]
+index=$target.bwt
+
+# Build the index.
+if [ ! -r $index ]; then
+ echo >&2 "Building the index $index..."
+ echo >&2 $bwa_index $target $target
+ $bwa_index $target $target 1>&2
+elif [ $index -ot $target ]; then
+ echo >&2 "The index $index is stale. Rebuilding the index..."
+ echo >&2 $bwa_index $target $target
+ $bwa_index $target $target 1>&2
+else
+ echo >&2 "The index $index is up to date."
+fi
+
+# Map the reads.
+echo >&2 $bwa_aln $target "${query[@]}"
+exec abyss-tofastq -i "${query[@]}" \
+ |$bwa_aln $target - \
+ |bwa samse $target - <(abyss-tofastq -i "${query[@]}")
diff --git a/bin/abyss-bwasw b/bin/abyss-bwasw
new file mode 100755
index 0000000..fcf72c3
--- /dev/null
+++ b/bin/abyss-bwasw
@@ -0,0 +1,74 @@
+#!/bin/bash
+set -eu
+
+case $1 in
+ --help)
+ cat <<EOF
+Usage: abyss-bwasw [OPTION]... QUERY... TARGET
+Align the sequences of the files QUERY to those of the file
+TARGET using bwa.
+EOF
+ exit
+ ;;
+ --version)
+ cat <<EOF
+abyss-bwasw (ABySS)
+Written by Shaun Jackman.
+EOF
+ bwa 2>&1 |head -n4
+ exit
+ ;;
+esac
+
+# Parse the command line.
+bwasw='bwa bwasw'
+bwa_index='bwa index -a bwtsw'
+while getopts :j:l:v opt; do
+ case $opt in
+ j) bwasw="$bwasw -t$OPTARG";;
+ l) ;;
+ v) ;;
+ \?) echo >&2 "abyss-bwasw: invalid option: $OPTARG"; exit 1;;
+ esac
+done
+shift $((OPTIND-1))
+
+query=("$@")
+target=${query[${#query[@]}-1]}
+unset query[${#query[@]}-1]
+index=$target.bwt
+
+# Build the index.
+if [ ! -r $index ]; then
+ echo >&2 "Building the index $index..."
+ echo >&2 $bwa_index $target $target
+ $bwa_index $target $target 1>&2
+elif [ $index -ot $target ]; then
+ echo >&2 "The index $index is stale. Rebuilding the index..."
+ echo >&2 $bwa_index $target $target
+ $bwa_index $target $target 1>&2
+else
+ echo >&2 "The index $index is up to date."
+fi
+
+# Map the reads.
+echo >&2 $bwasw $target "${query[@]}"
+exec abyss-tofastq -i "${query[@]}" \
+ |$bwasw $target - \
+ |awk '
+BEGIN {
+ OFS = "\t"
+}
+/^@/ { print; next }
+$1 == x { next }
+{ x = $1 }
+sub("/1$", "", $1) > 0 {
+ $2 = or($2, 0x41)
+ print; next
+}
+sub("/[23]$", "", $1) > 0 {
+ $2 = or($2, 0x81)
+ print; next
+}
+{ print }
+'
diff --git a/bin/abyss-cstont b/bin/abyss-cstont
new file mode 100755
index 0000000..270e02a
--- /dev/null
+++ b/bin/abyss-cstont
@@ -0,0 +1,105 @@
+#!/usr/bin/perl
+# Convert colour-space FASTA sequences to nucleotide FASTA sequences.
+# Written by Shaun Jackman <sjackman at bcgsc.ca>.
+# Usage: cstofasta data.csfa >data.fa
+
+use strict;
+use Getopt::Long;
+use Pod::Usage;
+
+my %opt;
+GetOptions(\%opt, qw'help man');
+pod2usage(-verbose => 1) if $opt{help};
+pod2usage(-verbose => 2) if $opt{man};
+
+my %table = (
+ 'A' => ['A', 'C', 'G', 'T'],
+ 'C' => ['C', 'A', 'T', 'G'],
+ 'G' => ['G', 'T', 'A', 'C'],
+ 'T' => ['T', 'G', 'C', 'A']
+);
+
+sub cs_to_nt($$)
+{
+ my $seed = shift;
+ my $cs = shift;
+ for (my $i = 0; $i < length $cs; $i++) {
+ my $p = \substr($cs, $i, 1);
+ $$p = $seed = $table{$seed}[$$p];
+ }
+ return $cs;
+}
+
+my ($id, $comment);
+while (<>) {
+ chomp;
+ if (/^[ACGT]/) {
+ my $seed = substr $_, 0, 1, '';
+ print "$id$comment\n",
+ substr(cs_to_nt($seed, $_), 1),
+ "\n";
+ } elsif (/^[0123]/) {
+ for my $seed (qw'A C G T') {
+ print "${id}_$seed$comment\n$seed",
+ cs_to_nt($seed, $_), "\n";
+ }
+ } elsif (/^>/) {
+ ($id, $comment) = split ' ', $_, 2;
+ $comment = ' ' . $comment if $comment;
+ } elsif (/^#/) {
+ print "$_\n";
+ } else {
+ die "error: what is `$_'";
+ }
+}
+
+=pod
+
+=head1 NAME
+
+abyss-cstont - convert colour-space FASTA sequences to nucleotide FASTA sequences
+
+=head1 SYNOPSIS
+
+B<cstofasta> F<data.csfa> >F<data.fa>
+
+=head1 DESCRIPTION
+
+Either reads or contigs may be converted from colour-space sequences
+to nucleotide sequences. If the first character of the input sequence
+is not a nucleotide, each colour-space contig will be converted to
+four nucleotide contigs, one for each possible starting nucleotide.
+
+=head1 EXAMPLE
+
+ $ printf '>1\nA0000' |abyss-cstont
+ >1
+ AAA
+
+ $ printf '>1\n0000' |abyss-cstont
+ >1_A
+ AAAAA
+ >1_C
+ CCCCC
+ >1_G
+ GGGGG
+ >1_T
+ TTTTT
+
+=head1 AUTHOR
+
+Written by Shaun Jackman.
+
+=head1 REPORTING BUGS
+
+Report bugs to <abyss-users at bcgsc.ca>.
+
+=head1 COPYRIGHT
+
+Copyright 2009 Canada's Michael Smith Genome Science Centre
+
+=head1 SEE ALSO
+
+L<ABYSS(1)>
+
+http://www.bcgsc.ca/platform/bioinfo/software/abyss
diff --git a/bin/abyss-fac.pl b/bin/abyss-fac.pl
new file mode 100755
index 0000000..4d09942
--- /dev/null
+++ b/bin/abyss-fac.pl
@@ -0,0 +1,121 @@
+#!/usr/bin/perl
+# abyss-fac (FASTA count)
+# Calculate assembly contiguity statistics, such as N50.
+# Written by Shaun Jackman <sjackman at bcgsc.ca>.
+use strict;
+use Getopt::Std qw'getopts';
+
+$| = 1;
+
+my %opt;
+getopts 'g:hHjt:', \%opt;
+my $opt_threshold = defined $opt{'t'} ? $opt{'t'} : 200;
+my $opt_filename = $opt{'H'} || (@ARGV > 1 && !$opt{'h'});
+my $opt_jira = $opt{'j'};
+my $opt_genome_size = $opt{'g'};
+
+sub eng($)
+{
+ my $x = shift;
+ return $x if $x < 10000000;
+ return substr($x / 1000000, 0, 5) . 'e6' if $x < 1000000000;
+ return substr($x / 1000000000, 0, 5) . 'e9';
+}
+
+my ($short, $sum);
+my @x;
+
+sub count($$)
+{
+ my $id = shift;
+ my $seq = uc shift;
+ my $x = $seq =~ tr/ACGT//;
+ my $colourspace = $seq =~ tr/0123//;
+ die unless $x == 0 || $colourspace == 0;
+ $x = $colourspace if $x == 0;
+ if ($x < $opt_threshold) {
+ $short++;
+ return;
+ }
+ $sum += $x;
+ push @x, $x;
+}
+
+sub fac($)
+{
+ my $path = shift;
+ $short = $sum = 0;
+ @x = ();
+
+ my $id;
+ my $seq;
+ open IN, "<$path" or die "$path: $!\n";
+ while (<IN>) {
+ chomp;
+ if (/^>/) {
+ count $id, $seq if defined $id;
+ $id = $_;
+ $seq = '';
+ } else {
+ $seq .= $_;
+ }
+ }
+ count $id, $seq if defined $id;
+ close IN;
+
+ my $n = @x;
+ if ($n > 0) {
+ @x = sort { $a <=> $b } @x;
+ my $min = $x[0];
+ my $max = $x[-1];
+
+ my $n50_target = defined $opt_genome_size
+ ? $opt_genome_size : $sum;
+ my ($n20, $n20sum,
+ $nn50, $n50, $n50sum,
+ $n80, $n80sum);
+ while (@x > 0 && $n80sum < 0.8 * $n50_target) {
+ my $x = pop @x;
+ if ($n20sum < 0.2 * $n50_target) {
+ $n20 = $x;
+ $n20sum += $x;
+ }
+ if ($n50sum < 0.5 * $n50_target) {
+ $nn50++;
+ $n50 = $x;
+ $n50sum += $x;
+ }
+ if ($n80sum < 0.8 * $n50_target) {
+ $n80 = $x;
+ $n80sum += $x;
+ }
+ }
+
+ my $ntotal = $short + $n;
+ format Spaces =
+@<<<<<<<@<<<<<<<@<<<<<<<@<<<<<<<@<<<<<<<@<<<<<<<@<<<<<<<@<<<<<<<@<<<<<<<@*
+eng($ntotal), eng($n), $nn50, $min, $n80, $n50, $n20, $max, eng($sum), $path
+.
+ format Pipes =
+|@<<<<<<|@<<<<<<|@<<<<<<|@<<<<<<|@<<<<<<|@<<<<<<|@<<<<<<|@<<<<<<|@<<<<<<|@*|
+eng($ntotal), eng($n), $nn50, $min, $n80, $n50, $n20, $max, eng($sum), $path
+.
+ $~ = $opt_jira ? 'Pipes' : 'Spaces';
+ $^ = $opt_jira ? 'Pipes_TOP' : 'Spaces_TOP';
+ write;
+ } else {
+ print STDERR "warning: `$path' is empty\n";
+ }
+}
+
+format Spaces_TOP =
+n n:@<<<< n:N50 min N80 N50 N20 max sum
+$opt_threshold
+.
+format Pipes_TOP =
+||n ||n:@<<<||n:N50 ||min ||N80 ||N50 ||N20 ||max ||sum ||
+$opt_threshold
+.
+
+ at ARGV = ('-') if @ARGV == 0;
+fac $_ foreach @ARGV;
diff --git a/bin/abyss-fatoagp b/bin/abyss-fatoagp
new file mode 100755
index 0000000..d1b517d
--- /dev/null
+++ b/bin/abyss-fatoagp
@@ -0,0 +1,53 @@
+#!/usr/bin/perl
+# Convert a FASTA file of scaffolds to a FASTA file of contigs and an
+# AGP file.
+# Written by Shaun Jackman <sjackman at bcgsc.ca>.
+
+use strict;
+use Getopt::Std qw'getopts';
+
+my %opt;
+getopts 'f:s:', \%opt;
+my $opt_fasta = $opt{'f'};
+my $opt_min_len = defined $opt{'s'} ? $opt{'s'} : 200;
+
+open FASTA, ">$opt_fasta"
+ or die "error: `$opt_fasta': $!\n"
+ if $opt_fasta;
+
+while (<>) {
+ die unless /^>/;
+ chomp;
+ my ($scafid, undef) = split ' ', $_, 2;
+ substr $scafid, 0, 1, '';
+
+ my $scafseq = <>;
+ chomp $scafseq;
+ my $scaflen = $scafseq =~ tr/ACGTacgt//;
+ next if $scaflen < $opt_min_len;
+
+ my @ctgseqs = split /([Nn]+)/, $scafseq;
+ my $i = 0;
+ my $x = 0;
+ for my $ctgseq (@ctgseqs) {
+ my $len = length $ctgseq;
+ # object object_beg object_end part_number
+ print 'scaffold', $scafid, "\t",
+ $x + 1, "\t",
+ $x + $len, "\t",
+ $i + 1, "\t";
+ if ($ctgseq =~ /^[nN]/) {
+ # component_type gap_length gap_type linkage
+ print "N\t", $len, "\tscaffold\tyes\tpaired-ends\n";
+ } else {
+ my $ctgid = 'contig' . $scafid . '_' . ($i / 2);
+ # component_type component_id
+ # component_beg component_end orientation
+ print "W\t", $ctgid, "\t1\t", $len, "\t+\n";
+ print FASTA '>', $ctgid, "\n", $ctgseq, "\n"
+ if $opt_fasta;
+ }
+ $i++;
+ $x += $len;
+ }
+}
diff --git a/bin/abyss-joindist b/bin/abyss-joindist
new file mode 100755
index 0000000..afbdfb4
--- /dev/null
+++ b/bin/abyss-joindist
@@ -0,0 +1,79 @@
+#!/usr/bin/perl
+# Join multiple ABySS distance estimate files.
+# Written by Shaun Jackman <sjackman at bcgsc.ca>.
+use strict;
+use Getopt::Long;
+use Pod::Usage;
+
+my %opt;
+GetOptions(\%opt, qw'help man');
+pod2usage(-verbose => 1) if $opt{help};
+pod2usage(-verbose => 2) if $opt{man};
+
+my (%id, %a, %b);
+
+while (<>) {
+ chomp;
+ my ($id, $rest) = split ' ', $_, 2;
+ my ($a, $b) = split ';', $rest, 2;
+ my @a = split ' ', $a;
+ my @b = split ' ', $b;
+ $id{$id} = 1;
+
+ for (@a) {
+ my ($to, $d, $n, $sd) = split ',';
+ if (!exists $a{$id}{$to} || $sd < $a{$id}{$to}) {
+ $a{$id}{$to} = "$sd $d $n";
+ }
+ }
+
+ for (@b) {
+ my ($to, $d, $n, $sd) = split ',';
+ if (!exists $b{$id}{$to} || $sd < $b{$id}{$to}) {
+ $b{$id}{$to} = "$sd $d $n";
+ }
+ }
+}
+
+for my $id (sort {$a<=>$b} keys %id) {
+ print $id;
+ for my $to (sort {$a<=>$b} keys %{$a{$id}}) {
+ my ($sd, $d, $n) = split ' ', $a{$id}{$to};
+ print " $to,$d,$n,$sd";
+ }
+ print ' ;';
+ for my $to (sort {$a<=>$b} keys %{$b{$id}}) {
+ my ($sd, $d, $n) = split ' ', $b{$id}{$to};
+ print " $to,$d,$n,$sd";
+ }
+ print "\n";
+}
+
+=pod
+
+=head1 NAME
+
+abyss-joindist -
+Join multiple ABySS distance estimate files.
+
+=head1 SYNOPSIS
+
+B<abyss-joindist> F<in.dist>... >F<out.dist>
+
+=head1 AUTHOR
+
+Written by Shaun Jackman.
+
+=head1 REPORTING BUGS
+
+Report bugs to <abyss at bcgsc.ca>.
+
+=head1 COPYRIGHT
+
+Copyright 2009 Canada's Michael Smith Genome Science Centre
+
+=head1 SEE ALSO
+
+L<ABYSS(1)>
+
+http://www.bcgsc.ca/platform/bioinfo/software/abyss
diff --git a/bin/abyss-kaligner b/bin/abyss-kaligner
new file mode 100755
index 0000000..5ee4787
--- /dev/null
+++ b/bin/abyss-kaligner
@@ -0,0 +1,3 @@
+#!/bin/bash
+set -eu
+exec KAligner "$@"
diff --git a/bin/abyss-pe b/bin/abyss-pe
new file mode 100755
index 0000000..c46b785
--- /dev/null
+++ b/bin/abyss-pe
@@ -0,0 +1,558 @@
+#!/usr/bin/make -rRf
+# Run the ABySS assembler.
+# Written by Shaun Jackman <sjackman at bcgsc.ca>.
+
+# Set pipefail to require that all commands of a pipe must succeed.
+SHELL=/bin/bash -o pipefail
+
+# Define this environment variable on Mac OS X to read
+# compressed files.
+export DYLD_FORCE_FLAT_NAMESPACE=1
+
+# Integrate with Sun Grid Engine (SGE)
+ifdef JOB_NAME
+name?=$(JOB_NAME)
+endif
+ifdef SGE_TASK_ID
+k?=$(SGE_TASK_ID)
+endif
+ifdef NSLOTS
+ifneq ($(NSLOTS), 1)
+np?=$(NSLOTS)
+endif
+endif
+
+# Integrate with Portable Batch System (PBS)
+ifdef PBS_JOBNAME
+name?=$(PBS_JOBNAME)
+endif
+ifdef PBS_ARRAYID
+k?=$(PBS_ARRAYID)
+endif
+ifdef PBS_NODEFILE
+NSLOTS=$(shell wc -l <$(PBS_NODEFILE))
+ifneq ($(NSLOTS), 1)
+np?=$(NSLOTS)
+endif
+endif
+
+# Integrate with Load Sharing Facility (LSF)
+ifdef LSB_JOBNAME
+name?=$(LSB_JOBNAME)
+endif
+ifdef LSB_JOBINDEX
+k?=$(LSB_JOBINDEX)
+endif
+ifdef LSB_DJOB_NUMPROC
+ifneq ($(LSB_DJOB_NUMPROC), 1)
+np?=$(LSB_DJOB_NUMPROC)
+endif
+endif
+ifdef LSF_BINDIR
+mpirun?=$(LSF_BINDIR)/mpirun.lsf
+endif
+
+# Integrate with IBM LoadLeveler
+ifdef LOADL_JOB_NAME
+name?=$(LOADL_JOB_NAME)
+endif
+ifdef LOADL_STEP_ID
+k?=$(LOADL_STEP_ID)
+endif
+ifdef LOADL_HOSTFILE
+NSLOTS=$(shell wc -l <$(LOADL_HOSTFILE))
+ifneq ($(NSLOTS), 1)
+np?=$(NSLOTS)
+endif
+endif
+
+# Integrate with SLURM
+ifdef SLURM_JOB_NAME
+name?=$(SLURM_JOB_NAME)
+endif
+ifdef SLURM_JOBID
+k?=$(SLURM_JOBID)
+endif
+ifdef SLURM_NTASKS
+np?=$(SLURM_NTASKS)
+endif
+
+# Determine the path to mpirun
+mpirun?=$(shell which mpirun)
+ifeq ($(mpirun),)
+mpirun=mpirun
+endif
+
+# Determine the path to the ABySS executables
+path?=$(shell if ! which ABYSS >/dev/null 2>/dev/null; then \
+ dirname $(MAKEFILE_LIST); fi)
+ifdef path
+PATH:=$(path):$(PATH)
+endif
+
+ifdef lib
+map=$(foreach a,$(2),$(call $(1),$(a)))
+deref=$($1)
+in?=$(call map, deref, $(lib))
+else
+ifdef in
+lib?=$(name)
+$(lib)?=$(in)
+endif
+endif
+pe?=$(lib)
+mp?=$(pe)
+
+# Strip spaces from the file paths
+ifdef in
+override in:=$(strip $(in))
+endif
+ifdef se
+override se:=$(strip $(se))
+endif
+
+# ABYSS parameters
+q ?= 3
+abyssopt += -k$k -q$q
+ifdef e
+abyssopt += -e$e
+endif
+ifdef E
+abyssopt += -E$E
+endif
+ifdef t
+abyssopt += -t$t
+endif
+ifdef c
+abyssopt += -c$c
+endif
+ifdef b
+abyssopt += -b$b
+pbopt += -b$b
+endif
+abyssopt += $v --coverage-hist=coverage.hist -s $*-bubbles.fa
+
+# Number of threads
+ifdef PE_HOSTFILE
+hostname?=$(shell hostname -f)
+j?=$(shell awk '$$1 == "$(hostname)" {print $$2}' $(PE_HOSTFILE))
+endif
+ifeq ($j,)
+j:=$(np)
+endif
+ifeq ($j,)
+j:=2
+endif
+
+# AdjList parameters
+m?=50
+
+# PopBubbles parameters
+p?=0.9
+pbopt += -p$p
+
+# Aligner parameters
+aligner?=map
+align?=abyss-$(aligner)
+mapopt=$v -j$j -l$($*_l) $(ALIGNER_OPTIONS) $(MAP_OPTIONS)
+
+# fixmate parameters
+ifeq ($(align),abyss-kaligner)
+fixmate?=ParseAligns
+fmopt=$v -l$($*_l) $(FIXMATE_OPTIONS)
+else
+fixmate?=abyss-fixmate
+fmopt=$v $(FIXMATE_OPTIONS)
+endif
+
+# DistanceEst parameters
+l?=$k
+s?=200
+n?=10
+libs=$(pe) $(mp)
+$(foreach i,$(libs),$(eval $i_l?=$l))
+$(foreach i,$(libs),$(eval $i_s?=$s))
+$(foreach i,$(libs),$(eval $i_n?=$n))
+deopt=$v -j$j -k$k -l$($*_l) -s$($*_s) -n$($*_n) $($*_de) \
+ $(DISTANCEEST_OPTIONS)
+
+# SimpleGraph parameters
+ifdef d
+sgopt += -d$d
+endif
+
+# PathConsensus parameters
+ifdef a
+pcopt += -a$a
+endif
+pcopt += -p$p
+
+# Scaffold parameters
+S?=$s
+N?=$n
+
+# Remove environment variables
+unexport in se $(lib) $(pe) $(mp)
+
+# Check the mandatory parameters
+
+ifndef name
+error::
+ @>&2 echo 'abyss-pe: missing parameter `name`'
+endif
+ifndef k
+error::
+ @>&2 echo 'abyss-pe: missing parameter `k`'
+endif
+ifeq ($(lib)$(in)$(se),)
+error::
+ @>&2 echo 'abyss-pe: missing parameter `lib`, `in` or `se`'
+endif
+
+default:
+
+error::
+ @>&2 echo 'Try `abyss-pe help` for more information.'
+ @false
+
+# Help and version messages
+
+help:
+ @printf '\
+Usage: abyss-pe [OPTION]... [PARAMETER=VALUE]... [COMMAND]...\n\
+Assemble reads into contigs and scaffolds. ABySS is a de novo\n\
+sequence assembler intended for short paired-end reads and large\n\
+genomes. See the abyss-pe man page for documentation of assembly\n\
+parameters and commands. abyss-pe is a Makefile script, and so\n\
+options of `make` may also be used with abyss-pe. See the `make`\n\
+man page for documentation.\n\
+\n\
+Report bugs to <abyss-users at bcgsc.ca>.\n'
+
+version:
+ @printf '\
+abyss-pe (ABySS) 1.3.4\n\
+Written by Shaun Jackman.\n\
+\n\
+Copyright 2012 Canada'\''s Michael Smith Genome Science Centre\n'
+
+versions: version
+ @ABYSS --version; echo
+ @-ABYSS-P --version; echo
+ @AdjList --version; echo
+ @DistanceEst --version; echo
+ @MergeContigs --version; echo
+ @MergePaths --version; echo
+ @Overlap --version; echo
+ @PathConsensus --version; echo
+ @PathOverlap --version; echo
+ @PopBubbles --version; echo
+ @SimpleGraph --version; echo
+ @abyss-fac --version; echo
+ @abyss-filtergraph --version; echo
+ @abyss-fixmate --version; echo
+ @abyss-map --version; echo
+ @abyss-scaffold --version; echo
+ @abyss-todot --version; echo
+ @$(align) --version; echo
+ @awk --version; echo
+ @sort --version; echo
+ @-mpirun --version
+
+# Determine the default target
+default: unitigs
+ifneq ($(in),)
+default: contigs contigs-dot
+endif
+ifneq ($(mp),)
+default: scaffolds scaffolds-dot
+endif
+default: stats
+
+# Define the commands (phony targets)
+unitigs: $(name)-unitigs.fa
+
+unitigs-dot: $(name)-unitigs.dot
+
+pe-index: $(name)-3.fa.fm
+
+pe-sam: $(addsuffix -3.sam.gz, $(pe))
+
+pe-bam: $(addsuffix -3.bam.bai, $(pe))
+
+contigs: $(name)-contigs.fa
+
+contigs-dot: $(name)-contigs.dot
+
+mp-index: $(name)-6.fa.fm
+
+mp-sam: $(addsuffix -6.sam.gz, $(mp))
+
+mp-bam: $(addsuffix -6.bam.bai, $(mp))
+
+scaffolds: $(name)-scaffolds.fa
+
+scaffolds-dot: $(name)-scaffolds.dot
+
+all: default bam stats
+
+clean:
+ rm -f *.adj *.dot *.sam.gz *.hist *.dist *.path *.path[123]
+
+.PHONY: bam default stats \
+ unitigs unitigs-dot \
+ pe-index pe-sam pe-bam contigs contigs-dot \
+ mp-index mp-sam mp-bam scaffolds scaffolds-dot \
+ all clean help version versions
+.DELETE_ON_ERROR:
+.SECONDARY:
+
+# Utilities
+
+%.fa.fm: %.fa
+ abyss-index $v $<
+
+%.bam: %.sam.gz
+ samtools view -Sb $< -o $@
+
+%.bam.bai: %.bam
+ samtools index $<
+
+# Assemble unitigs
+
+%-1.fa:
+ifdef np
+ $(mpirun) -np $(np) ABYSS-P $(abyssopt) $(ABYSS_OPTIONS) -o $@ $(in) $(se)
+else
+ ABYSS $(abyssopt) $(ABYSS_OPTIONS) -o $@ $(in) $(se)
+endif
+
+# Find overlapping contigs
+
+%-1.adj: %-1.fa
+ AdjList $v -k$k -m$m $< >$@
+
+# Remove shim contigs
+
+%-2.adj: %-1.adj
+ abyss-filtergraph $v -k$k -g $@ $^ >$*-1.path
+
+# Pop bubbles
+
+%-2.path %-3.adj: %-1.fa %-2.adj
+ PopBubbles $v -j$j -k$k $(pbopt) $(POPBUBBLES_OPTIONS) -g $*-3.adj $^ >$*-2.path
+
+%-3.fa: %-1.fa %-2.adj %-2.path
+ MergeContigs $v -k$k -o $@ $^
+ awk '!/^>/ {x[">" $$1]=1; next} {getline s} $$1 in x {print $$0 "\n" s}' \
+ $*-2.path $*-1.fa >$*-indel.fa
+
+%-3.dot: %-3.adj
+ abyss-todot $v -k$k $< >$@
+
+%-unitigs.fa: %-3.fa
+ ln -sf $< $@
+
+%-unitigs.dot: %-3.dot
+ ln -sf $< $@
+
+# Estimate distances between unitigs
+
+%-3.sam.gz %-3.hist: $(name)-3.fa
+ $(align) $(mapopt) $(strip $($*)) $< \
+ |$(fixmate) $(fmopt) -h $*-3.hist \
+ |sort -snk3 -k4 \
+ |gzip >$*-3.sam.gz
+
+%-3.bam %-3.hist: $(name)-3.fa
+ $(align) $(mapopt) $(strip $($*)) $< \
+ |$(fixmate) $(fmopt) -h $*-3.hist \
+ |sort -snk3 -k4 \
+ |samtools view -Sb - -o $*-3.bam
+
+%-3.dist: %-3.sam.gz %-3.hist
+ gunzip -c $< \
+ |DistanceEst $(deopt) -o $@ $*-3.hist
+
+%-3.dist: %-3.bam %-3.hist
+ samtools view -h $< \
+ |DistanceEst $(deopt) -o $@ $*-3.hist
+
+%-3.dist: $(name)-3.fa
+ $(align) $(mapopt) $(strip $($*)) $< \
+ |$(fixmate) $(fmopt) -h $*-3.hist \
+ |sort -snk3 -k4 \
+ |DistanceEst $(deopt) -o $@ $*-3.hist
+
+dist=$(addsuffix -3.dist, $(pe))
+
+ifneq ($(name)-3.dist, $(dist))
+$(name)-3.dist: $(name)-3.fa $(dist)
+ abyss-todot $v --dist -e $^ >$@
+
+$(name)-3.bam: $(addsuffix -3.bam, $(pe))
+ samtools merge -r $@ $^
+endif
+
+# Find overlaps between contigs
+
+%-4.fa %-4.adj: %-3.fa %-3.adj %-3.dist
+ Overlap $v $(OVERLAP_OPTIONS) -k$k -g $*-4.adj -o $*-4.fa $^
+
+# Assemble contigs
+
+%-4.path1: %-4.adj %-3.dist
+ SimpleGraph $v $(sgopt) $(SIMPLEGRAPH_OPTIONS) -j$j -k$k -o $@ $^
+
+%-4.path2: %-4.adj %-4.path1
+ MergePaths $v $(MERGEPATHS_OPTIONS) -j$j -k$k -o $@ $^
+
+%-4.path3: %-4.adj %-4.path2
+ PathOverlap --assemble $v -k$k $^ >$@
+
+ifndef cs
+
+%-5.path %-5.fa %-5.adj: %-3.fa %-4.fa %-4.adj %-4.path3
+ cat $(wordlist 1, 2, $^) \
+ |PathConsensus $v -k$k $(pcopt) -o $*-5.path -s $*-5.fa -g $*-5.adj - $(wordlist 3, 4, $^)
+
+%-6.fa: %-3.fa %-4.fa %-5.fa %-5.adj %-5.path
+ cat $(wordlist 1, 3, $^) |MergeContigs $v -k$k -o $@ - $(wordlist 4, 5, $^)
+
+else
+
+%-5.adj %-5.path: %-4.adj %-4.path3
+ ln -sf $*-4.adj $*-5.adj
+ ln -sf $*-4.path3 $*-5.path
+
+%-cs.fa: %-3.fa %-4.fa %-4.adj %-4.path3
+ cat $(wordlist 1, 2, $^) |MergeContigs $v -k$k -o $@ - $(wordlist 3, 4, $^)
+
+# Convert colour-space sequence to nucleotides
+
+%-6.fa: %-cs.fa
+ KAligner $v --seq -m -j$j -l$l $(in) $(se) $< \
+ |Consensus $v -o $@ $<
+
+endif
+
+%-6.dot: %-5.adj %-5.path
+ PathOverlap --overlap $v --dot -k$k $^ >$@
+
+%-contigs.fa: %-6.fa
+ ln -sf $< $@
+
+%-contigs.dot: %-6.dot
+ ln -sf $< $@
+
+# Estimate distances between contigs
+
+%-6.sam.gz %-6.hist: $(name)-6.fa
+ $(align) $(mapopt) $(strip $($*)) $< \
+ |$(fixmate) $(fmopt) -h $*-6.hist \
+ |sort -snk3 -k4 \
+ |gzip >$*-6.sam.gz
+
+%-6.bam %-6.hist: $(name)-6.fa
+ $(align) $(mapopt) $(strip $($*)) $< \
+ |$(fixmate) $(fmopt) -h $*-6.hist \
+ |sort -snk3 -k4 \
+ |samtools view -Sb - -o $*-6.bam
+
+%-6.dist.dot: %-6.sam.gz %-6.hist
+ gunzip -c $< \
+ |DistanceEst --dot $(deopt) -o $@ $*-6.hist
+
+%-6.dist.dot: %-6.bam %-6.hist
+ samtools view -h $< \
+ |DistanceEst --dot $(deopt) -o $@ $*-6.hist
+
+%-6.dist.dot: $(name)-6.fa
+ $(align) $(mapopt) $(strip $($*)) $< \
+ |$(fixmate) $(fmopt) -h $*-6.hist \
+ |sort -snk3 -k4 \
+ |DistanceEst --dot $(deopt) -o $@ $*-6.hist
+
+# Scaffold
+
+%-6.path1: $(name)-6.dot $(addsuffix -6.dist.dot, $(mp))
+ abyss-scaffold $v -k$k -s$S -n$N -g $@.dot $(SCAFFOLD_OPTIONS) $^ >$@
+
+%-6.path2: %-6.fa %-6.dot %-6.path1
+ PathConsensus $v -k$k -p1 -s /dev/null -o $@ $^
+
+%-7.fa %-7.dot: %-6.fa %-6.dot %-6.path2
+ MergeContigs $v -k$k -o $*-7.fa -g $*-7.dot $^
+
+%-scaffolds.fa: %-7.fa
+ ln -sf $< $@
+
+%-scaffolds.dot: %-7.dot
+ ln -sf $< $@
+
+# Create the final BAM file
+
+ifneq ($(mp),)
+bam: $(name)-scaffolds.bam.bai
+else
+ifneq ($(in),)
+bam: $(name)-contigs.bam.bai
+else
+bam: $(name)-unitigs.bam.bai
+endif
+endif
+
+$(name)-unitigs.bam: %.bam: %.fa
+ $(align) $v -j$j -l$l $(ALIGNER_OPTIONS) $(se) $< \
+ |samtools view -Su - |samtools sort -o - - >$@
+
+$(name)-contigs.bam $(name)-scaffolds.bam: %.bam: %.fa
+ $(align) $v -j$j -l$l $(ALIGNER_OPTIONS) \
+ $(call map, deref, $(sort $(lib) $(pe) $(mp))) $< \
+ |$(fixmate) $(fmopt) \
+ |sort -snk3 -k4 \
+ |samtools view -Sb - >$@
+
+# Align the variants to the assembly
+
+%.fa.bwt: %.fa
+ bwa index $<
+
+%-variants.bam: %.fa.bwt
+ bwa bwasw -t$j $*.fa <(cat $(name)-bubbles.fa $(name)-indel.fa) \
+ |samtools view -Su - |samtools sort -o - - >$@
+
+%-variants.vcf.gz: %.fa %-variants.bam
+ samtools mpileup -Buf $^ |bcftools view -vp1 - |bgzip >$@
+
+%.gz.tbi: %.gz
+ tabix -pvcf $<
+
+# Calculate assembly contiguity statistics
+
+stats: $(name)-stats
+
+$(name)-stats: %-stats: %-unitigs.fa
+ifneq ($(in),)
+$(name)-stats: %-stats: %-contigs.fa
+endif
+ifneq ($(mp),)
+$(name)-stats: %-stats: %-scaffolds.fa
+endif
+$(name)-stats:
+ abyss-fac $(FAC_OPTIONS) $^ |tee $@
+
+# Create an AGP file and FASTA file of scaftigs from scaffolds
+
+%.agp %-agp.fa: %.fa
+ abyss-fatoagp $(FATOAGP_OPTIONS) -f $*-agp.fa $< >$*.agp
+
+# Align the contigs to the reference
+
+%-$(ref).sam.gz: %.fa
+ bwa bwasw -t$j $(BWASW_OPTIONS) $($(ref)) $< |gzip >$@
+
+# Find breakpoints in the alignments
+
+%.break: %.sam.gz
+ sam2break $(SAM2BREAK_OPTIONS) $< >$@
diff --git a/bin/abyss-samtoafg b/bin/abyss-samtoafg
new file mode 100755
index 0000000..ce588bb
--- /dev/null
+++ b/bin/abyss-samtoafg
@@ -0,0 +1,210 @@
+#!/usr/bin/perl
+use strict;
+use Getopt::Long;
+use Pod::Usage;
+
+sub version {
+ print <<EOF;
+abyss-samtoafg (ABySS)
+Written by Shaun Jackman.
+
+Copyright 2012 Canada's Michael Smith Genome Science Centre
+EOF
+ exit;
+}
+
+my ($opt_eid, $opt_iid, $opt_mean, $opt_sd) = (1, 1);
+Getopt::Long::Configure(qw'bundling');
+GetOptions(
+ 'eid|e=s' => \$opt_eid,
+ 'iid|i=s' => \$opt_iid,
+ 'mean|m=i' => \$opt_mean,
+ 'sd|s=i' => \$opt_sd,
+ 'help' => sub { pod2usage(-verbose => 1) },
+ 'man' => sub { pod2usage(-verbose => 2) },
+ 'version' => \&version);
+
+for (@ARGV) { die "cannot read `$_'" unless $_ eq '-' || -r }
+
+# Output the library record (LIB).
+print "{LIB\neid:$opt_eid\niid:$opt_iid\n";
+print "{DST\nmea:$opt_mean\nstd:$opt_sd\n}\n"
+ if defined $opt_mean && defined $opt_sd;
+print "}\n";
+
+sub getMateID($)
+{
+ my $id = shift;
+ return $id =~ s%/1$%/2% || $id =~ s%/2$%/1%
+ ? $id : undef;
+}
+
+my ($g_red_iid, $g_frg_iid,
+ @ctg_eids, @ctg_seqs,
+ %reds, %frgs, %tles);
+
+# Output a read (RED) and possibly a fragment (FRG).
+sub createRead($$$)
+{
+ my ($eid, $seq, $qlt) = @_;
+ die "error: duplicate sequence ID `$eid'" if exists $reds{$eid};
+ my $red_iid = ++$g_red_iid;
+
+ (my $frg_eid = $eid) =~ s/\/[12]$//;
+ my ($my_frg_iid, $mate_iid);
+ if (exists $frgs{$frg_eid}) {
+ $my_frg_iid = delete $frgs{$frg_eid};
+ my $mate_eid = getMateID($eid);
+ die unless defined $mate_eid;
+ $mate_iid = delete $reds{$mate_eid};
+ die unless defined $mate_iid;
+ } else {
+ $my_frg_iid = $frgs{$frg_eid} = ++$g_frg_iid;
+ $reds{$eid} = $red_iid;
+ }
+
+ # Output a read (RED) record.
+ my $qlength = length $seq;
+ print "{RED\nclr:0,$qlength\niid:$red_iid\neid:$eid\n",
+ "frg:$my_frg_iid\n",
+ "seq:\n$seq\n.\nqlt:\n$qlt\n.\n}\n";
+
+ # Output a fragment (FRG) record.
+ if (defined $mate_iid) {
+ print "{FRG\nrds:$mate_iid,$red_iid\nlib:$opt_iid\n",
+ "eid:$frg_eid\niid:$my_frg_iid\ntyp:I\n}\n";
+ }
+
+ return $red_iid;
+}
+
+# Return the left and right soft clipping of this CIGAR string.
+sub parseCigar($)
+{
+ my $cigar = shift;
+ my $clipLeft = $cigar =~ /^([0-9]+)S/ ? $1 : 0;
+ my $clipRight = $cigar =~ /([0-9]+)S$/ ? $1 : 0;
+ return ($clipLeft, $clipRight);
+}
+
+# Record the alignment (TLE) records.
+while (<>) {
+ chomp;
+ next if /^#/ || /^@/;
+
+ if (/^>([^ ]+)/) {
+ my $eid = $1;
+ chomp (my $seq = <>);
+ push @ctg_eids, $eid;
+ push @ctg_seqs, $seq;
+ next;
+ }
+
+ my ($qid, $flag, $tid, $tstart, $mapq, $cigar,
+ $rnext, $pnext, $tlen, $qseq, $qqual) = split '\t';
+ die unless defined $qqual;
+
+ $tstart--; # convert to zero-based coordinate
+ $qid .= "/1" if $flag & 0x40; #FREAD1
+ $qid .= "/2" if $flag & 0x80; #FREAD2
+
+ my $rc = $flag & 0x10; #FREVERSE
+ if ($rc) {
+ # Reverse and complement the sequence.
+ $qseq =~ tr/ACGTacgt/TGCAtgca/;
+ $qseq = reverse $qseq;
+ $qqual = reverse $qqual;
+ }
+ my $riid = createRead($qid, $qseq, $qqual);
+ next if $flag & 0x4; #FUNMAP
+
+ my $qlength = length $qseq;
+ die if length $qqual != $qlength;
+ my ($qstart, $clipRight) = parseCigar($cigar);
+ my $qend = $qlength - $clipRight;
+ die unless $qstart < $qend;
+
+ my $clr = $rc ? "$qend,$qstart" : "$qstart,$qend";
+ $tles{$tid} .= "{TLE\nclr:$clr\noff:$tstart\nsrc:$riid\n}\n";
+}
+
+# Output the contig (CTG) and alignment (TLE) records.
+my $ctg_iid = 0;
+for my $ctg_eid (@ctg_eids) {
+ my $seq = shift @ctg_seqs;
+ next if length $tles{$ctg_eid} == 0;
+
+ # Split long lines.
+ my $qlt = 'I' x (length $seq);
+ $seq =~ s/.{60}/$&\n/sg;
+ $qlt =~ s/.{60}/$&\n/sg;
+
+ # Contig sequence.
+ $ctg_iid++;
+ print "{CTG\niid:$ctg_iid\n",
+ "eid:$ctg_eid\n",
+ "seq:\n", $seq, "\n.\n",
+ "qlt:\n", $qlt, "\n.\n";
+
+ print $tles{$ctg_eid};
+
+ print "}\n";
+}
+
+=pod
+
+=head1 NAME
+
+abyss-samtoafg - create an AMOS AFG file from a SAM file
+
+=head1 SYNOPSIS
+
+B<abyss-samtoafg> F<contigs.fa> F<alignments.sam> >F<assembly.afg>
+
+B<bank-transact> B<-cb> F<assembly.bnk> B<-m> F<assembly.afg>
+
+B<hawkeye> F<assembly.bnk>
+
+=head1 DESCRIPTION
+
+Create an AMOS AFG file from a FASTA file and a SAM file.
+
+=head1 OPTIONS
+
+=over
+
+=item B<-e>,B<--eid>
+
+the EID of the library
+
+=item B<-i>,B<--iid>
+
+the IID of the library
+
+=item B<-m>,B<--mean>
+
+the mean of the fragment-size
+
+=item B<-s>,B<--sd>
+
+the standard deviation of the fragment-size
+
+=back
+
+=head1 AUTHOR
+
+Written by Shaun Jackman.
+
+=head1 REPORTING BUGS
+
+Report bugs to <abyss-users at bcgsc.ca>.
+
+=head1 COPYRIGHT
+
+Copyright 2012 Canada's Michael Smith Genome Science Centre
+
+=head1 SEE ALSO
+
+http://www.bcgsc.ca/platform/bioinfo/software/abyss
+
+http://amos.sourceforge.net/hawkeye
diff --git a/config.h.in b/config.h.in
new file mode 100644
index 0000000..1b14e80
--- /dev/null
+++ b/config.h.in
@@ -0,0 +1,282 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* Define to use the popcnt instruction */
+#undef ENABLE_POPCNT
+
+/* Width of bits of the FM-index in bits */
+#undef FMBITS
+
+/* Define to 1 if you have the <boost/property_map/property_map.hpp> header
+ file. */
+#undef HAVE_BOOST_PROPERTY_MAP_PROPERTY_MAP_HPP
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */
+#undef HAVE_DOPRNT
+
+/* Define to 1 if you have the `dup2' function. */
+#undef HAVE_DUP2
+
+/* Define to 1 if you have the <fcntl.h> header file. */
+#undef HAVE_FCNTL_H
+
+/* Define to 1 if you have the <float.h> header file. */
+#undef HAVE_FLOAT_H
+
+/* Define to 1 if you have the `fork' function. */
+#undef HAVE_FORK
+
+/* Define to 1 if you have the `gethostname' function. */
+#undef HAVE_GETHOSTNAME
+
+/* Define to 1 if you have the `getopt_long' function. */
+#undef HAVE_GETOPT_LONG
+
+/* Define to 1 if you have the `getpagesize' function. */
+#undef HAVE_GETPAGESIZE
+
+/* Define to 1 if you have the <google/sparse_hash_map> header file. */
+#undef HAVE_GOOGLE_SPARSE_HASH_MAP
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the `dl' library (-ldl). */
+#undef HAVE_LIBDL
+
+/* Define to 1 if you have the `lam' library (-llam). */
+#undef HAVE_LIBLAM
+
+/* Define to 1 if you have the `lammpi++' library (-llammpi++). */
+#undef HAVE_LIBLAMMPI__
+
+/* Define to 1 if you have the `m' library (-lm). */
+#undef HAVE_LIBM
+
+/* Define to 1 if you have the `mpi' library (-lmpi). */
+#undef HAVE_LIBMPI
+
+/* Define to 1 if you have the `mpich' library (-lmpich). */
+#undef HAVE_LIBMPICH
+
+/* Define to 1 if you have the `pthread' library (-lpthread). */
+#undef HAVE_LIBPTHREAD
+
+/* Define to 1 if you have the <limits.h> header file. */
+#undef HAVE_LIMITS_H
+
+/* Define to 1 if your system has a GNU libc compatible `malloc' function, and
+ to 0 otherwise. */
+#undef HAVE_MALLOC
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the `memset' function. */
+#undef HAVE_MEMSET
+
+/* Define to 1 if you have the <mpi.h> header file. */
+#undef HAVE_MPI_H
+
+/* Define to 1 if you have the `pow' function. */
+#undef HAVE_POW
+
+/* Define to 1 if the system has the type `ptrdiff_t'. */
+#undef HAVE_PTRDIFF_T
+
+/* Define to 1 if your system has a GNU libc compatible `realloc' function,
+ and to 0 otherwise. */
+#undef HAVE_REALLOC
+
+/* Define to 1 if you have the `sqrt' function. */
+#undef HAVE_SQRT
+
+/* Define to 1 if stdbool.h conforms to C99. */
+#undef HAVE_STDBOOL_H
+
+/* Define to 1 if you have the <stddef.h> header file. */
+#undef HAVE_STDDEF_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the `strdup' function. */
+#undef HAVE_STRDUP
+
+/* Define to 1 if you have the `strerror' function. */
+#undef HAVE_STRERROR
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtoul' function. */
+#undef HAVE_STRTOUL
+
+/* Define to 1 if you have the <sys/param.h> header file. */
+#undef HAVE_SYS_PARAM_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <tr1/unordered_map> header file. */
+#undef HAVE_TR1_UNORDERED_MAP
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if you have the <unordered_map> header file. */
+#undef HAVE_UNORDERED_MAP
+
+/* Define to 1 if you have the `vfork' function. */
+#undef HAVE_VFORK
+
+/* Define to 1 if you have the <vfork.h> header file. */
+#undef HAVE_VFORK_H
+
+/* Define to 1 if you have the `vprintf' function. */
+#undef HAVE_VPRINTF
+
+/* Define to 1 if `fork' works. */
+#undef HAVE_WORKING_FORK
+
+/* Define to 1 if `vfork' works. */
+#undef HAVE_WORKING_VFORK
+
+/* Define to 1 if the system has the type `_Bool'. */
+#undef HAVE__BOOL
+
+/* Define if the system does not provide HOST_NAME_MAX */
+#undef HOST_NAME_MAX
+
+/* maximum k-mer length */
+#undef MAX_KMER
+
+/* Define to disable MPICH C++ bindings */
+#undef MPICH_SKIP_MPICXX
+
+/* Define to disable OpenMPI C++ bindings */
+#undef OMPI_SKIP_MPICXX
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to use SAM sequence and quality fields */
+#undef SAM_SEQ_QUAL
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
+
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
+
+/* Define for Solaris 2.5.1 so the uint32_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT32_T
+
+/* Define for Solaris 2.5.1 so the uint64_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT64_T
+
+/* Define for Solaris 2.5.1 so the uint8_t typedef from <sys/synch.h>,
+ <pthread.h>, or <semaphore.h> is not used. If the typedef were allowed, the
+ #define below would cause a syntax error. */
+#undef _UINT8_T
+
+/* Define if the system does not provide ceilf */
+#undef ceilf
+
+/* Define to empty if `const' does not conform to ANSI C. */
+#undef const
+
+/* Define to `__inline__' or `__inline' if that's what the C compiler
+ calls it, or to nothing if 'inline' is not supported under any name. */
+#ifndef __cplusplus
+#undef inline
+#endif
+
+/* Define to the type of a signed integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+#undef int64_t
+
+/* Define to rpl_malloc if the replacement function should be used. */
+#undef malloc
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef mode_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef pid_t
+
+/* Define to rpl_realloc if the replacement function should be used. */
+#undef realloc
+
+/* Define to `unsigned int' if <sys/types.h> does not define. */
+#undef size_t
+
+/* Define to `int' if <sys/types.h> does not define. */
+#undef ssize_t
+
+/* Define to the type of an unsigned integer type of width exactly 16 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint16_t
+
+/* Define to the type of an unsigned integer type of width exactly 32 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint32_t
+
+/* Define to the type of an unsigned integer type of width exactly 64 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint64_t
+
+/* Define to the type of an unsigned integer type of width exactly 8 bits if
+ such a type exists and the standard includes do not define it. */
+#undef uint8_t
+
+/* Define as `fork' if `vfork' does not work. */
+#undef vfork
diff --git a/configure b/configure
new file mode 100755
index 0000000..7b12f18
--- /dev/null
+++ b/configure
@@ -0,0 +1,8552 @@
+#! /bin/sh
+# Guess values for system-dependent variables and create Makefiles.
+# Generated by GNU Autoconf 2.69 for ABySS 1.3.4.
+#
+# Report bugs to <abyss-users at bcgsc.ca>.
+#
+#
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+#
+#
+# This configure script is free software; the Free Software Foundation
+# gives unlimited permission to copy, distribute and modify it.
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# Use a proper internal environment variable to ensure we don't fall
+ # into an infinite loop, continuously re-executing ourselves.
+ if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+ _as_can_reexec=no; export _as_can_reexec;
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+ fi
+ # We don't want this to propagate to other subprocesses.
+ { _as_can_reexec=; unset _as_can_reexec;}
+if test "x$CONFIG_SHELL" = x; then
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
+
+exitcode=0
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
+else
+ as_have_required=no
+fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
+for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ as_found=:
+ case $as_dir in #(
+ /*)
+ for as_base in sh bash ksh sh5; do
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
+ done;;
+ esac
+ as_found=false
+done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
+IFS=$as_save_IFS
+
+
+ if test "x$CONFIG_SHELL" != x; then :
+ export CONFIG_SHELL
+ # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+ *v*x* | *x*v* ) as_opts=-vx ;;
+ *v* ) as_opts=-v ;;
+ *x* ) as_opts=-x ;;
+ * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
+fi
+
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf at gnu.org and
+$0: abyss-users at bcgsc.ca about your system, including any
+$0: error possibly output before this message. Then install
+$0: a modern shell, or manually run the script under such a
+$0: shell if you do have one."
+ fi
+ exit 1
+fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
+
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+
+ # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+ # already done that, so ensure we don't try to do so again and fall
+ # in an infinite loop. This has already happened in practice.
+ _as_can_reexec=no; export _as_can_reexec
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
+
+# Name of the host.
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# so uname gets run too.
+ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
+
+#
+# Initializations.
+#
+ac_default_prefix=/usr/local
+ac_clean_files=
+ac_config_libobj_dir=.
+LIBOBJS=
+cross_compiling=no
+subdirs=
+MFLAGS=
+MAKEFLAGS=
+
+# Identity of this package.
+PACKAGE_NAME='ABySS'
+PACKAGE_TARNAME='abyss'
+PACKAGE_VERSION='1.3.4'
+PACKAGE_STRING='ABySS 1.3.4'
+PACKAGE_BUGREPORT='abyss-users at bcgsc.ca'
+PACKAGE_URL='http://www.bcgsc.ca/platform/bioinfo/software/abyss'
+
+ac_unique_file="ABYSS/Abyss.cpp"
+# Factoring default headers for most tests.
+ac_includes_default="\
+#include <stdio.h>
+#ifdef HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+# include <sys/stat.h>
+#endif
+#ifdef STDC_HEADERS
+# include <stdlib.h>
+# include <stddef.h>
+#else
+# ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+# endif
+#endif
+#ifdef HAVE_STRING_H
+# if !defined STDC_HEADERS && defined HAVE_MEMORY_H
+# include <memory.h>
+# endif
+# include <string.h>
+#endif
+#ifdef HAVE_STRINGS_H
+# include <strings.h>
+#endif
+#ifdef HAVE_INTTYPES_H
+# include <inttypes.h>
+#endif
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#endif
+#ifdef HAVE_UNISTD_H
+# include <unistd.h>
+#endif"
+
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+AM_CXXFLAGS
+OPENMP_CXXFLAGS
+CXXCPP
+MPI_LIBS
+HAVE_LIBMPI_FALSE
+HAVE_LIBMPI_TRUE
+LIBOBJS
+EGREP
+GREP
+RANLIB
+am__fastdepCXX_FALSE
+am__fastdepCXX_TRUE
+CXXDEPMODE
+ac_ct_CXX
+CXXFLAGS
+CXX
+CPP
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+am__nodep
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
+MKDIR_P
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
+ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_dependency_tracking
+with_boost
+with_mpi
+enable_mpich
+enable_lammpi
+enable_fm
+enable_maxk
+enable_popcnt
+enable_samseqqual
+enable_openmp
+'
+ ac_precious_vars='build_alias
+host_alias
+target_alias
+CC
+CFLAGS
+LDFLAGS
+LIBS
+CPPFLAGS
+CPP
+CXX
+CXXFLAGS
+CCC
+CXXCPP'
+
+
+# Initialize some variables set by options.
+ac_init_help=
+ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
+# The variables have the same names as the options, with
+# dashes changed to underlines.
+cache_file=/dev/null
+exec_prefix=NONE
+no_create=
+no_recursion=
+prefix=NONE
+program_prefix=NONE
+program_suffix=NONE
+program_transform_name=s,x,x,
+silent=
+site=
+srcdir=
+verbose=
+x_includes=NONE
+x_libraries=NONE
+
+# Installation directory options.
+# These are left unexpanded so users can "make install exec_prefix=/foo"
+# and all the variables that are supposed to be based on exec_prefix
+# by default will actually change.
+# Use braces instead of parens because sh, perl, etc. also accept them.
+# (The list follows the same order as the GNU Coding Standards.)
+bindir='${exec_prefix}/bin'
+sbindir='${exec_prefix}/sbin'
+libexecdir='${exec_prefix}/libexec'
+datarootdir='${prefix}/share'
+datadir='${datarootdir}'
+sysconfdir='${prefix}/etc'
+sharedstatedir='${prefix}/com'
+localstatedir='${prefix}/var'
+includedir='${prefix}/include'
+oldincludedir='/usr/include'
+docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
+infodir='${datarootdir}/info'
+htmldir='${docdir}'
+dvidir='${docdir}'
+pdfdir='${docdir}'
+psdir='${docdir}'
+libdir='${exec_prefix}/lib'
+localedir='${datarootdir}/locale'
+mandir='${datarootdir}/man'
+
+ac_prev=
+ac_dashdash=
+for ac_option
+do
+ # If the previous option needs an argument, assign it.
+ if test -n "$ac_prev"; then
+ eval $ac_prev=\$ac_option
+ ac_prev=
+ continue
+ fi
+
+ case $ac_option in
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
+ esac
+
+ # Accept the important Cygnus configure options, so we can diagnose typos.
+
+ case $ac_dashdash$ac_option in
+ --)
+ ac_dashdash=yes ;;
+
+ -bindir | --bindir | --bindi | --bind | --bin | --bi)
+ ac_prev=bindir ;;
+ -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
+ bindir=$ac_optarg ;;
+
+ -build | --build | --buil | --bui | --bu)
+ ac_prev=build_alias ;;
+ -build=* | --build=* | --buil=* | --bui=* | --bu=*)
+ build_alias=$ac_optarg ;;
+
+ -cache-file | --cache-file | --cache-fil | --cache-fi \
+ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
+ ac_prev=cache_file ;;
+ -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
+ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
+ cache_file=$ac_optarg ;;
+
+ --config-cache | -C)
+ cache_file=config.cache ;;
+
+ -datadir | --datadir | --datadi | --datad)
+ ac_prev=datadir ;;
+ -datadir=* | --datadir=* | --datadi=* | --datad=*)
+ datadir=$ac_optarg ;;
+
+ -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
+ | --dataroo | --dataro | --datar)
+ ac_prev=datarootdir ;;
+ -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
+ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
+ datarootdir=$ac_optarg ;;
+
+ -disable-* | --disable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
+
+ -docdir | --docdir | --docdi | --doc | --do)
+ ac_prev=docdir ;;
+ -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
+ docdir=$ac_optarg ;;
+
+ -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
+ ac_prev=dvidir ;;
+ -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
+ dvidir=$ac_optarg ;;
+
+ -enable-* | --enable-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
+
+ -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
+ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
+ | --exec | --exe | --ex)
+ ac_prev=exec_prefix ;;
+ -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
+ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
+ | --exec=* | --exe=* | --ex=*)
+ exec_prefix=$ac_optarg ;;
+
+ -gas | --gas | --ga | --g)
+ # Obsolete; use --with-gas.
+ with_gas=yes ;;
+
+ -help | --help | --hel | --he | -h)
+ ac_init_help=long ;;
+ -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
+ ac_init_help=recursive ;;
+ -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
+ ac_init_help=short ;;
+
+ -host | --host | --hos | --ho)
+ ac_prev=host_alias ;;
+ -host=* | --host=* | --hos=* | --ho=*)
+ host_alias=$ac_optarg ;;
+
+ -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
+ ac_prev=htmldir ;;
+ -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
+ | --ht=*)
+ htmldir=$ac_optarg ;;
+
+ -includedir | --includedir | --includedi | --included | --include \
+ | --includ | --inclu | --incl | --inc)
+ ac_prev=includedir ;;
+ -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
+ | --includ=* | --inclu=* | --incl=* | --inc=*)
+ includedir=$ac_optarg ;;
+
+ -infodir | --infodir | --infodi | --infod | --info | --inf)
+ ac_prev=infodir ;;
+ -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
+ infodir=$ac_optarg ;;
+
+ -libdir | --libdir | --libdi | --libd)
+ ac_prev=libdir ;;
+ -libdir=* | --libdir=* | --libdi=* | --libd=*)
+ libdir=$ac_optarg ;;
+
+ -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
+ | --libexe | --libex | --libe)
+ ac_prev=libexecdir ;;
+ -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
+ | --libexe=* | --libex=* | --libe=*)
+ libexecdir=$ac_optarg ;;
+
+ -localedir | --localedir | --localedi | --localed | --locale)
+ ac_prev=localedir ;;
+ -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
+ localedir=$ac_optarg ;;
+
+ -localstatedir | --localstatedir | --localstatedi | --localstated \
+ | --localstate | --localstat | --localsta | --localst | --locals)
+ ac_prev=localstatedir ;;
+ -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
+ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
+ localstatedir=$ac_optarg ;;
+
+ -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
+ ac_prev=mandir ;;
+ -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
+ mandir=$ac_optarg ;;
+
+ -nfp | --nfp | --nf)
+ # Obsolete; use --without-fp.
+ with_fp=no ;;
+
+ -no-create | --no-create | --no-creat | --no-crea | --no-cre \
+ | --no-cr | --no-c | -n)
+ no_create=yes ;;
+
+ -no-recursion | --no-recursion | --no-recursio | --no-recursi \
+ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
+ no_recursion=yes ;;
+
+ -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
+ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
+ | --oldin | --oldi | --old | --ol | --o)
+ ac_prev=oldincludedir ;;
+ -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
+ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
+ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
+ oldincludedir=$ac_optarg ;;
+
+ -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
+ ac_prev=prefix ;;
+ -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
+ prefix=$ac_optarg ;;
+
+ -program-prefix | --program-prefix | --program-prefi | --program-pref \
+ | --program-pre | --program-pr | --program-p)
+ ac_prev=program_prefix ;;
+ -program-prefix=* | --program-prefix=* | --program-prefi=* \
+ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
+ program_prefix=$ac_optarg ;;
+
+ -program-suffix | --program-suffix | --program-suffi | --program-suff \
+ | --program-suf | --program-su | --program-s)
+ ac_prev=program_suffix ;;
+ -program-suffix=* | --program-suffix=* | --program-suffi=* \
+ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
+ program_suffix=$ac_optarg ;;
+
+ -program-transform-name | --program-transform-name \
+ | --program-transform-nam | --program-transform-na \
+ | --program-transform-n | --program-transform- \
+ | --program-transform | --program-transfor \
+ | --program-transfo | --program-transf \
+ | --program-trans | --program-tran \
+ | --progr-tra | --program-tr | --program-t)
+ ac_prev=program_transform_name ;;
+ -program-transform-name=* | --program-transform-name=* \
+ | --program-transform-nam=* | --program-transform-na=* \
+ | --program-transform-n=* | --program-transform-=* \
+ | --program-transform=* | --program-transfor=* \
+ | --program-transfo=* | --program-transf=* \
+ | --program-trans=* | --program-tran=* \
+ | --progr-tra=* | --program-tr=* | --program-t=*)
+ program_transform_name=$ac_optarg ;;
+
+ -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
+ ac_prev=pdfdir ;;
+ -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
+ pdfdir=$ac_optarg ;;
+
+ -psdir | --psdir | --psdi | --psd | --ps)
+ ac_prev=psdir ;;
+ -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
+ psdir=$ac_optarg ;;
+
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ silent=yes ;;
+
+ -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
+ ac_prev=sbindir ;;
+ -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
+ | --sbi=* | --sb=*)
+ sbindir=$ac_optarg ;;
+
+ -sharedstatedir | --sharedstatedir | --sharedstatedi \
+ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
+ | --sharedst | --shareds | --shared | --share | --shar \
+ | --sha | --sh)
+ ac_prev=sharedstatedir ;;
+ -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
+ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
+ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
+ | --sha=* | --sh=*)
+ sharedstatedir=$ac_optarg ;;
+
+ -site | --site | --sit)
+ ac_prev=site ;;
+ -site=* | --site=* | --sit=*)
+ site=$ac_optarg ;;
+
+ -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
+ ac_prev=srcdir ;;
+ -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
+ srcdir=$ac_optarg ;;
+
+ -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
+ | --syscon | --sysco | --sysc | --sys | --sy)
+ ac_prev=sysconfdir ;;
+ -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
+ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
+ sysconfdir=$ac_optarg ;;
+
+ -target | --target | --targe | --targ | --tar | --ta | --t)
+ ac_prev=target_alias ;;
+ -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
+ target_alias=$ac_optarg ;;
+
+ -v | -verbose | --verbose | --verbos | --verbo | --verb)
+ verbose=yes ;;
+
+ -version | --version | --versio | --versi | --vers | -V)
+ ac_init_version=: ;;
+
+ -with-* | --with-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
+
+ -without-* | --without-*)
+ ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ # Reject names that are not valid shell variable names.
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
+
+ --x)
+ # Obsolete; use --with-x.
+ with_x=yes ;;
+
+ -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
+ | --x-incl | --x-inc | --x-in | --x-i)
+ ac_prev=x_includes ;;
+ -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
+ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
+ x_includes=$ac_optarg ;;
+
+ -x-libraries | --x-libraries | --x-librarie | --x-librari \
+ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
+ ac_prev=x_libraries ;;
+ -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
+ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
+ x_libraries=$ac_optarg ;;
+
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
+ ;;
+
+ *=*)
+ ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
+ # Reject names that are not valid shell variable names.
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
+ eval $ac_envvar=\$ac_optarg
+ export $ac_envvar ;;
+
+ *)
+ # FIXME: should be removed in autoconf 3.0.
+ $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ ;;
+
+ esac
+done
+
+if test -n "$ac_prev"; then
+ ac_option=--`echo $ac_prev | sed 's/_/-/g'`
+ as_fn_error $? "missing argument to $ac_option"
+fi
+
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
+for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
+ datadir sysconfdir sharedstatedir localstatedir includedir \
+ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
+ libdir localedir mandir
+do
+ eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
+ case $ac_val in
+ [\\/$]* | ?:[\\/]* ) continue;;
+ NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
+ esac
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+done
+
+# There might be people who depend on the old broken behavior: `$host'
+# used to hold the argument of --host etc.
+# FIXME: To remove some day.
+build=$build_alias
+host=$host_alias
+target=$target_alias
+
+# FIXME: To remove some day.
+if test "x$host_alias" != x; then
+ if test "x$build_alias" = x; then
+ cross_compiling=maybe
+ elif test "x$build_alias" != "x$host_alias"; then
+ cross_compiling=yes
+ fi
+fi
+
+ac_tool_prefix=
+test -n "$host_alias" && ac_tool_prefix=$host_alias-
+
+test "$silent" = yes && exec 6>/dev/null
+
+
+ac_pwd=`pwd` && test -n "$ac_pwd" &&
+ac_ls_di=`ls -di .` &&
+ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
+ as_fn_error $? "working directory cannot be determined"
+test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
+ as_fn_error $? "pwd does not report name of working directory"
+
+
+# Find the source files, if location was not specified.
+if test -z "$srcdir"; then
+ ac_srcdir_defaulted=yes
+ # Try the directory containing this script, then the parent directory.
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ srcdir=$ac_confdir
+ if test ! -r "$srcdir/$ac_unique_file"; then
+ srcdir=..
+ fi
+else
+ ac_srcdir_defaulted=no
+fi
+if test ! -r "$srcdir/$ac_unique_file"; then
+ test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+fi
+ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
+ac_abs_confdir=`(
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ pwd)`
+# When building in place, set srcdir=.
+if test "$ac_abs_confdir" = "$ac_pwd"; then
+ srcdir=.
+fi
+# Remove unnecessary trailing slashes from srcdir.
+# Double slashes in file names in object file debugging info
+# mess up M-x gdb in Emacs.
+case $srcdir in
+*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
+esac
+for ac_var in $ac_precious_vars; do
+ eval ac_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_env_${ac_var}_value=\$${ac_var}
+ eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
+ eval ac_cv_env_${ac_var}_value=\$${ac_var}
+done
+
+#
+# Report the --help message.
+#
+if test "$ac_init_help" = "long"; then
+ # Omit some internal or obsolete options to make the list less imposing.
+ # This message is too long to be a string in the A/UX 3.1 sh.
+ cat <<_ACEOF
+\`configure' configures ABySS 1.3.4 to adapt to many kinds of systems.
+
+Usage: $0 [OPTION]... [VAR=VALUE]...
+
+To assign environment variables (e.g., CC, CFLAGS...), specify them as
+VAR=VALUE. See below for descriptions of some of the useful variables.
+
+Defaults for the options are specified in brackets.
+
+Configuration:
+ -h, --help display this help and exit
+ --help=short display options specific to this package
+ --help=recursive display the short help of all the included packages
+ -V, --version display version information and exit
+ -q, --quiet, --silent do not print \`checking ...' messages
+ --cache-file=FILE cache test results in FILE [disabled]
+ -C, --config-cache alias for \`--cache-file=config.cache'
+ -n, --no-create do not create output files
+ --srcdir=DIR find the sources in DIR [configure dir or \`..']
+
+Installation directories:
+ --prefix=PREFIX install architecture-independent files in PREFIX
+ [$ac_default_prefix]
+ --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
+ [PREFIX]
+
+By default, \`make install' will install all the files in
+\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
+an installation prefix other than \`$ac_default_prefix' using \`--prefix',
+for instance \`--prefix=\$HOME'.
+
+For better control, use the options below.
+
+Fine tuning of the installation directories:
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/abyss]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
+_ACEOF
+
+ cat <<\_ACEOF
+
+Program names:
+ --program-prefix=PREFIX prepend PREFIX to installed program names
+ --program-suffix=SUFFIX append SUFFIX to installed program names
+ --program-transform-name=PROGRAM run sed PROGRAM on installed program names
+_ACEOF
+fi
+
+if test -n "$ac_init_help"; then
+ case $ac_init_help in
+ short | recursive ) echo "Configuration of ABySS 1.3.4:";;
+ esac
+ cat <<\_ACEOF
+
+Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
+ --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
+ --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
+ --enable-dependency-tracking
+ do not reject slow dependency extractors
+ --disable-dependency-tracking
+ speeds up one-time build
+ --enable-mpich use MPICH (default is to use Open MPI)
+ --enable-lammpi use LAM/MPI (default is to use Open MPI)
+ --enable-fm specify the width of the FM-index in bits (default
+ is 64-bit)
+ --enable-maxk=N set the maximum k-mer length (default is 64)
+ --disable-popcnt do not use the popcnt instruction
+ --enable-samseqqual enable SAM sequence and quality fields
+ --disable-openmp do not use OpenMP
+
+Optional Packages:
+ --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
+ --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
+ --with-boost=PATH specify directory for the boost header files
+ --with-mpi=PATH specify prefix directory for the installed MPI
+ parallel computing library
+
+Some influential environment variables:
+ CC C compiler command
+ CFLAGS C compiler flags
+ LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
+ nonstandard directory <lib dir>
+ LIBS libraries to pass to the linker, e.g. -l<library>
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ you have headers in a nonstandard directory <include dir>
+ CPP C preprocessor
+ CXX C++ compiler command
+ CXXFLAGS C++ compiler flags
+ CXXCPP C++ preprocessor
+
+Use these variables to override the choices made by `configure' or to help
+it to find libraries and programs with nonstandard names/locations.
+
+Report bugs to <abyss-users at bcgsc.ca>.
+ABySS home page: <http://www.bcgsc.ca/platform/bioinfo/software/abyss>.
+_ACEOF
+ac_status=$?
+fi
+
+if test "$ac_init_help" = "recursive"; then
+ # If there are subdirs, report their specific --help.
+ for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+ cd "$ac_dir" || { ac_status=$?; continue; }
+ # Check for guested configure.
+ if test -f "$ac_srcdir/configure.gnu"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure.gnu" --help=recursive
+ elif test -f "$ac_srcdir/configure"; then
+ echo &&
+ $SHELL "$ac_srcdir/configure" --help=recursive
+ else
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ fi || ac_status=$?
+ cd "$ac_pwd" || { ac_status=$?; break; }
+ done
+fi
+
+test -n "$ac_init_help" && exit $ac_status
+if $ac_init_version; then
+ cat <<\_ACEOF
+ABySS configure 1.3.4
+generated by GNU Autoconf 2.69
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This configure script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it.
+_ACEOF
+ exit
+fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_cxx_try_compile LINENO
+# ----------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_compile
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ----------------------------------- ##
+## Report this to abyss-users at bcgsc.ca ##
+## ----------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_find_intX_t LINENO BITS VAR
+# -----------------------------------
+# Finds a signed integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_intX_t ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5
+$as_echo_n "checking for int$2_t... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ # Order is important - never check a type that is potentially smaller
+ # than half of the expected target width.
+ for ac_type in int$2_t 'int' 'long int' \
+ 'long long int' 'short int' 'signed char'; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+ enum { N = $2 / 2 - 1 };
+int
+main ()
+{
+static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+ enum { N = $2 / 2 - 1 };
+int
+main ()
+{
+static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1)
+ < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ case $ac_type in #(
+ int$2_t) :
+ eval "$3=yes" ;; #(
+ *) :
+ eval "$3=\$ac_type" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if eval test \"x\$"$3"\" = x"no"; then :
+
+else
+ break
+fi
+ done
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_find_intX_t
+
+# ac_fn_c_find_uintX_t LINENO BITS VAR
+# ------------------------------------
+# Finds an unsigned integer type with width BITS, setting cache variable VAR
+# accordingly.
+ac_fn_c_find_uintX_t ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5
+$as_echo_n "checking for uint$2_t... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ # Order is important - never check a type that is potentially smaller
+ # than half of the expected target width.
+ for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \
+ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)];
+test_array [0] = 0;
+return test_array [0];
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ case $ac_type in #(
+ uint$2_t) :
+ eval "$3=yes" ;; #(
+ *) :
+ eval "$3=\$ac_type" ;;
+esac
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if eval test \"x\$"$3"\" = x"no"; then :
+
+else
+ break
+fi
+ done
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_find_uintX_t
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
+# ---------------------------------------------
+# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
+# accordingly.
+ac_fn_c_check_decl ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ as_decl_name=`echo $2|sed 's/ *(.*//'`
+ as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
+$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+#ifndef $as_decl_name
+#ifdef __cplusplus
+ (void) $as_decl_use;
+#else
+ (void) $as_decl_name;
+#endif
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_c_check_decl
+
+# ac_fn_cxx_try_link LINENO
+# -------------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ test -x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_link
+
+# ac_fn_cxx_try_cpp LINENO
+# ------------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_cxx_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+ as_fn_set_status $ac_retval
+
+} # ac_fn_cxx_try_cpp
+
+# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES
+# ---------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_cxx_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval \${$3+:} false; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ----------------------------------- ##
+## Report this to abyss-users at bcgsc.ca ##
+## ----------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval \${$3+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
+
+} # ac_fn_cxx_check_header_mongrel
+cat >config.log <<_ACEOF
+This file contains any messages produced by compilers while
+running configure, to aid debugging if configure makes a mistake.
+
+It was created by ABySS $as_me 1.3.4, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ $ $0 $@
+
+_ACEOF
+exec 5>>config.log
+{
+cat <<_ASUNAME
+## --------- ##
+## Platform. ##
+## --------- ##
+
+hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
+uname -m = `(uname -m) 2>/dev/null || echo unknown`
+uname -r = `(uname -r) 2>/dev/null || echo unknown`
+uname -s = `(uname -s) 2>/dev/null || echo unknown`
+uname -v = `(uname -v) 2>/dev/null || echo unknown`
+
+/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
+/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown`
+
+/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown`
+/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown`
+/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
+/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown`
+/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown`
+/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown`
+/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown`
+
+_ASUNAME
+
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ $as_echo "PATH: $as_dir"
+ done
+IFS=$as_save_IFS
+
+} >&5
+
+cat >&5 <<_ACEOF
+
+
+## ----------- ##
+## Core tests. ##
+## ----------- ##
+
+_ACEOF
+
+
+# Keep a trace of the command line.
+# Strip out --no-create and --no-recursion so they do not pile up.
+# Strip out --silent because we don't want to record it for future runs.
+# Also quote any args containing shell meta-characters.
+# Make two passes to allow for proper duplicate-argument suppression.
+ac_configure_args=
+ac_configure_args0=
+ac_configure_args1=
+ac_must_keep_next=false
+for ac_pass in 1 2
+do
+ for ac_arg
+ do
+ case $ac_arg in
+ -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil)
+ continue ;;
+ *\'*)
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ case $ac_pass in
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 2)
+ as_fn_append ac_configure_args1 " '$ac_arg'"
+ if test $ac_must_keep_next = true; then
+ ac_must_keep_next=false # Got value, back to normal.
+ else
+ case $ac_arg in
+ *=* | --config-cache | -C | -disable-* | --disable-* \
+ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
+ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
+ | -with-* | --with-* | -without-* | --without-* | --x)
+ case "$ac_configure_args0 " in
+ "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
+ esac
+ ;;
+ -* ) ac_must_keep_next=true ;;
+ esac
+ fi
+ as_fn_append ac_configure_args " '$ac_arg'"
+ ;;
+ esac
+ done
+done
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
+
+# When interrupted or exit'd, cleanup temporary files, and complete
+# config.log. We remove comments because anyway the quotes in there
+# would cause problems or look ugly.
+# WARNING: Use '\'' to represent an apostrophe within the trap.
+# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
+trap 'exit_status=$?
+ # Save into config.log some information that might help in debugging.
+ {
+ echo
+
+ $as_echo "## ---------------- ##
+## Cache variables. ##
+## ---------------- ##"
+ echo
+ # The following way of writing the cache mishandles newlines in values,
+(
+ for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+ (set) 2>&1 |
+ case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ sed -n \
+ "s/'\''/'\''\\\\'\'''\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
+ ;; #(
+ *)
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+)
+ echo
+
+ $as_echo "## ----------------- ##
+## Output variables. ##
+## ----------------- ##"
+ echo
+ for ac_var in $ac_subst_vars
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+
+ if test -n "$ac_subst_files"; then
+ $as_echo "## ------------------- ##
+## File substitutions. ##
+## ------------------- ##"
+ echo
+ for ac_var in $ac_subst_files
+ do
+ eval ac_val=\$$ac_var
+ case $ac_val in
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ esac
+ $as_echo "$ac_var='\''$ac_val'\''"
+ done | sort
+ echo
+ fi
+
+ if test -s confdefs.h; then
+ $as_echo "## ----------- ##
+## confdefs.h. ##
+## ----------- ##"
+ echo
+ cat confdefs.h
+ echo
+ fi
+ test "$ac_signal" != 0 &&
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
+ } >&5
+ rm -f core *.core core.conftest.* &&
+ rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
+ exit $exit_status
+' 0
+for ac_signal in 1 2 13 15; do
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+done
+ac_signal=0
+
+# confdefs.h avoids OS command line length limits that DEFS can exceed.
+rm -f -r conftest* confdefs.h
+
+$as_echo "/* confdefs.h */" > confdefs.h
+
+# Predefined preprocessor variables.
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_NAME "$PACKAGE_NAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_VERSION "$PACKAGE_VERSION"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_STRING "$PACKAGE_STRING"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
+_ACEOF
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
+
+# Let the site file select an alternate cache file if it wants to.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
+if test -n "$CONFIG_SITE"; then
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
+elif test "x$prefix" != xNONE; then
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
+else
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
+fi
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+do
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ sed 's/^/| /' "$ac_site_file" >&5
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+done
+
+if test -r "$cache_file"; then
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_echo "$as_me: loading cache $cache_file" >&6;}
+ case $cache_file in
+ [\\/]* | ?:[\\/]* ) . "$cache_file";;
+ *) . "./$cache_file";;
+ esac
+ fi
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
+ >$cache_file
+fi
+
+# Check that the precious variables saved in the cache have kept the same
+# value.
+ac_cache_corrupted=false
+for ac_var in $ac_precious_vars; do
+ eval ac_old_set=\$ac_cv_env_${ac_var}_set
+ eval ac_new_set=\$ac_env_${ac_var}_set
+ eval ac_old_val=\$ac_cv_env_${ac_var}_value
+ eval ac_new_val=\$ac_env_${ac_var}_value
+ case $ac_old_set,$ac_new_set in
+ set,)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,set)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ ac_cache_corrupted=: ;;
+ ,);;
+ *)
+ if test "x$ac_old_val" != "x$ac_new_val"; then
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ fi;;
+ esac
+ # Pass precious variables to config.status.
+ if test "$ac_new_set" = set; then
+ case $ac_new_val in
+ *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *) ac_arg=$ac_var=$ac_new_val ;;
+ esac
+ case " $ac_configure_args " in
+ *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
+ *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ esac
+ fi
+done
+if $ac_cache_corrupted; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+fi
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+
+am__api_version='1.12'
+
+ac_aux_dir=
+for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
+ if test -f "$ac_dir/install-sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install-sh -c"
+ break
+ elif test -f "$ac_dir/install.sh"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/install.sh -c"
+ break
+ elif test -f "$ac_dir/shtool"; then
+ ac_aux_dir=$ac_dir
+ ac_install_sh="$ac_aux_dir/shtool install -c"
+ break
+ fi
+done
+if test -z "$ac_aux_dir"; then
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+fi
+
+# These three variables are undocumented and unsupported,
+# and are intended to be withdrawn in a future Autoconf release.
+# They can cause serious problems if a builder's source tree is in a directory
+# whose full name contains unusual characters.
+ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var.
+ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var.
+ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
+
+
+# Find a good install program. We prefer a C program (faster),
+# so one script is as good as another. But avoid the broken or
+# incompatible versions:
+# SysV /etc/install, /usr/sbin/install
+# SunOS /usr/etc/install
+# IRIX /sbin/install
+# AIX /bin/install
+# AmigaOS /C/install, which installs bootblocks on floppy discs
+# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
+# AFS /usr/afsws/bin/install, which mishandles nonexistent args
+# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
+# OS/2's system install, which has a completely different semantic
+# ./install, which can be erroneously created by make from ./install.sh.
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
+if test -z "$INSTALL"; then
+if ${ac_cv_path_install+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in #((
+ ./ | .// | /[cC]/* | \
+ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ /usr/ucb/* ) ;;
+ *)
+ # OSF1 and SCO ODT 3.0 have their own names for install.
+ # Don't use installbsd from OSF since it installs stuff as root
+ # by default.
+ for ac_prog in ginstall scoinst install; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if test $ac_prog = install &&
+ grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # AIX install. It has an incompatible calling convention.
+ :
+ elif test $ac_prog = install &&
+ grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
+ # program-specific install script used by HP pwplus--don't use.
+ :
+ else
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
+ fi
+ fi
+ done
+ done
+ ;;
+esac
+
+ done
+IFS=$as_save_IFS
+
+rm -rf conftest.one conftest.two conftest.dir
+
+fi
+ if test "${ac_cv_path_install+set}" = set; then
+ INSTALL=$ac_cv_path_install
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for INSTALL within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ INSTALL=$ac_install_sh
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
+
+# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
+# It thinks the first close brace ends the variable substitution.
+test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
+
+test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
+
+test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;;
+esac
+
+# Do 'set' in a subshell so we don't clobber the current shell's
+# arguments. Must try -L first in case configure is actually a
+# symlink; some systems play weird games with the mod time of symlinks
+# (eg FreeBSD returns the mod time of the symlink's containing
+# directory).
+if (
+ am_has_slept=no
+ for am_try in 1 2; do
+ echo "timestamp, slept: $am_has_slept" > conftest.file
+ set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ if test "$*" = "X"; then
+ # -L didn't work.
+ set X `ls -t "$srcdir/configure" conftest.file`
+ fi
+ if test "$*" != "X $srcdir/configure conftest.file" \
+ && test "$*" != "X conftest.file $srcdir/configure"; then
+
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+ alias in your environment" "$LINENO" 5
+ fi
+ if test "$2" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ am_has_slept=yes
+ done
+ test "$2" = conftest.file
+ )
+then
+ # Ok.
+ :
+else
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+ ( sleep 1 ) &
+ am_sleep_pid=$!
+fi
+
+rm -f conftest.file
+
+test "$program_prefix" != NONE &&
+ program_transform_name="s&^&$program_prefix&;$program_transform_name"
+# Use a double $ so make ignores it.
+test "$program_suffix" != NONE &&
+ program_transform_name="s&\$&$program_suffix&;$program_transform_name"
+# Double any \ or $.
+# By default was `s,x,x', remove it if useless.
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+
+# expand $ac_aux_dir to an absolute path
+am_aux_dir=`cd $ac_aux_dir && pwd`
+
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
+# Use eval to expand $SHELL
+if eval "$MISSING --run true"; then
+ am_missing_run="$MISSING --run "
+else
+ am_missing_run=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# Installed binaries are usually stripped using 'strip' when the user
+# run "make install-strip". However 'strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the 'STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
+if test -z "$MKDIR_P"; then
+ if ${ac_cv_path_mkdir+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in mkdir gmkdir; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
+ case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
+ 'mkdir (GNU coreutils) '* | \
+ 'mkdir (coreutils) '* | \
+ 'mkdir (fileutils) '4.1*)
+ ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
+ break 3;;
+ esac
+ done
+ done
+ done
+IFS=$as_save_IFS
+
+fi
+
+ test -d ./--version && rmdir ./--version
+ if test "${ac_cv_path_mkdir+set}" = set; then
+ MKDIR_P="$ac_cv_path_mkdir -p"
+ else
+ # As a last resort, use the slow shell script. Don't cache a
+ # value for MKDIR_P within a source directory, because that will
+ # break other packages using the cache if that directory is
+ # removed, or if the value is a relative name.
+ MKDIR_P="$ac_install_sh -d"
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
+
+mkdir_p="$MKDIR_P"
+case $mkdir_p in
+ [\\/$]* | ?:[\\/]*) ;;
+ */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
+esac
+
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat >conftest.make <<\_ACEOF
+SHELL = /bin/sh
+all:
+ @echo '@@@%%%=$(MAKE)=@@@%%%'
+_ACEOF
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+case `${MAKE-make} -f conftest.make 2>/dev/null` in
+ *@@@%%%=?*=@@@%%%*)
+ eval ac_cv_prog_make_${ac_make}_set=yes;;
+ *)
+ eval ac_cv_prog_make_${ac_make}_set=no;;
+esac
+rm -f conftest.make
+fi
+if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ SET_MAKE=
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ SET_MAKE="MAKE=${MAKE-make}"
+fi
+
+rm -rf .tst 2>/dev/null
+mkdir .tst 2>/dev/null
+if test -d .tst; then
+ am__leading_dot=.
+else
+ am__leading_dot=_
+fi
+rmdir .tst 2>/dev/null
+
+if test "`cd $srcdir && pwd`" != "`pwd`"; then
+ # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
+ # is not polluted with repeated "-I."
+ am__isrc=' -I$(srcdir)'
+ # test to see if srcdir already configured
+ if test -f $srcdir/config.status; then
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
+ fi
+fi
+
+# test whether we have cygpath
+if test -z "$CYGPATH_W"; then
+ if (cygpath --version) >/dev/null 2>/dev/null; then
+ CYGPATH_W='cygpath -w'
+ else
+ CYGPATH_W=echo
+ fi
+fi
+
+
+# Define the identity of the package.
+ PACKAGE='abyss'
+ VERSION='1.3.4'
+
+
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE "$PACKAGE"
+_ACEOF
+
+
+cat >>confdefs.h <<_ACEOF
+#define VERSION "$VERSION"
+_ACEOF
+
+# Some tools Automake needs.
+
+ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
+
+
+AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
+
+
+AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
+
+
+AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
+
+
+MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
+# Always define AMTAR for backward compatibility. Yes, it's still used
+# in the wild :-( We should find a proper way to deprecate it ...
+AMTAR='$${TAR-tar}'
+
+am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+
+
+
+
+
+
+ac_config_headers="$ac_config_headers config.h"
+
+
+# Checks for programs.
+for ac_prog in gawk mawk nawk awk
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_AWK+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$AWK"; then
+ ac_cv_prog_AWK="$AWK" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_AWK="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+AWK=$ac_cv_prog_AWK
+if test -n "$AWK"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$AWK" && break
+done
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_CC"; then
+ ac_ct_CC=$CC
+ # Extract the first word of "gcc", so it can be a program name with args.
+set dummy gcc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+else
+ CC="$ac_cv_prog_CC"
+fi
+
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
+set dummy ${ac_tool_prefix}cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ fi
+fi
+if test -z "$CC"; then
+ # Extract the first word of "cc", so it can be a program name with args.
+set dummy cc; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+ ac_prog_rejected=no
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
+ ac_prog_rejected=yes
+ continue
+ fi
+ ac_cv_prog_CC="cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+if test $ac_prog_rejected = yes; then
+ # We found a bogon in the path, so make sure we never use it.
+ set dummy $ac_cv_prog_CC
+ shift
+ if test $# != 0; then
+ # We chose a different compiler from the bogus one.
+ # However, it has the same basename, so the bogon will be chosen
+ # first if we set CC to just the basename; use the full file name.
+ shift
+ ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
+ fi
+fi
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CC"; then
+ ac_cv_prog_CC="$CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CC" && break
+ done
+fi
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in cl.exe
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CC+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CC"; then
+ ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CC" && break
+done
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+fi
+
+fi
+
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5; }
+
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+# Try to create an executable without -o first, disregard a.out.
+# It will help us diagnose broken compilers, and finding out an intuition
+# of exeext.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
+ac_rmfiles=
+for ac_file in $ac_files
+do
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ * ) ac_rmfiles="$ac_rmfiles $ac_file";;
+ esac
+done
+rm -f $ac_rmfiles
+
+if { { ac_try="$ac_link_default"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link_default") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
+# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
+# in a Makefile. We should not override ac_cv_exeext if it was cached,
+# so that the user can short-circuit this test for compilers unknown to
+# Autoconf.
+for ac_file in $ac_files ''
+do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ ;;
+ [ab].out )
+ # We found the default executable, but exeext='' is most
+ # certainly right.
+ break;;
+ *.* )
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ then :; else
+ ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ fi
+ # We set ac_cv_exeext here because the later test for it is not
+ # safe: cross compilers may not add the suffix if given an `-o'
+ # argument, so we may need to know it at that point already.
+ # Even if this section looks crufty: it has the advantage of
+ # actually working.
+ break;;
+ * )
+ break;;
+ esac
+done
+test "$ac_cv_exeext" = no && ac_cv_exeext=
+
+else
+ ac_file=''
+fi
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
+ac_exeext=$ac_cv_exeext
+
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ # If both `conftest.exe' and `conftest' are `present' (well, observable)
+# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
+# work properly (i.e., refer to `conftest.exe'), while it won't with
+# `rm'.
+for ac_file in conftest.exe conftest conftest.*; do
+ test -f "$ac_file" || continue
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
+ break;;
+ * ) break;;
+ esac
+done
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest.$ac_ext
+EXEEXT=$ac_cv_exeext
+ac_exeext=$EXEEXT
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if ${ac_cv_objext+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.o conftest.obj
+if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
+ for ac_file in conftest.o conftest.obj conftest.*; do
+ test -f "$ac_file" || continue;
+ case $ac_file in
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
+ break;;
+ esac
+done
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+rm -f conftest.$ac_cv_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$ac_cv_objext" >&6; }
+OBJEXT=$ac_cv_objext
+ac_objext=$OBJEXT
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if ${ac_cv_c_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if ${ac_cv_prog_cc_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+else
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$ac_cv_prog_cc_g" >&6; }
+if test "$ac_test_CFLAGS" = set; then
+ CFLAGS=$ac_save_CFLAGS
+elif test $ac_cv_prog_cc_g = yes; then
+ if test "$GCC" = yes; then
+ CFLAGS="-g -O2"
+ else
+ CFLAGS="-g"
+ fi
+else
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
+ else
+ CFLAGS=
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if ${ac_cv_prog_cc_c89+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+struct stat;
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has
+ function prototypes and stuff, but not '\xHH' hex character constants.
+ These don't provoke an error unfortunately, instead are silently treated
+ as 'x'. The following induces an error, until -std is added to get
+ proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an
+ array size at least. It's necessary to write '\x00'==0 to get something
+ that's true only with -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
+
+int test (int i, double x);
+struct s1 {int (*f) (int a);};
+struct s2 {int (*f) (double a);};
+int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
+int argc;
+char **argv;
+int
+main ()
+{
+return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1];
+ ;
+ return 0;
+}
+_ACEOF
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
+
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+DEPDIR="${am__leading_dot}deps"
+
+ac_config_commands="$ac_config_commands depfiles"
+
+
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from 'make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-dependency-tracking was given.
+if test "${enable_dependency_tracking+set}" = set; then :
+ enableval=$enable_dependency_tracking;
+fi
+
+if test "x$enable_dependency_tracking" != xno; then
+ am_depcomp="$ac_aux_dir/depcomp"
+ AMDEPBACKSLASH='\'
+ am__nodep='_no'
+fi
+ if test "x$enable_dependency_tracking" != xno; then
+ AMDEP_TRUE=
+ AMDEP_FALSE='#'
+else
+ AMDEP_TRUE='#'
+ AMDEP_FALSE=
+fi
+
+
+
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CC_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CC_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CC_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CC_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
+CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
+else
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
+fi
+
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
+fi
+if test -z "$CPP"; then
+ if ${ac_cv_prog_CPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CPP=$CPP
+
+fi
+ CPP=$ac_cv_prog_CPP
+else
+ ac_cv_prog_CPP=$CPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+if test -z "$CXX"; then
+ if test -n "$CCC"; then
+ CXX=$CCC
+ else
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+ do
+ # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
+set dummy $ac_tool_prefix$ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$CXX"; then
+ ac_cv_prog_CXX="$CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CXX=$ac_cv_prog_CXX
+if test -n "$CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
+$as_echo "$CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$CXX" && break
+ done
+fi
+if test -z "$CXX"; then
+ ac_ct_CXX=$CXX
+ for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+do
+ # Extract the first word of "$ac_prog", so it can be a program name with args.
+set dummy $ac_prog; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_CXX+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_CXX"; then
+ ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_CXX="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
+if test -n "$ac_ct_CXX"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
+$as_echo "$ac_ct_CXX" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ test -n "$ac_ct_CXX" && break
+done
+
+ if test "x$ac_ct_CXX" = x; then
+ CXX="g++"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CXX=$ac_ct_CXX
+ fi
+fi
+
+ fi
+fi
+# Provide some information about the compiler.
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
+$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
+if ${ac_cv_cxx_compiler_gnu+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+#ifndef __GNUC__
+ choke me
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_compiler_gnu=yes
+else
+ ac_compiler_gnu=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
+$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GXX=yes
+else
+ GXX=
+fi
+ac_test_CXXFLAGS=${CXXFLAGS+set}
+ac_save_CXXFLAGS=$CXXFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
+$as_echo_n "checking whether $CXX accepts -g... " >&6; }
+if ${ac_cv_prog_cxx_g+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_cxx_werror_flag=$ac_cxx_werror_flag
+ ac_cxx_werror_flag=yes
+ ac_cv_prog_cxx_g=no
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_g=yes
+else
+ CXXFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+
+else
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ CXXFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_compile "$LINENO"; then :
+ ac_cv_prog_cxx_g=yes
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
+$as_echo "$ac_cv_prog_cxx_g" >&6; }
+if test "$ac_test_CXXFLAGS" = set; then
+ CXXFLAGS=$ac_save_CXXFLAGS
+elif test $ac_cv_prog_cxx_g = yes; then
+ if test "$GXX" = yes; then
+ CXXFLAGS="-g -O2"
+ else
+ CXXFLAGS="-g"
+ fi
+else
+ if test "$GXX" = yes; then
+ CXXFLAGS="-O2"
+ else
+ CXXFLAGS=
+ fi
+fi
+ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+depcc="$CXX" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if ${am_cv_CXX_dependencies_compiler_type+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
+ # We make a subdir and do the tests there. Otherwise we can end up
+ # making bogus files that we don't know about and never remove. For
+ # instance it was reported that on HP-UX the gcc test will end up
+ # making a dummy file named 'D' -- because '-MD' means "put the output
+ # in D".
+ rm -rf conftest.dir
+ mkdir conftest.dir
+ # Copy depcomp to subdir because otherwise we won't find it if we're
+ # using a relative directory.
+ cp "$am_depcomp" conftest.dir
+ cd conftest.dir
+ # We will build objects and dependencies in a subdirectory because
+ # it helps to detect inapplicable dependency modes. For instance
+ # both Tru64's cc and ICC support -MD to output dependencies as a
+ # side effect of compilation, but ICC will put the dependencies in
+ # the current directory while Tru64 will put them in the object
+ # directory.
+ mkdir sub
+
+ am_cv_CXX_dependencies_compiler_type=none
+ if test "$am_compiler_list" = ""; then
+ am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
+ fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
+ for depmode in $am_compiler_list; do
+ # Setup a source with many dependencies, because some compilers
+ # like to wrap large dependency lists on column 80 (with \), and
+ # we should not choose a depcomp mode which is confused by this.
+ #
+ # We need to recreate these files for each test, as the compiler may
+ # overwrite some of them when testing with obscure command lines.
+ # This happens at least with the AIX C compiler.
+ : > sub/conftest.c
+ for i in 1 2 3 4 5 6; do
+ echo '#include "conftst'$i'.h"' >> sub/conftest.c
+ # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with
+ # Solaris 10 /bin/sh.
+ echo '/* dummy */' > sub/conftst$i.h
+ done
+ echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+
+ # We check with '-c' and '-o' for the sake of the "dashmstdout"
+ # mode. It turns out that the SunPro C++ compiler does not properly
+ # handle '-M -o', and we need to detect this. Also, some Intel
+ # versions had trouble with output in subdirs.
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
+ case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
+ nosideeffect)
+ # After this tag, mechanisms are not by side-effect, so they'll
+ # only be used when explicitly requested.
+ if test "x$enable_dependency_tracking" = xyes; then
+ continue
+ else
+ break
+ fi
+ ;;
+ msvc7 | msvc7msys | msvisualcpp | msvcmsys)
+ # This compiler won't grok '-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
+ none) break ;;
+ esac
+ if depmode=$depmode \
+ source=sub/conftest.c object=$am__obj \
+ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
+ >/dev/null 2>conftest.err &&
+ grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj sub/conftest.Po > /dev/null 2>&1 &&
+ ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
+ # icc doesn't choke on unknown options, it will just issue warnings
+ # or remarks (even with -Werror). So we grep stderr for any message
+ # that says an option was ignored or not supported.
+ # When given -MP, icc 7.0 and 7.1 complain thusly:
+ # icc: Command line warning: ignoring option '-M'; no argument required
+ # The diagnosis changed in icc 8.0:
+ # icc: Command line remark: option '-MP' not supported
+ if (grep 'ignoring option' conftest.err ||
+ grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
+ am_cv_CXX_dependencies_compiler_type=$depmode
+ break
+ fi
+ fi
+ done
+
+ cd ..
+ rm -rf conftest.dir
+else
+ am_cv_CXX_dependencies_compiler_type=none
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CXX_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CXX_dependencies_compiler_type" >&6; }
+CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
+
+ if
+ test "x$enable_dependency_tracking" != xno \
+ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
+ am__fastdepCXX_TRUE=
+ am__fastdepCXX_FALSE='#'
+else
+ am__fastdepCXX_TRUE='#'
+ am__fastdepCXX_FALSE=
+fi
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ RANLIB=$ac_ct_RANLIB
+ fi
+else
+ RANLIB="$ac_cv_prog_RANLIB"
+fi
+
+
+# Checks for header files.
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if ${ac_cv_path_GREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -z "$GREP"; then
+ ac_path_GREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_GREP" || continue
+# Check for GNU ac_path_GREP and select it if it is found.
+ # Check for GNU $ac_path_GREP
+case `"$ac_path_GREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
+ "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_GREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_GREP="$ac_path_GREP"
+ ac_path_GREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_GREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_GREP=$GREP
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
+ GREP="$ac_cv_path_GREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if ${ac_cv_path_EGREP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
+ then ac_cv_path_EGREP="$GREP -E"
+ else
+ if test -z "$EGREP"; then
+ ac_path_EGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ as_fn_executable_p "$ac_path_EGREP" || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
+ # Check for GNU $ac_path_EGREP
+case `"$ac_path_EGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
+ "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_EGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_EGREP="$ac_path_EGREP"
+ ac_path_EGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
+esac
+
+ $ac_path_EGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
+else
+ ac_cv_path_EGREP=$EGREP
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
+ EGREP="$ac_cv_path_EGREP"
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+for ac_header in dlfcn.h fcntl.h float.h limits.h \
+ stddef.h stdint.h stdlib.h sys/param.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
+$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
+if ${ac_cv_header_stdbool_h+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #include <stdbool.h>
+ #ifndef bool
+ "error: bool is not defined"
+ #endif
+ #ifndef false
+ "error: false is not defined"
+ #endif
+ #if false
+ "error: false is not 0"
+ #endif
+ #ifndef true
+ "error: true is not defined"
+ #endif
+ #if true != 1
+ "error: true is not 1"
+ #endif
+ #ifndef __bool_true_false_are_defined
+ "error: __bool_true_false_are_defined is not defined"
+ #endif
+
+ struct s { _Bool s: 1; _Bool t; } s;
+
+ char a[true == 1 ? 1 : -1];
+ char b[false == 0 ? 1 : -1];
+ char c[__bool_true_false_are_defined == 1 ? 1 : -1];
+ char d[(bool) 0.5 == true ? 1 : -1];
+ /* See body of main program for 'e'. */
+ char f[(_Bool) 0.0 == false ? 1 : -1];
+ char g[true];
+ char h[sizeof (_Bool)];
+ char i[sizeof s.t];
+ enum { j = false, k = true, l = false * true, m = true * 256 };
+ /* The following fails for
+ HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
+ _Bool n[m];
+ char o[sizeof n == m * sizeof n[0] ? 1 : -1];
+ char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
+ /* Catch a bug in an HP-UX C compiler. See
+ http://gcc.gnu.org/ml/gcc-patches/2003-12/msg02303.html
+ http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00161.html
+ */
+ _Bool q = true;
+ _Bool *pq = &q;
+
+int
+main ()
+{
+
+ bool e = &s;
+ *pq |= q;
+ *pq |= ! q;
+ /* Refer to every declared value, to avoid compiler optimizations. */
+ return (!a + !b + !c + !d + !e + !f + !g + !h + !i + !!j + !k + !!l
+ + !m + !n + !o + !p + !q + !pq);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdbool_h=yes
+else
+ ac_cv_header_stdbool_h=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
+$as_echo "$ac_cv_header_stdbool_h" >&6; }
+ ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
+if test "x$ac_cv_type__Bool" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE__BOOL 1
+_ACEOF
+
+
+fi
+
+
+if test $ac_cv_header_stdbool_h = yes; then
+
+$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if ${ac_cv_header_stdc+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_header_stdc=yes
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then :
+ :
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
+
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+
+else
+ ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+
+fi
+
+
+# Checks for typedefs, structures, and compiler characteristics.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if ${ac_cv_c_bigendian+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_bigendian=unknown
+ # See if we're dealing with a universal compiler.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __APPLE_CC__
+ not a universal capable compiler
+ #endif
+ typedef int dummy;
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ # Check for potential -arch flags. It is not universal unless
+ # there are at least two -arch flags with different values.
+ ac_arch=
+ ac_prev=
+ for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+ if test -n "$ac_prev"; then
+ case $ac_word in
+ i?86 | x86_64 | ppc | ppc64)
+ if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+ ac_arch=$ac_word
+ else
+ ac_cv_c_bigendian=universal
+ break
+ fi
+ ;;
+ esac
+ ac_prev=
+ elif test "x$ac_word" = "x-arch"; then
+ ac_prev=arch
+ fi
+ done
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if sys/param.h defines the BYTE_ORDER macro.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/param.h>
+
+int
+main ()
+{
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+ && LITTLE_ENDIAN)
+ bogus endian macros
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ # It does; now see whether it defined to BIG_ENDIAN or not.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <sys/types.h>
+ #include <sys/param.h>
+
+int
+main ()
+{
+#if BYTE_ORDER != BIG_ENDIAN
+ not big endian
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_bigendian=yes
+else
+ ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+
+int
+main ()
+{
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+ bogus endian macros
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ # It does; now see whether it defined to _BIG_ENDIAN or not.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
+
+int
+main ()
+{
+#ifndef _BIG_ENDIAN
+ not big endian
+ #endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_bigendian=yes
+else
+ ac_cv_c_bigendian=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ if test $ac_cv_c_bigendian = unknown; then
+ # Compile a test program.
+ if test "$cross_compiling" = yes; then :
+ # Try to guess by grepping values from an object file.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+short int ascii_mm[] =
+ { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+ short int ascii_ii[] =
+ { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+ int use_ascii (int i) {
+ return ascii_mm[i] + ascii_ii[i];
+ }
+ short int ebcdic_ii[] =
+ { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+ short int ebcdic_mm[] =
+ { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+ int use_ebcdic (int i) {
+ return ebcdic_mm[i] + ebcdic_ii[i];
+ }
+ extern int foo;
+
+int
+main ()
+{
+return use_ascii (foo) == use_ebcdic (foo);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
+ ac_cv_c_bigendian=yes
+ fi
+ if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
+ fi
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long int l;
+ char c[sizeof (long int)];
+ } u;
+ u.l = 1;
+ return u.c[sizeof (long int) - 1] == 1;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_c_bigendian=no
+else
+ ac_cv_c_bigendian=yes
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+ yes)
+ $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
+;; #(
+ no)
+ ;; #(
+ universal)
+
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+
+ ;; #(
+ *)
+ as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if ${ac_cv_c_const+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+#ifndef __cplusplus
+ /* Ultrix mips cc rejects this sort of thing. */
+ typedef int charset[2];
+ const charset cs = { 0, 0 };
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* NEC SVR4.0.2 mips cc rejects this. */
+ struct point {int x, y;};
+ static struct point const zero = {0,0};
+ /* AIX XL C 1.02.0.0 rejects this.
+ It does not let you subtract one const X* pointer from another in
+ an arm of an if-expression whose if-part is not a constant
+ expression */
+ const char *g = "string";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this sort of thing. */
+ char tx;
+ char *t = &tx;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 0;
+ }
+ { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */
+ int x[] = {25, 17};
+ const int *foo = &x[0];
+ ++foo;
+ }
+ { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */
+ typedef const int *iptr;
+ iptr p = 0;
+ ++p;
+ }
+ { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying
+ "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */
+ struct s { int j; const int *ap[3]; } bx;
+ struct s *b = &bx; b->j = 5;
+ }
+ { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */
+ const int foo = 10;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+
+$as_echo "#define const /**/" >>confdefs.h
+
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
+ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
+if test "x$ac_cv_type_ptrdiff_t" = xyes; then :
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_PTRDIFF_T 1
+_ACEOF
+
+
+fi
+
+ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default"
+if test "x$ac_cv_type_mode_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define mode_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default"
+if test "x$ac_cv_type_pid_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define pid_t int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define size_t unsigned int
+_ACEOF
+
+fi
+
+ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default"
+if test "x$ac_cv_type_ssize_t" = xyes; then :
+
+else
+
+cat >>confdefs.h <<_ACEOF
+#define ssize_t int
+_ACEOF
+
+fi
+
+ac_fn_c_find_intX_t "$LINENO" "64" "ac_cv_c_int64_t"
+case $ac_cv_c_int64_t in #(
+ no|yes) ;; #(
+ *)
+
+cat >>confdefs.h <<_ACEOF
+#define int64_t $ac_cv_c_int64_t
+_ACEOF
+;;
+esac
+
+ac_fn_c_find_uintX_t "$LINENO" "8" "ac_cv_c_uint8_t"
+case $ac_cv_c_uint8_t in #(
+ no|yes) ;; #(
+ *)
+
+$as_echo "#define _UINT8_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint8_t $ac_cv_c_uint8_t
+_ACEOF
+;;
+ esac
+
+ac_fn_c_find_uintX_t "$LINENO" "16" "ac_cv_c_uint16_t"
+case $ac_cv_c_uint16_t in #(
+ no|yes) ;; #(
+ *)
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint16_t $ac_cv_c_uint16_t
+_ACEOF
+;;
+ esac
+
+ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t"
+case $ac_cv_c_uint32_t in #(
+ no|yes) ;; #(
+ *)
+
+$as_echo "#define _UINT32_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint32_t $ac_cv_c_uint32_t
+_ACEOF
+;;
+ esac
+
+ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t"
+case $ac_cv_c_uint64_t in #(
+ no|yes) ;; #(
+ *)
+
+$as_echo "#define _UINT64_T 1" >>confdefs.h
+
+
+cat >>confdefs.h <<_ACEOF
+#define uint64_t $ac_cv_c_uint64_t
+_ACEOF
+;;
+ esac
+
+
+# Checks for library functions.
+for ac_func in dup2 gethostname getopt_long getpagesize \
+ memset strdup strerror strtoul
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+for ac_header in vfork.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default"
+if test "x$ac_cv_header_vfork_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_VFORK_H 1
+_ACEOF
+
+fi
+
+done
+
+for ac_func in fork vfork
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+if test "x$ac_cv_func_fork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5
+$as_echo_n "checking for working fork... " >&6; }
+if ${ac_cv_func_fork_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_fork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* By Ruediger Kuhlmann. */
+ return fork () < 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_fork_works=yes
+else
+ ac_cv_func_fork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5
+$as_echo "$ac_cv_func_fork_works" >&6; }
+
+else
+ ac_cv_func_fork_works=$ac_cv_func_fork
+fi
+if test "x$ac_cv_func_fork_works" = xcross; then
+ case $host in
+ *-*-amigaos* | *-*-msdosdjgpp*)
+ # Override, as these systems have only a dummy fork() stub
+ ac_cv_func_fork_works=no
+ ;;
+ *)
+ ac_cv_func_fork_works=yes
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;}
+fi
+ac_cv_func_vfork_works=$ac_cv_func_vfork
+if test "x$ac_cv_func_vfork" = xyes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5
+$as_echo_n "checking for working vfork... " >&6; }
+if ${ac_cv_func_vfork_works+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_vfork_works=cross
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Thanks to Paul Eggert for this test. */
+$ac_includes_default
+#include <sys/wait.h>
+#ifdef HAVE_VFORK_H
+# include <vfork.h>
+#endif
+/* On some sparc systems, changes by the child to local and incoming
+ argument registers are propagated back to the parent. The compiler
+ is told about this with #include <vfork.h>, but some compilers
+ (e.g. gcc -O) don't grok <vfork.h>. Test for this by using a
+ static variable whose address is put into a register that is
+ clobbered by the vfork. */
+static void
+#ifdef __cplusplus
+sparc_address_test (int arg)
+# else
+sparc_address_test (arg) int arg;
+#endif
+{
+ static pid_t child;
+ if (!child) {
+ child = vfork ();
+ if (child < 0) {
+ perror ("vfork");
+ _exit(2);
+ }
+ if (!child) {
+ arg = getpid();
+ write(-1, "", 0);
+ _exit (arg);
+ }
+ }
+}
+
+int
+main ()
+{
+ pid_t parent = getpid ();
+ pid_t child;
+
+ sparc_address_test (0);
+
+ child = vfork ();
+
+ if (child == 0) {
+ /* Here is another test for sparc vfork register problems. This
+ test uses lots of local variables, at least as many local
+ variables as main has allocated so far including compiler
+ temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris
+ 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should
+ reuse the register of parent for one of the local variables,
+ since it will think that parent can't possibly be used any more
+ in this routine. Assigning to the local variable will thus
+ munge parent in the parent process. */
+ pid_t
+ p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(),
+ p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid();
+ /* Convince the compiler that p..p7 are live; otherwise, it might
+ use the same hardware register for all 8 local variables. */
+ if (p != p1 || p != p2 || p != p3 || p != p4
+ || p != p5 || p != p6 || p != p7)
+ _exit(1);
+
+ /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent
+ from child file descriptors. If the child closes a descriptor
+ before it execs or exits, this munges the parent's descriptor
+ as well. Test for this by closing stdout in the child. */
+ _exit(close(fileno(stdout)) != 0);
+ } else {
+ int status;
+ struct stat st;
+
+ while (wait(&status) != child)
+ ;
+ return (
+ /* Was there some problem with vforking? */
+ child < 0
+
+ /* Did the child fail? (This shouldn't happen.) */
+ || status
+
+ /* Did the vfork/compiler bug occur? */
+ || parent != getpid()
+
+ /* Did the file descriptor bug occur? */
+ || fstat(fileno(stdout), &st) != 0
+ );
+ }
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_vfork_works=yes
+else
+ ac_cv_func_vfork_works=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5
+$as_echo "$ac_cv_func_vfork_works" >&6; }
+
+fi;
+if test "x$ac_cv_func_fork_works" = xcross; then
+ ac_cv_func_vfork_works=$ac_cv_func_vfork
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5
+$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;}
+fi
+
+if test "x$ac_cv_func_vfork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h
+
+else
+
+$as_echo "#define vfork fork" >>confdefs.h
+
+fi
+if test "x$ac_cv_func_fork_works" = xyes; then
+
+$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h
+
+fi
+
+for ac_header in stdlib.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdlib_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STDLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5
+$as_echo_n "checking for GNU libc compatible malloc... " >&6; }
+if ${ac_cv_func_malloc_0_nonnull+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_malloc_0_nonnull=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *malloc ();
+#endif
+
+int
+main ()
+{
+return ! malloc (0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_malloc_0_nonnull=yes
+else
+ ac_cv_func_malloc_0_nonnull=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5
+$as_echo "$ac_cv_func_malloc_0_nonnull" >&6; }
+if test $ac_cv_func_malloc_0_nonnull = yes; then :
+
+$as_echo "#define HAVE_MALLOC 1" >>confdefs.h
+
+else
+ $as_echo "#define HAVE_MALLOC 0" >>confdefs.h
+
+ case " $LIBOBJS " in
+ *" malloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS malloc.$ac_objext"
+ ;;
+esac
+
+
+$as_echo "#define malloc rpl_malloc" >>confdefs.h
+
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
+$as_echo_n "checking for working memcmp... " >&6; }
+if ${ac_cv_func_memcmp_working+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_memcmp_working=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+
+ /* Some versions of memcmp are not 8-bit clean. */
+ char c0 = '\100', c1 = '\200', c2 = '\201';
+ if (memcmp(&c0, &c2, 1) >= 0 || memcmp(&c1, &c2, 1) >= 0)
+ return 1;
+
+ /* The Next x86 OpenStep bug shows up only when comparing 16 bytes
+ or more and with at least one buffer not starting on a 4-byte boundary.
+ William Lewis provided this test program. */
+ {
+ char foo[21];
+ char bar[21];
+ int i;
+ for (i = 0; i < 4; i++)
+ {
+ char *a = foo + i;
+ char *b = bar + i;
+ strcpy (a, "--------01111111");
+ strcpy (b, "--------10000000");
+ if (memcmp (a, b, 16) >= 0)
+ return 1;
+ }
+ return 0;
+ }
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_memcmp_working=yes
+else
+ ac_cv_func_memcmp_working=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5
+$as_echo "$ac_cv_func_memcmp_working" >&6; }
+test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
+ *" memcmp.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
+ ;;
+esac
+
+
+for ac_header in stdlib.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default"
+if test "x$ac_cv_header_stdlib_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_STDLIB_H 1
+_ACEOF
+
+fi
+
+done
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible realloc" >&5
+$as_echo_n "checking for GNU libc compatible realloc... " >&6; }
+if ${ac_cv_func_realloc_0_nonnull+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test "$cross_compiling" = yes; then :
+ ac_cv_func_realloc_0_nonnull=no
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#if defined STDC_HEADERS || defined HAVE_STDLIB_H
+# include <stdlib.h>
+#else
+char *realloc ();
+#endif
+
+int
+main ()
+{
+return ! realloc (0, 0);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_run "$LINENO"; then :
+ ac_cv_func_realloc_0_nonnull=yes
+else
+ ac_cv_func_realloc_0_nonnull=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
+fi
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_realloc_0_nonnull" >&5
+$as_echo "$ac_cv_func_realloc_0_nonnull" >&6; }
+if test $ac_cv_func_realloc_0_nonnull = yes; then :
+
+$as_echo "#define HAVE_REALLOC 1" >>confdefs.h
+
+else
+ $as_echo "#define HAVE_REALLOC 0" >>confdefs.h
+
+ case " $LIBOBJS " in
+ *" realloc.$ac_objext "* ) ;;
+ *) LIBOBJS="$LIBOBJS realloc.$ac_objext"
+ ;;
+esac
+
+
+$as_echo "#define realloc rpl_realloc" >>confdefs.h
+
+fi
+
+
+if ${ac_cv_func_setvbuf_reversed+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_func_setvbuf_reversed=no
+fi
+
+
+for ac_func in vprintf
+do :
+ ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf"
+if test "x$ac_cv_func_vprintf" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_VPRINTF 1
+_ACEOF
+
+ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt"
+if test "x$ac_cv_func__doprnt" = xyes; then :
+
+$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h
+
+fi
+
+fi
+done
+
+
+
+# Checks for library constants.
+ac_fn_c_check_decl "$LINENO" "HOST_NAME_MAX" "ac_cv_have_decl_HOST_NAME_MAX" "#include <limits.h>
+"
+if test "x$ac_cv_have_decl_HOST_NAME_MAX" = xyes; then :
+
+else
+
+$as_echo "#define HOST_NAME_MAX _POSIX_HOST_NAME_MAX" >>confdefs.h
+
+fi
+
+
+# Options to configure.
+# Boost
+
+# Check whether --with-boost was given.
+if test "${with_boost+set}" = set; then :
+ withval=$with_boost;
+fi
+
+if test "$with_boost" -a -d "$with_boost"; then
+ boost_cppflags="-I$with_boost"
+fi
+# MPI
+
+# Check whether --with-mpi was given.
+if test "${with_mpi+set}" = set; then :
+ withval=$with_mpi;
+fi
+
+if test "$with_mpi" -a -d "$with_mpi"; then
+ mpi_cppflags="-I$with_mpi/include"
+ mpi_ldflags="-L$with_mpi/lib"
+fi
+
+# Check whether --enable-mpich was given.
+if test "${enable_mpich+set}" = set; then :
+ enableval=$enable_mpich;
+fi
+
+# Check whether --enable-lammpi was given.
+if test "${enable_lammpi+set}" = set; then :
+ enableval=$enable_lammpi;
+fi
+
+
+# Check whether --enable-fm was given.
+if test "${enable_fm+set}" = set; then :
+ enableval=$enable_fm;
+else
+ enable_fm=64
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define FMBITS $enable_fm
+_ACEOF
+
+
+# Check whether --enable-maxk was given.
+if test "${enable_maxk+set}" = set; then :
+ enableval=$enable_maxk;
+else
+ enable_maxk=64
+fi
+
+
+cat >>confdefs.h <<_ACEOF
+#define MAX_KMER $enable_maxk
+_ACEOF
+
+
+# Check whether --enable-popcnt was given.
+if test "${enable_popcnt+set}" = set; then :
+ enableval=$enable_popcnt;
+fi
+
+if test "$enable_popcnt" != no; then
+
+$as_echo "#define ENABLE_POPCNT 1" >>confdefs.h
+
+fi
+
+# Check whether --enable-samseqqual was given.
+if test "${enable_samseqqual+set}" = set; then :
+ enableval=$enable_samseqqual;
+cat >>confdefs.h <<_ACEOF
+#define SAM_SEQ_QUAL 1
+_ACEOF
+
+fi
+
+
+# Set compiler flags.
+CPPFLAGS="-I$srcdir $boost_cppflags $mpi_cppflags $CPPFLAGS"
+
+LDFLAGS="$mpi_ldflags $LDFLAGS"
+
+
+# Check for the MPI parallel computing library.
+libs="$LIBS"
+
+$as_echo "#define MPICH_SKIP_MPICXX 1" >>confdefs.h
+
+
+$as_echo "#define OMPI_SKIP_MPICXX 1" >>confdefs.h
+
+for ac_header in mpi.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "mpi.h" "ac_cv_header_mpi_h" "$ac_includes_default"
+if test "x$ac_cv_header_mpi_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_MPI_H 1
+_ACEOF
+
+fi
+
+done
+
+if test "$enable_mpich"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
+$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
+if ${ac_cv_lib_pthread_pthread_create+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pthread_create ();
+int
+main ()
+{
+return pthread_create ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_pthread_pthread_create=yes
+else
+ ac_cv_lib_pthread_pthread_create=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
+$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
+if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPTHREAD 1
+_ACEOF
+
+ LIBS="-lpthread $LIBS"
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpich" >&5
+$as_echo_n "checking for MPI_Init in -lmpich... " >&6; }
+if ${ac_cv_lib_mpich_MPI_Init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmpich $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char MPI_Init ();
+int
+main ()
+{
+return MPI_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mpich_MPI_Init=yes
+else
+ ac_cv_lib_mpich_MPI_Init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpich_MPI_Init" >&5
+$as_echo "$ac_cv_lib_mpich_MPI_Init" >&6; }
+if test "x$ac_cv_lib_mpich_MPI_Init" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBMPICH 1
+_ACEOF
+
+ LIBS="-lmpich $LIBS"
+
+fi
+
+ ac_cv_lib_mpi_MPI_Init=$ac_cv_lib_mpich_MPI_Init
+elif test "$enable_lammpi"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
+$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
+if ${ac_cv_lib_pthread_pthread_create+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lpthread $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char pthread_create ();
+int
+main ()
+{
+return pthread_create ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_pthread_pthread_create=yes
+else
+ ac_cv_lib_pthread_pthread_create=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
+$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
+if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBPTHREAD 1
+_ACEOF
+
+ LIBS="-lpthread $LIBS"
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlopen+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlopen=yes
+else
+ ac_cv_lib_dl_dlopen=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lam_mutex_lock in -llam" >&5
+$as_echo_n "checking for lam_mutex_lock in -llam... " >&6; }
+if ${ac_cv_lib_lam_lam_mutex_lock+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-llam $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char lam_mutex_lock ();
+int
+main ()
+{
+return lam_mutex_lock ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_lam_lam_mutex_lock=yes
+else
+ ac_cv_lib_lam_lam_mutex_lock=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lam_lam_mutex_lock" >&5
+$as_echo "$ac_cv_lib_lam_lam_mutex_lock" >&6; }
+if test "x$ac_cv_lib_lam_lam_mutex_lock" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBLAM 1
+_ACEOF
+
+ LIBS="-llam $LIBS"
+
+fi
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5
+$as_echo_n "checking for MPI_Init in -lmpi... " >&6; }
+if ${ac_cv_lib_mpi_MPI_Init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmpi $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char MPI_Init ();
+int
+main ()
+{
+return MPI_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mpi_MPI_Init=yes
+else
+ ac_cv_lib_mpi_MPI_Init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5
+$as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; }
+if test "x$ac_cv_lib_mpi_MPI_Init" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBMPI 1
+_ACEOF
+
+ LIBS="-lmpi $LIBS"
+
+fi
+
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for main in -llammpi++" >&5
+$as_echo_n "checking for main in -llammpi++... " >&6; }
+if ${ac_cv_lib_lammpipp_main+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-llammpi++ $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+
+int
+main ()
+{
+return main ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_cv_lib_lammpipp_main=yes
+else
+ ac_cv_lib_lammpipp_main=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lammpipp_main" >&5
+$as_echo "$ac_cv_lib_lammpipp_main" >&6; }
+if test "x$ac_cv_lib_lammpipp_main" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBLAMMPI__ 1
+_ACEOF
+
+ LIBS="-llammpi++ $LIBS"
+
+fi
+
+ ac_ext=c
+ac_cpp='$CPP $CPPFLAGS'
+ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_c_compiler_gnu
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MPI_Init in -lmpi" >&5
+$as_echo_n "checking for MPI_Init in -lmpi... " >&6; }
+if ${ac_cv_lib_mpi_MPI_Init+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lmpi $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char MPI_Init ();
+int
+main ()
+{
+return MPI_Init ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_mpi_MPI_Init=yes
+else
+ ac_cv_lib_mpi_MPI_Init=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mpi_MPI_Init" >&5
+$as_echo "$ac_cv_lib_mpi_MPI_Init" >&6; }
+if test "x$ac_cv_lib_mpi_MPI_Init" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBMPI 1
+_ACEOF
+
+ LIBS="-lmpi $LIBS"
+
+fi
+
+fi
+ if test $ac_cv_header_mpi_h = yes -a $ac_cv_lib_mpi_MPI_Init = yes; then
+ HAVE_LIBMPI_TRUE=
+ HAVE_LIBMPI_FALSE='#'
+else
+ HAVE_LIBMPI_TRUE='#'
+ HAVE_LIBMPI_FALSE=
+fi
+
+MPI_LIBS="$LIBS"
+
+
+# Check for the math library.
+LIBS="$libs"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sqrt in -lm" >&5
+$as_echo_n "checking for sqrt in -lm... " >&6; }
+if ${ac_cv_lib_m_sqrt+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lm $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char sqrt ();
+int
+main ()
+{
+return sqrt ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_m_sqrt=yes
+else
+ ac_cv_lib_m_sqrt=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_sqrt" >&5
+$as_echo "$ac_cv_lib_m_sqrt" >&6; }
+if test "x$ac_cv_lib_m_sqrt" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBM 1
+_ACEOF
+
+ LIBS="-lm $LIBS"
+
+fi
+
+for ac_func in pow sqrt
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+done
+
+ac_fn_c_check_func "$LINENO" "ceilf" "ac_cv_func_ceilf"
+if test "x$ac_cv_func_ceilf" = xyes; then :
+
+else
+
+$as_echo "#define ceilf ceil" >>confdefs.h
+
+fi
+
+
+# Check for the dynamic linking library.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlsym in -ldl" >&5
+$as_echo_n "checking for dlsym in -ldl... " >&6; }
+if ${ac_cv_lib_dl_dlsym+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-ldl $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlsym ();
+int
+main ()
+{
+return dlsym ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_dl_dlsym=yes
+else
+ ac_cv_lib_dl_dlsym=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlsym" >&5
+$as_echo "$ac_cv_lib_dl_dlsym" >&6; }
+if test "x$ac_cv_lib_dl_dlsym" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+
+ LIBS="-ldl $LIBS"
+
+fi
+
+
+# Check for the hash table implementation.
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
+$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+if test -z "$CXXCPP"; then
+ if ${ac_cv_prog_CXXCPP+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ # Double quotes because CXXCPP needs to be expanded
+ for CXXCPP in "$CXX -E" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
+fi
+
+ done
+ ac_cv_prog_CXXCPP=$CXXCPP
+
+fi
+ CXXCPP=$ac_cv_prog_CXXCPP
+else
+ ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
+$as_echo "$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+
+else
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_cxx_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5; }
+fi
+
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+for ac_header in \
+ boost/property_map/property_map.hpp \
+ google/sparse_hash_map \
+ unordered_map tr1/unordered_map \
+
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_cxx_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+
+fi
+
+done
+
+
+# Check for Boost.
+if test $ac_cv_header_boost_property_map_property_map_hpp != yes; then
+ as_fn_error $? "ABySS requires the Boost C++ libraries, which may
+ be downloaded from here: http://www.boost.org/users/download/
+ It is not necessary to compile Boost before installing it. The
+ following commands will download and install Boost for ABySS:
+ wget http://downloads.sourceforge.net/project/boost/boost/1.49.0/boost_1_49_0.tar.bz2
+ tar jxf boost_1_49_0.tar.bz2
+ ln -s boost_1_49_0/boost boost
+ " "$LINENO" 5
+fi
+
+# Check for OpenMP.
+
+ OPENMP_CXXFLAGS=
+ # Check whether --enable-openmp was given.
+if test "${enable_openmp+set}" = set; then :
+ enableval=$enable_openmp;
+fi
+
+ if test "$enable_openmp" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CXX option to support OpenMP" >&5
+$as_echo_n "checking for $CXX option to support OpenMP... " >&6; }
+if ${ac_cv_prog_cxx_openmp+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifndef _OPENMP
+ choke me
+#endif
+#include <omp.h>
+int main () { return omp_get_num_threads (); }
+
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_cv_prog_cxx_openmp='none needed'
+else
+ ac_cv_prog_cxx_openmp='unsupported'
+ for ac_option in -fopenmp -xopenmp -openmp -mp -omp -qsmp=omp -homp \
+ -Popenmp --openmp; do
+ ac_save_CXXFLAGS=$CXXFLAGS
+ CXXFLAGS="$CXXFLAGS $ac_option"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#ifndef _OPENMP
+ choke me
+#endif
+#include <omp.h>
+int main () { return omp_get_num_threads (); }
+
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+ ac_cv_prog_cxx_openmp=$ac_option
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ CXXFLAGS=$ac_save_CXXFLAGS
+ if test "$ac_cv_prog_cxx_openmp" != unsupported; then
+ break
+ fi
+ done
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_openmp" >&5
+$as_echo "$ac_cv_prog_cxx_openmp" >&6; }
+ case $ac_cv_prog_cxx_openmp in #(
+ "none needed" | unsupported)
+ ;; #(
+ *)
+ OPENMP_CXXFLAGS=$ac_cv_prog_cxx_openmp ;;
+ esac
+ fi
+
+
+if test -z $OPENMP_CXXFLAGS; then
+ OPENMP_CXXFLAGS=-Wno-unknown-pragmas
+fi
+
+# Set compiler flags.
+AM_CXXFLAGS='-Wall -Wextra -Werror'
+
+
+ac_config_files="$ac_config_files Makefile ABYSS/Makefile Align/Makefile Assembly/Makefile Common/Makefile DataLayer/Makefile FMIndex/Makefile Graph/Makefile Parallel/Makefile bin/Makefile doc/Makefile dialign/Makefile kmerprint/Makefile AdjList/Makefile DAssembler/Makefile DistanceEst/Makefile Map/Makefile Overlap/Makefile PopBubbles/Makefile Scaffold/Makefile SimpleGraph/Makefile MergePaths/Makefile KAligner/Makefile ParseAligns/Makefile PathOverlap/Makefile Consensus/Makefile FilterGr [...]
+
+cat >confcache <<\_ACEOF
+# This file is a shell script that caches the results of configure
+# tests run on this system so they can be shared between configure
+# scripts and configure runs, see configure's option --config-cache.
+# It is not useful on other systems. If it contains results you don't
+# want to keep, you may remove or edit it.
+#
+# config.status only pays attention to the cache file if you give it
+# the --recheck option to rerun configure.
+#
+# `ac_cv_env_foo' variables (set or unset) will be overridden when
+# loading this file, other *unset* `ac_cv_foo' will be assigned the
+# following values.
+
+_ACEOF
+
+# The following way of writing the cache mishandles newlines in values,
+# but we know of no workaround that is simple, portable, and efficient.
+# So, we kill variables containing newlines.
+# Ultrix sh set writes to stderr and can't be redirected directly,
+# and sets the high bit in the cache file unless we assign to the vars.
+(
+ for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
+ eval ac_val=\$$ac_var
+ case $ac_val in #(
+ *${as_nl}*)
+ case $ac_var in #(
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ esac
+ case $ac_var in #(
+ _ | IFS | as_nl) ;; #(
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
+ esac ;;
+ esac
+ done
+
+ (set) 2>&1 |
+ case $as_nl`(ac_space=' '; set) 2>&1` in #(
+ *${as_nl}ac_space=\ *)
+ # `set' does not quote correctly, so add quotes: double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \.
+ sed -n \
+ "s/'/'\\\\''/g;
+ s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
+ ;; #(
+ *)
+ # `set' quotes correctly as required by POSIX, so do not add quotes.
+ sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
+ ;;
+ esac |
+ sort
+) |
+ sed '
+ /^ac_cv_env_/b end
+ t clear
+ :clear
+ s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
+ t end
+ s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
+ :end' >>confcache
+if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
+ if test -w "$cache_file"; then
+ if test "x$cache_file" != "x/dev/null"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
+ if test ! -f "$cache_file" || test -h "$cache_file"; then
+ cat confcache >"$cache_file"
+ else
+ case $cache_file in #(
+ */* | ?:*)
+ mv -f confcache "$cache_file"$$ &&
+ mv -f "$cache_file"$$ "$cache_file" ;; #(
+ *)
+ mv -f confcache "$cache_file" ;;
+ esac
+ fi
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ fi
+fi
+rm -f confcache
+
+test "x$prefix" = xNONE && prefix=$ac_default_prefix
+# Let make expand exec_prefix.
+test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
+
+DEFS=-DHAVE_CONFIG_H
+
+ac_libobjs=
+ac_ltlibobjs=
+U=
+for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
+ # 1. Remove the extension, and $U if already installed.
+ ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
+ # will be set to the directory where LIBOBJS objects are built.
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+done
+LIBOBJS=$ac_libobjs
+
+LTLIBOBJS=$ac_ltlibobjs
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+ if test -n "$am_sleep_pid"; then
+ # Hide warnings about reused PIDs.
+ wait $am_sleep_pid 2>/dev/null
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
+if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCXX\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+if test -z "${HAVE_LIBMPI_TRUE}" && test -z "${HAVE_LIBMPI_FALSE}"; then
+ as_fn_error $? "conditional \"HAVE_LIBMPI\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+
+: "${CONFIG_STATUS=./config.status}"
+ac_write_fail=0
+ac_clean_files_save=$ac_clean_files
+ac_clean_files="$ac_clean_files $CONFIG_STATUS"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate the current configuration.
+# Compiler output produced by configure, useful for debugging
+# configure, is in config.log if it exists.
+
+debug=false
+ac_cs_recheck=false
+ac_cs_silent=false
+
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
+
+# Be more Bourne compatible
+DUALCASE=1; export DUALCASE # for MKS sh
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
+fi
+
+
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
+ else
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
+ fi
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
+fi
+
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
+fi
+
+
+# IFS
+# We need space, tab and new line, in precisely that order. Quoting is
+# there to prevent editors from complaining about space-tab.
+# (If _AS_PATH_WALK were called with IFS unset, it would disable word
+# splitting by setting IFS to empty value.)
+IFS=" "" $as_nl"
+
+# Find who we are. Look in the path if we contain no directory separator.
+as_myself=
+case $0 in #((
+ *[\\/]* ) as_myself=$0 ;;
+ *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
+IFS=$as_save_IFS
+
+ ;;
+esac
+# We did not find ourselves, most probably we were run as `sh COMMAND'
+# in which case we are not to be found in the path.
+if test "x$as_myself" = x; then
+ as_myself=$0
+fi
+if test ! -f "$as_myself"; then
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
+fi
+
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+done
+PS1='$ '
+PS2='> '
+PS4='+ '
+
+# NLS nuisances.
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
+
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
+
+ECHO_C= ECHO_N= ECHO_T=
+case `echo -n x` in #(((((
+-n*)
+ case `echo 'xy\c'` in
+ *c*) ECHO_T=' ';; # ECHO_T is single tab character.
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
+ esac;;
+*)
+ ECHO_N='-n';;
+esac
+
+rm -f conf$$ conf$$.exe conf$$.file
+if test -d conf$$.dir; then
+ rm -f conf$$.dir/conf$$.file
+else
+ rm -f conf$$.dir
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -pR'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -pR'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
+ as_ln_s='cp -pR'
+ fi
+else
+ as_ln_s='cp -pR'
+fi
+rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+rmdir conf$$.dir 2>/dev/null
+
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+if mkdir -p . 2>/dev/null; then
+ as_mkdir_p='mkdir -p "$as_dir"'
+else
+ test -d ./-p && rmdir ./-p
+ as_mkdir_p=false
+fi
+
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+ test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
+
+# Sed expression to map a string onto a valid CPP name.
+as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
+
+# Sed expression to map a string onto a valid variable name.
+as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
+# report actual input values of CONFIG_FILES etc. instead of their
+# values after options handling.
+ac_log="
+This file was extended by ABySS $as_me 1.3.4, which was
+generated by GNU Autoconf 2.69. Invocation command line was
+
+ CONFIG_FILES = $CONFIG_FILES
+ CONFIG_HEADERS = $CONFIG_HEADERS
+ CONFIG_LINKS = $CONFIG_LINKS
+ CONFIG_COMMANDS = $CONFIG_COMMANDS
+ $ $0 $@
+
+on `(hostname || uname -n) 2>/dev/null | sed 1q`
+"
+
+_ACEOF
+
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+# Files that config.status was made for.
+config_files="$ac_config_files"
+config_headers="$ac_config_headers"
+config_commands="$ac_config_commands"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ac_cs_usage="\
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
+
+Usage: $0 [OPTION]... [TAG]...
+
+ -h, --help print this help, then exit
+ -V, --version print version number and configuration settings, then exit
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ do not print progress messages
+ -d, --debug don't remove temporary files
+ --recheck update $as_me by reconfiguring in the same conditions
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
+
+Configuration files:
+$config_files
+
+Configuration headers:
+$config_headers
+
+Configuration commands:
+$config_commands
+
+Report bugs to <abyss-users at bcgsc.ca>.
+ABySS home page: <http://www.bcgsc.ca/platform/bioinfo/software/abyss>."
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+ac_cs_version="\\
+ABySS config.status 1.3.4
+configured by $0, generated by GNU Autoconf 2.69,
+ with options \\"\$ac_cs_config\\"
+
+Copyright (C) 2012 Free Software Foundation, Inc.
+This config.status script is free software; the Free Software Foundation
+gives unlimited permission to copy, distribute and modify it."
+
+ac_pwd='$ac_pwd'
+srcdir='$srcdir'
+INSTALL='$INSTALL'
+MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
+ac_need_defaults=:
+while test $# != 0
+do
+ case $1 in
+ --*=?*)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
+ ac_shift=:
+ ;;
+ --*=)
+ ac_option=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
+ *)
+ ac_option=$1
+ ac_optarg=$2
+ ac_shift=shift
+ ;;
+ esac
+
+ case $ac_option in
+ # Handling of the options.
+ -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
+ ac_cs_recheck=: ;;
+ --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
+ --debug | --debu | --deb | --de | --d | -d )
+ debug=: ;;
+ --file | --fil | --fi | --f )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --header | --heade | --head | --hea )
+ $ac_shift
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ ac_need_defaults=false;;
+ --he | --h)
+ # Conflict between --help and --header
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
+ --help | --hel | -h )
+ $as_echo "$ac_cs_usage"; exit ;;
+ -q | -quiet | --quiet | --quie | --qui | --qu | --q \
+ | -silent | --silent | --silen | --sile | --sil | --si | --s)
+ ac_cs_silent=: ;;
+
+ # This is an error.
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
+
+ *) as_fn_append ac_config_targets " $1"
+ ac_need_defaults=false ;;
+
+ esac
+ shift
+done
+
+ac_configure_extra_args=
+
+if $ac_cs_silent; then
+ exec 6>/dev/null
+ ac_configure_extra_args="$ac_configure_extra_args --silent"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+if \$ac_cs_recheck; then
+ set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
+ export CONFIG_SHELL
+ exec "\$@"
+fi
+
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+exec 5>>config.log
+{
+ echo
+ sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
+## Running $as_me. ##
+_ASBOX
+ $as_echo "$ac_log"
+} >&5
+
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+#
+# INIT-COMMANDS
+#
+AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+
+# Handling of arguments.
+for ac_config_target in $ac_config_targets
+do
+ case $ac_config_target in
+ "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
+ "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "ABYSS/Makefile") CONFIG_FILES="$CONFIG_FILES ABYSS/Makefile" ;;
+ "Align/Makefile") CONFIG_FILES="$CONFIG_FILES Align/Makefile" ;;
+ "Assembly/Makefile") CONFIG_FILES="$CONFIG_FILES Assembly/Makefile" ;;
+ "Common/Makefile") CONFIG_FILES="$CONFIG_FILES Common/Makefile" ;;
+ "DataLayer/Makefile") CONFIG_FILES="$CONFIG_FILES DataLayer/Makefile" ;;
+ "FMIndex/Makefile") CONFIG_FILES="$CONFIG_FILES FMIndex/Makefile" ;;
+ "Graph/Makefile") CONFIG_FILES="$CONFIG_FILES Graph/Makefile" ;;
+ "Parallel/Makefile") CONFIG_FILES="$CONFIG_FILES Parallel/Makefile" ;;
+ "bin/Makefile") CONFIG_FILES="$CONFIG_FILES bin/Makefile" ;;
+ "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;;
+ "dialign/Makefile") CONFIG_FILES="$CONFIG_FILES dialign/Makefile" ;;
+ "kmerprint/Makefile") CONFIG_FILES="$CONFIG_FILES kmerprint/Makefile" ;;
+ "AdjList/Makefile") CONFIG_FILES="$CONFIG_FILES AdjList/Makefile" ;;
+ "DAssembler/Makefile") CONFIG_FILES="$CONFIG_FILES DAssembler/Makefile" ;;
+ "DistanceEst/Makefile") CONFIG_FILES="$CONFIG_FILES DistanceEst/Makefile" ;;
+ "Map/Makefile") CONFIG_FILES="$CONFIG_FILES Map/Makefile" ;;
+ "Overlap/Makefile") CONFIG_FILES="$CONFIG_FILES Overlap/Makefile" ;;
+ "PopBubbles/Makefile") CONFIG_FILES="$CONFIG_FILES PopBubbles/Makefile" ;;
+ "Scaffold/Makefile") CONFIG_FILES="$CONFIG_FILES Scaffold/Makefile" ;;
+ "SimpleGraph/Makefile") CONFIG_FILES="$CONFIG_FILES SimpleGraph/Makefile" ;;
+ "MergePaths/Makefile") CONFIG_FILES="$CONFIG_FILES MergePaths/Makefile" ;;
+ "KAligner/Makefile") CONFIG_FILES="$CONFIG_FILES KAligner/Makefile" ;;
+ "ParseAligns/Makefile") CONFIG_FILES="$CONFIG_FILES ParseAligns/Makefile" ;;
+ "PathOverlap/Makefile") CONFIG_FILES="$CONFIG_FILES PathOverlap/Makefile" ;;
+ "Consensus/Makefile") CONFIG_FILES="$CONFIG_FILES Consensus/Makefile" ;;
+ "FilterGraph/Makefile") CONFIG_FILES="$CONFIG_FILES FilterGraph/Makefile" ;;
+
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ esac
+done
+
+
+# If the user did not use the arguments to specify the items to instantiate,
+# then the envvar interface is used. Set only those that are not.
+# We use the long form for the default assignment because of an extremely
+# bizarre bug on SunOS 4.1.3.
+if $ac_need_defaults; then
+ test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
+ test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
+ test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
+fi
+
+# Have a temporary directory for convenience. Make it in the build tree
+# simply because there is no reason against having it here, and in addition,
+# creating and moving files from /tmp can sometimes cause problems.
+# Hook for its removal unless debugging.
+# Note that there is a small window in which the directory will not be cleaned:
+# after its creation but before its name has been assigned to `$tmp'.
+$debug ||
+{
+ tmp= ac_tmp=
+ trap 'exit_status=$?
+ : "${ac_tmp:=$tmp}"
+ { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+' 0
+ trap 'as_fn_exit 1' 1 2 13 15
+}
+# Create a (secure) tmp directory for tmp files.
+
+{
+ tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
+ test -d "$tmp"
+} ||
+{
+ tmp=./conf$$-$RANDOM
+ (umask 077 && mkdir "$tmp")
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
+ac_tmp=$tmp
+
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
+if test -n "$CONFIG_FILES"; then
+
+
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
+fi
+
+echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
+_ACEOF
+
+
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
+
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
+
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+_ACEOF
+
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
+s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+fi # test -n "$CONFIG_FILES"
+
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
+
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_tt"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #undef with comments. This is necessary, for example,
+ # in the case of _POSIX_SOURCE, which is predefined and required
+ # on some systems where configure will not decide to define it.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
+do
+ case $ac_tag in
+ :[FHLC]) ac_mode=$ac_tag; continue;;
+ esac
+ case $ac_mode$ac_tag in
+ :[FHL]*:*);;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :[FH]-) ac_tag=-:-;;
+ :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
+ esac
+ ac_save_IFS=$IFS
+ IFS=:
+ set x $ac_tag
+ IFS=$ac_save_IFS
+ shift
+ ac_file=$1
+ shift
+
+ case $ac_mode in
+ :L) ac_source=$1;;
+ :[FH])
+ ac_file_inputs=
+ for ac_f
+ do
+ case $ac_f in
+ -) ac_f="$ac_tmp/stdin";;
+ *) # Look for the file first in the build tree, then in the source tree
+ # (if the path is not absolute). The absolute path cannot be DOS-style,
+ # because $ac_f cannot contain `:'.
+ test -f "$ac_f" ||
+ case $ac_f in
+ [\\/$]*) false;;
+ *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
+ esac ||
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ esac
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
+ done
+
+ # Let's still pretend it is `configure' which instantiates (i.e., don't
+ # use $as_me), people would be surprised to read:
+ # /* config.h. Generated by config.status. */
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
+ if test x"$ac_file" != x-; then
+ configure_input="$ac_file. $configure_input"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
+ fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
+
+ case $ac_tag in
+ *:-:* | *:-) cat >"$ac_tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ esac
+ ;;
+ esac
+
+ ac_dir=`$as_dirname -- "$ac_file" ||
+$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$ac_file" : 'X\(//\)[^/]' \| \
+ X"$ac_file" : 'X\(//\)$' \| \
+ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$ac_file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir="$ac_dir"; as_fn_mkdir_p
+ ac_builddir=.
+
+case "$ac_dir" in
+.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
+*)
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ # A ".." for each directory in $ac_dir_suffix.
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ case $ac_top_builddir_sub in
+ "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
+ *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
+ esac ;;
+esac
+ac_abs_top_builddir=$ac_pwd
+ac_abs_builddir=$ac_pwd$ac_dir_suffix
+# for backward compatibility:
+ac_top_builddir=$ac_top_build_prefix
+
+case $srcdir in
+ .) # We are building in place.
+ ac_srcdir=.
+ ac_top_srcdir=$ac_top_builddir_sub
+ ac_abs_top_srcdir=$ac_pwd ;;
+ [\\/]* | ?:[\\/]* ) # Absolute name.
+ ac_srcdir=$srcdir$ac_dir_suffix;
+ ac_top_srcdir=$srcdir
+ ac_abs_top_srcdir=$srcdir ;;
+ *) # Relative name.
+ ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
+ ac_top_srcdir=$ac_top_build_prefix$srcdir
+ ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
+esac
+ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
+
+
+ case $ac_mode in
+ :F)
+ #
+ # CONFIG_FILE
+ #
+
+ case $INSTALL in
+ [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
+ *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
+ esac
+ ac_MKDIR_P=$MKDIR_P
+ case $MKDIR_P in
+ [\\/$]* | ?:[\\/]* ) ;;
+ */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
+ esac
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# If the template does not know about datarootdir, expand it.
+# FIXME: This hack should be removed a few years after 2.60.
+ac_datarootdir_hack=; ac_datarootdir_seen=
+ac_sed_dataroot='
+/datarootdir/ {
+ p
+ q
+}
+/@datadir@/p
+/@docdir@/p
+/@infodir@/p
+/@localedir@/p
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+*datarootdir*) ac_datarootdir_seen=yes;;
+*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ ac_datarootdir_hack='
+ s&@datadir@&$datadir&g
+ s&@docdir@&$docdir&g
+ s&@infodir@&$infodir&g
+ s&@localedir@&$localedir&g
+ s&@mandir@&$mandir&g
+ s&\\\${datarootdir}&$datarootdir&g' ;;
+esac
+_ACEOF
+
+# Neutralize VPATH when `$srcdir' = `.'.
+# Shell code in configure.ac might set extrasub.
+# FIXME: do we really want to maintain this feature?
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
+$extrasub
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+:t
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
+s|@configure_input@|$ac_sed_conf_input|;t t
+s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
+s&@srcdir@&$ac_srcdir&;t t
+s&@abs_srcdir@&$ac_abs_srcdir&;t t
+s&@top_srcdir@&$ac_top_srcdir&;t t
+s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
+s&@builddir@&$ac_builddir&;t t
+s&@abs_builddir@&$ac_abs_builddir&;t t
+s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
+s&@INSTALL@&$ac_INSTALL&;t t
+s&@MKDIR_P@&$ac_MKDIR_P&;t t
+$ac_datarootdir_hack
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
+ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+
+test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
+ { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
+ "$ac_tmp/out"`; test -z "$ac_out"; } &&
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
+
+ rm -f "$ac_tmp/stdin"
+ case $ac_file in
+ -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
+ *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ ;;
+ :H)
+ #
+ # CONFIG_HEADER
+ #
+ if test x"$ac_file" != x-; then
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
+ } >"$ac_tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ else
+ rm -f "$ac_file"
+ mv "$ac_tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ fi
+ else
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
+ fi
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
+_am_stamp_count=1
+for _am_header in $config_headers :; do
+ case $_am_header in
+ $_am_arg | $_am_arg:* )
+ break ;;
+ * )
+ _am_stamp_count=`expr $_am_stamp_count + 1` ;;
+ esac
+done
+echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
+$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$_am_arg" : 'X\(//\)[^/]' \| \
+ X"$_am_arg" : 'X\(//\)$' \| \
+ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$_am_arg" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`/stamp-h$_am_stamp_count
+ ;;
+
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
+ ;;
+ esac
+
+
+ case $ac_file$ac_mode in
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ do
+ # Strip MF so we end up with the name of the file.
+ mf=`echo "$mf" | sed -e 's/:.*$//'`
+ # Check whether this is an Automake generated Makefile or not.
+ # We used to match only the files named 'Makefile.in', but
+ # some people rename them; so instead we look at the file content.
+ # Grep'ing the first line is not enough: some people post-process
+ # each Makefile.in and add a new line on top of each file to say so.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
+$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$mf" : 'X\(//\)[^/]' \| \
+ X"$mf" : 'X\(//\)$' \| \
+ X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$mf" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ else
+ continue
+ fi
+ # Extract the definition of DEPDIR, am__include, and am__quote
+ # from the Makefile without running 'make'.
+ DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
+ test -z "$DEPDIR" && continue
+ am__include=`sed -n 's/^am__include = //p' < "$mf"`
+ test -z "am__include" && continue
+ am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
+ # Find all dependency output files, they are included files with
+ # $(DEPDIR) in their names. We invoke sed twice because it is the
+ # simplest approach to changing $(DEPDIR) to its actual value in the
+ # expansion.
+ for file in `sed -n "
+ s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
+ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do
+ # Make sure the directory exists.
+ test -f "$dirpart/$file" && continue
+ fdir=`$as_dirname -- "$file" ||
+$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$file" : 'X\(//\)[^/]' \| \
+ X"$file" : 'X\(//\)$' \| \
+ X"$file" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$file" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
+ done
+ done
+}
+ ;;
+
+ esac
+done # for ac_tag
+
+
+as_fn_exit 0
+_ACEOF
+ac_clean_files=$ac_clean_files_save
+
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
+
+# configure is writing to config.log, and then calls config.status.
+# config.status does its own redirection, appending to config.log.
+# Unfortunately, on DOS this fails, as config.log is still kept open
+# by configure, so config.status won't be able to write to it; its
+# output is simply discarded. So we exec the FD to /dev/null,
+# effectively closing config.log, so it can be properly (re)opened and
+# appended to by config.status. When coming back to configure, we
+# need to make the FD available again.
+if test "$no_create" != yes; then
+ ac_cs_success=:
+ ac_config_status_args=
+ test "$silent" = yes &&
+ ac_config_status_args="$ac_config_status_args --quiet"
+ exec 5>/dev/null
+ $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
+ exec 5>>config.log
+ # Use ||, not &&, to avoid exiting from the if with $? = 1, which
+ # would make configure fail if this is the last instruction.
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
+fi
+
+
+if test $ac_cv_header_google_sparse_hash_map != yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ABySS should be compiled with Google sparsehash to
+ reduce memory usage. It may be downloaded here:
+ http://code.google.com/p/google-sparsehash" >&5
+$as_echo "$as_me: WARNING: ABySS should be compiled with Google sparsehash to
+ reduce memory usage. It may be downloaded here:
+ http://code.google.com/p/google-sparsehash" >&2;}
+fi
diff --git a/configure.ac b/configure.ac
new file mode 100644
index 0000000..dfbd3aa
--- /dev/null
+++ b/configure.ac
@@ -0,0 +1,202 @@
+AC_PREREQ(2.59)
+AC_INIT(ABySS, 1.3.4, abyss-users at bcgsc.ca, abyss,
+ http://www.bcgsc.ca/platform/bioinfo/software/abyss)
+AM_INIT_AUTOMAKE(foreign)
+AC_CONFIG_SRCDIR([ABYSS/Abyss.cpp])
+AC_CONFIG_HEADER([config.h])
+
+# Checks for programs.
+AC_PROG_AWK
+AC_PROG_CC
+AC_PROG_CPP
+AC_PROG_CXX
+AC_PROG_INSTALL
+AC_PROG_RANLIB
+
+# Checks for header files.
+AC_CHECK_HEADERS([dlfcn.h fcntl.h float.h limits.h \
+ stddef.h stdint.h stdlib.h sys/param.h])
+AC_HEADER_STDBOOL
+AC_HEADER_STDC
+
+# Checks for typedefs, structures, and compiler characteristics.
+AC_C_BIGENDIAN
+AC_C_CONST
+AC_C_INLINE
+AC_CHECK_TYPES([ptrdiff_t])
+AC_TYPE_MODE_T
+AC_TYPE_PID_T
+AC_TYPE_SIZE_T
+AC_TYPE_SSIZE_T
+AC_TYPE_INT64_T
+AC_TYPE_UINT8_T
+AC_TYPE_UINT16_T
+AC_TYPE_UINT32_T
+AC_TYPE_UINT64_T
+
+# Checks for library functions.
+AC_CHECK_FUNCS([dup2 gethostname getopt_long getpagesize \
+ memset strdup strerror strtoul])
+AC_FUNC_FORK
+AC_FUNC_MALLOC
+AC_FUNC_MEMCMP
+AC_FUNC_REALLOC
+AC_FUNC_SETVBUF_REVERSED
+AC_FUNC_VPRINTF
+
+# Checks for library constants.
+AC_CHECK_DECL(HOST_NAME_MAX, [],
+ AC_DEFINE(HOST_NAME_MAX, [_POSIX_HOST_NAME_MAX],
+ [Define if the system does not provide HOST_NAME_MAX]),
+ [#include <limits.h>])
+
+# Options to configure.
+# Boost
+AC_ARG_WITH(boost, AS_HELP_STRING([--with-boost=PATH],
+ [specify directory for the boost header files]))
+if test "$with_boost" -a -d "$with_boost"; then
+ boost_cppflags="-I$with_boost"
+fi
+# MPI
+AC_ARG_WITH(mpi, AS_HELP_STRING([--with-mpi=PATH],
+ [specify prefix directory for the installed MPI parallel
+ computing library]))
+if test "$with_mpi" -a -d "$with_mpi"; then
+ mpi_cppflags="-I$with_mpi/include"
+ mpi_ldflags="-L$with_mpi/lib"
+fi
+
+AC_ARG_ENABLE(mpich, AS_HELP_STRING([--enable-mpich],
+ [use MPICH (default is to use Open MPI)]))
+AC_ARG_ENABLE(lammpi, AS_HELP_STRING([--enable-lammpi],
+ [use LAM/MPI (default is to use Open MPI)]))
+
+AC_ARG_ENABLE(fm, AS_HELP_STRING([--enable-fm],
+ [specify the width of the FM-index in bits (default is 64-bit)]),
+ [], [enable_fm=64])
+AC_DEFINE_UNQUOTED(FMBITS, $enable_fm,
+ [Width of bits of the FM-index in bits])
+
+AC_ARG_ENABLE(maxk, AS_HELP_STRING([--enable-maxk=N],
+ [set the maximum k-mer length (default is 64)]),
+ [], [enable_maxk=64])
+AC_DEFINE_UNQUOTED(MAX_KMER, [$enable_maxk], [maximum k-mer length])
+
+AC_ARG_ENABLE(popcnt, AS_HELP_STRING([--disable-popcnt],
+ [do not use the popcnt instruction]))
+if test "$enable_popcnt" != no; then
+ AC_DEFINE(ENABLE_POPCNT, 1, [Define to use the popcnt instruction])
+fi
+
+AC_ARG_ENABLE(samseqqual,
+ AS_HELP_STRING([--enable-samseqqual],
+ [enable SAM sequence and quality fields]),
+ AC_DEFINE_UNQUOTED(SAM_SEQ_QUAL, 1,
+ [Define to use SAM sequence and quality fields]))
+
+# Set compiler flags.
+AC_SUBST(CPPFLAGS,
+ "-I$srcdir $boost_cppflags $mpi_cppflags $CPPFLAGS")
+AC_SUBST(LDFLAGS, "$mpi_ldflags $LDFLAGS")
+
+# Check for the MPI parallel computing library.
+libs="$LIBS"
+AC_DEFINE(MPICH_SKIP_MPICXX, 1,
+ [Define to disable MPICH C++ bindings])
+AC_DEFINE(OMPI_SKIP_MPICXX, 1,
+ [Define to disable OpenMPI C++ bindings])
+AC_CHECK_HEADERS([mpi.h])
+if test "$enable_mpich"; then
+ AC_CHECK_LIB([pthread], [pthread_create])
+ AC_CHECK_LIB([mpich], [MPI_Init])
+ ac_cv_lib_mpi_MPI_Init=$ac_cv_lib_mpich_MPI_Init
+elif test "$enable_lammpi"; then
+ AC_CHECK_LIB([pthread], [pthread_create])
+ AC_CHECK_LIB([dl], [dlopen])
+ AC_CHECK_LIB([lam], [lam_mutex_lock])
+ AC_CHECK_LIB([mpi], [MPI_Init])
+ AC_LANG_PUSH([C++])
+ AC_CHECK_LIB([lammpi++], [main])
+ AC_LANG_POP([C++])
+else
+ AC_CHECK_LIB([mpi], [MPI_Init])
+fi
+AM_CONDITIONAL([HAVE_LIBMPI],
+ [test $ac_cv_header_mpi_h = yes -a $ac_cv_lib_mpi_MPI_Init = yes])
+AC_SUBST(MPI_LIBS, "$LIBS")
+
+# Check for the math library.
+LIBS="$libs"
+AC_CHECK_LIB([m], [sqrt])
+AC_CHECK_FUNCS([pow sqrt])
+AC_CHECK_FUNC(ceilf, [], AC_DEFINE(ceilf, [ceil],
+ [Define if the system does not provide ceilf]))
+
+# Check for the dynamic linking library.
+AC_CHECK_LIB([dl], [dlsym])
+
+# Check for the hash table implementation.
+AC_LANG([C++])
+AC_CHECK_HEADERS([ \
+ boost/property_map/property_map.hpp \
+ google/sparse_hash_map \
+ unordered_map tr1/unordered_map \
+])
+
+# Check for Boost.
+if test $ac_cv_header_boost_property_map_property_map_hpp != yes; then
+ AC_MSG_ERROR([ABySS requires the Boost C++ libraries, which may
+ be downloaded from here: http://www.boost.org/users/download/
+ It is not necessary to compile Boost before installing it. The
+ following commands will download and install Boost for ABySS:
+ wget http://downloads.sourceforge.net/project/boost/boost/1.49.0/boost_1_49_0.tar.bz2
+ tar jxf boost_1_49_0.tar.bz2
+ ln -s boost_1_49_0/boost boost
+ ])
+fi
+
+# Check for OpenMP.
+AC_OPENMP
+if test -z $OPENMP_CXXFLAGS; then
+ OPENMP_CXXFLAGS=-Wno-unknown-pragmas
+fi
+
+# Set compiler flags.
+AC_SUBST(AM_CXXFLAGS, '-Wall -Wextra -Werror')
+
+AC_CONFIG_FILES([
+ Makefile
+ ABYSS/Makefile
+ Align/Makefile
+ Assembly/Makefile
+ Common/Makefile
+ DataLayer/Makefile
+ FMIndex/Makefile
+ Graph/Makefile
+ Parallel/Makefile
+ bin/Makefile
+ doc/Makefile
+ dialign/Makefile
+ kmerprint/Makefile
+ AdjList/Makefile
+ DAssembler/Makefile
+ DistanceEst/Makefile
+ Map/Makefile
+ Overlap/Makefile
+ PopBubbles/Makefile
+ Scaffold/Makefile
+ SimpleGraph/Makefile
+ MergePaths/Makefile
+ KAligner/Makefile
+ ParseAligns/Makefile
+ PathOverlap/Makefile
+ Consensus/Makefile
+ FilterGraph/Makefile
+])
+AC_OUTPUT
+
+if test $ac_cv_header_google_sparse_hash_map != yes; then
+ AC_MSG_WARN([ABySS should be compiled with Google sparsehash to
+ reduce memory usage. It may be downloaded here:
+ http://code.google.com/p/google-sparsehash])
+fi
diff --git a/depcomp b/depcomp
new file mode 100755
index 0000000..df8eea7
--- /dev/null
+++ b/depcomp
@@ -0,0 +1,630 @@
+#! /bin/sh
+# depcomp - compile a program generating dependencies as side-effects
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
+# Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+# Originally written by Alexandre Oliva <oliva at dcc.unicamp.br>.
+
+case $1 in
+ '')
+ echo "$0: No command. Try \`$0 --help' for more information." 1>&2
+ exit 1;
+ ;;
+ -h | --h*)
+ cat <<\EOF
+Usage: depcomp [--help] [--version] PROGRAM [ARGS]
+
+Run PROGRAMS ARGS to compile a file, generating dependencies
+as side-effects.
+
+Environment variables:
+ depmode Dependency tracking mode.
+ source Source file read by `PROGRAMS ARGS'.
+ object Object file output by `PROGRAMS ARGS'.
+ DEPDIR directory where to store dependencies.
+ depfile Dependency file to output.
+ tmpdepfile Temporary file to use when outputing dependencies.
+ libtool Whether libtool is used (yes/no).
+
+Report bugs to <bug-automake at gnu.org>.
+EOF
+ exit $?
+ ;;
+ -v | --v*)
+ echo "depcomp $scriptversion"
+ exit $?
+ ;;
+esac
+
+if test -z "$depmode" || test -z "$source" || test -z "$object"; then
+ echo "depcomp: Variables source, object and depmode must be set" 1>&2
+ exit 1
+fi
+
+# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
+depfile=${depfile-`echo "$object" |
+ sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
+tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
+
+rm -f "$tmpdepfile"
+
+# Some modes work just like other modes, but use different flags. We
+# parameterize here, but still list the modes in the big case below,
+# to make depend.m4 easier to write. Note that we *cannot* use a case
+# here, because this file can only contain one case statement.
+if test "$depmode" = hp; then
+ # HP compiler uses -M and no extra arg.
+ gccflag=-M
+ depmode=gcc
+fi
+
+if test "$depmode" = dashXmstdout; then
+ # This is just like dashmstdout with a different argument.
+ dashmflag=-xM
+ depmode=dashmstdout
+fi
+
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u="sed s,\\\\\\\\,/,g"
+ depmode=msvisualcpp
+fi
+
+case "$depmode" in
+gcc3)
+## gcc 3 implements dependency tracking that does exactly what
+## we want. Yay! Note: for some reason libtool 1.4 doesn't like
+## it if -MD -MP comes after the -MF stuff. Hmm.
+## Unfortunately, FreeBSD c89 acceptance of flags depends upon
+## the command line argument order; so add the flags where they
+## appear in depend2.am. Note that the slowdown incurred here
+## affects only configure: in makefiles, %FASTDEP% shortcuts this.
+ for arg
+ do
+ case $arg in
+ -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
+ *) set fnord "$@" "$arg" ;;
+ esac
+ shift # fnord
+ shift # $arg
+ done
+ "$@"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ mv "$tmpdepfile" "$depfile"
+ ;;
+
+gcc)
+## There are various ways to get dependency output from gcc. Here's
+## why we pick this rather obscure method:
+## - Don't want to use -MD because we'd like the dependencies to end
+## up in a subdir. Having to rename by hand is ugly.
+## (We might end up doing this anyway to support other compilers.)
+## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
+## -MM, not -M (despite what the docs say).
+## - Using -M directly means running the compiler twice (even worse
+## than renaming).
+ if test -z "$gccflag"; then
+ gccflag=-MD,
+ fi
+ "$@" -Wp,"$gccflag$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
+## The second -e expression handles DOS-style file names with drive letters.
+ sed -e 's/^[^:]*: / /' \
+ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
+## This next piece of magic avoids the `deleted header file' problem.
+## The problem is that when a header file which appears in a .P file
+## is deleted, the dependency causes make to die (because there is
+## typically no way to rebuild the header). We avoid this by adding
+## dummy dependencies for each header file. Too bad gcc doesn't do
+## this for us directly.
+ tr ' ' '
+' < "$tmpdepfile" |
+## Some versions of gcc put a space before the `:'. On the theory
+## that the space means something, we add a space to the output as
+## well.
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+sgi)
+ if test "$libtool" = yes; then
+ "$@" "-Wp,-MDupdate,$tmpdepfile"
+ else
+ "$@" -MDupdate "$tmpdepfile"
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+
+ if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files
+ echo "$object : \\" > "$depfile"
+
+ # Clip off the initial element (the dependent). Don't try to be
+ # clever and replace this with sed code, as IRIX sed won't handle
+ # lines with more than a fixed number of characters (4096 in
+ # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines;
+ # the IRIX cc adds comments like `#:fec' to the end of the
+ # dependency line.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
+ tr '
+' ' ' >> "$depfile"
+ echo >> "$depfile"
+
+ # The second pass generates a dummy entry for each header file.
+ tr ' ' '
+' < "$tmpdepfile" \
+ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
+ >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+aix)
+ # The C for AIX Compiler uses -M and outputs the dependencies
+ # in a .u file. In older versions, this file always lives in the
+ # current directory. Also, the AIX compiler puts `$object:' at the
+ # start of each line; $object doesn't have directory information.
+ # Version 6 uses the directory in both cases.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$base.u
+ tmpdepfile3=$dir.libs/$base.u
+ "$@" -Wc,-M
+ else
+ tmpdepfile1=$dir$base.u
+ tmpdepfile2=$dir$base.u
+ tmpdepfile3=$dir$base.u
+ "$@" -M
+ fi
+ stat=$?
+
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ # Each line is of the form `foo.o: dependent.h'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ # The sourcefile does not contain any dependencies, so just
+ # store a dummy comment line, to avoid errors with the Makefile
+ # "include basename.Plo" scheme.
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+icc)
+ # Intel's C compiler understands `-MD -MF file'. However on
+ # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
+ # ICC 7.0 will fill foo.d with something like
+ # foo.o: sub/foo.c
+ # foo.o: sub/foo.h
+ # which is wrong. We want:
+ # sub/foo.o: sub/foo.c
+ # sub/foo.o: sub/foo.h
+ # sub/foo.c:
+ # sub/foo.h:
+ # ICC 7.1 will output
+ # foo.o: sub/foo.c sub/foo.h
+ # and will wrap long lines using \ :
+ # foo.o: sub/foo.c ... \
+ # sub/foo.h ... \
+ # ...
+
+ "$@" -MD -MF "$tmpdepfile"
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile"
+ exit $stat
+ fi
+ rm -f "$depfile"
+ # Each line is of the form `foo.o: dependent.h',
+ # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
+ # Do two passes, one to just change these to
+ # `$object: dependent.h' and one to simply `dependent.h:'.
+ sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
+ # Some versions of the HPUX 10.20 sed can't process this invocation
+ # correctly. Breaking it into two sed invocations is a workaround.
+ sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
+ sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+hp2)
+ # The "hp" stanza above does not work with aCC (C++) and HP's ia64
+ # compilers, which have integrated preprocessors. The correct option
+ # to use with these is +Maked; it writes dependencies to a file named
+ # 'foo.d', which lands next to the object file, wherever that
+ # happens to be.
+ # Much of this is similar to the tru64 case; see comments there.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+ if test "$libtool" = yes; then
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir.libs/$base.d
+ "$@" -Wc,+Maked
+ else
+ tmpdepfile1=$dir$base.d
+ tmpdepfile2=$dir$base.d
+ "$@" +Maked
+ fi
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
+ # Add `dependent.h:' lines.
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile" "$tmpdepfile2"
+ ;;
+
+tru64)
+ # The Tru64 compiler uses -MD to generate dependencies as a side
+ # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
+ # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
+ # dependencies in `foo.d' instead, so we check for that too.
+ # Subdirectories are respected.
+ dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
+ test "x$dir" = "x$object" && dir=
+ base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
+
+ if test "$libtool" = yes; then
+ # With Tru64 cc, shared objects can also be used to make a
+ # static library. This mechanism is used in libtool 1.4 series to
+ # handle both shared and static libraries in a single compilation.
+ # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
+ #
+ # With libtool 1.5 this exception was removed, and libtool now
+ # generates 2 separate objects for the 2 libraries. These two
+ # compilations output dependencies in $dir.libs/$base.o.d and
+ # in $dir$base.o.d. We have to check for both files, because
+ # one of the two compilations can be disabled. We should prefer
+ # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
+ # automatically cleaned when .libs/ is deleted, while ignoring
+ # the former would cause a distcleancheck panic.
+ tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4
+ tmpdepfile2=$dir$base.o.d # libtool 1.5
+ tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5
+ tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504
+ "$@" -Wc,-MD
+ else
+ tmpdepfile1=$dir$base.o.d
+ tmpdepfile2=$dir$base.d
+ tmpdepfile3=$dir$base.d
+ tmpdepfile4=$dir$base.d
+ "$@" -MD
+ fi
+
+ stat=$?
+ if test $stat -eq 0; then :
+ else
+ rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ exit $stat
+ fi
+
+ for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
+ do
+ test -f "$tmpdepfile" && break
+ done
+ if test -f "$tmpdepfile"; then
+ sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
+ # That's a tab and a space in the [].
+ sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
+ else
+ echo "#dummy" > "$depfile"
+ fi
+ rm -f "$tmpdepfile"
+ ;;
+
+#nosideeffect)
+ # This comment above is used by automake to tell side-effect
+ # dependency tracking mechanisms from slower ones.
+
+dashmstdout)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout, regardless of -o.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ test -z "$dashmflag" && dashmflag=-M
+ # Require at least two characters before searching for `:'
+ # in the target name. This is to cope with DOS-style filenames:
+ # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
+ "$@" $dashmflag |
+ sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ tr ' ' '
+' < "$tmpdepfile" | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+dashXmstdout)
+ # This case only exists to satisfy depend.m4. It is never actually
+ # run, as this mode is specially recognized in the preamble.
+ exit 1
+ ;;
+
+makedepend)
+ "$@" || exit $?
+ # Remove any Libtool call
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+ # X makedepend
+ shift
+ cleared=no eat=no
+ for arg
+ do
+ case $cleared in
+ no)
+ set ""; shift
+ cleared=yes ;;
+ esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
+ case "$arg" in
+ -D*|-I*)
+ set fnord "$@" "$arg"; shift ;;
+ # Strip any option that makedepend may not understand. Remove
+ # the object too, otherwise makedepend will parse it as a source file.
+ -arch)
+ eat=yes ;;
+ -*|$object)
+ ;;
+ *)
+ set fnord "$@" "$arg"; shift ;;
+ esac
+ done
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
+ touch "$tmpdepfile"
+ ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
+ rm -f "$depfile"
+ cat < "$tmpdepfile" > "$depfile"
+ sed '1,2d' "$tmpdepfile" | tr ' ' '
+' | \
+## Some versions of the HPUX 10.20 sed can't process this invocation
+## correctly. Breaking it into two sed invocations is a workaround.
+ sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile" "$tmpdepfile".bak
+ ;;
+
+cpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ # Remove `-o $object'.
+ IFS=" "
+ for arg
+ do
+ case $arg in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift # fnord
+ shift # $arg
+ ;;
+ esac
+ done
+
+ "$@" -E |
+ sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
+ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
+ sed '$ s: \\$::' > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ cat < "$tmpdepfile" >> "$depfile"
+ sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvisualcpp)
+ # Important note: in order to support this mode, a compiler *must*
+ # always write the preprocessed file to stdout.
+ "$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
+ IFS=" "
+ for arg
+ do
+ case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
+ "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
+ set fnord "$@"
+ shift
+ shift
+ ;;
+ *)
+ set fnord "$@" "$arg"
+ shift
+ shift
+ ;;
+ esac
+ done
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
+ rm -f "$depfile"
+ echo "$object : \\" > "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ echo " " >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ rm -f "$tmpdepfile"
+ ;;
+
+msvcmsys)
+ # This case exists only to let depend.m4 do its work. It works by
+ # looking at the text of this script. This case will never be run,
+ # since it is checked for above.
+ exit 1
+ ;;
+
+none)
+ exec "$@"
+ ;;
+
+*)
+ echo "Unknown depmode $depmode" 1>&2
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local Variables:
+# mode: shell-script
+# sh-indentation: 2
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/dialign/Makefile.am b/dialign/Makefile.am
new file mode 100644
index 0000000..9a502a3
--- /dev/null
+++ b/dialign/Makefile.am
@@ -0,0 +1,17 @@
+noinst_LIBRARIES = libdialign.a
+noinst_PROGRAMS = dialign
+
+libdialign_a_SOURCES = \
+ alig.c \
+ assemble.c \
+ diag.c \
+ io.c io.h \
+ orf.c orf.h \
+ parameters.c parameters.h \
+ prob.c \
+ struct.h \
+ translate.c translate.h
+
+dialign_SOURCES = museq.c
+
+dialign_LDADD = libdialign.a
diff --git a/dialign/Makefile.in b/dialign/Makefile.in
new file mode 100644
index 0000000..63c451c
--- /dev/null
+++ b/dialign/Makefile.in
@@ -0,0 +1,501 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+noinst_PROGRAMS = dialign$(EXEEXT)
+subdir = dialign
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+LIBRARIES = $(noinst_LIBRARIES)
+AR = ar
+ARFLAGS = cru
+libdialign_a_AR = $(AR) $(ARFLAGS)
+libdialign_a_LIBADD =
+am_libdialign_a_OBJECTS = alig.$(OBJEXT) assemble.$(OBJEXT) \
+ diag.$(OBJEXT) io.$(OBJEXT) orf.$(OBJEXT) parameters.$(OBJEXT) \
+ prob.$(OBJEXT) translate.$(OBJEXT)
+libdialign_a_OBJECTS = $(am_libdialign_a_OBJECTS)
+PROGRAMS = $(noinst_PROGRAMS)
+am_dialign_OBJECTS = museq.$(OBJEXT)
+dialign_OBJECTS = $(am_dialign_OBJECTS)
+dialign_DEPENDENCIES = libdialign.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libdialign_a_SOURCES) $(dialign_SOURCES)
+DIST_SOURCES = $(libdialign_a_SOURCES) $(dialign_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+noinst_LIBRARIES = libdialign.a
+libdialign_a_SOURCES = \
+ alig.c \
+ assemble.c \
+ diag.c \
+ io.c io.h \
+ orf.c orf.h \
+ parameters.c parameters.h \
+ prob.c \
+ struct.h \
+ translate.c translate.h
+
+dialign_SOURCES = museq.c
+dialign_LDADD = libdialign.a
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign dialign/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign dialign/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstLIBRARIES:
+ -test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
+libdialign.a: $(libdialign_a_OBJECTS) $(libdialign_a_DEPENDENCIES) $(EXTRA_libdialign_a_DEPENDENCIES)
+ -rm -f libdialign.a
+ $(libdialign_a_AR) libdialign.a $(libdialign_a_OBJECTS) $(libdialign_a_LIBADD)
+ $(RANLIB) libdialign.a
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+dialign$(EXEEXT): $(dialign_OBJECTS) $(dialign_DEPENDENCIES) $(EXTRA_dialign_DEPENDENCIES)
+ @rm -f dialign$(EXEEXT)
+ $(LINK) $(dialign_OBJECTS) $(dialign_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/alig.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/assemble.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/diag.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/io.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/museq.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/orf.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/parameters.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/prob.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/translate.Po at am__quote@
+
+.c.o:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c $<
+
+.c.obj:
+ at am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LIBRARIES) $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstLIBRARIES clean-noinstPROGRAMS \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstLIBRARIES clean-noinstPROGRAMS cscopelist ctags \
+ distclean distclean-compile distclean-generic distclean-tags \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-dvi \
+ install-dvi-am install-exec install-exec-am install-html \
+ install-html-am install-info install-info-am install-man \
+ install-pdf install-pdf-am install-ps install-ps-am \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic pdf pdf-am ps ps-am \
+ tags uninstall uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/dialign/alig.c b/dialign/alig.c
new file mode 100644
index 0000000..bf9d7ce
--- /dev/null
+++ b/dialign/alig.c
@@ -0,0 +1,1074 @@
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "parameters.h"
+#include "struct.h"
+
+extern void error(char *message);
+extern void merror(char *msg1, char *msg2);
+extern inline void calc_weight(struct diag* dg, struct scr_matrix* smatrix,
+ struct prob_dist *pdist);
+extern inline void calc_ov_weight(struct diag* dg, struct diag_col *dcol, struct scr_matrix* smatrix,
+ struct prob_dist *pdist);
+//extern struct seq_part* create_seq_part(int num, struct seq* aSeq, unsigned int startpos);
+extern struct diag* create_diag(struct seq_part* part1, struct seq_part* part2,
+ int dlength);
+extern void free_diag(struct diag* dg);
+
+// long balance = 0;
+//unsigned long allocss = 0;
+//unsigned long freess = 0;
+
+long sslen;
+
+
+/**
+ *
+ * alig.c: Takes care of the alignment data structure
+ *
+ * 2003-10-31 A.R.Subramanian
+ * (Initial)
+ */
+
+/**
+ * creates initial empty alignment data structure
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+struct alignment* create_empty_alignment(struct seq_col *scol) {
+ /*
+ printf("before\n");
+ sleep(5);
+ */
+ struct alignment* algn = malloc(sizeof(struct alignment));
+ sslen = scol->length;
+ //allocss += sizeof(struct alignment);
+ if(algn==NULL) error("create_empty_alignment(): (1) Out of memory !");
+
+
+ //long xsize = sizeof(struct alignment);
+
+ algn->next = NULL;
+ // algn->prev = NULL;
+ algn->total_weight = 0.0;
+ //algn->pos = 0;
+ algn->max_pos = -1;
+ algn->scol = scol;
+ //algn->aligned_diags_amount=0;
+ //algn->aligned_diags = malloc(sizeof(struct diag*)*diag_amount);
+ //algn->max_aligned_diags_amount = diag_amount;
+ //algn->orig_max_aligned_diags_amount = diag_amount;
+ //algn->backlog_diags = NULL;
+ ////allocss += (sizeof(struct diag*)*diag_amount);
+
+ //if(algn->aligned_diags==NULL)
+ // error("create_empty_alignment(): (1.5) Out of memory !");
+
+
+ unsigned int slen = scol->length;
+ algn->seq_is_orphane = calloc(slen, sizeof(char));
+ //allocss += (sizeof(char)*slen);
+
+ //xsize += slen*sizeof(char);
+
+ if(algn->seq_is_orphane==NULL) error("create_empty_alignment(): (2) Out of memory !");
+ // memset(algn->seq_is_orphane, 1, slen*sizeof(char));
+
+ algn->algn = malloc(sizeof(struct algn_pos *)*slen);
+ //allocss += sizeof(struct algn_pos *)*slen;
+
+ //xsize += slen*sizeof(struct algn_pos *);
+
+ if(algn->algn==NULL) error("create_empty_alignment(): (3) Out of memory !");
+ //algn->redo_seqs = calloc(slen*slen, sizeof(char));
+ int i,j;
+ struct seq* sq;
+ for(i=0;i<slen;i++) {
+ sq = &(scol->seqs[i]);
+ algn->seq_is_orphane[i]=1;
+ algn->algn[i] = malloc(sizeof(struct algn_pos)*sq->length );
+ //allocss += sizeof(struct algn_pos )*sq->length;
+ //xsize += sq->length*sizeof(struct algn_pos *);
+
+ if(algn->algn[i]==NULL) error("create_empty_alignment(): (4) Out of memory !");
+
+ for(j=0;j<sq->length;j++) {
+ algn->algn[i][j].state = para->STATE_ORPHANE;
+ // algn->algn[i][j].isInherited = 0;
+ algn->algn[i][j].predFPos = -1;
+ algn->algn[i][j].succFPos = -1;
+
+ algn->algn[i][j].eqcParent= &(algn->algn[i][j]);
+ //if(j==442) printf(" parent: %i\n", algn->algn[i][j].eqcParent);
+ algn->algn[i][j].eqcRank= 0;
+ algn->algn[i][j].eqcAlgnPos=calloc(1, sizeof(int));;
+ //allocss += sizeof(int);
+ *algn->algn[i][j].eqcAlgnPos=j;
+ algn->algn[i][j].proceed=calloc(1, sizeof(char));;
+ //allocss += sizeof(char);
+ *algn->algn[i][j].proceed = 0;
+
+ algn->algn[i][j].predF = NULL;
+ algn->algn[i][j].succF = NULL;
+
+ algn->algn[i][j].row = i;
+ algn->algn[i][j].col = j;
+ algn->algn[i][j].dg_cont = NULL;
+ //xsize += sizeof(char) + sizeof(int);
+ }
+ }
+ /*
+ printf("after\n");
+ sleep(5);
+ printf("gone\n");
+ */
+ // printf(" algnsize=%i\n",xsize);
+ return algn;
+}
+
+
+/**
+ * free alignment
+ *
+ */
+void free_alignment(struct alignment *algn) {
+ struct seq_col *scol = algn->scol;
+ int slen = scol->length;
+ int i,j;
+ struct algn_pos *apos;
+ struct algn_pos *o_apos;
+ struct algn_pos *tpos;
+ struct seq *sq;
+ struct diag_cont *dgc,*ndgc;
+
+ if(algn->seq_is_orphane!=NULL) {
+ free(algn->seq_is_orphane);
+ //freess += sizeof(char)*slen;
+ }
+ for(i=0;i<slen;i++) {
+ sq = &(scol->seqs[i]);
+ for(j=0;j<sq->length;j++) {
+ apos = &(algn->algn[i][j]);
+ if(! (apos->state & para->STATE_INHERITED) && ! (apos->state & para->STATE_ORPHANE)) {
+ //if(! (apos->state & para->STATE_INHERITED) && ! (apos->state & para->STATE_ORPHANE)) {
+ if(apos->predF!=NULL) {
+ free(apos->predF);
+ //freess += sizeof(int)*slen;
+ }
+ if(apos->succF!=NULL) {
+ free(apos->succF);
+ //freess += sizeof(int)*slen;
+ }
+
+ }
+ if(! (apos->state & para->STATE_INHERITED) || (apos->state & para->STATE_ORPHANE) ) {
+ free(apos->eqcAlgnPos);
+ free(apos->proceed);
+ //freess += sizeof(int)+sizeof(char);
+ }
+ dgc = apos->dg_cont;
+ while(dgc!=NULL) {
+ ndgc = dgc->next;
+ //printf(" free %i %i %i %i\n", i,j,dgc, dgc->next);
+ free(dgc);
+ //freess += sizeof(struct diag_cont);
+ dgc = ndgc;
+ }
+
+ }
+ free(algn->algn[i]);
+ //freess += sizeof(struct algn_pos)*sq->length;
+ }
+ //dgc = algn->backlog_diags;
+ //while(dgc!=NULL) {
+ // ndgc = dgc->next;
+ // free(dgc);
+ // //freess += sizeof(struct diag_cont);
+ // dgc = ndgc;
+ //}
+
+
+
+ //free(algn->aligned_diags);
+ ////freess += sizeof(struct diag *)*algn->;
+ free(algn->algn);
+ free(algn);
+ ////freess += sizeof(struct algn_pos *)*slen + sizeof(struct alignment);
+}
+
+
+/**
+ * returnes the representative of the equivalence class
+ */
+struct algn_pos *_find_eqc(struct algn_pos *ap) {
+ if(ap!=ap->eqcParent) {
+ // if(doprint) printf(" FIND: %i %i\n", ap, ap->eqcParent);
+
+ /**
+ if(ap->eqcParent->eqcAlgnPos!=NULL) {
+ if( (ap->eqcAlgnPos!=NULL) && *ap->eqcParent->eqcAlgnPos < *ap->eqcAlgnPos) {
+ // if(doprint) printf(" 1.1 ALGNPOS: %i %i\n", ap, ap->eqcParent);
+ *ap->eqcParent->eqcAlgnPos = *ap->eqcAlgnPos;
+ }
+ } else {
+ // ap->eqcParent->eqcAlgnPos = ap->eqcAlgnPos;
+ }
+ */
+ ap->eqcParent = _find_eqc(ap->eqcParent);
+ }
+ // if(doprint) printf(" 1.ALGNPOS: %i %i\n", ap, ap->eqcParent);
+ // if(doprint) printf(" 2.ALGNPOS: %i %i\n", ap, ap->eqcParent);
+ return ap->eqcParent;
+}
+
+/**
+ * returnes the representative of the equivalence class
+ */
+struct algn_pos *find_eqc(struct algn_pos **ap, int seqnum, int pos) {
+ //if(1) printf("%i %i %i\n", ap, seqnum,pos);
+ struct algn_pos *tap = &ap[seqnum][pos];
+ struct algn_pos *eq_ap;
+ eq_ap = _find_eqc(tap);
+ struct diag_cont *old_dgc;
+
+ // if(eq_ap->eqcAlgnPos != tap->eqcAlgnPos) {
+ if(eq_ap != tap) {
+
+ /*
+ if(tap->state & para->STATE_ORPHANE) {
+ printf(" ALARM ORPHANE %i %i\n", eq_ap->state, tap->state);
+ }
+ if(eq_ap->state & para->STATE_ORPHANE) {
+ printf(" ALARM ORPHANE %i %i\n", eq_ap->state, tap->state);
+ }
+ */
+ //if((tap->eqcAlgnPos!=NULL) && (*tap->eqcAlgnPos > *eq_ap->eqcAlgnPos))
+ // *eq_ap->eqcAlgnPos = *tap->eqcAlgnPos;
+
+ // if(eq_ap->eqcAlgnPos != tap->eqcAlgnPos)
+ if( (!(tap->state & para->STATE_INHERITED))) { //&& !oldparentIsInherited) {
+ if(tap->eqcAlgnPos !=NULL) {
+ //if(pos==175) printf("free eqcAlgnPos: %i\n", tap->eqcAlgnPos);
+ //balance -= sizeof(int);
+ free(tap->eqcAlgnPos);
+ tap->eqcAlgnPos = NULL;
+ //freess += sizeof(int);
+ }
+
+ if(tap->proceed !=NULL) {
+ //printf("free proceed: %i\n", tap->proceed);
+ //balance -= sizeof(char);
+ free(tap->proceed);
+ //freess += sizeof(char);
+ //printf("after free proceed: %i\n", tap->proceed);
+ tap->proceed = NULL;
+ }
+
+ //if(tap->predFPos>=0)
+ if( (eq_ap->predF != tap->predF) && (1 || (tap->predFPos<0)) && (tap->predF!=NULL)){
+ //printf(" free predF: %i %i %i %i\n", tap->predF, tap->isInherited, seqnum, pos);
+ //balance -= sizeof(int)*sslen;
+ //printf (" 3. free: %i %i %i\n",allocs, frees, allocs-frees);
+ //freess += sizeof(int)*sslen;
+ free(tap->predF);
+ //printf(" after free predF: %i\n", tap->predF);
+ tap->predF=NULL;
+ }
+ //if(tap->succFPos>=0)
+ if((eq_ap->succF != tap->succF) && (1 || (tap->succFPos<0)) && (tap->succF!=NULL)) {
+ //printf("free succ: %i\n", tap->succF);
+ //balance -= sizeof(int)*sslen;
+ //printf (" 4. free: %i %i %i\n",allocs, frees, allocs-frees);
+ //freess += sizeof(int)*sslen;
+ free(tap->succF);
+ //printf("after free succ: %i\n", tap->succF);
+ tap->succF=NULL;
+ }
+ } /*else {
+ if(eq_ap->state & para->STATE_INHERITED) {
+ printf(" inherited alarm!\n");
+ }
+ if(eq_ap->state & para->STATE_ORPHANE) {
+ printf(" orphane alarm!\n");
+ }
+ }*/
+ old_dgc = tap->dg_cont;
+ *tap = *eq_ap;
+ tap->dg_cont = old_dgc;
+ tap->row = seqnum;
+ tap->col = pos;
+ tap->state = (tap->state | para->STATE_INHERITED);
+ }
+ //if(seqnum==0 &&pos==175) printf("after !=\n");
+ // tap = eq_ap;
+
+ struct algn_pos *ttap;
+ if(tap->predFPos>=0 ) {
+ //if(seqnum==0 && pos==175) printf(" alarm predF: %i %i %i %i\n", tap->predF, tap->predFPos, seqnum, pos);
+ // printf ("PRE Pos %i %i \n", tap->predFPos, pos);
+ if( (tap->predFPos==pos)|| !(tap->state & para->STATE_ORPHANE)) {
+ printf("pred ALARM %i %i\n", tap->predFPos, pos);
+ exit(99);
+ }
+ ttap=find_eqc(ap, seqnum, tap->predFPos);
+ tap->predF = ttap->predF;
+ }
+ if(tap->succFPos>=0) {
+ //if(seqnum==0 && pos==175) printf(" alarm succF: %i %i %i %i\n", tap->succF, tap->succFPos, seqnum, pos);
+ //printf ("2. PRE Pos %i %i \n", tap->predFPos, tap->succFPos);
+ if( (tap->succFPos==pos)|| !(tap->state & para->STATE_ORPHANE)) {
+ printf("succ ALARM %i %i\n", tap->succFPos, pos);
+ exit(99);
+ }
+ ttap = find_eqc(ap, seqnum, tap->succFPos);
+ tap->succF = ttap->succF;
+ }
+ //if(seqnum==0 && pos==175) printf(" end qgc\n");
+ return tap;
+}
+
+/**
+ * copy alignment
+ *
+ * doDgc = 0: ignore all backlogdiags and position dg_cont's
+ * doDgc = 1: free the target backlogdiags and dg_conts'
+ * doDgc = 2: same as 1 but also copy the original backlog diags and dg_conts to the target
+struct alignment* copy_alignment( struct alignment *o_algn, struct alignment *algn, char doDgc) {
+
+ struct seq_col *scol = o_algn->scol;
+ int slen = scol->length;
+ int i,j;
+ struct algn_pos *apos;
+ struct algn_pos *o_apos;
+ struct algn_pos *tpos;
+ struct seq *sq;
+ struct diag_cont *ptdgc, *tdgc, *o_tdgc;
+
+ if(doDgc>0) {
+ tdgc = algn->backlog_diags;
+ while(tdgc!=NULL) {
+ algn->backlog_diags = algn->backlog_diags->next;
+ free(tdgc);
+ tdgc = algn->backlog_diags;
+ }
+
+ if(doDgc>1) {
+ o_tdgc = o_algn->backlog_diags;
+ ptdgc = NULL;
+ while(o_tdgc!=NULL) {
+ tdgc = malloc(sizeof(struct diag_cont));
+ *tdgc = *o_tdgc;
+ if(ptdgc == NULL) {
+ algn->backlog_diags = tdgc;
+ } else {
+ ptdgc->next = tdgc;
+ }
+ ptdgc = tdgc;
+ }
+ }
+ }
+
+
+ memcpy(algn->seq_is_orphane, o_algn->seq_is_orphane, sizeof(char)*slen);
+ algn->total_weight = o_algn->total_weight;
+ // printf(" enter copy\n");
+ for(i=0;i<slen;i++) {
+ sq = &(scol->seqs[i]);
+ for(j=0;j<sq->length;j++) {
+ apos = &(algn->algn[i][j]);
+ o_apos = &(o_algn->algn[i][j]);
+
+ if(doDgc>0) {
+ tdgc = apos->dg_cont;
+ while(tdgc!=NULL) {
+ apos->dg_cont = apos->dg_cont->next;
+ free(tdgc);
+ tdgc = apos->dg_cont;
+ }
+
+ if(doDgc>1) {
+ o_tdgc = o_apos->dg_cont;
+ ptdgc = NULL;
+ while(o_tdgc!=NULL) {
+ tdgc = malloc(sizeof(struct diag_cont));
+ *tdgc = *o_tdgc;
+ if(ptdgc == NULL) {
+ apos->dg_cont = tdgc;
+ } else {
+ ptdgc->next = tdgc;
+ }
+ ptdgc = tdgc;
+ }
+ }
+ }
+
+ if(! (apos->state & para->STATE_ORPHANE)) {
+ if(o_apos->state & para->STATE_ORPHANE) {
+ if(!(apos->state & para->STATE_INHERITED)) {
+ // printf (" free1\n")
+ //frees += sizeof(int)*slen*2;
+ //printf (" 1. frees: %i %i %i\n",allocs, frees, allocs-frees);
+
+ free(apos->predF);
+ free(apos->succF);
+ //balance -= 2*sizeof(int)*slen;
+ }
+ apos->predF=NULL;
+ apos->succF=NULL;
+ } else {
+ if(apos->state & para->STATE_INHERITED) {
+ if(! (o_apos->state & para->STATE_INHERITED)) {
+ //printf (" 1. malloc: %i %i %i\n",allocs, frees, allocs-frees);
+ apos->predF=malloc(sizeof(int)*slen);
+ apos->succF=malloc(sizeof(int)*slen);
+ //allocss += sizeof(int)*slen*2;
+ //balance += 2*sizeof(int)*slen;
+ if( (apos->predF==NULL) || (apos->succF==NULL)) error("copy_alignment(): (1) Out of memory !");
+ memcpy(apos->predF, o_apos->predF, sizeof(int)*slen);
+ memcpy(apos->succF, o_apos->succF, sizeof(int)*slen);
+ } else {
+ apos->predF=NULL;
+ apos->succF=NULL;
+ }
+ } else {
+ if(! (o_apos->state & para->STATE_INHERITED)) {
+ memcpy(apos->predF, o_apos->predF, sizeof(int)*slen);
+ memcpy(apos->succF, o_apos->succF, sizeof(int)*slen);
+ } else {
+ // printf (" free2\n")
+ //frees += sizeof(int)*slen*2;
+ //printf (" 2. frees: %i %i %i\n",allocs, frees, allocs-frees);
+ free(apos->predF);
+ free(apos->succF);
+ //freess += sizeof(int)*slen*2;
+
+ //balance -= 2*sizeof(int)*slen;
+ apos->predF=NULL;
+ apos->succF=NULL;
+ }
+ }
+ }
+ } else {
+ if( !(o_apos->state & para->STATE_ORPHANE)) {
+ if(o_apos->state & para->STATE_INHERITED) {
+ apos->predF=NULL;
+ apos->succF=NULL;
+ } else {
+ //allocs += sizeof(int)*slen*2;
+ //printf (" 2. malloc: %i %i %i\n",allocs, frees, allocs-frees);
+ apos->predF=malloc(sizeof(int)*slen);
+ apos->succF=malloc(sizeof(int)*slen);
+ //allocss += sizeof(int)*slen*2;
+ //balance += 2*sizeof(int)*slen;
+ if( (apos->predF==NULL) || (apos->succF==NULL)) error("copy_alignment(): (2) Out of memory !");
+ memcpy(apos->predF, o_apos->predF, sizeof(int)*slen);
+ memcpy(apos->succF, o_apos->succF, sizeof(int)*slen);
+ }
+ } else {
+ apos->predF=NULL;
+ apos->succF=NULL;
+ }
+ }
+
+
+ apos->predFPos = o_apos->predFPos;
+ apos->succFPos = o_apos->succFPos;
+
+
+ //printf(" before %i %i\n", i,j);
+ apos->eqcRank = o_apos->eqcRank;
+ tpos = o_apos->eqcParent;
+ apos->eqcParent = &(algn->algn[tpos->row][tpos->col]);
+ if( (apos->state & para->STATE_INHERITED)) {
+ if( !(o_apos->state & para->STATE_INHERITED)) {
+ //allocs += sizeof(int)+sizeof(char);
+ apos->eqcAlgnPos = malloc(sizeof(int));
+ *(apos->eqcAlgnPos)=j;
+ apos->proceed = malloc(sizeof(char));
+ *(apos->proceed)=0;
+ //allocss += sizeof(int)+sizeof(char);
+ }
+ } else {
+ if((o_apos->state & para->STATE_INHERITED)) {
+ //frees += sizeof(int)+sizeof(char);
+ free(apos->eqcAlgnPos);
+ free(apos->proceed);
+ apos->eqcAlgnPos=NULL;
+ apos->proceed=NULL;
+ //balance -= sizeof(int)+sizeof(char);
+ }
+ }
+ //printf(" after %i %i\n", i,j);
+
+ apos->state = o_apos->state;
+ }
+ }
+
+ // printf(" leave copy\n");
+ return algn;
+}
+
+ */
+
+/**
+ * adds the given diagional to the given alignment and updates the
+ * datastructure (i.e. frontiers). The given diag must be consistent
+ * to the given alignment !
+ */
+char align_diag(struct alignment *algn, struct scr_matrix *smatrix, struct diag* dg) {
+
+ char alignedSomething = 0;
+ int i,j,k;
+ char al;
+ if(dg->multi_dg) {
+ //return 0;
+ for(i=0;i<dg->multi_length;i++) {
+ if(dg->multi_cont[i]!=NULL) {
+ //printf(" before %f %f\n", dg->total_weight, dg->multi_cont[i]->weight);
+ al = align_diag(algn,smatrix, dg->multi_cont[i]);
+ if(al) algn->total_weight -= dg->multi_cont[i]->total_weight;
+ alignedSomething = alignedSomething || al;
+
+ //printf(" after \n");
+ }
+ }
+ return alignedSomething;
+ }
+
+ //if((dg->length==0) ) return 0;
+ if((dg->length==0) || (!dg->meetsThreshold && !dg->anchor)) return 0;
+ /*
+ printf(" dg %i %i %i\n", dg, dg->multi_dg, dg->length);
+ char adapted = adapt_diag(algn, smatrix, dg);
+ if(adapted) {
+ printf(" dg %i %i %i\n", dg, dg->multi_dg, dg->length);
+ error(" inconsistent diag!\n");
+ }
+ */
+
+ struct seq_col *scol = algn->scol;
+ int s1 = dg->seq_p1.num;
+ int s2 = dg->seq_p2.num;
+
+ //printf("%i %i\n", s1,s2);
+
+ //char o1 = algn->seq_is_orphane[s1];
+ //char o2 = algn->seq_is_orphane[s2];
+
+ int length = dg->length;
+ int sp1 = dg->seq_p1.startpos;
+ int sp2 = dg->seq_p2.startpos;
+
+ struct algn_pos **ap=algn->algn;
+ struct algn_pos *tp;
+
+ struct algn_pos *apos1, *apos2, *tpos;
+
+ int p1, p2,plen;
+ int p;
+ struct seq *sq = scol->seqs;
+ int s, slen = scol->length;
+ int *oldpredF, *oldsuccF, *otherpredF, *othersuccF;
+ int pF,sF;
+
+ int *c2n = smatrix->char2num;
+ int *sdata = smatrix ->data;
+ char *data1 = dg->seq_p1.sq->data;
+ char *data2 = dg->seq_p2.sq->data;
+ int smatrixlen = smatrix->length;
+ int a1,a2;
+ int score1;
+
+ char seenNonOrphane;
+ int opos;
+ int ms;
+ char skip = 0;
+ char found;
+
+ struct diag_cont *dgc, *dgc_next;
+ double ttim;
+ /*
+ int nextpos[slen];
+ int firstpos;
+ int oldpos;
+ char firstRound;
+ */
+ for(i=0;i<length;i++) {
+ p1 = sp1+i; p2 = sp2+i;
+ // printf("pos %i %i %i %i\n",s1,s2,p1,p2);
+ //printf(" %i \n", scol->length);
+ skip = 0;
+
+ //if(sp1==30) printf("%i %i %i %i %i \n", p1,p2,dg->length, dg->seq_p1.sq->length, dg->seq_p2.sq->length);
+ /*
+ // if(dg->onlyOverThres==1) {
+ a1 = c2n[data1[p1]];
+ a2 = c2n[data2[p2]];
+ score1 = sdata[smatrixlen*a1+a2];
+
+ if( (score1<=3) && (i>length/3)) {
+ skip = 1;
+ }
+ //}
+ */
+ // printf(" %i %i %i\n",p1,p2,skip);
+ //} else {
+ /*
+ a1 = c2n[data1[p1]];
+ a2 = c2n[data2[p2]];
+ score1 = sdata[smatrixlen*a1+a2];
+
+ if(score1<=4) {
+ skip = 1;
+ }
+ */
+ //if( (i==(length-1)) ){
+
+ //ttim = clock();
+ //tim += (clock()-ttim)/CLOCKS_PER_SEC;
+ // printf(" tim %f\n", tim);
+
+
+ //printf(" diag n1=%i s1=%i n2=%i s2=%i l=%i\n", s1,sp1,s2,sp2,length);
+ //allocss += 2*sizeof(struct diag_cont );
+ //}
+ // TODO: tune ration is 1:45 (minor)
+ /*
+ dgc_next = ap[s1][p1].dg_cont;
+ dgc = malloc(sizeof(struct diag_cont));
+ dgc->dg = dg;
+ dgc->next = dgc_next;
+ ap[s1][p1].dg_cont = dgc;
+ //if((s1==0) && (p1==133)) printf(" dddgc %i %i\n", dgc, dgc->next);
+
+ dgc_next = ap[s2][p2].dg_cont;
+ dgc = malloc(sizeof(struct diag_cont));
+ dgc->dg = dg;
+ dgc->next = dgc_next;
+ ap[s2][p2].dg_cont = dgc;
+ */
+
+
+ if(! skip) {
+ //printf("apos1 %i %i\n", s1, p1);
+ apos1 = find_eqc(ap, s1,p1);//&(ap[s1][p1]);
+ //printf("apos2 %i %i %i\n", s2, p2, scol->seqs[s2].length);
+ apos2 = find_eqc(ap, s2,p2); //&(ap[s2][p2]);
+ //printf("after apos2 %i %i\n", s2, p2);
+
+ oldpredF = apos1->predF;
+ oldsuccF = apos1->succF;
+ if(oldpredF!=NULL && oldsuccF!=NULL)
+ if(oldpredF[s2]==p2 && oldsuccF[s2]==p2) skip = 1;
+
+ if(para->DEBUG>4) {
+ if(!skip) {
+ if(oldpredF!=NULL) if(oldpredF[s2]>=p2) {
+ printf(" Incons1 %i %i %i\n", s2, p2,oldpredF[p2]);
+ error(" ERROR");
+ }
+ if(oldsuccF!=NULL) if(oldsuccF[s2]<=p2) {
+ printf(" Incons2 %i %i %i\n",s2, p2,oldsuccF[p2]);
+ error(" ERROR");
+ }
+ oldpredF=apos2->predF;
+ oldsuccF=apos2->succF;
+ if(oldpredF!=NULL) if(oldpredF[s1]>=p1) {
+ printf(" Incons3 %i %i %i\n", s1, p1,oldpredF[p1]);
+ error(" ERROR");
+ }
+ if(oldsuccF!=NULL) if(oldsuccF[s1]<=p1) {
+ printf(" Incons4 %i %i %i\n",s1, p1,oldsuccF[p1]);
+ error(" ERROR");
+ }
+ }
+ }
+ }
+ //}
+
+ if(! skip) {
+ alignedSomething = 1;
+ for(k=0;k<2;k++) {
+ tpos = (k==0 ? apos1 : apos2);
+ //printf("tpos %i\n", tpos);
+ oldpredF = tpos->predF;
+ oldsuccF = tpos->succF;
+ otherpredF = (k==0 ? apos2->predF : apos1->predF);
+ othersuccF = (k==0 ? apos2->succF : apos1->succF);
+ //printf("pre isorphane %i\n", tpos);
+ if(tpos->state & para->STATE_ORPHANE) {
+ //if(scol->length>21) printf("isorphane %i %i\n", tpos,sizeof(int)*scol->length);
+ //printf("step 1\n");
+ // printf (" 3. malloc: %i\n",sizeof(int)*slen*2);
+ //allocs += sizeof(int)*slen*2;
+ // printf (" 3. malloc: %i %i %i\n",allocs, frees, allocs-frees);
+ //balance += sizeof(int)*slen*2;
+ tpos->predF = malloc(sizeof(int)*scol->length);
+ //if(k==0) printf(" apos1->predF = %i\n",tpos->predF),
+ //printf("pre succForphane %i %i\n", tpos->succF, scol->length);
+ //printf(" step 2\n");
+ tpos->succF = malloc(sizeof(int)*scol->length);
+ //allocss += 2*sizeof(int )*scol->length;
+ //printf(" step 3\n");
+ //printf("succForphane %i\n", tpos);
+ if( (tpos->predF==NULL) || (tpos->succF==NULL)) error("align_diag(): (1) Out of memory !");
+
+ }
+ // printf("init loop %i\n", tpos);
+
+ for(j=0;j<scol->length;j++) {
+ pF = -1;
+ sF = sq[j].length;
+
+
+ // propagate predF and succF
+ if(oldpredF!=NULL && oldpredF[j]>pF) pF = oldpredF[j];
+ //if(j==0) printf("1 pf=%i\n", pF);
+ if(otherpredF!=NULL && otherpredF[j]> pF) pF = otherpredF[j];
+ //if(j==0) printf("2 pf=%i\n", pF);
+
+ if(oldsuccF!=NULL && oldsuccF[j]<sF) sF = oldsuccF[j];
+ if(othersuccF!=NULL && othersuccF[j]<sF) sF = othersuccF[j];
+ //}
+ if(j==s1) {
+ pF = p1;
+ sF = p1;
+ } else if(j==s2) {
+ pF = p2;
+ sF = p2;
+ }
+ /*
+ if(pF > sF) {
+ if(oldpredF!=NULL) printf(" PRE 1. ALARM oldpredF: %i \n",oldpredF[j] );
+ if(oldsuccF!=NULL) printf(" PRE 1. ALARM oldsuccF: %i \n",oldsuccF[j] );
+ if(otherpredF!=NULL) printf(" PRE 1. ALARM otherpredF: %i \n",otherpredF[j] );
+ if(othersuccF!=NULL) printf(" PRE 1. ALARM othersuccF: %i \n",othersuccF[j] );
+
+ printf("1. ALARM j=%i %i %i %i %i %i %i %i\n",
+ j,
+ (k==0 ? s1 : s2),
+ (k==0 ? p1 : p2),
+ (k==0 ? p2 : p1),
+ oldpredF!=NULL ? oldpredF[k==0 ? s2 : s1] : -2,
+ oldsuccF!=NULL ? oldsuccF[k==0 ? s2 : s1]: 99999,
+ tpos->predFPos,
+ tpos->succFPos);
+ exit(1);
+ }
+ */
+ //if(pF==sF && pF==0 && j==0) printf("pf=%i sf=%i j=%i s1=%i s2=%i p1=%i p2=%i iso=%i opf=%i osf=%i otpf=%i otsf=%i\n", pF,sF,j,s1,s2,p1,p2,tpos->isOrphane,oldpredF, oldsuccF, otherpredF, othersuccF);
+ tpos->predF[j]=pF;
+ tpos->succF[j]=sF;
+ }
+ //if(s1==0 && p1==0) printf(" SET IT 1\n");
+ //if(s2==0 && p2==0) printf(" SET IT 2\n");
+ //if(tpos->state & para->STATE_ORPHANE)
+ tpos->state = tpos->state & (tpos->state ^ para->STATE_ORPHANE);
+ tpos->predFPos = -1;
+ tpos->succFPos = -1;
+ }
+ //printf("end pre/succ %i\n", tpos);
+ apos1->predF[s1]=p1;
+ apos1->succF[s1]=p1;
+ apos2->predF[s2]=p2;
+ apos2->succF[s2]=p2;
+
+ apos1->predF[s2]=p2;
+ apos1->succF[s2]=p2;
+ apos2->predF[s1]=p1;
+ apos2->succF[s1]=p1;
+
+
+
+ if(apos2->eqcRank< apos1->eqcRank) {
+ apos2->eqcParent = apos1;
+ } else {
+ apos1->eqcParent = apos2;
+ if(apos2->eqcRank==apos1->eqcRank)
+ apos2->eqcRank++;
+ }
+
+ //printf("end ranking %i, %i %i\n", s1,p1,apos1->predF);
+ apos1 = find_eqc(ap, s1,p1);//&(ap[s1][p1]);
+ //printf("end first egc %i\n", tpos);
+ apos2 = find_eqc(ap, s2,p2); //&(ap[s2][p2]);
+ //printf("end second egc %i\n", tpos);
+
+ // update the other affected sites
+ for(ms=0;ms<slen;ms++) {
+ // spaeter ueberlegen: if((ms!=s1 && ms!=s2) || ( (ms==s1 || ms==s2) && (i==0 || i== (length-1) ))) {
+ // if(apos1->predF[ms]==apos1->succF[ms]) {
+
+ p = apos1->predF[ms]; // -( (apos1->predF[ms]==apos1->succF[ms]) ? 1 : 0); // GOGOGOGO
+ opos=apos1->predF[ms];
+ // printf("SUPERPRE WHILE %i %i %i\n",k,s1,s2);
+ tp = ap[ms];
+ //printf("PRE WHILE %i\n",k);
+ seenNonOrphane=0;
+ found = 1;
+ //firstRound = 1;
+ //firstpos = 0;
+ while( (p>=0)&& found) { // && tp[p].isOrphane) {
+ //printf(" WHILE %i\n",p);
+ if(tp[p].state & para->STATE_ORPHANE) {
+ if( (! seenNonOrphane)) {
+ // if(ms==0 && p==0) printf("setting s1=%i p1=%i iso=%i ms=%i p=%i opos=%i\n",s1,p1, tp[p].isOrphane, ms,p,opos);
+ tp[p].succFPos = opos;
+ } else p = tp[p].predFPos+1;
+ } else {
+ if( (p!=opos) || (apos1->succF[ms]!=apos1->predF[ms]))
+ seenNonOrphane = 1;
+ //if(p==442) printf(" pre find %i %i %i\n",s1, ms,p);
+ tpos = find_eqc(ap, ms,p);//&(ap[s1][p1]);
+ //if(p==442)printf(" post find %i %i\n",ms,p);
+ if(! (tpos->state & para->STATE_ORPHANE) && ! (tpos->state & para->STATE_INHERITED)) {
+ //printf(" %i %i %i %i\n",ms,p,s1,p1);
+ if(seenNonOrphane) found = 0;
+ for(s=0;s<slen;s++) {
+ if(tpos->succF[s]>apos1->succF[s]) {
+ tpos->succF[s]=apos1->succF[s];
+ found = 1;
+ }
+ }
+ /*
+ oldpos = firstpos;
+ s = firstpos;
+ while(s<slen) {
+ if(firstRound) {
+ nextpos[s]=s+1;
+ }
+ if(tpos->succF[s]>apos1->succF[s]) {
+ tpos->succF[s]=apos1->succF[s];
+ found = 1;
+ oldpos = s;
+ } else {
+ if(! firstRound) {
+ nextpos[oldpos] = nextpos[s];
+ if(oldpos==firstpos) {
+ firstpos=nextpos[oldpos];
+ oldpos = firstpos;
+ }
+ }
+ }
+ if(firstRound) {
+ oldpos = s;
+ s++;
+ } else {
+ s = nextpos[s];
+ }
+ }
+ */
+ }
+ }
+ //firstRound = 0;
+ p--;
+ }
+
+ //printf("END WHILE\n");
+
+ //printf(" PRE 2 %i %i %i\n", apos1->predF, apos1->succF,ms );
+ p = apos1->succF[ms]; // +( (apos1->predF[ms]==apos1->succF[ms]) ? 1 : 0); // GOGOGOGO ;
+ opos= apos1->succF[ms];
+ plen = scol->seqs[ms].length;
+ seenNonOrphane=0;
+ //printf("2. PRE WHILE %i\n",k);
+ // if(opos>=plen) opos = -1;
+ found = 1;
+ while( (p<plen ) && found) {
+ // step = (int)(p-tep);
+ if(tp[p].state & para->STATE_ORPHANE) {
+ if( (! seenNonOrphane)) {
+ /*
+ if(p==opos) {
+ printf("ALARM set predFPos s1=%i s2=%i p1=%i p2=%i ms=%i sF=%i pF=%i p=%i opos=%i iso=%i %i %i %i\n",
+ s1,s2,p1,p2,ms, apos1->succF[ms],
+ apos1->predF[ms],p,opos, tp[p].state,(int) &tp[p],(int) apos1, (int) apos2);
+ exit(98);
+ }
+ */
+ tp[p].predFPos = opos;
+ } else {
+ if(tp[p].succFPos < 0)
+ p = plen+1;
+ else
+ p = tp[p].succFPos-1;
+ }
+
+ } else {
+ if( (p!=opos)|| (apos1->succF[ms]!=apos1->predF[ms]))
+ seenNonOrphane = 1;
+ //printf(" pre find %i %i\n",ms,p);
+ tpos = find_eqc(ap, ms,p);//&(ap[s1][p1]);
+ //printf(" end find\n");
+ if(! (tpos->state & para->STATE_ORPHANE) && !(tpos->state & para->STATE_INHERITED)) {
+ if(seenNonOrphane) found = 0;
+ for(s=0;s<slen;s++) {
+ // printf(" s=%i slen=%i tpos->predF=%i\n",s,slen,tpos->predF);
+
+ if( tpos->predF[s]<apos1->predF[s]) {
+ //printf(" inner before s=%i slen=%i\n",s,slen);
+ tpos->predF[s]=apos1->predF[s];
+ //printf(" inner after s=%i slen=%i\n",s,slen);
+ found = 1;
+ }
+ }
+ }
+ }
+ p++;
+ }
+ //printf("2. END WHILE %i\n",k);
+ }
+
+ }
+ }
+
+
+ // printf("s1: %i s2: %i\n", algn->seq_is_orphane[s2],s2);
+ algn->seq_is_orphane[s1]=0;
+ algn->seq_is_orphane[s2]=0;
+
+ int maxposs1 = dg->seq_p1.startpos + dg->length-1;
+ int maxposs2 = dg->seq_p2.startpos + dg->length-1;
+ if(dg->seq_p1.sq->max_seen < maxposs1)
+ dg->seq_p1.sq->max_seen = maxposs1;
+
+ if(dg->seq_p2.sq->max_seen < maxposs2)
+ dg->seq_p2.sq->max_seen = maxposs2;
+
+ //if(alignedSomething) {
+ /*
+ if(algn->aligned_diags_amount >= algn->max_aligned_diags_amount) {
+ algn->max_aligned_diags_amount = algn->aligned_diags_amount + 16;
+ algn->aligned_diags = realloc(algn->aligned_diags,
+ sizeof(struct diag*)*algn->max_aligned_diags_amount);
+ if(algn->aligned_diags==NULL) error(" align_diag(): Out of Memory!");
+ }
+ algn->aligned_diags[algn->aligned_diags_amount++] = dg;
+ */
+ /*
+ } else {
+
+ dgc = malloc(sizeof(struct diag_cont));
+ dgc->dg = dg;
+ dgc->next = NULL;
+ algn->backlog_diags = enter_sorted(algn->backlog_diags, dgc);
+
+ }
+ */
+ //printf(" diaglen: %i\n", algn->aligned_diags_amount);
+ if(! dg->anchor) algn->total_weight += dg->weight;//*dg->weight_fac;
+ return(alignedSomething);
+}
+
+
+
+
+
+/**
+ *
+ * prepares the alignment: calculates the position number of each residue
+ *
+ */
+void prepare_alignment(struct alignment *algn) {
+ struct seq_col *scol = algn->scol;
+ unsigned int slen = scol->length;
+
+ unsigned int i,j,s,ts, hasmore, max;
+ int *predF, *succF;
+ struct seq* sq;
+ struct algn_pos **ap = algn->algn;
+ int tproc[slen];
+ // char proceed[slen];
+
+ for(i=0;i<slen;i++) {
+ tproc[i]=0;
+ }
+
+ //
+ // prepare block
+ //
+ struct algn_pos *ap1;
+ hasmore = 1;
+ char alarmHasProceed;
+
+ for(j=0;hasmore;j++) {
+ hasmore = 0;
+ //memset(proceed, 0, slen*sizeof(char));
+ // printf("Position: %i\n", j);
+ // for(k=0;k<2;k++) {
+ for(s=0;s<slen;s++) {
+ sq = &scol->seqs[s];
+ if(tproc[s]<sq->length) {
+ ap1 = find_eqc(ap,s,tproc[s]);
+ *ap1->proceed = 1;
+
+ }
+ }
+ for(s=0;s<slen;s++) {
+ sq = &scol->seqs[s];
+ if(tproc[s]<sq->length) {
+ //printf(" DO IT %i %i %i %i\n",j,s,tproc[s], *ap1->eqcAlgnPos);
+ ap1 = find_eqc(ap,s,tproc[s]);
+// printf("alig.c ap1 = %d\tap = %d\n",ap1,ap);
+
+ if(j>=*ap1->eqcAlgnPos) {
+ predF = ap1->predF;
+ succF = ap1->succF;
+
+ *ap1->eqcAlgnPos=j;// *tap1->eqcAlgnPos;
+ if(predF!=NULL) {
+ for(ts=0;ts<slen;ts++) {
+ //printf(" MIST %i %i %i %i %i %i %i\n",j,s,ts,tproc[s], tproc[ts], predF[ts], succF!=NULL ? succF[ts]: 99999);
+ if( (tproc[ts]<predF[ts]) && !(tproc[ts]==predF[ts] && succF!=NULL && succF[ts]==predF[ts])) {
+ *ap1->eqcAlgnPos=j+1;// *tap1->eqcAlgnPos;
+ //printf(" 2. MIST %i %i %i %i %i %i %i\n",j,s,ts,tproc[s], tproc[ts], predF[ts], succF!=NULL ? succF[ts]: 99999);
+ *ap1->proceed = 0;
+ break;
+ } else {
+ /*
+ *ap1->eqcAlgnPos=j;// *tap1->eqcAlgnPos;
+ *ap1->proceed = 1;
+ */
+ }
+ }
+ }
+ } else {
+ *ap1->proceed = 0;
+ }
+ /*
+ if(j>=143) {
+ printf("ALARM j=%i s=%i tproc[s]=%i algnPos=%i\n",j,s,tproc[s],*ap[s][tproc[s]].eqcAlgnPos);
+ }
+ */
+ }
+ }
+ alarmHasProceed=0;
+ for(s=0;s<slen;s++) {
+ sq = &scol->seqs[s];
+ if(tproc[s]<sq->length) {
+ ap1 = find_eqc(ap,s,tproc[s]);
+ if(*ap1->proceed) {
+ alarmHasProceed = 1;
+ tproc[s]++;
+ }
+ }
+ if(tproc[s]<sq->length) hasmore = 1;
+ //printf("%i %i\n", sq->length,tproc[s]);
+ }
+ if(! alarmHasProceed && hasmore) {
+ printf("IO ALARM! %i\n",j);
+ exit(1);
+ hasmore=0;
+ }
+ if(!hasmore) max = j+1;
+ }
+ algn->max_pos= max;
+}
+
+
+
diff --git a/dialign/assemble.c b/dialign/assemble.c
new file mode 100644
index 0000000..25e92f0
--- /dev/null
+++ b/dialign/assemble.c
@@ -0,0 +1,1418 @@
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "parameters.h"
+#include "struct.h"
+
+extern void error(char *message);
+extern void merror(char *msg1, char *msg2);
+extern inline void calc_weight(struct diag* dg, struct scr_matrix* smatrix,
+ struct prob_dist *pdist);
+extern inline void calc_ov_weight(struct diag* dg, struct diag_col *dcol, struct scr_matrix* smatrix,
+ struct prob_dist *pdist);
+//extern struct seq_part* create_seq_part(int num, struct seq* aSeq, unsigned int startpos);
+extern long double** create_tmp_pdist(struct prob_dist *pdist);
+extern void free_tmp_pdist(long double **dist, int length);
+
+extern struct diag* create_diag(int n1, struct seq* sq1, unsigned int sp1,
+ int n2, struct seq* sq2, unsigned int sp2,
+ int dlength);
+extern void free_diag(struct diag* dg);
+extern inline struct simple_diag_col* find_diags_guided(struct scr_matrix *smatrix,
+ struct prob_dist *pdist,
+ struct gt_node* n1,
+ struct gt_node* n2,
+ struct alignment *algn,
+ double thres_weight,
+ int *** diag_info);
+
+
+
+extern struct alignment* create_empty_alignment(struct seq_col *scol);
+extern void free_alignment(struct alignment *algn);
+extern inline struct algn_pos *find_eqc(struct algn_pos **ap, int seqnum, int pos);
+extern struct alignment* copy_alignment( struct alignment *o_algn, struct alignment *algn, char doDgc);
+//extern char adapt_diag(struct alignment *algn, struct scr_matrix *smatrix, struct diag* dg);
+extern inline char align_diag(struct alignment *algn, struct scr_matrix *smatrix, struct diag* dg);
+//extern inline struct diag_cont* enter_sorted(struct diag_cont* backlog_diags, struct diag_cont *cand);
+//extern inline char fit_fpos_diag(struct alignment *algn, struct diag* dg);
+
+//extern unsigned long allocss;
+//extern unsigned long freess;
+
+/**
+ *
+ * assemble.c: assembles the alignment from the diagonals
+ *
+ */
+
+
+//double tim = 0;
+
+
+/**
+ * enters the candidate in a sorted way to the list and returns pointer to the first element
+ */
+inline struct diag_cont* enter_sorted(struct diag_cont* backlog_diags, struct diag_cont *cand) {
+ if(backlog_diags==NULL) {
+ cand->next=NULL;
+ return cand;
+ }
+
+ struct diag_cont *prev = backlog_diags;
+ struct diag_cont *actual = backlog_diags;
+
+ //printf(" before %f %i\n", cand->dg->total_weight, backlog_diags->dg);
+ // if( (cand==backlog_diags) || (backlog_diags->next==cand)) error(" enter_sorted(): critical error");
+
+ if((cand->dg->total_weight >= backlog_diags->dg->total_weight)) {
+ cand->next = backlog_diags;
+ return cand;
+ }
+
+ while( (actual!=NULL) && (cand->dg->total_weight < actual->dg->total_weight)) {
+ prev = actual;
+ actual = actual->next;
+ }
+ prev->next = cand;
+ cand->next = actual;
+
+ //printf(" after\n");
+
+ return backlog_diags;
+}
+
+
+
+
+/**
+ * returns whether the given first position of the diag fits intho the given alignment
+ */
+inline char fit_fpos_diag(struct alignment *algn, struct diag* dg) {
+ unsigned int s1 = dg->seq_p1.num;
+ unsigned int s2 = dg->seq_p2.num;
+
+ char o1 = algn->seq_is_orphane[s1];
+ char o2 = algn->seq_is_orphane[s2];
+ // if any sequence is orphane the diag is always consistent
+ if( o1 || o2) return 1;
+
+ int sp1 = dg->seq_p1.startpos;
+ int sp2 = dg->seq_p2.startpos;
+ int ep1 = sp1+dg->length-1;
+ int ep2 = sp2+dg->length-1;
+
+ struct algn_pos **ap=algn->algn;
+ int predF, succF;
+
+
+ struct algn_pos *tap;
+
+ tap = find_eqc(ap, s1, sp1);
+ if(tap->predF!=NULL) { //&& tap->succF!=NULL) {
+ predF = tap->predF[s2];
+ } else {
+ predF=-1;
+ }
+ if(tap->succF!=NULL) {
+ succF = tap->succF[s2];
+ } else {
+ succF = ep2+1;
+ }
+ if( ( (predF>=sp2)|| (succF<=sp2) ) && !(predF==sp2 && succF==sp2)) {
+ //printf(" leave fit_fpos 0 \n");
+ return 0;
+ } else {
+ // printf(" leave fit_fpos 1 \n");
+ return 1;
+ }
+
+}
+
+
+
+/**
+ * changes the startpos's and length of the diag such that
+ * it becomes consistent with the given alignment. If the diag
+ * has more than one part that is consistent the leftmost will be chosen
+ * The return value is 1 if any changes were made otherwise 0.
+ * (The weight of the diag is not recalculated !).
+ *
+ */
+char adapt_diag(struct alignment *algn, struct scr_matrix *smatrix, struct diag* dg) {
+//char adapt_diag(struct alignment *algn, struct diag* dg) {
+ //printf(" ENTER adapt\n");
+
+ if(dg->multi_dg) {
+ char adapted = 0;
+ int i;
+ for(i=0;i<dg->multi_length;i++) {
+ if(dg->multi_cont[i]!=NULL) {
+ if(dg->multi_cont[i]->length > 0) {
+ //printf(" adapted before %i %i\n", adapted, dg->multi_cont[i]->length);
+ adapted = adapted || adapt_diag(algn, smatrix, dg->multi_cont[i]);
+ /*
+ if(dg->multi_cont[i]->length == 0) {
+ dg->multi_cont[i]->meetsThreshold = 0;
+ }*/
+ //printf(" adapted after %i %i\n", adapted, dg->multi_cont[i]->length);
+ }
+ if(dg->multi_cont[i]->length==0) {
+ free(dg->multi_cont[i]);
+ dg->multi_cont[i]=NULL;
+ }
+ }
+ }
+ return adapted;
+ }
+
+ unsigned int s1 = dg->seq_p1.num;
+ unsigned int s2 = dg->seq_p2.num;
+
+ char o1 = algn->seq_is_orphane[s1];
+ char o2 = algn->seq_is_orphane[s2];
+ // if any sequence is orphane the diag is always consistent
+ if( o1 || o2) return 0;
+
+ int sp1 = dg->seq_p1.startpos;
+ int sp2 = dg->seq_p2.startpos;
+ int ep1 = sp1+dg->length-1;
+ int ep2 = sp2+dg->length-1;
+
+ struct algn_pos **ap=algn->algn;
+ int predF, succF;
+ int rlen;
+
+
+ // cut off the beginning of the diag
+ struct algn_pos *tap;// = find_eqc(ap, s1, sp1);
+
+ sp1--;
+ sp2--;
+ // jump to a consistent position
+ //char included = 1;
+ do {
+ sp1++; sp2++;
+ if(sp1<=ep1) {
+ tap = find_eqc(ap, s1, sp1);
+ if(tap->predF!=NULL) { //&& tap->succF!=NULL) {
+ predF = tap->predF[s2];
+ } else {
+ predF=-1;
+ }
+ if(tap->succF!=NULL) {
+ succF = tap->succF[s2];
+ } else {
+ succF = ep2+1;
+ }
+ }
+ //if(predF!=sp2 || succF!=sp2) included = 0;
+ } while( ( (predF>=sp2)|| (succF<=sp2) ) && !(predF==sp2 && succF==sp2) && sp1<=ep1);
+
+ // cutoff low scoring positions at the beginning
+ /*
+ while( (sp1<=ep1)) {
+ a1 = c2n[data1[sp1]];
+ a2 = c2n[data2[sp2]];
+ score1 = sdata[smatrixlen*a1+a2];
+
+ if(score1<PROT_SIM_SCORE_THRESHOLD) {
+ //printf(" SHORT1 ALARM %i %i %i %i %i %i\n",sp1,ep1, sp2,ep2,dg->length, score1);
+ sp1++;
+ sp2++;
+ } else {
+ break;
+ }
+ }
+ */
+
+ // check whether the diagonal has been cut off to zero length
+ if(sp1>ep1) {
+ // printf(" OUT OF RANGE %i %i %i \n",predF, succF, sp2);
+ //if(included)
+ // dg->weight = 0.0;
+ //else
+ // dg->weight = -1.0;
+
+ dg->length=0;
+ return 1;
+ }
+
+ // cut off the end of the diag
+ rlen=0;
+ do {
+ rlen++;
+ //printf(" rlen: %i %i %i %i %i\n", ep1, sp1, sp2, dg->length, sp1+rlen-1);
+ if((sp1+rlen-1)>ep1) {
+ break;
+ }else {
+ tap = find_eqc(ap, s1, sp1+rlen-1);
+ //printf(" after rlen: %i\n", rlen);
+ if(tap->predF!=NULL) {
+ predF = tap->predF[s2];
+ } else {
+ predF=-1;
+ }
+ if(tap->succF!=NULL) {
+ succF = tap->succF[s2];
+ } else {
+ succF = sp2+rlen;
+ }
+ }
+ } while( ( ((succF>=(sp2+rlen)) && (predF<(sp2+rlen-1))) || ((succF==(sp2+rlen-1)) && (predF==(sp2+rlen-1))))
+ && ((sp1+rlen-1)<=ep1));
+ rlen--;
+
+ // cutoff low scoring positions at the end
+ /*
+ while(rlen>0) {
+ a1 = c2n[data1[sp1+rlen-1]];
+ a2 = c2n[data2[sp2+rlen-1]];
+ //printf(" %i %i %i\n", a1, a2,smatrixlen);
+ score1 = sdata[smatrixlen*a1+a2];
+ break;
+
+ if(score1<PROT_SIM_SCORE_THRESHOLD) {
+ //printf(" SHORTENING ALARM %i %i %i %i !\n", sp1,sp2,rlen,score1);
+ rlen--;
+ } else {
+ break;
+ }
+ }
+ */
+
+ if(rlen<=0) {
+ dg->length=0;
+ //printf("sp1: %i\n", sp1);
+ return 1;
+ }
+ int oldlen = dg->length;
+ //printf("sp1: %i\n", sp1);
+ dg->length = rlen;
+ dg->seq_p1.startpos=sp1;
+ dg->seq_p2.startpos=sp2;
+
+ if(oldlen==rlen) {
+ return 0;
+ }
+
+ return 1;
+}
+
+
+
+/**
+ * heapify
+void heapify_diag_array(struct diag **diags, int pos, int length, int up) {
+ struct diag *dg = diags[pos];
+ if(up) {
+ if(pos<=3) return;
+ int parent = (pos-1)/2;
+ struct diag *pdg = diags[parent];
+ if(pdg->total_weight<dg->total_weight) {
+ diags[parent]=dg;
+ diags[pos] = pdg;
+ // printf("heapify: %i %i %i %i %i\n", pos,parent, length, dg, pdg);
+ heapify_diag_array(diags, parent,length,up);
+ }
+
+ } else {
+ int lchild = 2*pos+1;
+ if( (lchild)>=length) return;
+ int rchild = lchild+1;
+ //struct diag *dg = diags[pos];
+ struct diag *ldg = diags[lchild];
+ struct diag *rdg = (rchild>=length ? ldg : diags[rchild]);
+ int greatest = pos;
+ if(ldg->total_weight > diags[greatest]->total_weight) greatest = lchild;
+ if( (rchild<length) && (rdg->total_weight > diags[greatest]->total_weight)) greatest = rchild;
+ if(greatest != pos) {
+ diags[pos] = diags[greatest];
+ diags[greatest] = dg;
+
+ heapify_diag_array(diags, greatest,length,up);
+
+ }
+ }
+}
+ */
+
+
+/**
+ * heapify
+ */
+void heapify_diag_array(struct diag **diags, int pos, int length, int up) {
+ struct diag *dg = diags[pos];
+ if(up) {
+ if(pos<=3) return;
+ int parent = (pos-1)/2;
+ struct diag *pdg = diags[parent];
+ if( (pdg->total_weight*pdg->weight_fac)< (dg->total_weight*dg->weight_fac)) {
+ //if( (pow(pdg->total_weight,2)*pdg->weight_fac)< (pow(dg->total_weight,2)*dg->weight_fac)) {
+ diags[parent]=dg;
+ diags[pos] = pdg;
+ // printf("heapify: %i %i %i %i %i\n", pos,parent, length, dg, pdg);
+ heapify_diag_array(diags, parent,length,up);
+ }
+
+ } else {
+ int lchild = 2*pos+1;
+ if( (lchild)>=length) return;
+ int rchild = lchild+1;
+ //struct diag *dg = diags[pos];
+ struct diag *ldg = diags[lchild];
+ struct diag *rdg = (rchild>=length ? ldg : diags[rchild]);
+ int greatest = pos;
+ if( (ldg->total_weight*ldg->weight_fac) > (diags[greatest]->total_weight * diags[greatest]->weight_fac)) greatest = lchild;
+ //if( (pow(ldg->total_weight,2)*ldg->weight_fac) > (pow(diags[greatest]->total_weight,2) * diags[greatest]->weight_fac)) greatest = lchild;
+ if( (rchild<length) && ( (rdg->total_weight*rdg->weight_fac) > (diags[greatest]->total_weight*diags[greatest]->weight_fac))) greatest = rchild;
+ //if( (rchild<length) && ( (pow(rdg->total_weight,2)*rdg->weight_fac) > (pow(diags[greatest]->total_weight,2) *diags[greatest]->weight_fac))) greatest = rchild;
+ if(greatest != pos) {
+ diags[pos] = diags[greatest];
+ diags[greatest] = dg;
+
+ heapify_diag_array(diags, greatest,length,up);
+
+ }
+ }
+}
+
+
+
+/**
+ *------------------------------------------------------------------------------------------
+ * SIMPLE ALIGNER SECTION
+ *------------------------------------------------------------------------------------------
+ */
+
+/**
+ * test function that constructs an arbitrary consistent alignment.this function
+ * is used to check the the correctness of adapt_diag() and align_diag()
+ *
+ * Returns whether something new could be aligned
+ */
+char simple_aligner(struct seq_col *scol, struct diag_col *dcol,
+ struct scr_matrix* smatrix,
+ struct prob_dist *pdist,
+ struct alignment *algn, int round) {
+ int dlen = dcol->diag_amount;
+ int i;
+
+ struct diag * dg,*tdg;
+ char changed;
+ char alignedSomething = 0;
+ // compute counter weights
+
+ // heapify
+ struct diag **diags = dcol->diags; //calloc(dlen, sizeof(struct diag *));
+ int alloc_dlen = dlen;
+ for(i= (dlen+1)/2-1;i>=0;i--) {
+ heapify_diag_array(diags, i, dlen,0);
+ }
+ //memset(algn->redo_seqs, 0, sizeof(char)*slen*slen);
+
+ double oldweight=0.0, prevweight;
+
+ i=0;
+ double total_weight = 0.0;
+ double alig_time = 0.0;
+ double tclock;
+ struct diag tmp_diag;
+ int tmp_end;
+ int offset;
+ struct diag *hookdg;
+ while(dlen>0) {
+ // printf(" dlen %i\n", dlen);
+ dg = diags[0];
+ //if(dg->score==217) print_diag(dg);
+ changed = 0;
+ // print_diag(dg);
+ // hookdg = NULL;
+ if(dg!=NULL) {
+ if((dg->length>0) && (dg->meetsThreshold || dg->anchor) ) {
+ /*
+ if(oldweight > 0.0)
+ if(dg->weight > oldweight) {
+ //printf(" ALARM %.20f %.20f\n", oldweight, dg->weight);
+ //print_diag(&odg);
+ //print_diag(dg);
+ //intf(" %i %i \n", odg, dg);
+ }
+ */
+ //odg = *dg;
+ //printf(" pre changed\n");
+ prevweight = dg->weight;
+ tmp_diag = *dg;
+ changed= adapt_diag(algn,smatrix, dg);
+ //changed= adapt_diag(algn,NULL, dg);
+ //print_diag(dg);
+ //printf(" after changed %i\n", dg->length);
+ //if(dg!=NULL) printf(" diag %i %i %i %i %.20f %i %i\n", dg, dg->multi_dg, dg->length, dg->meetsThreshold,dg->weight, dg->multi_length,changed);
+ if(changed) {
+ //printf("\nCHANGED\n");
+ //print_diag(dg);
+ //printf(" pre recalc\n");
+ calc_weight(dg, smatrix, pdist);
+
+ if(dg->anchor) {
+ *dg = tmp_diag;
+ }
+
+ if( (dg->length > 0) && !(dg->anchor)) {
+ tmp_end = tmp_diag.seq_p1.startpos+tmp_diag.length-1;
+ if( ((dg->seq_p1.startpos+dg->length-1)< tmp_end) &&
+ !(dg->multi_dg)) {
+ offset = dg->seq_p1.startpos+dg->length-tmp_diag.seq_p1.startpos;
+ tmp_diag.seq_p1.startpos += offset;
+ tmp_diag.seq_p2.startpos += offset;
+ tmp_diag.length -= offset;
+
+ adapt_diag(algn,smatrix, &tmp_diag);
+ tmp_diag.length = tmp_end - tmp_diag.seq_p1.startpos+1;
+ calc_weight(&tmp_diag, smatrix, pdist);
+
+ if((tmp_diag.length>0)&& tmp_diag.meetsThreshold) {
+
+ hookdg = malloc(sizeof(struct diag));
+ *hookdg = tmp_diag;
+ hookdg->marked = 1;
+
+ dcol->diag_amount++;
+ if(dcol->diag_amount>alloc_dlen) {
+ //printf("\n\n\nresize %i %i\n\n\n", dlen, alloc_dlen);
+ alloc_dlen += 8;
+ dcol->diags = (diags = realloc(diags, sizeof(struct diag*)*alloc_dlen));
+ if(diags==NULL) error("Error increasing diag heap durign aligning.");
+ }
+ //print_diag(hookdg);
+ //printf("dlen %i damount %i %i\n", dlen, dcol->diag_amount, hookdg);
+ //free(diags[dcol->diag_amount-1]);
+ dlen++;
+ diags[dcol->diag_amount-1] = diags[dlen-1];
+ diags[dlen-1]=hookdg;
+
+ if(dlen>=2) {
+ //printf("heapify: %i\n", dlen-1);
+ heapify_diag_array(diags,dlen-1,dlen,1);
+ }
+
+ //print_diag(hookdg);
+ }
+ }
+ } else {
+ dg->meetsThreshold=0;
+ }
+
+ //printf(" \nafter recalc %i %.20f %.20f\n",dg->length, oldweight, dg->weight);
+
+ //printf("%.20f %.20f\n", oldweight, dg->weight);
+
+ //if(dg->weight<prevweight*0.5) dg->meetsThreshold = 0;
+
+ // TODO: reactivate !!!
+ //(dg->weight<oldweight*0.5) {
+ //if(dg->weight>oldweight) printf(" WEIGHT %e %e\n", dg->weight, oldweight);
+ //algn->redo_seqs[dg->seq_p1.num*slen+dg->seq_p2.num] = 1;
+ //algn->redo_seqs[dg->seq_p2.num*slen+dg->seq_p1.num] = 1;
+
+ // DELETE THIS:
+ //dg->meetsThreshold = 0;
+
+ //if(para->DO_OVERLAP) calc_ov_weight(dg, dcol, smatrix, pdist);
+ } else {
+ //printf(" Pre align\n");
+ //print_diag(dg);
+ if(para->DEBUG >1) tclock = clock();
+
+ //if(dg->anchor) printf(" ANCHOR %.20f %.20f\n", dg->weight, dg->total_weight);
+ alignedSomething = align_diag(algn, smatrix, dg) || alignedSomething;
+ if(para->DEBUG >1) alig_time += clock()-tclock;
+
+ if(para->DEBUG >1) total_weight += dg->total_weight;
+ //printf(" After align\n");
+ //if(para->DEBUG >2) printf(" aligned diag %i %e\n", i, dg->weight);
+ //dg->length = 0;
+ //dg->weight = 0.0;
+ dg->meetsThreshold = 0;
+ }
+ } else {
+ // printf("ALARM %i %i %Le\n", i, dg->length, dg->weight);
+ oldweight = dg->weight;
+ }
+ }
+
+
+ if((dg==NULL) || (!dg->meetsThreshold)) {
+ tdg = diags[dlen-1];
+ diags[dlen-1]=dg;
+ diags[0] = tdg;
+ dlen--;
+ }
+ heapify_diag_array(diags, 0, dlen,0);
+ }
+ // if(para->DEBUG >1) printf(" Total Weight: %.20f (total %f) with pure alignment time %f \n", total_weight, algn->total_weight, alig_time/CLOCKS_PER_SEC);
+ if(para->DEBUG >1) printf(" Total Weight: %.20f with pure alignment time %f \n", total_weight, alig_time/CLOCKS_PER_SEC);
+ // return algn;
+ return alignedSomething;
+}
+
+
+/**
+ *------------------------------------------------------------------------------------------
+ * COMPLEX ALIGNER SECTION
+ *------------------------------------------------------------------------------------------
+ */
+
+
+
+/**
+ * returns a value >0 if the given diags are in conflict within the given alignment
+ * returns a value <0 if there is an non-conflicting overlap
+ * returns 0 in all other non-conflicting cases
+ */
+static char confl_diag(struct alignment *algn, char *layer, struct diag *dg1, struct diag *dg2) {
+ // if(dg1->multi_dg || dg2->multi_dg) error(" confl_diag(): cannot accept multi dgs!");
+ int s1_1 = dg1->seq_p1.num;
+ int s1_2 = dg1->seq_p2.num;
+ int s2_1 = dg2->seq_p1.num;
+ int s2_2 = dg2->seq_p2.num;
+ int ts;
+
+ int sp1_1 = dg1->seq_p1.startpos;
+ int sp1_2 = dg1->seq_p2.startpos;
+ int sp2_1 = dg2->seq_p1.startpos;
+ int sp2_2 = dg2->seq_p2.startpos;
+ int tsp;
+
+ int sl1_1 = dg1->seq_p1.sq->length;
+ int sl1_2 = dg1->seq_p2.sq->length;
+ int sl2_1 = dg2->seq_p1.sq->length;
+ int sl2_2 = dg2->seq_p2.sq->length;
+ int tsl;
+
+ struct algn_pos* ap1_1;
+ struct algn_pos* ap1_2;
+ struct algn_pos* ap2_1;
+ struct algn_pos* ap2_2;
+ int p1_1, p1_2, p2_1, p2_2;
+ int off1, off2;
+ int l1 = dg1->length;
+ int l2 = dg2->length;
+
+ int pF1, pF2, sF1, sF2;
+ int opF1, opF2, osF1, osF2;
+ int pos2[4];
+ int lpos2 = 0;
+
+ int ret = 0;
+ signed char ucmp,lcmp;
+
+
+ //l1=1;l2=1;
+ /*
+ int step1 = (l1>10) ? 3 : 1;
+ int step2 = (l2>10) ? 3 : 1;;
+ if(step1==0) step1 = 1;
+ if(step2==0) step2 = 1;
+ */
+ if(layer[dg1->seq_p1.num]!=1) {
+ ts = s1_2;
+ s1_2 = s1_1;
+ s1_1 = ts;
+
+ tsl = sl1_2;
+ sl1_2 = sl1_1;
+ sl1_1 = tsl;
+
+ tsp = sp1_2;
+ sp1_2 = sp1_1;
+ sp1_1 = tsp;
+ }
+ if(layer[dg2->seq_p1.num]!=1) {
+ ts = s2_2;
+ s2_2 = s2_1;
+ s2_1 = ts;
+
+ tsl = sl2_2;
+ sl2_2 = sl2_1;
+ sl2_1 = tsl;
+
+ tsp = sp2_2;
+ sp2_2 = sp2_1;
+ sp2_1 = tsp;
+ }
+
+ // if one is included in the other we define it as a conflict
+ //if( (s1_1==s2_1) && (s1_2==s2_2)) {
+ //
+ //}
+
+ opF1 = -1;
+ osF1 = sl2_1;
+ opF2 = -1;
+ osF2 = sl2_2;
+
+
+ for(off1=0;off1<l1;off1++) {
+
+ p1_1 = sp1_1; // dg1->seq_p1.startpos+off1;
+ p1_2 = sp1_2; // dg1->seq_p2.startpos+off1;
+ ap1_1 = find_eqc(algn->algn, s1_1, p1_1);
+ ap1_2 = find_eqc(algn->algn, s1_2, p1_2);
+
+ // calculate the positions in dg2 that have to be considered for conflicts
+ if(ap1_1->predF!=NULL) {
+ pF1 = ap1_1->predF[s2_1];
+ } else {
+ pF1 = opF1;
+ }
+ if(ap1_1->succF!=NULL) {
+ sF1 = ap1_1->succF[s2_1];
+ } else {
+ sF1 = osF1;
+ }
+ if(ap1_2->predF!=NULL) {
+ pF2 = ap1_2->predF[s2_2];
+ } else {
+ pF2 = opF2;
+ }
+ if(ap1_2->succF!=NULL) {
+ sF1 = ap1_2->succF[s2_2];
+ } else {
+ sF2 = osF2;
+ }
+
+ /*
+ //if(ret==0)
+ if( (pF1>=sp2_1) && (pF1!=opF1) && (pF1<sp2_1+l2))
+ ret--;//ret = -1;
+ else
+ if( (sF1>=sp2_1) && (sF1!=osF1)&& (sF1<sp2_1+l2))
+ ret--;//ret = -1;
+ else
+ if( (pF2>=sp2_2) && (pF2!=opF2) && (pF2<sp2_2+l2))
+ ret--;//ret = -1;
+ else
+ if( (sF2>=sp2_2) && (sF2!=osF2)&& (sF2<sp2_2+l2))
+ ret--;//ret = -1;
+ */
+
+ if(pF1 < sp2_1) {
+ pF1 = sp2_1;
+ }
+ if(pF1 >= sp2_1+l2) {
+ pF1 = sp2_1+l2-1;
+ off1 = l1;
+ }
+ if(sF1 < sp2_1) {
+ sF1 = sp2_1;
+ off1 = l1;
+ }
+ if(sF1 >= sp2_1+l2) {
+ sF1 = sp2_1+l2-1;
+ }
+ if(pF2 < sp2_2) {
+ pF2 = sp2_2;
+ }
+ if(pF2 >= sp2_2+l2) {
+ pF2 = sp2_2+l2-1;
+ off1 = l1;
+ }
+ if(sF2 < sp2_2) {
+ sF2 = sp2_2;
+ off1 = l1;
+ }
+ if(sF2 >= sp2_2+l2) {
+ sF2 = sp2_2+l2-1;
+ }
+
+ lpos2 = 0;
+ if((pF1!=opF1)) {
+ pos2[lpos2++] = pF1-sp2_1;
+ }
+ if((pF2!=opF2)) {
+ pos2[lpos2++] = pF2-sp2_2;
+ }
+ if((sF1!=osF1)) {
+ pos2[lpos2++] = sF1-sp2_1;
+ }
+ if((sF2!=opF2)) {
+ pos2[lpos2++] = sF2-sp2_2;
+ }
+
+ opF1 = pF1;
+ opF2 = pF2;
+ osF1 = sF1;
+ osF2 = sF2;
+ //for(off2=0;off2<l2;off2++) {
+ for(off2=0;off2<lpos2;off2++) {
+
+ //p2_1 = sp2_1+off2;
+ //p2_2 = sp2_2+off2;
+ p2_1 = sp2_1+pos2[off2];
+ p2_2 = sp2_2+pos2[off2];
+ ap2_1 = find_eqc(algn->algn, s2_1, p2_1);
+ ap2_2 = find_eqc(algn->algn, s2_2, p2_2);
+
+ ucmp = -1;
+ lcmp = -1;
+
+ // upper compare
+ if(s1_1==s2_1) {
+ if(p1_1 == p2_1) ucmp = 0;
+ if(p1_1 < p2_1) ucmp = 1;
+ if(p1_1 > p2_1) ucmp = 2;
+ } else if( (ap1_1->succF!=NULL) && (ap1_1->predF!=NULL) &&
+ (ap1_1->succF[s2_1]==ap1_1->predF[s2_1]) &&
+ (ap1_1->predF[s2_1]==p2_1)) {
+ ucmp = 0;
+ } else if( ( (ap1_1->succF!=NULL) && ( ap1_1->succF[s2_1]<=p2_1))) {
+ ucmp = 1;
+ } else if( ( (ap1_1->predF!=NULL) && ( ap1_1->predF[s2_1]>=p2_1))) {
+ ucmp = 2;
+ }
+
+ // lower compare
+ if(s1_2==s2_2) {
+ if(p1_2 == p2_2) lcmp = 0;
+ if(p1_2 < p2_2) lcmp = 1;
+ if(p1_2 > p2_2) lcmp = 2;
+ } else if( (ap1_2->succF!=NULL) && (ap1_2->predF!=NULL) &&
+ (ap1_2->succF[s2_2]==ap1_2->predF[s2_2]) &&
+ (ap1_2->predF[s2_2]==p2_2)) {
+ lcmp = 0;
+ } else if( ( (ap1_2->succF!=NULL) && ( ap1_2->succF[s2_2]<=p2_2))) {
+ lcmp = 1;
+ } else if( ( (ap1_2->predF!=NULL) && ( ap1_2->predF[s2_2]>=p2_2))) {
+ lcmp = 2;
+ }
+
+ if( (ucmp>=0) && (lcmp>=0)) {
+ if(ucmp!=lcmp) return 1;
+ }
+ }
+ }
+ /*
+ ret = -ret;
+ if((ret<=l1*0.1)&&(ret<=l2*0.1)) {
+ return 0;
+ } else {
+ return -1;
+ }
+ */
+ return ret;
+}
+
+
+/**
+ * determine the best diags that fit into the alignment
+struct simple_diag_col *determine_diags((struct alignment *algn, struct seq_col *scol,
+ struct scr_matrix *smatrix,
+ struct prob_dist *pdist, char *layer,
+ struct diag **diags,
+ int diag_amount) {
+ struct simple_diag_col scol;
+ // TODO
+ return scol;
+}
+ */
+
+
+
+/**
+ * guided aligner recursion
+ *
+ * doHigher: >0 - only higher and equal than threshold weight
+ * doHigher: 0 - only lower than threshold weight
+ */
+struct alignment* guided_aligner_rec(struct alignment *palgn,
+ struct seq_col *scol, struct diag_col *dcol,
+ struct scr_matrix* smatrix,
+ struct prob_dist *pdist,
+ struct gt_node *gtn,
+ double thres_weight, char doHigher,
+ int round) {
+ if(palgn==NULL) {
+ palgn = create_empty_alignment(scol);
+ }
+
+ // recursion as per the guide tree
+ if(gtn->isLeaf) return palgn;
+ palgn = guided_aligner_rec(palgn,scol,dcol,smatrix,pdist, gtn->succ1, thres_weight,doHigher,round);
+
+ palgn = guided_aligner_rec(palgn,scol,dcol,smatrix,pdist, gtn->succ2, thres_weight,doHigher,round);
+
+
+
+ // now align the fragments that are between succ1 and succ2 of gtn
+ int scol_len = scol->length;
+ struct diag *dg, *tdg, *sdg, *stdg;
+ int i,j,si,sj,k,l, l1,l2;
+ struct gt_node *n1, *n2;
+ n1 = gtn->succ1;
+ n2 = gtn->succ2;
+ int diag_amount = dcol->diag_amount;//n1->seq_num_length + n2->seq_num_length;
+ double multi_weight_fac = 0.0;
+ int diag_p=0;
+ struct diag **all_diags = malloc(sizeof( struct diag*)*diag_amount);
+ //struct diag *looser_diags[diag_amount];
+ int diag_l=0;
+ struct simple_diag_col *sdcol;
+ //char crossing[scol_len*scol_len];
+ char changed;
+ char layer[scol_len];
+ // memset(crossing, 0, sizeof(char)*scol_len*scol_len);
+ memset(layer, 0, sizeof(char)*scol_len);
+
+
+ for(i=0;i<n1->seq_num_length;i++) {
+ si = n1->seq_num[i];
+ layer[si]=1;
+ for(j=0;j<n2->seq_num_length;j++) {
+ sj = n2->seq_num[j];
+
+ if(i==0) layer[sj]=2;
+ //printf(" %i %i %i %i\n", i,j,si,sj);
+ //crossing[si*scol_len+sj] = 1;
+ //crossing[sj*scol_len+si] = 1;
+ if(sj>si) {
+ sdcol = dcol->diag_matrix[scol_len*si+sj];
+ } else {
+ sdcol = dcol->diag_matrix[scol_len*sj+si];
+ }
+ multi_weight_fac += pow(sdcol->weight_fac,0.5);
+ for(k=0;k<sdcol->length;k++) {
+ dg = (sdcol->data[k]);
+ //changed = adapt_diag(palgn, smatrix, dg);
+
+ //if(changed) {
+ //calc_weight(dg, smatrix, pdist);
+ //}
+ if(dg->meetsThreshold) {
+ if(doHigher>0) {
+ if((dg->total_weight) >= thres_weight) {
+ all_diags[diag_p++] = dg;
+ }
+ } else {
+ if((dg->total_weight) < thres_weight) {
+ all_diags[diag_p++] = dg;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ multi_weight_fac = pow(multi_weight_fac/((double)n1->seq_num_length*n2->seq_num_length),2.0);
+ struct diag_col tdcol;
+ int survive;
+
+
+ /*
+ tdcol.diags = all_diags;
+ tdcol.diag_amount = diag_p;
+
+ simple_aligner(scol, &tdcol, smatrix, pdist, palgn, 0);
+ return palgn;
+ */
+ /*
+ struct simple_diag_col ssdcol = split_diags(palgn, scol,
+ smatrix,
+ pdist, all_diags,
+ diag_p);
+ struct diag **sall_diags = ssdcol.data;
+ int sdiag_p = ssdcol.length;
+
+
+ printf(" diags split before:%i after:%i\n", diag_p, sdiag_p);
+ */
+
+ int sdiag_p = diag_p;
+ struct diag **sall_diags = all_diags;
+
+ // if both successor nodes are leaf align directly
+ if(n1->isLeaf && n2->isLeaf) {
+ tdcol.diags = all_diags;
+ tdcol.diag_amount = diag_p;
+
+ //printf(" before inner rec %i %i %i\n",all_diags,diag_p,diag_amount);
+ simple_aligner(scol, &tdcol, smatrix, pdist, palgn, 0);
+ //printf(" after inner rec %i\n",all_diags);
+ free(all_diags);
+ //printf(" after inner rec\n");
+ return palgn;
+ }
+
+ //if( (n1->seq_num_length > 1) && (n2->seq_num_length > 1)) {
+ // OMIT for the time being
+ /*
+ if( ((n1->seq_num_length>1) || (n2->seq_num_length>1)) &&
+ ((n1->seq_num_length*n2->seq_num_length)>=4.0) &&
+ ((n1->seq_num_length > sqrt(scol->length)) || (n2->seq_num_length > sqrt(scol->length)))) {
+
+ int ***diag_info;
+ diag_info = malloc(sizeof(int **)*n1->seq_num_length);
+ for(i=0;i<n1->seq_num_length;i++) {
+ diag_info[i] = malloc(sizeof(int *)*n2->seq_num_length);
+ }
+ struct seq *seq1, *seq2;
+ int maxk;
+
+ for(i=0;i<n1->seq_num_length;i++) {
+ si = n1->seq_num[i];
+ for(j=0;j<n2->seq_num_length;j++) {
+ sj = n2->seq_num[j];
+
+ seq1 = &(scol->seqs[si]);
+ seq2 = &(scol->seqs[sj]);
+ // prepare diag info
+ diag_info[i][j] = malloc(sizeof(int)*seq1->length);
+
+
+ for(k=0;k<seq1->length;k++) {
+ diag_info[i][j][k] = -1;
+ }
+ if(sj>si) {
+ sdcol = dcol->diag_matrix[scol_len*si+sj];
+ } else {
+ sdcol = dcol->diag_matrix[scol_len*sj+si];
+ }
+ for(k=0;k<sdcol->length;k++) {
+ dg = (sdcol->data[k]);
+ if(dg->meetsThreshold) {
+ for(l=0;l<dg->length;l++) {
+ if( (dg->weight >= thres_weight)) {
+ if(dg->seq_p1.num==si) {
+ //printf(" 1) %i %i %i\n",dg->seq_p1.startpos+l, dg->length, seq1->length);
+ diag_info[i][j][dg->seq_p1.startpos+l] = dg->seq_p2.startpos+l;
+ } else {
+ //printf(" 2) %i %i %i \n",dg->seq_p2.startpos+l,dg->length, seq1->length);
+ diag_info[i][j][dg->seq_p2.startpos+l] = dg->seq_p1.startpos+l;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ //printf(" before guided diags\n");
+ struct simple_diag_col *mscol = find_diags_guided(smatrix, pdist,n1, n2, palgn, thres_weight, diag_info);
+ //printf(" after guided diags\n");
+
+ for(i=0;i<n1->seq_num_length;i++) {
+ si = n1->seq_num[i];
+ for(j=0;j<n2->seq_num_length;j++) {
+ sj = n2->seq_num[j];
+ free(diag_info[i][j]);
+ // free_tmp_pdist(tmp_dist[sj][si], pdist->max_dlen);
+ }
+ free(diag_info[i]);
+ }
+ free(diag_info);
+
+ diag_amount += mscol->length;
+ all_diags = realloc(all_diags, sizeof( struct diag*)*diag_amount);
+ sall_diags = all_diags;
+ for(i=0;i<mscol->length;i++) {
+ //printf(" multi dg %i %i %.20f\n", mscol->length,mscol->data[i], mscol->data[i]->weight);
+ //survive = 1;
+ dg = mscol->data[i];
+
+ survive = 0;
+ dg->weight = 0.0;
+ for(j=0;j<dg->multi_length;j++) {
+ if( (dg->multi_cont[j]!=NULL) && (dg->multi_cont[j]->weight >= thres_weight)) {
+ survive++;
+ dg->weight += dg->multi_cont[j]->weight;
+ } else {
+ free_diag(dg->multi_cont[j]);
+ dg->multi_cont[j]=NULL;
+ }
+ }
+
+
+ dg->total_weight = dg->weight;
+ if(survive>1) {
+ sall_diags[sdiag_p++] = mscol->data[i];
+ mscol->data[i]->weight_fac = multi_weight_fac;
+ mscol->data[i]->pred_diag = NULL;
+ } else {
+ free_diag(mscol->data[i]);
+ }
+ }
+
+ // free data
+ free(mscol->data);
+ free(mscol);
+
+ }
+ if(para->DEBUG>1) printf(" Found %i relevant multi diags\n", sdiag_p - diag_p);
+*/
+
+ diag_p = sdiag_p;
+ struct diag **looser_diags = malloc(sizeof( struct diag*)*diag_amount);
+
+
+ /*
+ // sort diags
+ for(i=0;i<sdiag_p;i++) {
+ //printf(" damn %i %i\n", sall_diags[i], i);
+ for(j=i+1;j<sdiag_p;j++) {
+ dg = sall_diags[i];
+ tdg = sall_diags[j];
+ //if( (tdg->total_weight*dg->weight_fac) > (dg->total_weight*dg->weight_fac)) {
+ if( (tdg->total_weight) > (dg->total_weight)) {
+ sall_diags[i] = tdg;
+ sall_diags[j]= dg;
+ }
+ }
+ }
+
+ // align the good diags first
+ diag_l=0;
+ for(i=0;i<sdiag_p*0.75;i++) {
+ looser_diags[diag_l++] = sall_diags[i];
+ }
+
+ tdcol.diags = looser_diags;
+ tdcol.diag_amount = diag_l;
+ simple_aligner(scol, &tdcol, smatrix, pdist, palgn, 0);
+
+ for(i=diag_l;i<sdiag_p;i++) {
+ sall_diags[i-diag_l] = sall_diags[i];
+ }
+ sdiag_p -= diag_l;
+ diag_l = 0;
+ */
+ //if(para->DEBUG>2) printf(" BEGIN: calc conflict of #diags: %i\n", sdiag_p);
+
+ // build vertex cover graph
+ char confl;
+ int multilen1; int multipos1;
+ int multilen2; int multipos2;
+ char multi1, multi2;
+ for(i=0;i<sdiag_p;i++) {
+ dg = sall_diags[i];
+ //dg->weight_fac = 1.0;
+ dg->weight_sum = dg->total_weight;//*dg->weight_fac;
+ multilen1 = 1;
+ multipos1 = 0;
+ multi1 = dg->multi_dg;
+ if(multi1) multilen1 = dg->multi_length;
+
+ //dg->weight_sum = dg->total_weight;
+ //printf(" degree %i\n", dg->degree);
+ sdg = dg;
+ while(multipos1<multilen1) {
+ if(multi1) dg = sdg->multi_cont[multipos1];
+
+ if(dg!=NULL) {
+ for(j=i+1;j<sdiag_p;j++) {
+ tdg = sall_diags[j];
+
+ multilen2 = 1;
+ multipos2 = 0;
+ multi2 = tdg->multi_dg;
+ if(multi2) multilen2 = tdg->multi_length;
+ stdg = tdg;
+
+ while(multipos2<multilen2) {
+ if(multi2) tdg = stdg->multi_cont[multipos2];
+ if(tdg!=NULL) {
+
+ confl = confl_diag(palgn, layer, dg, tdg) ;
+
+ if( (confl>0) ) {
+ //printf(" conflict %i %i !\n",i,j);
+ sdg->degree++;
+ if(sdg->degree > sdg->max_degree) {
+ sdg->max_degree += 64;
+ sdg->neighbours = realloc(sdg->neighbours, sizeof(struct diag *)*sdg->max_degree);
+ }
+ sdg->neighbours[sdg->degree - 1] = stdg;
+
+ stdg->degree++;
+ if(stdg->degree > stdg->max_degree) {
+ stdg->max_degree += 64;
+ stdg->neighbours = realloc(stdg->neighbours, sizeof(struct diag *)*stdg->max_degree);
+ }
+ stdg->neighbours[stdg->degree - 1] = sdg;
+ //printf(" CONFLICT FOUND %i %i!\n", i,j);
+ }
+ }
+ multipos2++;
+ }
+ }
+ }
+ multipos1++;
+ }
+ }
+ // if(para->DEBUG>2) printf(" END: calc conflict of #diags: %i\n", sdiag_p);
+
+ // perform clarkson vertex cover
+ int max_n;
+ double max_d;
+ double t_d;
+ while(1) {
+ max_n = -1;
+ max_d = -1.0;
+ for(i=0;i<sdiag_p;i++) {
+ dg = sall_diags[i];
+ if(dg != NULL) {
+ //printf(" degree %i\n", dg->degree);
+ //printf(" before %i %i %i\n",i,sdiag_p,dg);
+ //printf(" degree %i\n", dg->degree);
+ //printf(" after\n");
+ if(dg->degree > 0) {
+ t_d = dg->degree / dg->weight_sum;
+ if((max_d<t_d) || (max_n<0)){
+ max_n = i;
+ max_d = t_d;
+ }
+ }
+ }
+ }
+
+ //printf(" max_n: %i\n", max_n);
+ if(max_n < 0) break;
+ dg = sall_diags[max_n];
+ sall_diags[max_n] = NULL;
+ looser_diags[diag_l++] = dg;
+ // printf(" wlooser %i %i %i %f\n", max_n, dg, dg->multi_dg, dg->total_weight);
+ //printf(" 0sall[0] %i \n",sall_diags[0]);
+ //i=11;
+ //printf(" 00sall[0] %i \n",sall_diags[0]);
+ for(i=0; i < dg->degree; i++) {
+ //printf(" 1sall[0] %i i=%i\n",sall_diags[0],i);
+ //printf(" %i %i\n",i,dg->degree);
+ dg->neighbours[i]->weight_sum -= max_d;
+ tdg = dg->neighbours[i];
+
+ //printf(" before loop %i %i\n",i,dg->degree);
+ for(j=0;j<tdg->degree;j++) {
+ if(tdg->neighbours[j]==dg) {
+ //printf(" MATCH \n");
+ tdg->neighbours[j]=tdg->neighbours[tdg->degree-1];
+ tdg->degree--;
+ j=tdg->degree;//break;
+ }
+ }
+ //printf(" 2sall[0] %i\n",sall_diags[0]);
+ }
+ free(dg->neighbours);
+ dg->neighbours=NULL;
+ dg->degree = 0;
+ dg->max_degree=0;
+ }
+
+ /*
+ struct algn_pos *ap1 = find_eqc(palgn->algn,4,19);
+ if(ap1->predF!=NULL)printf(" 4-19 predF-0 %i\n", ap1->predF[0]);
+ ap1 = find_eqc(palgn->algn,0,4);
+ if(ap1->succF!=NULL)printf(" 0-4 succF-4 %i\n", ap1->succF[4]);
+ */
+
+ //if( (sdiag_p>60) && (sall_diags[60]!=NULL)) sall_diags[0]=sall_diags[60];
+ /*
+ if((sdiag_p>60) && (sall_diags[60]!=NULL) && (sall_diags[52]!=NULL)) {
+ printf(" conflict pre %i\n", confl_diag(palgn, layer, sall_diags[52], sall_diags[60]));
+ }
+ */
+ /*
+ for(i=0;i<sdiag_p;i++) {
+ dg = sall_diags[i];
+ if(dg!=NULL) {
+ //printf(" num: %i\n",i);
+ //printf(" a) %i %i %i\n", dg->seq_p1.num, dg->seq_p1.startpos, dg->length);
+ //printf(" b) %i %i %i\n\n", dg->seq_p2.num, dg->seq_p2.startpos, dg->length);
+ //rdg = *dg;
+ //printf(" before adapt %i %i\n", i, sdiag_p);
+ changed = adapt_diag(palgn, smatrix, dg);
+ //printf(" after adapt %i %i %i %i %i\n", changed, i, sdiag_p, rdg.length,dg->length);
+
+ if(changed) {
+ calc_weight(dg, smatrix, pdist);
+ looser_diags[diag_l++] = dg;
+ } else {
+ //if(dg->meetsThreshold) {
+ align_diag(palgn, smatrix, dg);
+ //}
+ dg->meetsThreshold = 0;
+ }
+
+ if(dg->neighbours!=NULL) {
+ free(dg->neighbours);
+ dg->neighbours = NULL;
+ }
+ } else {
+ }
+ }
+ */
+
+
+ // align the winners first
+ tdcol.diags = all_diags;
+ tdcol.diag_amount = 0;
+ for(i=0;i<sdiag_p;i++) {
+ if(sall_diags[i]!=NULL) {
+ //printf(" winner %i %i %f\n", sall_diags[i], sall_diags[i]->multi_dg, sall_diags[i]->total_weight);
+ all_diags[tdcol.diag_amount++] = sall_diags[i];
+ }
+ }
+
+ simple_aligner(scol, &tdcol, smatrix, pdist, palgn, 0);
+ all_diags = tdcol.diags;
+ for(i=0;i<tdcol.diag_amount;i++) {
+ if(all_diags[i]->marked ) {
+ //printf(" free %i %i %i\n", all_diags[i], all_diags[i]->multi_dg, looser_diags[0]);
+ free_diag(all_diags[i]);
+ //printf(" free end%i\n", all_diags[i]);
+ } else {
+ if(all_diags[i]->neighbours!=NULL) {
+ free(all_diags[i]->neighbours);
+ all_diags[i]->neighbours=NULL;
+ }
+ all_diags[i]->meetsThreshold = 0;
+ }
+ }
+
+ // align the loosers afterwards
+ tdcol.diags = looser_diags;
+ tdcol.diag_amount = diag_l;
+ simple_aligner(scol, &tdcol, smatrix, pdist, palgn, 0);
+ looser_diags = tdcol.diags;
+ for(i=0;i<tdcol.diag_amount;i++) {
+ if(looser_diags[i]->marked ) {
+ //printf(" lfree %i %i %i %i %i %i\n", i, diag_l, tdcol.diag_amount, looser_diags[i], all_diags[i]->multi_dg, looser_diags[0]);
+ free_diag(looser_diags[i]);
+ //printf(" lfree end%i\n", all_diags[i]);
+ } else {
+ if(looser_diags[i]->neighbours!=NULL) {
+ free(looser_diags[i]->neighbours);
+ looser_diags[i]->neighbours=NULL;
+ }
+ looser_diags[i]->meetsThreshold = 0;
+ }
+ }
+
+
+ //printf("-----------------END GUIDED ALIGNER RECURSION STEP-------------------\n");
+
+ // TODO: free/remove used diags
+ //free(sall_diags);
+ free(all_diags);
+ free(looser_diags);
+
+ return palgn;
+}
+
+
+/**
+ * guided aligner method
+ * NOTE: all diags are freeded within this routine
+ */
+struct alignment* guided_aligner(struct alignment *palgn,
+ struct seq_col *scol, struct diag_col *dcol,
+ struct scr_matrix* smatrix,
+ struct prob_dist *pdist,
+ struct gt_node *gtn,
+ int round) {
+ struct diag **all_diags = dcol->diags;
+ int diag_p = dcol->diag_amount;
+ struct diag *dg, *tdg;
+ int i,j,k;
+
+
+ /*
+ // sort diags
+ for(i=0;i<diag_p;i++) {
+ for(j=i+1;j<diag_p;j++) {
+ dg = all_diags[i];
+ tdg = all_diags[j];
+ //if( (tdg->total_weight*dg->weight_fac) > (dg->total_weight*dg->weight_fac)) {
+ if( (tdg->total_weight) > (dg->total_weight)) {
+ all_diags[i] = tdg;
+ all_diags[j]= dg;
+ }
+ }
+ }
+ */
+
+
+ int slen = scol->length;
+
+ double tavg, ttavg;
+ double avg_weight = 0.0;
+ struct simple_diag_col *sdcol;
+ int tsdlen=0;
+ ttavg = 0;
+
+ for(i=0;i<slen;i++) {
+ for(j=i+1;j<slen;j++) {
+
+ tavg=0.0;
+ sdcol = dcol->diag_matrix[slen*i+j];
+ for(k=0; k<sdcol->length; k++) {
+ tavg +=sdcol->data[k]->total_weight;
+ ttavg += sdcol->data[k]->total_weight;
+ tsdlen++;
+ }
+
+ if(sdcol->length >0) {
+ tavg = (tavg/sdcol->length);
+ }
+ /*
+ tavg = 0.0;
+ tsdlen = 0;
+ for(k=0; k<sdcol->length; k++) {
+ if(sdcol->data[k]->total_weight >= ttavg) {
+ tavg +=sdcol->data[k]->total_weight;
+ tsdlen++;
+ }
+ }
+
+ tavg = tavg / tsdlen;
+ */
+ avg_weight += tavg;
+ }
+ }
+
+ avg_weight = avg_weight/ (slen*(slen-1)/2.0);
+ double thres_weight = ttavg/tsdlen;//1.0*avg_weight; //all_diags[ 0]->total_weight*0.05;
+
+ palgn = guided_aligner_rec(palgn,scol,dcol,smatrix,pdist,gtn,thres_weight,1,round);
+
+ //palgn = guided_aligner_rec(palgn,scol,dcol,smatrix,pdist,gtn,thres_weight,0,round);
+ //printf(" intermediate alignment weight %f %f\n",palgn->total_weight, thres_weight);
+
+
+ struct diag_col tdcol;
+ struct diag **sall_diags = malloc(sizeof(struct diag*)*diag_p);
+ int sdiag_p=0;
+
+ for(i=0;i<diag_p;i++) {
+ if(all_diags[i]->meetsThreshold && (all_diags[i]->total_weight < thres_weight)) {
+ sall_diags[sdiag_p++] = all_diags[i];
+ } else {
+ free(all_diags[i]);
+ }
+ }
+
+ tdcol.diags = sall_diags;
+ tdcol.diag_amount = sdiag_p;
+ simple_aligner(scol, &tdcol, smatrix, pdist, palgn, 0);
+ sall_diags = tdcol.diags;
+
+ for(i=0;i<tdcol.diag_amount;i++) {
+ free(sall_diags[i]);
+ }
+ free(sall_diags);
+ //diag_p -= thres_pos;
+ // dcol->diag_amount = diag_p;
+ return palgn;
+}
diff --git a/dialign/diag.c b/dialign/diag.c
new file mode 100644
index 0000000..1bfd946
--- /dev/null
+++ b/dialign/diag.c
@@ -0,0 +1,2125 @@
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "parameters.h"
+#include "struct.h"
+#include "io.h"
+
+extern void error(char *message);
+extern void merror(char *msg1, char *msg2);
+
+extern struct algn_pos *find_eqc(struct algn_pos **ap, int seqnum, int pos);
+extern void prepare_alignment(struct alignment *algn);
+
+/**
+ *
+ * diag.c: Creation of diagonals & calculation of scores and weights
+ *
+ */
+
+
+/**
+ * factory method that creates a diagonal from the given sequence parts
+ *
+ * The pointer returned has to be deallocted explicitely from memory.
+ */
+struct diag* create_diag(int n1, struct seq* sq1, unsigned int sp1,
+ int n2, struct seq* sq2, unsigned int sp2,
+ int dlength) {
+ struct diag* dg = malloc(sizeof(struct diag));
+ if(dg==NULL) error("create_diag(): Out of Memory !");
+
+ if(sq1->length < sp1+dlength) {
+ printf(" startpos=%i diaglength=%i seqlength=%i\n",sp1,dlength,sq1->length);
+ merror("create_diag(): startpos+diaglength exceeds sequence length in diag ", sq1->name);
+ }
+ if(sq2->length < sp2+dlength) {
+ printf(" startpos=%i diaglength=%i seqlength=%i\n",sp2,dlength,sq2->length);
+ merror("create_diag(): startpos+diaglength exceeds sequence length in diag ", sq2->name);
+ }
+
+ dg->seq_p1.num = n1;
+ dg->seq_p1.sq = sq1;
+ dg->seq_p1.startpos = sp1;
+ //dg->seq_p1.leftmargin = sp1;
+ //dg->seq_p1.rightmargin = sq1->length - dlength - sp1;
+
+ dg->seq_p2.num = n2;
+ dg->seq_p2.sq = sq2;
+ dg->seq_p2.startpos = sp2;
+ //dg->seq_p1.leftmargin = sp2;
+ //dg->seq_p1.rightmargin = sq2->length - dlength - sp2;
+
+ dg->pred_diag = NULL;
+ dg->col_pred_diag = NULL;
+ dg->length = dlength;
+ //dg->onlyOverThres= 0;
+ dg->score= -1;
+ dg->orig_score= -1;
+ dg->weight = 0.0;
+ dg->weight_sum = 0.0;
+ dg->ov_weight = 0.0;
+ dg->weight_fac = 1.0;
+ dg->anchor = 0;
+ dg->marked = 0;
+ dg->multi_dg = 0;
+ dg->multi_cont = NULL;
+ dg->multi_length = 0;
+ dg->meetsThreshold = 0;
+
+ dg->neighbours = NULL;
+ dg->degree = 0;
+ dg->max_degree= 0;
+ return dg;
+}
+
+/**
+ * frees the memory of the given diagonal and the included seq_parts
+ */
+void free_diag(struct diag* dg) {
+ if(dg->multi_dg) {
+ int i;
+ for(i=0;i<dg->multi_length;i++) {
+ if(dg->multi_cont[i]!=NULL) free_diag(dg->multi_cont[i]);
+ }
+ free(dg->multi_cont);
+ }
+ free(dg);
+}
+
+/**
+ * frees the (sub) tree of the given gt_node
+ */
+void free_gt_node(struct gt_node *gtn) {
+ if(! gtn->isLeaf) {
+ free_gt_node(gtn->succ1);
+ free_gt_node(gtn->succ2);
+ }
+ free(gtn->seq_num);
+ free(gtn);
+}
+
+/**
+ * calculuates "m over n"
+ */
+unsigned long binomial(long m, long n) {
+ double result=1.0;
+ long i;
+ for(i=0;i<n;i++) {
+ result *= ((double)(m-i))/(double)(n-i);
+ }
+ return (unsigned long)result;
+}
+
+/**
+ * creates temporary probability distribution
+ */
+long double **create_tmp_pdist(struct prob_dist *pdist) {
+ int length = pdist->max_dlen;
+ struct scr_matrix *smatrix = pdist->smatrix;
+
+ long double **dist = calloc(length+1, sizeof(long double *));
+ if(dist==NULL) error("create_tmp_pdist(): (1) Out of memory when allocating data !");
+
+ int i;
+ long mxscr, sm_max_scr=smatrix->max_score;
+ for(i=0;i<=length;i++) {
+ mxscr = i *sm_max_scr;
+ dist[i] = calloc(mxscr+1, sizeof(long double ));
+ if(dist[i]==NULL) error("create_tmp_pdist(): (3) Out of memory at iteration" );
+ }
+ return dist;
+}
+
+/**
+ * frees temporary probability distribution
+ */
+void free_tmp_pdist(long double **dist, int length) {
+ int i;
+ for(i=0;i<=length;i++) {
+ free(dist[i]);
+ }
+ free(dist);
+}
+
+void fill_tmp_pdist(struct prob_dist *pdist, long double **tmp_dist, int slen1, int slen2) {
+ unsigned int length = pdist->max_dlen;
+ struct scr_matrix * smatrix = pdist->smatrix;
+
+
+ unsigned int i;
+ long mxscr, sm_max_scr=smatrix->max_score,scr;
+
+ long double factor, np, np2,prob;
+ long double seq_factor= (((long double)slen1)*(slen2));
+
+ for(i=1;i<=length;i++) {
+ mxscr = i *sm_max_scr;
+
+ factor = (long double)(seq_factor)/(long double)(4.0*i*i); // original !
+
+ for(scr=0;scr<=mxscr;scr++) {
+ prob = pdist->data[i][scr];
+
+ np2 =prob * (factor);
+ if(np2>=para->DIAG_CALC_WEIGHT_THRESHOLD) { // curent
+ np = (long double)1.0- pow(1.0-prob,factor); // current
+ } else {
+ np = np2;
+ }
+ tmp_dist[i][scr] = -log(np);
+ }
+ }
+}
+
+/**
+ * calculates the score of the given diag by using the given score matrix. the
+ * resulting score is stored within the diag
+ * omitScore = -1: score calculation but weight interpolation with seqlen = 100
+ * omitScore = 0: normal
+ * omitScore = 1: no score calculation
+ */
+static void real_calc_weight(struct diag* dg, struct scr_matrix* smatrix,
+ struct prob_dist *pdist, char omitScore, long double **tmp_dist, struct alignment *algn ) {
+
+ if(dg->multi_dg) {
+ int i;
+ dg->weight = 0.0;
+ dg->meetsThreshold = 0;
+ dg->length = 0;
+ for(i=0;i<dg->multi_length;i++) {
+ if(dg->multi_cont[i]!=NULL) {
+ //printf(" before real calc %i %i %f\n", dg->length, dg->score, dg->weight);
+ real_calc_weight(dg->multi_cont[i],smatrix, pdist, omitScore, tmp_dist, algn);
+ if(dg->multi_cont[i]->length > dg->length)
+ dg->length = dg->multi_cont[i]->length;
+
+ //printf(" real calc %i %i %f\n", dg->length, dg->score,dg->weight);
+ dg->weight += dg->multi_cont[i]->weight;
+ dg->meetsThreshold = dg->meetsThreshold | dg->multi_cont[i]->meetsThreshold;
+ //printf(" readjusted %i %i %i %i %i %i %f %f %i\n", dg, dg->multi_cont[i],dg->multi_cont[i], dg->multi_dg, dg->multi_length, dg->weight, dg->multi_cont[i]->weight, dg->length);
+
+ }
+ }
+ if(dg->length<=0) dg->meetsThreshold = 0;
+ dg->total_weight = dg->weight;
+ return;
+ }
+
+ if(dg->length==0) {
+ dg->score = 0;
+ dg->weight = 0.0;
+ dg->meetsThreshold = 0;
+ return;
+ }
+
+ unsigned int len = dg->length;
+
+ int pos;
+ long double np=0.0,np2;
+
+ if(omitScore<=0) {
+ unsigned int sp1=dg->seq_p1.startpos;
+ unsigned int sp2=dg->seq_p2.startpos;
+ char *data1 = dg->seq_p1.sq->data;
+ char *data2 = dg->seq_p2.sq->data;
+ int a1, a2;
+ int *c2n = smatrix->char2num;
+ int *sdata = smatrix ->data;
+ int slen = smatrix->length;
+
+ dg->score = 0;
+ for(pos=0;pos<len;pos++) {
+ a1 = c2n[(int) data1[sp1+pos]];
+ a2 = c2n[(int) data2[sp2+pos]];
+ dg->score+=(long)sdata[slen*a1+a2];
+ }
+ }
+
+ long double prob;
+
+ long double factor;
+
+ dg->meetsThreshold = 0;
+
+
+ if(dg->score <= pdist->smatrix->avg_sim_score*dg->length) {
+ dg->total_weight = 0.0;
+ dg->ov_weight = 0.0;
+ dg->weight_fac = 1.0;
+ dg->weight = 0.0;
+ return;
+ }
+
+ // interpolate only for splitted diags that fall beyond the threshold
+ /*
+ if( (dg->orig_score>0)) {
+ //if( (dg->weight<=0.0) && (dg->orig_score>0)) {
+ dg->weight = ((double)dg->score)/((double)dg->orig_score)*dg->weight_sum;
+ // printf(" ws %.20f %.20f \n", dg->weight, dg->weight_sum);
+ //if(dg->weight_sum>0.0) dg->weight = dg->weight_sum;
+ }else */
+ if(len<=pdist->max_dlen) {
+
+ if(tmp_dist==NULL) {
+ prob =pdist->data[len][dg->score];
+
+ /*
+ if(omitScore>=0) {
+ factor = (long double)((len + dg->seq_p1.leftmargin + dg->seq_p1.rightmargin )* (len + dg->seq_p2.leftmargin + dg->seq_p2.rightmargin ))/(long double)(4.0*len*len); // original
+ } else {
+ factor = (long double)(10000.0)/(long double)(4.0*len*len);
+ }
+ */
+ //printf(" %i %i\n", dg->seq_p1.sq->length, len+dg->seq_p1.leftmargin+dg->seq_p1.rightmargin);
+
+ if(omitScore>=0) {
+ factor = (long double)((dg->seq_p1.sq->length )* (dg->seq_p2.sq->length ))/(long double)(4.0*len*len); // original
+ } else {
+ factor = (long double)(10000.0)/(long double)(4.0*len*len);
+ }
+
+ np2 =prob * (factor);
+ if(np2>=para->DIAG_CALC_WEIGHT_THRESHOLD) {
+ np = (long double)1.0- pow(1.0-prob,factor); // current
+ } else {
+ np = np2;
+ }
+ dg->weight = -log(np);
+ } else {
+ dg->weight = tmp_dist[len][dg->score];
+ }
+ }
+
+ dg->total_weight = (dg->weight);//+dg->ov_weight);//* dg->weight_fac;
+ if( (dg->length >= para->DIAG_MIN_LENGTH) && (dg->weight > para->DIAG_THRESHOLD_WEIGHT)) {
+ dg->meetsThreshold = 1;
+ } else {
+ }
+}
+
+void calc_weight(struct diag* dg, struct scr_matrix* smatrix,
+ struct prob_dist *pdist) {
+ real_calc_weight(dg, smatrix, pdist, 0,NULL,NULL);
+}
+
+
+
+/**
+ * calculates the overlap weight for the given diag
+ */
+void calc_ov_weight(struct diag* dg, struct diag_col *dcol, struct scr_matrix* smatrix,
+ struct prob_dist *pdist) {
+ int sn1 = dg->seq_p1.num;
+ int sn2 = dg->seq_p2.num;
+ int snt, sn;
+ struct seq *seq1 = dg->seq_p1.sq;
+ struct seq *seq2 = dg->seq_p1.sq;
+ struct diag* tdg = create_diag(sn1, seq1,0,
+ 1, seq2,0,0);
+ struct diag* dg2;
+ struct simple_diag_col *sdcol;
+
+ int i,j, slen=dcol->seq_amount, dlen;
+ int sp1 = dg->seq_p2.startpos,tsp1;
+ int tep1,t;
+ double w;
+ struct seq_part *seq_p, *d_seq_p1, *d_seq_p2;
+ dg->ov_weight = 0.0;
+ int tstartpos;
+ if(dg->length >0) {
+ for(sn=0;sn<2;sn++) {
+ tstartpos = (sn==0 ? dg->seq_p1.startpos : dg->seq_p2.startpos);
+ tdg->seq_p1.sq = (sn==0 ? seq1 : seq2);
+ tdg->seq_p1.num = (sn==0 ? sn1 : sn2);;
+ // other way
+ seq_p = (sn==0 ? &dg->seq_p2 : &dg->seq_p1);
+ tsp1 = seq_p->startpos;
+ tep1 = seq_p->startpos+dg->length-1;
+
+ snt = (sn==0 ? sn2 : sn1);
+ //printf(" slen %i\n", slen);
+ for(i=0; i<slen;i++) {
+ if((i!=sn1) && (i!=sn2)) {
+ //printf("OV %i %i!\n",i, slen);
+
+ sdcol = dcol->diag_matrix[(snt < i) ? (snt*slen + i) : (i*slen+snt)];
+
+ tdg->seq_p2.num=i;
+ dlen = sdcol->length;
+ for(j=0;j<dlen;j++) {
+ dg2 = sdcol->data[j];
+ if(snt<i) {
+ d_seq_p1 = &dg2->seq_p1;
+ d_seq_p2 = &dg2->seq_p2;
+ } else {
+ d_seq_p1 = &dg2->seq_p2;
+ d_seq_p2 = &dg2->seq_p1;
+ }
+ if(j==0) {
+ tdg->seq_p2.sq = d_seq_p2->sq;
+ }
+ if(dg2->length >0) {
+ if(d_seq_p1->startpos>tsp1) tsp1 = d_seq_p1->startpos;
+ t=d_seq_p1->startpos+dg2->length-1;
+ if(t<tep1) tep1 = t;
+ if(tsp1<=tep1) {
+ //tdg->seq_p2.sq=dg2->seq_p2.sq;
+ tdg->seq_p1.startpos = tstartpos + tsp1- sp1;
+ tdg->seq_p2.startpos = d_seq_p2->startpos + tsp1- d_seq_p1->startpos;
+
+ tdg->length = tep1-tsp1+1;
+ //real_calc_weight(tdg, smatrix, pdist,-1,NULL,NULL);
+ real_calc_weight(tdg, smatrix, pdist,0,NULL,NULL);
+ if(tdg->meetsThreshold ) {
+ w = tdg->weight;
+ //printf("add %.20f\n",w);
+ dg->ov_weight += w/2.0;
+ //dg2->ov_weight += w;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ dg->total_weight = (dg->weight);//+dg->ov_weight)*dg->weight_fac;// + dg->ov_weight;
+ free_diag(tdg);
+}
+
+
+/**
+ * creates the collection of all diags
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+struct diag_col* create_diag_col(int seq_amount) {
+ struct diag_col *dc = calloc(1, sizeof(struct diag_col));
+ if(dc==NULL) error("create_diag_col(): (1) Out of memory !");
+
+ //printf("go for k\n");
+ dc->diag_matrix = malloc(seq_amount*seq_amount*
+ sizeof(struct simple_diag_col *));
+ //printf("2go for k\n");
+ dc->gt_root = NULL;
+ if(dc->diag_matrix==NULL) error("create_diag_col(): (2) Out of memory !");
+ return dc;
+}
+
+/**
+ * frees a diagcol and all data included in it
+ */
+void free_diag_col(struct diag_col* dcol) {
+ int s1,s2,sl=dcol->seq_amount;
+ // printf("damount: %i\n", dcol->diag_amount);
+ //printf("--------------------------------\n");
+ for(s1 =0;s1<dcol->diag_amount;s1++) {
+ // print_diag(dcol->diags[s1]);
+ //printf(" NO FREEEEEEEEEE %i %i\n", s1,dcol->diags[s1]);
+ free_diag(dcol->diags[s1]);
+ }
+ free(dcol->diags);
+ for(s1=0;s1<sl;s1++) {
+ for(s2=s1+1;s2<sl;s2++) {
+ free(dcol->diag_matrix[s1+sl*s2]->data);
+ free(dcol->diag_matrix[s1+sl*s2]);
+ }
+ }
+ free(dcol->diag_matrix);
+ if(dcol->gt_root!=NULL) free_gt_node(dcol->gt_root);
+ free(dcol);
+}
+
+
+/**
+ * finds all relevant multi diags with respect to the given alignment
+ * and two groups of sequences that come from the guided method
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+inline struct simple_diag_col* find_diags_guided(struct scr_matrix *smatrix,
+ struct prob_dist *pdist, struct gt_node* n1,
+ struct gt_node* n2, struct alignment *algn,
+ double thres_weight,
+ int*** diag_info) {
+
+ struct simple_diag_col* dcol = calloc(1, sizeof(struct simple_diag_col));
+ if(dcol==NULL) error("find_diags_guided(): (1) Out of memory !");
+
+ prepare_alignment(algn);
+
+
+
+ struct seq_col *scol = algn->scol;
+ struct seq *seq1 = &(scol->seqs[n1->seq_num[0]]);
+ struct seq *seq2 = &(scol->seqs[n2->seq_num[0]]);
+ int slen = scol->length;
+
+ int ni1, ni2;
+ struct seq *seq_n1, *seq_n2;
+
+ unsigned int size = 16;
+ int length = 0;
+ struct diag **data = calloc(size, sizeof(struct diag* ));
+ // printf("go for k\n");
+ if(data==NULL) error("find_diags_guided(): (2) Out of memory !");
+
+ struct algn_pos *tap;// = find_eqc(algn->algn, seq1->num, seq1->length-1);
+ long slen1 = algn->max_pos;
+ long slen2 = slen1;
+
+
+ unsigned int max_dlen = pdist->max_dlen;
+
+ struct diag *sdg, *tsdg;
+ struct diag *dg = create_diag(seq1->num, seq1,0,
+ seq2->num, seq2,0,0);
+
+ struct diag* tdg,*tdg2;
+
+ int i,j,k,l,kposi,kposj,jmin=0,jmax=slen2;
+
+
+ int sn1 = seq1->num;
+ int sn2 = seq2->num;
+
+ int *c2n = smatrix->char2num;
+ int *sdata = smatrix ->data;
+ char *data1;// = seq1->data;
+ char *data2;// = seq2->data;
+ int smatrixlen = smatrix->length;
+ int a1,a2;
+
+ int maxslen = slen1;
+ if(slen2>maxslen) maxslen = slen2;
+
+ //long double **tmp_dist = create_tmp_pdist(pdist);
+ //fill_tmp_pdist(pdist, tmp_dist, slen1, slen1);
+
+
+ int max_pool = (slen1+slen2-1);
+ struct diag **diag_col = malloc(sizeof(struct diag*)*(slen1+1));
+ struct diag **diag_row = malloc(sizeof(struct diag*)*(slen2+1));
+ struct diag **pool_diags=malloc(sizeof(struct diag *)*max_pool);
+ int pooled = 0;
+ double thres_sim_score =para->PROT_SIM_SCORE_THRESHOLD;
+ char hasAli = (algn!=NULL);
+ double diag_thres = para->DIAG_THRESHOLD_WEIGHT;
+ double avg_sim_score = pdist->smatrix->avg_sim_score;
+
+ int maxd,maxd2,cons_maxd;
+ int score1=0,score2 = 0;
+ char prevail;
+ int extended,passed;//,actuals;
+ int passed2;
+ int max_under = 0;//para->PROT_DIAG_MAX_UNDER_THRESHOLD_POS;
+ int max_under_inner =0;//2*para->PROT_DIAG_MAX_UNDER_THRESHOLD_POS;
+
+ double dg_thres_weight = thres_weight;// * n1->seq_num_length*n2->seq_num_length;
+
+ //int min_motives = n1->seq_num_length;
+ //if(n2->seq_num_length > min_motives) min_motives = n2->seq_num_length;
+ //min_motives++;
+ int min_motives = sqrt(n1->seq_num_length * n2->seq_num_length);
+ if(min_motives<2) min_motives = 2;
+ // if(min_motives>(n1->seq_num_length*n2->seq_num_length)) min_motives = (n1->seq_num_length * n2->seq_num_length);
+
+ char stst;
+ char mstatus;
+ int slensq = slen*slen;
+ int sqind;
+ char startstop[slensq];
+ char startstop_pre[slen];
+ int c_klen[slensq];
+ int c_kscore[slensq];
+
+ int rev_pos[slen][slen1];
+ struct gt_node *tgtn;
+
+
+ // build reverse algn pos
+
+ int iterlen = 0;
+ int iter[slen*slen];
+ for(ni1=0;ni1<n1->seq_num_length;ni1++) {
+ sn1 = n1->seq_num[ni1];
+ for(ni2=0;ni2<n2->seq_num_length;ni2++) {
+ //printf(" begin MARKER MARKER MARKER %i %i %i\n",i,j,k);
+ sn2 = n2->seq_num[ni2];
+ sqind = sn1*slen+sn2;
+ iter[iterlen++] = sqind;
+ }
+ }
+
+
+ dg->multi_dg = 1;
+ dg->marked = 1;
+ dg->multi_length = slensq;
+ dg->multi_cont = malloc(sizeof(struct diag *)*slensq);
+ memset(dg->multi_cont, 0, sizeof(struct diag *)*slensq);
+ for(i=0;i<slensq;i++) {
+ dg->multi_cont[i]=NULL;
+ }
+
+ maxd = n1->seq_num_length + n2->seq_num_length;
+ for(i=0;i<maxd;i++) {
+ k = i;
+ tgtn = n1;
+ if(i>=n1->seq_num_length) {
+ k-=n1->seq_num_length;
+ tgtn = n2;
+ }
+ ni1 = tgtn->seq_num[k];
+ seq_n1 = &(scol->seqs[ni1]);
+ for(j=0;j<slen1;j++) {
+ rev_pos[ni1][j]=-1;
+ }
+ for(j=0;j<seq_n1->length;j++) {
+ tap = find_eqc(algn->algn, seq_n1->num, j);
+ rev_pos[ni1][*(tap->eqcAlgnPos)] = j;
+ }
+ }
+
+ // DIALIGN
+ for(k=0;k<=slen1;k++) {
+ //printf(" begin %i %i %i %i\n",k,slen, seq1->num, seq2->num);
+ diag_col[k]=create_diag(seq1->num, seq1,0,
+ seq2->num, seq2,0,0);
+ //printf(" middle\n");
+ diag_col[k]->multi_dg = 1;
+ diag_col[k]->marked = 1;
+ diag_col[k]->multi_length = 0;
+
+ //diag_col[k]->length = 1;
+ diag_col[k]->weight_sum = 0.0;
+ diag_col[k]->weight = 0.0;
+ diag_col[k]->meetsThreshold = 0;
+ pool_diags[pooled] = diag_col[k];
+ pool_diags[pooled]->pool_pos = pooled;
+ pooled++;
+ //printf(" end %i %i\n",k,slen);
+ }
+ for(k=0;k<=slen2;k++) {
+ diag_row[k] = diag_col[0];
+ }
+
+ double old_weight;
+
+ if(max_dlen> slen1/2.0) max_dlen = slen1/2.0;
+ if(max_dlen> slen2/2.0) max_dlen = slen2/2.0;
+
+ for(i=0;i<=slen1;i++) {
+
+ // merge row/col
+ //printf("before \n");
+ if(i>0) {
+ tdg = diag_col[i];
+ while(tdg!=NULL) {
+ kposi = tdg->seq_p2.startpos+tdg->length;
+ //printf(" kposi %i %i %i\n", diag_row[kposi], kposi, slen2);
+ if(tdg->weight_sum > diag_row[kposi]->weight_sum) {
+ diag_row[kposi] = tdg;
+ prevail = 1;
+ } else {
+ prevail = 0;
+ }
+ tdg2 = tdg;
+ tdg = tdg->col_pred_diag;
+ if(! prevail) {
+ pool_diags[tdg2->pool_pos]=NULL;
+ //printf(" BEFORE\n");
+ free_diag(tdg2);
+ //printf(" AFTER\n");
+ }
+ }
+ }
+ //printf("after \n");
+
+ for(j=1;j<=slen2;j++) {
+ if(diag_row[j-1]->weight_sum > diag_row[j]->weight_sum) {
+ diag_row[j] = diag_row[j-1];
+ }
+ }
+
+ if(i==slen1) break;
+
+ for(j=jmin;j<jmax;j++) {
+ old_weight = 0.0;
+ memset(startstop, 0, sizeof(char)*slen*slen);
+ memset(startstop_pre, 0, sizeof(char)*slen);
+ maxd = max_dlen;
+ if( (i+maxd)>slen1) maxd = slen1-i;
+ if( (j+maxd)>slen1) maxd = slen1-j;
+ /*
+ for(l=0;l<iterlen;l++) {
+ sdg = dg->multi_cont[iter[l]];
+ if(sdg!=NULL) {
+ free_diag(sdg);
+ dg->multi_cont[iter[l]]=NULL;
+ }
+ }
+ */
+ dg->seq_p1.startpos = i;
+ dg->seq_p2.startpos = j;
+
+ passed = 0;
+ passed2 = 0;
+ // actuals = 0;
+ for(k=1;k<=maxd;k++) {
+ //printf(" %i %i %i %i\n",i,j,k,slen1);
+ kposi = i+k-1;
+ kposj = j+k-1;
+ maxd2 = maxd;
+ maxd = 0;
+ //printf(" k= %i\n",k);
+ extended = 0;
+ //mstatus = 0;
+
+ for(ni1=0;ni1<n1->seq_num_length;ni1++) {
+ sn1 = n1->seq_num[ni1];
+ seq_n1 = &(scol->seqs[sn1]);
+
+ if( (rev_pos[sn1][kposi]>=0)&& (startstop_pre[sn1]!=2) ) {
+ data1 = seq_n1->data;
+ startstop_pre[sn1]=2;
+ for(ni2=0;ni2<n2->seq_num_length;ni2++) {
+ //printf(" begin MARKER MARKER MARKER %i %i %i\n",i,j,k);
+ sn2 = n2->seq_num[ni2];
+ seq_n2 = &(scol->seqs[sn2]);
+ sqind = sn1*slen+sn2;
+ stst = startstop[sqind];
+ //if(stst==1) mstatus += stst;
+
+ //printf(" end MARKER MARKER MARKER %i %i\n",sn2, kpos);
+ if( (rev_pos[sn2][kposj]>=0) && (stst!=2)
+ && (diag_info[ni1][ni2][rev_pos[sn1][kposi]]==rev_pos[sn2][kposj])
+ ) {
+
+ dg->length = k;
+
+ data2 = seq_n2->data;
+
+ a1 = c2n[(int) data1[rev_pos[sn1][kposi]]];
+ a2 = c2n[(int) data2[rev_pos[sn2][kposj]]];
+ score2 = sdata[smatrixlen*a1+a2];
+ sdg = NULL;
+ if( (stst==0) && (score2 >= thres_sim_score)) {
+ //if(rev_pos[sn1][kpos]>1000) printf(" %i %i %i\n", sn1,kpos, rev_pos[sn1][kpos]);
+ sdg = dg->multi_cont[sqind];
+ if(sdg==NULL) {
+ sdg = create_diag(sn1, seq_n1, rev_pos[sn1][kposi],
+ sn2, seq_n2, rev_pos[sn2][kposj],0);
+ } else {
+ sdg->seq_p1.num = sn1;
+ sdg->seq_p1.sq = seq_n1;
+ sdg->seq_p1.startpos = rev_pos[sn1][kposi];
+ sdg->seq_p2.num = sn2;
+ sdg->seq_p2.sq = seq_n2;
+ sdg->seq_p2.startpos = rev_pos[sn2][kposj];
+ sdg->length = 0;
+ }
+ sdg->score = 0;
+ dg->multi_cont[sqind] = sdg;
+ startstop[sqind] = 1;
+ passed++;
+ c_klen[sqind] = 0;
+ c_kscore[sqind] = 0;
+ } else if(stst==1) {
+ sdg = dg->multi_cont[sqind];
+ } else {
+ //startstop[sqind]=2;
+ if(k>max_under) startstop[sqind] = 2;
+ sdg == NULL;
+ }
+
+ if(sdg!=NULL) {
+ maxd = maxd2; // reallow next k
+ //printf(" length compare %i %i %i %i\n",sqind, sdg->length+1,k,sdg);
+ c_klen[sqind]++;
+ c_kscore[sqind]+=score2;
+
+ // if( (sdg->seq_p1.startpos==20) && (sdg->seq_p2.startpos==2) ) printf(" %i %i %i %i %i\n", k, c_klen[sqind], sdg->seq_p1.startpos, sdg->seq_p2.startpos);
+
+
+ if(((sdg->score+c_kscore[sqind]) < (avg_sim_score*(sdg->length+c_klen[sqind])))) {
+ if( (sdg->length+c_klen[sqind])>max_under_inner) startstop[sqind]=2;
+ }
+ /*
+ if( (c_klen[sqind]>=1) &&
+ (c_kscore[sqind]< (para->PROT_DIAG_AVG_SCORE_THRESHOLD*c_klen[sqind]))) {
+ passed--;
+ startstop[sqind]=2;
+ }
+ */
+
+ if( (c_klen[sqind]>=para->PROT_DIAG_MAX_UNDER_THRESHOLD_POS) &&
+ (c_kscore[sqind]< (para->PROT_DIAG_AVG_SCORE_THRESHOLD*c_klen[sqind]))) {
+ if ( ((sdg->length+c_klen[sqind])>para->PROT_DIAG_MIN_LENGTH_THRESHOLD)) {
+ passed--;
+ startstop[sqind]=2;
+ }
+ }
+
+ //printf(" diag length %i %i %i %i %i\n", sn1, sn2, i,j, sdg->length);
+ if( (score2 >= thres_sim_score) && (startstop[sqind]==1)) {
+ //printf(" very before score %i\n", sdg->score);
+ sdg->score += c_kscore[sqind];
+ sdg->length += c_klen[sqind];
+ //printf(" begin CONSIDER SDG %i %i %i %f %f\n",sn1,sn2,sdg->length,sdg->weight, diag_thres);
+ //sdg->weight = tmp_dist[sdg->length][sdg->score];
+ calc_weight(sdg, smatrix, pdist);
+ //printf(" before score %i %i %.20f %i %i\n", sdg->score, sdg->length, sdg->weight, c_kscore[sqind], c_klen[sqind]);
+ /*
+ score1 = sdg->score;
+ if(score1!=sdg->score) {
+ print_diag(sdg);
+ printf(" score %i %i %i %.20f sc %i %i len %i %i %i \n", score1, sdg->score, sdg->length, sdg->weight, c_kscore[sqind],score2, c_klen[sqind],a1,a2);
+ error(" score changed!\n");
+ }
+ */
+
+ //printf(" after score %i %i %.20f\n", sdg->score, sdg->length, sdg->weight);
+ //printf(" END\n");
+ //if(sdg->weight>0.0) printf(" end CONSIDER SDG %i %i %i %i %f %f\n",sn1, sn2, sdg->length, sdg->score, sdg->weight, diag_thres);
+ c_klen[sqind]=0;
+ c_kscore[sqind]=0;
+ sdg->meetsThreshold = (sdg->weight>diag_thres ? 1 : 0);
+ extended++;
+ }
+ }
+ } else {
+ if(startstop[sqind]==1) {
+ startstop[sqind]=2;
+ passed--;
+ }
+ }
+ if(startstop[sqind]!=2) startstop_pre[sn1]=0;
+ }
+ } else {
+ for(ni2=0;ni2<n2->seq_num_length;ni2++) {
+ sn2 = n2->seq_num[ni2];
+ sqind = sn1*slen+sn2;
+ if(startstop[sqind]==1) {
+ startstop[sqind]=2;
+ passed--;
+ }
+ }
+ }
+ }
+
+ // if no inner starting diag break
+ if( (k==1) && !extended) maxd = 0;
+ // if only one inner diag and proceeded max_under further then break
+ if( (passed2>=0) && (passed<min_motives) && ( (k-passed2)>=max_under)) {
+ //printf(" break %i\n");
+ maxd = 0;
+ }
+ // find the last k where >=2 inner diags where active
+ if(passed >= min_motives) passed2 = k;
+
+ if( ((extended) && (passed>=min_motives))) { // && (passed>1)){// && (mstatus>1)) {
+ dg->weight = 0.0;
+ extended = 0;
+ for(l=0;l<iterlen;l++) {
+ sdg = dg->multi_cont[iter[l]];
+ if( (sdg!=NULL) && (startstop[iter[l]]>0) && (sdg->weight >= thres_weight)) {
+ extended++;
+ dg->weight += sdg->weight;
+ }
+ }
+ dg->meetsThreshold = (dg->weight>diag_thres ? 1 : 0);
+
+ if(dg->meetsThreshold && (extended >=min_motives) && (dg->weight>=old_weight) && (dg->weight>=dg_thres_weight)) {
+ old_weight = dg->weight;
+
+ if(max_pool<=pooled) {
+ max_pool += maxslen;
+ pool_diags = realloc(pool_diags, sizeof(struct diag*)*max_pool);
+ //printf(" pool size %i %.20f %.20f\n", max_pool, dg->weight, old_weight);
+ }
+ tdg = malloc(sizeof(struct diag));
+ pool_diags[pooled] = tdg;
+ dg->pool_pos = pooled;
+ pooled++;
+ *tdg = *dg;
+ tdg->pred_diag = diag_row[j];
+ tdg->weight_sum = diag_row[j]->weight_sum+tdg->weight;
+ tdg->col_pred_diag = diag_col[i+k];
+
+ diag_col[i+k] = tdg;
+
+ dg->multi_cont = malloc(sizeof(struct diag *)*slensq);
+ memset(dg->multi_cont, 0, sizeof(struct diag *)*slensq);
+ for(l=0;l<iterlen;l++) {
+
+ tsdg = tdg->multi_cont[iter[l]];
+ if((tsdg!=NULL)) { // && (startstop[iter[l]]==1)){
+ sdg = malloc(sizeof(struct diag));
+
+ if(startstop[iter[l]]==0) {
+ tsdg->length = 0;
+ tsdg->score = 0;
+ tsdg->weight = 0.0;
+ tsdg->total_weight = 0.0;
+ }
+
+ *sdg = *tsdg;
+ dg->multi_cont[iter[l]]=sdg;
+ } else {
+ dg->multi_cont[iter[l]]=NULL;
+ }
+
+ //dg->multi_cont[iter[l]]=NULL;
+ }
+ }
+ }
+ //if(k > 20) printf(" maxk= %i\n",k);
+
+ }
+ }
+ }
+ //printf(" after main %i\n",k);
+ tdg = diag_row[slen2];
+ dcol->total_weight = 0;
+ double lencomp = (log(slen1)+log(slen2));
+ length = 0;
+
+ while((tdg!=NULL)) {
+ //if (tdg->weight <=0.0) break;
+ if(tdg->meetsThreshold) {
+ // printf(" add tdg %i %i %i\n", tdg, tdg->length, tdg->meetsThreshold);
+ dcol->total_weight += tdg->weight+lencomp;
+
+ data[length] = tdg;
+ l = 0;
+ tdg->weight = 0.0;
+ for(i=0;i<slensq;i++) {
+ sdg = tdg->multi_cont[i];
+ if(sdg!=NULL) {
+ calc_weight(sdg, smatrix, pdist);
+
+ if ((sdg->length>0) && (sdg->meetsThreshold) && (sdg->weight > thres_weight)){
+ tdg->multi_cont[l++] = sdg;
+ tdg->weight += sdg->weight;
+ //printf (" tdg %i %f %f\n", tdg, tdg->weight, sdg->weight);
+ }
+ }
+ }
+ tdg->multi_length = l;
+ if( (tdg->multi_length>=min_motives) && (tdg->weight >= dg_thres_weight)) {
+ tdg->marked = 1;
+ tdg->total_weight = tdg->weight;
+ tdg->weight_sum = -1.0;
+ length++;
+ } else {
+ // TODO free ??
+ }
+
+ if(length >= size) {
+ size += 64;
+ data = realloc(data, sizeof(struct diag *)*size);
+ if(data==NULL) error("find_diags(): (3) Out of memory !");
+ }
+ }
+ tdg = tdg->pred_diag;
+ }
+
+ for(k=0;k<pooled;k++) {
+ if(pool_diags[k]!=NULL)
+ if(pool_diags[k]->weight_sum>-1.0) {
+ free_diag(pool_diags[k]);
+ }
+ }
+
+ free(pool_diags);
+ free(diag_col);
+ free(diag_row);
+ free_diag(dg);
+ //free_tmp_pdist(tmp_dist, pdist->max_dlen);
+
+ dcol->length = length;
+
+ data = realloc(data, sizeof(struct diag *)*length);
+ dcol->data = data;
+
+ return dcol;
+}
+
+/**
+ * finds all relevant diags by the DIALIGN METHOD
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+struct simple_diag_col* find_diags_dialign(struct scr_matrix *smatrix,
+ struct prob_dist *pdist, struct seq* seq1,
+ struct seq* seq2, struct alignment *algn,
+ long double **tmp_dist, int round) {
+ struct simple_diag_col* dcol = calloc(1, sizeof(struct simple_diag_col));
+ if(dcol==NULL) error("find_diags_dialign(): (1) Out of memory !");
+
+ unsigned int size = 16;
+ int length = 0;
+ struct diag **data = calloc(size, sizeof(struct diag* ));
+ // printf("go for k\n");
+ if(data==NULL) error("find_diags_dialign(): (2) Out of memory !");
+
+ long slen1 = seq1->length;
+ long slen2 = seq2->length;
+ unsigned int max_dlen = pdist->max_dlen;
+
+ struct diag *dg = create_diag(seq1->num, seq1,0,
+ seq2->num, seq2,0,0);
+ struct diag* tdg,*tdg2;
+
+ int i,j,k,kpos,jmin=0,jmax=slen2;
+
+ int sn1 = seq1->num;
+ int sn2 = seq2->num;
+
+ int *c2n = smatrix->char2num;
+ int *sdata = smatrix ->data;
+ char *data1 = seq1->data;
+ char *data2 = seq2->data;
+ int smatrixlen = smatrix->length;
+ int a1,a2;
+ int c_klen,c_kscore;
+
+ int maxslen = slen1;
+ if(slen2>maxslen) maxslen = slen2;
+
+ int max_pool = (slen1+slen2-1);
+ struct diag **diag_col = malloc(sizeof(struct diag*)*(slen1+1));
+ struct diag **diag_row = malloc(sizeof(struct diag*)*(slen2+1));
+ struct diag **pool_diags=malloc(sizeof(struct diag *)*max_pool);
+ int pooled = 0;
+ double thres_sim_score =para->PROT_SIM_SCORE_THRESHOLD;
+ char hasAli = (round>1); //(algn!=NULL);
+ struct algn_pos **ap,*tap;
+ double diag_thres = para->DIAG_THRESHOLD_WEIGHT;
+ double avg_sim_score = pdist->smatrix->avg_sim_score;
+
+ int maxd,maxd2,cons_maxd;
+ double score1=0,score2 = 0;
+ char prevail;
+
+ if(hasAli || para->DO_ANCHOR) {
+ ap = algn->algn;
+ }
+
+ // DIALIGN
+ for(k=0;k<=slen1;k++) {
+ diag_col[k]=create_diag(seq1->num, seq1,0,
+ seq2->num, seq2,0,1);
+
+ //diag_col[k]->length = 1;
+ diag_col[k]->weight_sum = 0.0;
+ diag_col[k]->weight = 0.0;
+ pool_diags[pooled] = diag_col[k];
+ pool_diags[pooled]->pool_pos = pooled;
+ pooled++;
+ }
+ for(k=0;k<=slen2;k++) {
+ diag_row[k] = diag_col[0];
+ }
+
+ double old_weight;
+
+ if(max_dlen> slen1/2.0) max_dlen = slen1/2.0;
+ if(max_dlen> slen2/2.0) max_dlen = slen2/2.0;
+
+ for(i=0;i<=slen1;i++) {
+
+ // merge row/col
+ if(i>0) {
+ tdg = diag_col[i];
+ while(tdg!=NULL) {
+ kpos = tdg->seq_p2.startpos+tdg->length;
+ if(tdg->weight_sum > diag_row[kpos]->weight_sum) {
+ diag_row[kpos] = tdg;
+ prevail = 1;
+ } else {
+ prevail = 0;
+ }
+ tdg2 = tdg;
+ tdg = tdg->col_pred_diag;
+ if(! prevail) {
+ pool_diags[tdg2->pool_pos]=NULL;
+ free_diag(tdg2);
+ }
+ }
+ }
+ for(j=1;j<=slen2;j++) {
+ if(diag_row[j-1]->weight_sum > diag_row[j]->weight_sum) {
+ diag_row[j] = diag_row[j-1];
+ }
+ }
+ if(i==slen1) break;
+ if(hasAli || para->DO_ANCHOR) {
+ tap = find_eqc(ap, sn1, i);
+
+ if(tap->predF!=NULL) {
+ jmin = tap->predF[sn2]+1;
+ } else {
+ jmin = 0;
+ }
+
+ if(tap->succF!=NULL) {
+ jmax = tap->succF[sn2];
+ }else {
+ jmax = slen2;
+ }
+
+ if(jmin<0) jmin = 0;
+ }
+
+ if(para->DO_ANCHOR) {
+ if( (jmin-1)==jmax) {
+ jmin--;
+ jmax++;
+ }
+ }
+
+ for(j=jmin;j<jmax;j++) {
+
+ if(i<slen1 && j<slen2) {
+ a1 = c2n[(int) data1[i]];
+ a2 = c2n[(int) data2[j]];
+ score1 = sdata[smatrixlen*a1+a2];
+ } else {
+ score1 = 0;
+ }
+
+ if(score1>=thres_sim_score) {
+ maxd = slen1 - i;
+ maxd2 = slen2 - j;
+ if(maxd >maxd2) maxd = maxd2;
+ if(maxd > max_dlen) maxd = max_dlen;
+
+ dg->seq_p1.startpos = i;
+ dg->seq_p2.startpos = j;
+ dg->score = score1;
+
+ cons_maxd = maxd+1;
+ old_weight = 0.0;
+
+ c_klen = 0;
+ c_kscore = 0;
+
+ for(k=1;k<=maxd;k++) {
+ dg->length = k;
+ kpos = i+k;
+ if(hasAli || para->DO_ANCHOR) {
+ a1 = i+k-1;
+ a2 = j+k-1;
+ tap = find_eqc(ap, sn1, a1);
+
+ if (! ( (para->DO_ANCHOR) && (tap->predF!=NULL) && (tap->succF!=NULL) &&
+ (tap->predF[sn2]==tap->succF[sn2]) &&
+ (tap->predF[sn2]==a2)
+ )
+ ) {
+
+ if(tap->predF!=NULL) {
+ if( (tap->predF[sn2] - a2)>0) break;
+ /*
+ if(tap->predF[sn2]==a2) {
+ if( (tap->succF==NULL) || (tap->predF[sn2]!=tap->succF[sn2])) break;
+ }
+ */
+ }
+ if(tap->succF!=NULL) {
+ if((a2 - tap->succF[sn2])>0) break;
+ /*
+ if(tap->succF[sn2]==a2) {
+ if( (tap->predF==NULL) || (tap->predF[sn2]!=tap->succF[sn2])) break;
+ }
+ */
+ }
+ }
+ }
+
+ if(k>1) {
+ a1 = c2n[(int) data1[kpos-1]];
+ a2 = c2n[(int) data2[j+k-1]];
+ score2 = sdata[smatrixlen*a1+a2];
+ dg->score += score2;
+ } else {
+ score2 = score1;
+ }
+
+
+ if( dg->score < (avg_sim_score*(double)k)) {
+ break;
+ }
+
+ c_klen++;
+ c_kscore+=score2;
+
+ if( (c_klen>=para->PROT_DIAG_MAX_UNDER_THRESHOLD_POS) &&
+ (c_kscore< (para->PROT_DIAG_AVG_SCORE_THRESHOLD*c_klen))) {
+ if ( (k>para->PROT_DIAG_MIN_LENGTH_THRESHOLD)) {
+ break;
+ } else {
+ if(maxd>para->PROT_DIAG_MIN_LENGTH_THRESHOLD) maxd = para->PROT_DIAG_MIN_LENGTH_THRESHOLD;
+ }
+ }
+
+ if(score2 >= thres_sim_score) {
+ c_klen=0;
+ c_kscore=0;
+ if(1) {
+ if(!hasAli) {
+ dg->weight = tmp_dist[k][dg->score];
+ dg->meetsThreshold = (dg->weight>diag_thres ? 1 : 0);
+ } else {
+ real_calc_weight(dg, smatrix, pdist,1,tmp_dist,algn);
+ }
+ if(dg->meetsThreshold && (dg->weight>=old_weight)) {
+ old_weight = dg->weight;
+ if(max_pool<=pooled) {
+ max_pool += maxslen;
+ pool_diags = realloc(pool_diags, sizeof(struct diag*)*max_pool);
+ //printf(" old pool size %i\n", max_pool);
+ }
+ tdg = malloc(sizeof(struct diag));
+ pool_diags[pooled] = tdg;
+ dg->pool_pos = pooled;
+ pooled++;
+ *tdg = *dg;
+ tdg->pred_diag = diag_row[j];
+ tdg->weight_sum = diag_row[j]->weight_sum+tdg->weight;
+ tdg->col_pred_diag = diag_col[kpos];
+
+ diag_col[kpos] = tdg;
+ }
+ }
+ }
+ }
+ }
+
+ }
+ }
+
+ tdg = diag_row[slen2];
+ dcol->total_weight = 0;
+ double lencomp = (log(slen1)+log(slen2));
+
+ while((tdg!=NULL)) {
+ if (tdg->weight <=0.0) break;
+ if(1) {
+ dcol->total_weight += tdg->weight+lencomp;
+
+ data[length] = tdg;
+ tdg->weight_sum = -1.0;
+ length++;
+ if(length >= size) {
+ size += 64;
+ data = realloc(data, sizeof(struct diag *)*size);
+ if(data==NULL) error("find_diags(): (3) Out of memory !");
+ }
+ }
+ tdg = tdg->pred_diag;
+ }
+
+ for(k=0;k<pooled;k++) {
+ if(pool_diags[k]!=NULL)
+ if(pool_diags[k]->weight_sum>-1.0) {
+ free(pool_diags[k]);
+ }
+ }
+
+ free(pool_diags);
+ free(diag_col);
+ free(diag_row);
+ free_diag(dg);
+ dcol->length = length;
+
+ data = realloc(data, sizeof(struct diag *)*length);
+ dcol->data = data;
+
+ if(para->DEBUG>5) {
+ for(i=0;i<length;i++) {
+ print_diag(data[i]);
+ printf("\n");
+ }
+ }
+
+ return dcol;
+}
+
+
+/**
+ * finds all relevant diags by dynamic programming on diagonal stripes
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+inline struct simple_diag_col* find_diags_dyn(struct scr_matrix *smatrix,
+ struct prob_dist *pdist, struct seq* seq1,
+ struct seq* seq2, struct alignment *algn,
+ long double **tmp_dist) {
+
+ struct simple_diag_col* dcol = calloc(1, sizeof(struct simple_diag_col));
+ if(dcol==NULL) error("find_diags_dyn(): (1) Out of memory !");
+
+ unsigned int size = 64;
+ int l, k,lastk, maxl;
+ int length = 0;
+ struct diag **data = calloc(size, sizeof(struct diag *));
+ if(data==NULL) error("find_diags_dyn(): (2) Out of memory !");
+
+ int slen1 = seq1->length;
+ int slen2 = seq2->length;
+ unsigned int max_dlen = pdist->max_dlen;
+
+ struct diag* dg = create_diag(seq1->num, seq1,0,
+ seq2->num, seq2,0,0);
+ struct diag* tdg;
+
+ int i,j,d;
+
+ int sn1 = seq1->num;
+ int sn2 = seq2->num;
+ // printf("%i\n",slen2);
+ int *c2n = smatrix->char2num;
+ int *sdata = smatrix ->data;
+ char *data1 = seq1->data;
+ char *data2 = seq2->data;
+ int slen = smatrix->length;
+
+ int a1,a2;
+ int score1=0,score2 = 0;
+
+ int maxslen = slen1;
+ if(slen2>maxslen) maxslen = slen2;
+ double avslen = ((double)slen1+slen2)/2.0;
+
+ int delta;
+ int sim_thr_pred_pos[maxslen];
+ //int sim_thr_succ_pos[maxslen];
+ int scores[maxslen];
+ long score_sum[maxslen];
+ long s_sum;
+ int old_thr_pos;
+
+ //double *dyn_weight = calloc(maxslen, sizeof(double));
+ double weight;
+ struct diag **dyn_diags=malloc(sizeof(struct diag *)*maxslen);
+ int max_pool = maxslen;
+ struct diag **pool_diags=malloc(sizeof(struct diag *)*max_pool);
+ int pooled = 0;
+
+ int thres_sim_score = para->PROT_SIM_SCORE_THRESHOLD;
+
+ int kscore, klen;
+
+ char hasAli = (algn!=NULL);
+
+ double diag_thres = para->DIAG_THRESHOLD_WEIGHT;
+ double avg_sim_score = pdist->smatrix->avg_sim_score;
+
+ struct algn_pos **ap,*tap;
+ if(hasAli) {
+ ap = algn->algn;
+ thres_sim_score =thres_sim_score/2;
+ if(thres_sim_score<4) thres_sim_score = 4;
+ diag_thres = 0.0;
+ }
+
+
+ for(d=-slen1+1;d<slen2;d++) {
+ //printf(" d=%i\n",d);
+
+ if(d<=0) {
+ i = - d;
+ j=0;
+ maxl = slen1-i;
+ if(slen2<maxl) maxl = slen2;
+ } else {
+ i=0;
+ j=d;
+ maxl = slen2 -j;
+ if(slen1<maxl) maxl = slen1;
+ }
+
+ // prepare values
+ old_thr_pos=-1;
+ s_sum=0;
+ for(k=0;k<maxl;k++) {
+ // hier: hasAlipredF/SuccF abfragen !!!!
+ if(hasAli) {
+ a1 = i+k;
+ a2 = j+k;
+ //printf("pre %i\n", a1);
+ tap = find_eqc(ap, sn1, a1);
+ //printf("after %i\n", a1);
+ if(tap->predF!=NULL) {
+ if( (tap->predF[sn2] - a2)>0) break;
+ }
+ if(tap->succF!=NULL) {
+ if((a2 - tap->succF[sn2])>0) break;
+ }
+ }
+
+ a1 = c2n[(int) data1[i+k]];
+ a2 = c2n[(int) data2[j+k]];
+ score1 = sdata[slen*a1+a2];
+ scores[k] = score1;
+ s_sum+= score1;
+ score_sum[k] = s_sum;
+ if(score1 < thres_sim_score) {
+ sim_thr_pred_pos[k] = old_thr_pos;
+ } else {
+ //if(old_thr_pos>=0) sim_thr_succ_pos[old_thr_pos] = k;
+ old_thr_pos = k;
+ }
+ }
+ maxl = k;
+ //if(old_thr_pos>=0) sim_thr_succ_pos[old_thr_pos] = maxl;
+
+ dyn_diags[0] = create_diag(seq1->num, seq1,0,
+ seq2->num, seq2,0,0);
+ dyn_diags[0]->weight_sum = 0.0;
+ dyn_diags[0]->weight = 0.0;
+ pool_diags[0] = dyn_diags[0];
+ pooled = 1;
+ lastk=0;
+
+ for(k=0;k<maxl;k++) {
+ //printf("process %i %i\n", k,maxl);
+
+ if(k>0) {
+ dyn_diags[k] = dyn_diags[lastk];
+ //dyn_weight[k] = dyn_weight[lastk];
+ }
+ if(hasAli) {
+ a1 = i+k;
+ a2 = j+k;
+ //printf("pre %i\n", a1);
+ tap = find_eqc(ap, sn1, a1);
+ //printf("after %i\n", a1);
+ if(tap->predF!=NULL) {
+ if( (tap->predF[sn2] - a2)>0) break;
+ }
+ if(tap->succF!=NULL) {
+ if((a2 - tap->succF[sn2])>0) break;
+ }
+ }
+
+ score1 = scores[k];
+ if(score1>=thres_sim_score) {
+
+ for(l=para->DIAG_MIN_LENGTH;l<=max_dlen; l++) {
+ delta = k-l+1;
+ dg->seq_p1.startpos = i+delta;
+ dg->seq_p2.startpos = j+delta;
+
+ kscore = 0;
+ klen = 0;
+
+ if((dg->seq_p1.startpos<0) || (dg->seq_p2.startpos<0)) {
+ break;
+ } else {
+
+
+ dg->length = l;
+ //printf("%i %i \n", i-l+1, j-l+1);
+
+ score2 = scores[delta];
+ klen++;
+ kscore += score2;
+
+ if( (kscore < avg_sim_score*klen)) { // && (dg->score>1.2*k*avg_sim_score)) {
+
+ /* experiment */
+ if( ( (k>=0.2*avslen) || (k>=20) || ( (i-j)>0.3*avslen)) && klen>=4) break;
+ }
+
+ if(kscore >= avg_sim_score*klen ) {
+ //if(score2 >= thres_sim_score) {
+ kscore = 0;
+ klen = 0;
+ dg->score = score_sum[k] - (delta > 0 ? score_sum[delta-1] : 0);
+ if(dg->score <= avg_sim_score*dg->length) break;
+ if(!hasAli) {
+ dg->weight = tmp_dist[dg->length][dg->score];
+ dg->meetsThreshold = (dg->weight>diag_thres ? 1 : 0);
+ } else {
+ real_calc_weight(dg, smatrix, pdist,1,tmp_dist,algn);
+ }
+
+ if(dg->meetsThreshold) {
+ if(max_pool<=pooled) {
+ max_pool += maxslen;
+ pool_diags = realloc(pool_diags, sizeof(struct diag*)*max_pool);
+ }
+ if(delta==0) {
+ if(dg->weight > dyn_diags[k]->weight_sum) {
+ dg->weight_sum = dg->weight;
+ dyn_diags[k] = malloc(sizeof(struct diag));
+ pool_diags[pooled] = dyn_diags[k];
+ pooled++;
+ *dyn_diags[k] = *dg;
+ dyn_diags[k]->pred_diag = NULL;
+ }
+ } else {
+ weight = dg->weight + dyn_diags[delta-1]->weight_sum;
+ if( (weight) >= dyn_diags[k]->weight_sum) {
+ dg->weight_sum = weight;
+ dyn_diags[k] = malloc(sizeof(struct diag));
+ pool_diags[pooled] = dyn_diags[k];
+ pooled++;
+ *dyn_diags[k] = *dg;
+ if(dyn_diags[delta-1]->weight >0) {
+ dyn_diags[k]->pred_diag = dyn_diags[delta-1];
+ } else {
+ dyn_diags[k]->pred_diag = NULL;
+ }
+ }
+ }
+
+ lastk = k;
+ }
+
+ } else {
+ l += (delta - sim_thr_pred_pos[delta])-1;
+ }
+ }
+ }
+ }
+ }
+ tdg = dyn_diags[lastk];
+ while((tdg!=NULL)) {
+ if (tdg->weight <=0.0) break;
+
+ data[length] = tdg;
+ tdg->weight_sum = -1.0;
+ length++;
+ if(length >= size) {
+ size += 64;
+ data = realloc(data, sizeof(struct diag *)*size);
+ if(data==NULL) error("find_diags(): (3) Out of memory !");
+ }
+ tdg = tdg->pred_diag;
+ }
+
+
+ for(k=0;k<pooled;k++) {
+ if(pool_diags[k]->weight_sum>-1.0) free(pool_diags[k]);
+ }
+ }
+
+ data = realloc(data, sizeof(struct diag *)*length);
+ free(pool_diags);
+ free(dyn_diags);
+ free_diag(dg);
+ dcol->length = length;
+ dcol->data = data;
+
+ if(para->DEBUG>5) {
+ for(i=0;i<length;i++) {
+ print_diag(data[i]);
+ printf("\n");
+ }
+ }
+
+ return dcol;
+}
+
+/**
+ * changes all_diags such that each diag is splitted, whenever there is
+ * another diag that has parts of it in common
+void split_diags(struct seq_col *in_seq_col, struct diag_col *all_diags) {
+
+ // note that we re-use *pred_diag for the successor diag here to save memory !!!
+
+
+ struct diag *dg;
+ struct diag *tdg;
+ struct diag *pdg;
+ struct diag *sdg;
+ struct diag **data;
+ struct diag **n_data;
+ struct simple_diag_col *sdcol;
+
+ unsigned int s1, s2, sl = in_seq_col->length;
+ unsigned int dl, d, si,k;
+ unsigned int odgpos1[sl];
+ unsigned int odgpos2[sl];
+ int min,max,xpos,txpos1, txpos2;
+ unsigned int odglen;
+ char next;
+ char hasSplit=1;
+ while(hasSplit) {
+ //printf("hasSplit %i\n",hasSplit);
+ hasSplit = 0;
+ for(s1=0;s1<sl;s1++) {
+ for(s2=s1+1;s2<sl;s2++) {
+ sdcol = all_diags->diag_matrix[s1+sl*s2];
+ dl = sdcol->length;
+ data = sdcol->data;
+ memset(odgpos1,0,sl*sizeof(int));
+ memset(odgpos2,0,sl*sizeof(int));
+ pdg=NULL;
+ for(d=0;d<dl;d++) {
+ dg = data[d];
+ dg->weight_sum = dg->weight;
+ dg->orig_score = dg->score;
+ if(pdg!=NULL) pdg->pred_diag = dg;
+ pdg = dg;
+ dg->pred_diag=NULL;
+
+ next=0;
+ while(! next) {
+ next = 1;
+ xpos = -1;
+
+ // round 1
+ //print_diag(dg);
+ //printf(" %i %i min=%i max=%i\n", s1,s2, min,max);
+ min = dg->seq_p1.startpos;
+ max = dg->seq_p1.startpos+dg->length-1;
+ for(si=0;si<sl;si++) {
+ if( (si==s1) || (si==s2)) continue;
+
+ // if( (s1==0) && (s2==3) && (si==2)) printf("%i %i min=%i max=%i\n", s1,s2,si,min,max);
+ if(s1<si){
+ odglen =all_diags->diag_matrix[s1+sl*si]->length;
+ n_data = all_diags->diag_matrix[s1+sl*si]->data;
+ } else {
+ odglen = all_diags->diag_matrix[si+sl*s1]->length;
+ n_data = all_diags->diag_matrix[si+sl*s1]->data;
+ }
+ //printf(" %i %i %i\n", si, odglen, odgpos1[si]);
+ while( (odgpos1[si]<odglen)) {
+ sdg = n_data[odgpos1[si]];
+ txpos1 = (s1==sdg->seq_p2.num) ? sdg->seq_p2.startpos : sdg->seq_p1.startpos;
+ txpos2 = txpos1 + sdg->length-1;
+ //if( (s1==0) && (s2==2) && (si==3)) printf(" pppp %i %i %i %i\n", min,max,txpos1, txpos2);
+ if(txpos2<min) {
+ odgpos1[si]++;
+ } else {
+ txpos2++;
+ if( ( (txpos1>min) && (txpos1<=max) && ((txpos1<xpos) || (xpos<0)))) xpos=txpos1;
+ if( (txpos2<=max) && ((txpos2<xpos) || (xpos<0))) xpos=txpos2;
+ //printf("sss %i %i %i %i %i xp=%i\n", odgpos1[si], min,max,txpos1,txpos2,xpos);
+ break;
+ }
+ }
+ }
+
+ // round 2
+ min = dg->seq_p2.startpos;
+ max = dg->seq_p2.startpos+dg->length-1;
+ if(xpos>=0) xpos = dg->seq_p2.startpos + (xpos-dg->seq_p1.startpos);
+ for(si=0;si<sl;si++) {
+ if( (si==s1) || (si==s2)) continue;
+ //if(si==s2) continue;
+
+ if(s2<si){
+ odglen = all_diags->diag_matrix[s2+sl*si]->length;
+ n_data = all_diags->diag_matrix[s2+sl*si]->data;
+ } else {
+ odglen = all_diags->diag_matrix[si+sl*s2]->length;
+ n_data = all_diags->diag_matrix[si+sl*s2]->data;
+ }
+ while( (odgpos2[si]<odglen)) {
+ //printf(" before split %i %i %i %i %i\n", si, s1, s2, odgpos2[si],odglen);
+ sdg = n_data[odgpos2[si]];
+ //printf(" after split %i\n", sdg);
+ txpos1 = (s2==sdg->seq_p2.num) ? sdg->seq_p2.startpos : sdg->seq_p1.startpos;
+ txpos2 = txpos1 + sdg->length-1;
+ if(txpos2<min) {
+ odgpos2[si]++;
+ } else {
+ txpos2++;
+ if( (txpos1>min) && (txpos1<=max) && ((txpos1<xpos) || (xpos<0))) xpos=txpos1;
+ if( (txpos2<=max) && ((txpos2<xpos) || (xpos<0))) xpos=txpos2;
+ break;
+ }
+ }
+ }
+
+ // split diag ?
+ if( (xpos>=0) && (xpos<=max) && (xpos>min)) {
+ hasSplit = 1;
+ next = 0;
+ //print_diag(dg);
+ tdg = create_diag(dg->seq_p1.num, dg->seq_p1.sq, xpos-min+dg->seq_p1.startpos,
+ dg->seq_p2.num, dg->seq_p2.sq, xpos,
+ max-xpos+1);
+ tdg->weight_sum = dg->weight_sum;
+ tdg->orig_score = dg->score;
+ dg->length = xpos - min;
+ //print_diag(dg);
+ //print_diag(tdg);
+ //if( (s1==0) && (s2==2)) printf(" SPLIT %i %i %i %i %i !\n", dg, dg->seq_p1.startpos, dg->length, tdg->seq_p1.startpos, tdg->length);
+ //printf(" 2SPLIT %i !\n", dg->length);
+ sdcol->length++;
+ dg->pred_diag = tdg;
+ tdg->pred_diag=NULL;
+ dg = tdg;
+ pdg = dg;
+ } else {
+ //if(s1==0) printf(" ELSE %i %i %i !\n", dg, dg->seq_p1.startpos, dg->length);
+
+ }
+ }
+ }
+ dl = sdcol->length;
+ if(dl>0) dg=sdcol->data[0];
+ //printf(" before realloc %i\n", sdcol->length);
+ sdcol->data=realloc(sdcol->data, sdcol->length*sizeof(struct diag*));
+ //printf(" after realloc %i\n", sdcol->length);
+
+ if( (dl>0)&& (sdcol->data==NULL)) {
+ error(" split_diags: Out of Memory - reallocating!\n");
+ }
+ for(k=0;k<dl;k++) {
+ //printf (" %i %i %i %i\n",s1,s2,k,dg);
+ if(dg==NULL) {
+ error("split_diags: ALARM dg=NULL !\n");
+ }
+ //printf(" diag %i %i %i %i\n",dg->seq_p1.num, dg->seq_p2.num, dg->seq_p1.startpos, dg->length);
+ sdcol->data[k] = dg;
+ dg = dg->pred_diag;
+ }
+ }
+ }
+ }
+}
+
+ */
+
+
+/**
+ * builds the upgma guide tree in the given diag_col
+ */
+void build_guide_tree(struct diag_col *dcol) {
+ int slen = dcol->seq_amount;
+ double weights[slen][slen];
+ struct gt_node *nodes[slen];
+ struct gt_node *gtn, *gtn1, *gtn2;
+ int max1=0, max2=1;
+
+ int i,j,k;
+
+ for(i=0;i<slen;i++) {
+ gtn = malloc(sizeof(struct gt_node ));
+ gtn->isLeaf = 1;
+ gtn->seq_num = malloc(sizeof(int)*1);
+ gtn->seq_num[0] = i;
+ gtn->seq_num_length = 1;
+ gtn->succ1 = NULL;
+ gtn->succ2 = NULL;
+ nodes[i] = gtn;
+ for(j=i+1;j<slen;j++) {
+ weights[i][j] = dcol->diag_matrix[slen*i+j]->total_weight;
+ weights[j][i] = weights[i][j];
+ if(weights[i][j] > weights[max1][max2]) {
+ max1 = i;
+ max2 = j;
+ }
+ }
+ }
+
+ for(k=0;k<(slen-1);k++) {
+ gtn1 = nodes[max1];
+ gtn2 = nodes[max2];
+ gtn = malloc(sizeof(struct gt_node ));
+ gtn->isLeaf = 0;
+ gtn->seq_num_length = gtn1->seq_num_length + gtn2->seq_num_length;
+ gtn->seq_num = malloc(sizeof(int)*gtn->seq_num_length);
+
+ for(i=0;i<gtn1->seq_num_length;i++) {
+ gtn->seq_num[i] = gtn1->seq_num[i];
+ }
+ for(i=0;i<gtn2->seq_num_length;i++) {
+ gtn->seq_num[gtn1->seq_num_length+i] = gtn2->seq_num[i];
+ }
+
+ gtn->succ1 = gtn1;
+ gtn->succ2 = gtn2;
+ nodes[max1] = gtn;
+ nodes[max2] = NULL;
+ for(i=0;i<slen;i++) {
+ if( (i!=max1) && (i!=max2)) {
+ weights[i][max1] = 0.1*0.5*(weights[i][max1]+weights[i][max2]) + 0.9*
+ ( (weights[i][max1] > weights[i][max2]) ? weights[i][max1] : weights[i][max2]);
+ //weights[i][max1] = 1.0*(weights[i][max1]+weights[i][max2]) + 0.0* ( (weights[i][max1] > weights[i][max2]) ? weights[i][max1] : weights[i][max2]);
+ weights[max1][i] = weights[i][max1];
+ }
+ }
+ max1 = -1;
+ max2 = -1;
+ for(i=0;i<slen;i++) {
+ for(j=i+1;j<slen;j++) {
+ if( (nodes[i]!=NULL) && (nodes[j]!=NULL)) {
+ if( (max1<0) || (weights[max1][max2]< weights[i][j])) {
+ max1=i;
+ max2=j;
+ }
+ }
+ }
+ }
+ }
+
+ dcol->gt_root = nodes[0];
+ /*
+ printf(" root %i\n", nodes[0]);
+ printf(" left1 %i\n", nodes[0]->succ1->succ1->seq_num);
+ printf(" left2 %i\n", nodes[0]->succ1->succ2->seq_num);
+ printf(" right %i\n", nodes[0]->succ2->seq_num);
+ */
+}
+
+
+/**
+ * Finds all diags of each pair of sequences in in_seq_col by using
+ * the function above
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+struct diag_col *find_all_diags(struct scr_matrix *smatrix,
+ struct prob_dist *pdist,
+ struct seq_col *in_seq_col, struct alignment *algn, int round) {
+ unsigned int s1, s2, rs2, sl = in_seq_col->length, sp, ap;
+ struct diag_col *all_diags = create_diag_col(sl);
+ struct simple_diag_col *sdcol;
+
+ unsigned int diag_amount = 0;
+ struct diag *dg;
+
+ char hasAli = (round >1);//(algn!=NULL);
+
+ long double **tmp_dist = NULL;
+ if(!hasAli) tmp_dist = create_tmp_pdist(pdist);
+
+ int s2max = sl;
+ int s2width =(int) sqrt(sl);
+
+ double total=0.0;
+ //double imp[sl];
+ // for(s1=0;s1<sl;s1++) {
+ // imp[s1] = 0.0;
+ //}
+ double totala[sl];
+ memset(totala,0,sizeof(double)*sl);
+ for(s1=0;s1<sl;s1++) {
+ if(para->FAST_PAIRWISE_ALIGNMENT && s2width+1<sl) {
+ s2max = s1+s2width+1;
+ //printf("%i %i\n",s1, s2max);
+ }
+ //printf("before enter %i\n", s1);
+ for(s2=s1+1;s2<s2max;s2++) {
+ rs2 = s2 % sl;
+ if(!hasAli) {
+ fill_tmp_pdist(pdist,tmp_dist,in_seq_col->seqs[s1].length,in_seq_col->seqs[rs2].length );
+ }
+ if(para->DEBUG>5) printf("%i %i\n", s1,s2);
+ //time1 = clock();
+ //sdcol=find_diags_dyn(smatrix, pdist, &in_seq_col->seqs[s1],
+ // &in_seq_col->seqs[s2],algn,tmp_dist);
+
+ /*
+ doAlign = 1;
+ if(hasAli) {
+ if(algn->redo_seqs[s1*sl+s2]==0)
+ doAlign = 0;
+ }
+
+ if(doAlign) {
+ */
+ if(in_seq_col->seqs[s1].length > 0 && in_seq_col->seqs[s2].length > 0) {
+ //if(para->DEBUG>1) printf(" %i %i %i\n", s1, rs2,sl-1);
+ // printf("find diags %i %i\n",s1,s2);
+ sdcol=find_diags_dialign(smatrix, pdist, &in_seq_col->seqs[s1],
+ &in_seq_col->seqs[rs2],algn,tmp_dist, round);
+ // imp[s1] += sdcol->total_weight;
+ //imp[s2] += sdcol->total_weight;
+ total += sdcol->total_weight;
+ //totala[s1] +=sdcol->total_weight;
+ //totala[s2] +=sdcol->total_weight;
+ //printf(" num of diags:%i\n ", sdcol->length);
+ /*
+ } else {
+ sdcol = calloc(1, sizeof(struct simple_diag_col));
+ sdcol->length = 0;
+ }
+ */
+ //printf("%i %i %f\n", s1,s2, (clock()-time1)/CLOCKS_PER_SEC);
+
+ all_diags->diag_matrix[s1+sl*rs2] = sdcol;
+ all_diags->diag_matrix[rs2+sl*s1] = sdcol;
+ diag_amount += sdcol->length;
+ }
+ }
+ }
+ if(!hasAli) free_tmp_pdist(tmp_dist, pdist->max_dlen);
+ all_diags->diags= calloc(diag_amount, sizeof(struct diag*));
+ if(all_diags->diags==NULL) error("find_all_diags(): (1) Out of memory !");
+
+ ap=0;
+ for(s1=0;s1<sl;s1++) {
+ for(s2=s1+1;s2<sl;s2++) {
+ sdcol=all_diags->diag_matrix[s1+sl*s2];
+ if(sdcol!=NULL) {
+ for(sp=0;sp<sdcol->length;sp++) {
+ // if(hasAli || (sdcol->data[sp]->weight >0.01*(sdcol->total_weight/sdcol->length))) {
+ sdcol->data[sp]->pred_diag = NULL;
+ all_diags->diags[ap]=sdcol->data[sp];
+ ap++;
+ //} else {
+ // free(sdcol->data[sp]);
+ //diag_amount--;
+ // }
+ }
+ }
+ }
+ }
+
+ all_diags->seq_amount = sl;
+
+ for(s1=0;s1<sl;s1++) {
+ for(s2=s1+1;s2<sl;s2++) {
+ sdcol=all_diags->diag_matrix[sl*s1+s2];
+ if(sdcol!=NULL) {
+ sdcol->weight_fac =pow(sdcol->total_weight/total,2.0);
+ for(sp=0;sp<sdcol->length;sp++) {
+ dg = sdcol->data[sp];
+ // if(hasAli) print_diag(dg);
+ dg->weight_fac = sdcol->weight_fac;
+ // dg->ov_weight = sdcol->total_weight;
+ /*
+ if(1 || !hasAli) {
+ dg->weight_fac = sdcol->total_weight*totala[s1]/(sl-1)*sdcol->total_weight*totala[s2]/(sl-1);
+ }
+ */
+ //dg->weight_fac =pow(sdcol->total_weight*(sl-1),2.0)/(totala[s1]*totala[s2]);
+
+ if(!hasAli) {
+ if(para->DO_OVERLAP) {
+ //printf(" do overlap\n");
+ //dg->weight_fac = 1.0;
+ calc_ov_weight(dg,all_diags, smatrix,pdist);
+ }
+ dg->total_weight = (dg->weight);//+dg->ov_weight);// *dg->weight_fac;
+ } else {
+ // changed in TX 1.0.0
+ if(para->FAST_MODE) dg->weight_fac = 1.0;
+ dg->total_weight = (dg->weight);//+dg->ov_weight);// *dg->weight_fac;
+ }
+ //if(sp==sdcol->length-1) sdcol->total_weight *= dg->weight_fac;
+ }
+ }
+ }
+ }
+
+ all_diags->diag_amount = diag_amount;
+
+ if(! hasAli) build_guide_tree(all_diags);
+ return all_diags;
+}
+
+
+
+/**
+ * Finds all diags of each pair of sequences in in_seq_col by using
+ * the function above
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+struct diag_col *old_find_all_diags(struct scr_matrix *smatrix,
+ struct prob_dist *pdist,
+ struct seq_col *in_seq_col,
+ struct alignment *algn,
+ int round ) {
+ unsigned int s1, s2, rs2, sl = in_seq_col->length, sp, ap;
+ struct diag_col *all_diags = create_diag_col(sl);
+ struct simple_diag_col *sdcol;
+
+ unsigned int diag_amount = 0;
+ struct diag *dg;
+
+ char hasAli = (round >1);//(algn!=NULL);
+
+ long double **tmp_dist = NULL;
+ if(!hasAli) tmp_dist = create_tmp_pdist(pdist);
+
+ int s2max = sl;
+ int s2width =(int) sqrt(sl);
+
+ double total=0.0;
+ //double imp[sl];
+ // for(s1=0;s1<sl;s1++) {
+ // imp[s1] = 0.0;
+ //}
+ //double totala[sl];
+ //memset(totala,0,sizeof(double)*sl);
+ for(s1=0;s1<sl;s1++) {
+ if(para->FAST_PAIRWISE_ALIGNMENT && s2width+1<sl) {
+ s2max = s1+s2width+1;
+ //printf("%i %i\n",s1, s2max);
+ }
+ //printf("before enter %i\n", s1);
+ for(s2=s1+1;s2<s2max;s2++) {
+ rs2 = s2 % sl;
+ if(!hasAli) {
+ fill_tmp_pdist(pdist,tmp_dist,in_seq_col->seqs[s1].length,in_seq_col->seqs[rs2].length );
+ }
+ if(para->DEBUG>5) printf("%i %i\n", s1,s2);
+ //time1 = clock();
+ //sdcol=find_diags_dyn(smatrix, pdist, &in_seq_col->seqs[s1],
+ // &in_seq_col->seqs[s2],algn,tmp_dist);
+
+ /*
+ doAlign = 1;
+ if(hasAli) {
+ if(algn->redo_seqs[s1*sl+s2]==0)
+ doAlign = 0;
+ }
+
+ if(doAlign) {
+ */
+ if(in_seq_col->seqs[s1].length > 0 && in_seq_col->seqs[s2].length > 0) {
+ //if(para->DEBUG>1) printf(" %i %i %i\n", s1, rs2,sl-1);
+ // printf("find diags %i %i\n",s1,s2);
+ sdcol=find_diags_dialign(smatrix, pdist, &in_seq_col->seqs[s1],
+ &in_seq_col->seqs[rs2],algn,tmp_dist, round);
+ // imp[s1] += sdcol->total_weight;
+ //imp[s2] += sdcol->total_weight;
+ total += sdcol->total_weight;
+ //totala[s1] +=sdcol->total_weight;
+ //totala[s2] +=sdcol->total_weight;
+ //printf(" num of diags:%i\n ", sdcol->length);
+ /*
+ } else {
+ sdcol = calloc(1, sizeof(struct simple_diag_col));
+ sdcol->length = 0;
+ }
+ */
+ //printf("%i %i %f\n", s1,s2, (clock()-time1)/CLOCKS_PER_SEC);
+
+ all_diags->diag_matrix[s1+sl*rs2] = sdcol;
+ all_diags->diag_matrix[rs2+sl*s1] = sdcol;
+ diag_amount += sdcol->length;
+ }
+ }
+ }
+
+
+ // new: call of split function
+ //printf("before split\n");
+ /*
+ if(! hasAli) {
+ diag_amount = 0;
+ split_diags(in_seq_col, all_diags);
+ //total=0.0;
+ for(s1=0;s1<sl;s1++) {
+ for(s2=s1+1;s2<sl;s2++) {
+ sdcol=all_diags->diag_matrix[s1+sl*s2];
+ if(sdcol!=NULL) {
+ //sdcol->total_weight = 0.0;
+ for(sp=0;sp<sdcol->length;sp++) {
+ dg = sdcol->data[sp];
+ real_calc_weight(dg, smatrix, pdist, 0, NULL,algn);
+ //sdcol->total_weight += dg->weight;
+ //total += dg->weight;
+ }
+ diag_amount +=sdcol->length;
+ }
+ }
+ }
+ }
+ */
+ //all_diags->diag_amount = diag_amount;
+ // printf("after split\n");
+ //double max = 0.0;
+
+
+ all_diags->diags= calloc(diag_amount, sizeof(struct diag*));
+ if(all_diags->diags==NULL) error("find_all_diags(): (1) Out of memory !");
+
+ double sdtotal;
+
+ ap=0;
+ for(s1=0;s1<sl;s1++) {
+ for(s2=s1+1;s2<sl;s2++) {
+ sdcol=all_diags->diag_matrix[s1+sl*s2];
+ if(sdcol!=NULL) {
+ for(sp=0;sp<sdcol->length;sp++) {
+ // if(hasAli || (sdcol->data[sp]->weight >0.01*(sdcol->total_weight/sdcol->length))) {
+ all_diags->diags[ap]=sdcol->data[sp];
+ ap++;
+ //} else {
+ // free(sdcol->data[sp]);
+ //diag_amount--;
+ // }
+ }
+ }
+ }
+ }
+
+ all_diags->seq_amount = sl;
+
+ all_diags->total_weight = 0.0;
+ for(s1=0;s1<sl;s1++) {
+ for(s2=s1+1;s2<sl;s2++) {
+ sdcol=all_diags->diag_matrix[sl*s1+s2];
+ sdcol->total_weight = 0.0;
+ sdtotal = 0.0;
+ if(sdcol!=NULL) {
+ for(sp=0;sp<sdcol->length;sp++) {
+ dg = sdcol->data[sp];
+ // if(hasAli) print_diag(dg);
+ dg->weight_fac = pow(sdcol->total_weight/total,2.0);
+ //dg->weight_fac = 1.0;
+
+ // dg->ov_weight = sdcol->total_weight;
+ /*
+ if(1 || !hasAli) {
+ dg->weight_fac = sdcol->total_weight*totala[s1]/(sl-1)*sdcol->total_weight*totala[s2]/(sl-1);
+ }
+ */
+ // dg->weight_fac =pow(sdcol->total_weight*(sl-1),2.0)/(totala[s1]*totala[s2]);
+
+ if(!hasAli) {
+ if(para->DO_OVERLAP) {
+ //dg->weight_fac = 1.0;
+ //error("calc ov\n");
+ calc_ov_weight(dg,all_diags, smatrix,pdist);
+ }
+ //dg->total_weight = (dg->weight+dg->ov_weight) *dg->weight_fac;
+ } else {
+ dg->weight_fac = 1.0;
+ }
+ dg->total_weight = (dg->weight+dg->ov_weight);//*dg->weight_fac;
+ //if(dg->total_weight > max) max = dg->total_weight;
+ //dg->weight = dg->score;
+ // print_diag(dg);
+ sdtotal += dg->weight;
+ all_diags->total_weight += dg->total_weight;
+ }
+ sdcol->total_weight = sdtotal;
+ }
+ }
+ }
+
+ all_diags->average_weight = all_diags->total_weight / all_diags->diag_amount;
+ //printf(" max %f\n", max);
+ if(!hasAli) free_tmp_pdist(tmp_dist, pdist->max_dlen);
+ all_diags->diag_amount = diag_amount;
+
+ if(! hasAli) build_guide_tree(all_diags);
+ return all_diags;
+}
diff --git a/dialign/io.c b/dialign/io.c
new file mode 100644
index 0000000..24e4f92
--- /dev/null
+++ b/dialign/io.c
@@ -0,0 +1,1158 @@
+/**
+ *
+ * io.c: IO operations, e.g. read input files, console output etc.
+ *
+ * A.R.Subramanian
+ */
+
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "parameters.h"
+#include "struct.h"
+#include "translate.h"
+#include "io.h"
+
+
+// alig.c
+extern struct algn_pos *find_eqc(struct algn_pos **ap, int seqnum, int pos);
+extern void prepare_alignment(struct alignment *algn);
+
+
+extern struct diag* create_diag(int n1, struct seq* sq1, unsigned int sp1,
+ int n2, struct seq* sq2, unsigned int sp2,
+ int dlength);
+
+extern int errno;
+
+
+/**
+ * print version
+ */
+void version() {
+
+ printf(" This is DIALIGN-TX Version %s - A Multiple Sequence alignment program.\n",para->VERSION );
+ printf(" Author: Amarendran R. Subramanian, 2004-2008 \n");
+ printf(" subraman at informatik.uni-tuebingen.de\n\n");
+ printf(" \n");
+ printf(" Research work using DIALIGN-TX should cite:\n\n");
+ printf(" DIALIGN-TX: improvement of the segment-based approach for multiple\n");
+ printf(" sequence alignment by combining greedy and progressive alignment strategies\n");
+ printf(" Amarendran R. Subramanian, Michael Kaufmann, Burkhard Morgenstern,\n");
+ printf(" Algorithms for Molecular Biology 3:6, 2008\n\n");
+ printf(" DIALIGN-T: An improved algorithm for segment-based multiple sequence alignment\n");
+ printf(" Amarendran R. Subramanian, Jan Weyer-Menkhoff, Michael Kaufmann,\n");
+ printf(" Burkhard Morgenstern, BMC Bioinformatics 6:66, 2005\n");
+ // printf(" Special Thanks to:\n");
+ //printf(" Burkhard Morgenstern\n");
+ //printf(" Michael Kaufmann\n");
+ //printf(" David Mathog\n");
+ //printf(" Numereous DIALIGN-T/X Users\n");
+}
+
+/**
+ * print error message and exit
+ */
+void error(char *message)
+{
+ printf("ERROR: %s\n", message);
+// if(errno) perror("perror()");
+ exit(1);
+}
+
+/**
+ * print error message and exit
+ */
+void merror(char *msg1, char *msg2)
+{
+ printf("ERROR: %s %s\n", msg1, msg2);
+// if(errno) perror("perror()");
+ exit(1);
+}
+
+/**
+ * strips off leading whitespace characters
+ */
+void strip_leading_ws( char *str ) {
+ int s,d;
+ for(s=d=0; str[s]==' ' || str[s]=='\t'; s++){}
+ for(;;s++,d++){
+ str[d]=str[s];
+ if( str[s] == '\0')break;
+ }
+}
+
+/**
+ * builds a pathname from a dir-name and a filename.
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+char* build_pathname(char *dir, char *file) {
+ int dirslen = strlen(dir);
+
+ char *pathn = calloc(dirslen+strlen(file)+2, sizeof(char));
+ if(pathn==NULL) error("build_pathname(): out of memory !");
+
+ strcpy(pathn, dir);
+ if(dirslen>0 && dir[dirslen-1]!='/') strcat(pathn, "/");
+ strcat(pathn, file);
+ // if(para->DEBUG)
+ // printf("DEBUG build_pathname(): Created filename: %s from dir=%s and file=%s\n", pathn, dir, file);
+
+ return pathn;
+}
+
+
+/**
+ * prints a sequence
+ */
+void print_seq(struct seq * aSeq) {
+ int row;
+ int slen = aSeq->length;
+ int maxrow = slen/para->PRINT_SEQ_LINE_LENGTH;
+ int row_residue = slen % para->PRINT_SEQ_LINE_LENGTH;
+
+ printf("Sequence: %s\nLength: %i\n", aSeq->name, slen);
+
+
+ char line[para->PRINT_SEQ_LINE_LENGTH+1];
+
+ for(row=0;row <=maxrow; row++) {
+ if(row<maxrow) {
+ strncpy(line, &(aSeq->data[row*para->PRINT_SEQ_LINE_LENGTH]),
+ para->PRINT_SEQ_LINE_LENGTH);
+ line[para->PRINT_SEQ_LINE_LENGTH]='\0';
+ } else{
+ if(row_residue==0) break;
+ strncpy(line, &(aSeq->data[row*para->PRINT_SEQ_LINE_LENGTH]),
+ row_residue);
+ line[row_residue]='\0';
+ }
+ printf("%s\n", line);
+ }
+
+}
+
+/**
+ * prints a diagional
+ */
+void print_diag(struct diag *aDiag) {
+ int row;
+ int slen = aDiag->length;
+ int maxrow = slen/para->PRINT_SEQ_LINE_LENGTH;
+ int row_residue = slen % para->PRINT_SEQ_LINE_LENGTH;
+
+ printf("Diag: %s\n %s\nLength: %i startpos1: %i startpos2: %i\n", aDiag->seq_p1.sq->name,
+ aDiag->seq_p2.sq->name, slen, aDiag->seq_p1.startpos,aDiag->seq_p2.startpos );
+
+ char *data1 =aDiag->seq_p1.sq->data;
+ char *data2 =aDiag->seq_p2.sq->data;
+ char *data;
+
+ int startpos1 = aDiag->seq_p1.startpos;
+ int startpos2 = aDiag->seq_p2.startpos;
+ int snum, startpos;
+
+ char line[para->PRINT_SEQ_LINE_LENGTH+1];
+
+ for(row=0;row <=maxrow; row++) {
+ for (snum=0;snum<2;snum++) {
+ startpos = (snum==0 ? startpos1 : startpos2);
+ data = (snum==0 ? data1 : data2);
+ if(row<maxrow) {
+ strncpy(line, &(data[startpos+row*para->PRINT_SEQ_LINE_LENGTH]),
+ para->PRINT_SEQ_LINE_LENGTH);
+ line[para->PRINT_SEQ_LINE_LENGTH]='\0';
+ } else{
+ if(row_residue==0) break;
+ strncpy(line, &(data[startpos+row*para->PRINT_SEQ_LINE_LENGTH]),
+ row_residue);
+ line[row_residue]='\0';
+ }
+ printf("%s\n", line);
+ }
+ if(row<maxrow) printf("\n");
+ }
+ printf("Score: %li Weight: %e \n", aDiag->score, aDiag->weight);
+}
+
+/**
+ * prints a score matrix
+ */
+void print_scr_matrix(struct scr_matrix *aSmatrix) {
+ int len =aSmatrix->length;
+ printf("Length: %i, maximal score: %i\n", len, aSmatrix->max_score);
+
+ int r, c;
+ for (r=-1; r<len;r++) {
+ for (c=0; c<=len;c++) {
+ if(r==-1) {
+ if(c<len) printf(" %c ", aSmatrix->num2char[c]);
+ } else if(c<len) {
+ printf("%3i ", aSmatrix->data[len*r+c]);
+ } else {
+ printf(" %c ", aSmatrix->num2char[r]);
+ }
+ }
+ printf("\n");
+ }
+}
+
+/**
+ * reads score matrix from the file
+ * indicated by filename parameter.
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+struct scr_matrix* read_scr_matrix(char *filename) {
+
+ if(para->DEBUG)
+ printf("DEBUG read_scr_matrix(): Processing input file: %s\n", filename);
+
+ int length = 0;
+
+ struct scr_matrix *smatrix = calloc(1, sizeof(struct scr_matrix));
+ int *char2num = (smatrix->char2num =calloc(256, sizeof(int)));
+ int *num2char = (smatrix->num2char =calloc(256, sizeof(int)));
+
+ if(smatrix==NULL || char2num==NULL) error("read_scr_matrix(): Out of memory !");
+
+ FILE *fp;
+
+ char rline[100];
+
+ if( (fp = fopen( filename , "r")) == NULL) {
+ merror("read_scr_matrix(): Cannot open input score matrix file", filename );
+ }
+
+ int sret;
+ char amino;
+ while( (sret=fscanf(fp, " %c ", &amino))!=EOF && sret>0) {
+ if(amino=='#') {
+ break;
+ } else {
+ num2char[length]=amino;
+ char2num[(int)amino]=length++;
+ }
+ }
+
+ num2char[length]='?';
+ char2num[(int)'?']=length++;
+ num2char[length]='#';
+ char2num[(int)'#']=length++;
+ num2char[length]='$';
+ char2num[(int)'$']=length++;
+ int additional=3;
+
+ if(sret==EOF) merror("read_scr_matrix(): Unexpected end of file ",filename);
+ if(length==0) merror("read_scr_matrix(): Invalid format of file ",filename);
+
+ smatrix->length = length;
+ int *data = (smatrix->data = calloc(length*length, sizeof(int)));
+ if(data==NULL) error("read_scr_matrix(): Out of memory when allocating data !");
+
+ // read the matrix entries
+ int r,c;
+ int is;//,tis;
+ long double frac = (long double)2.0/(long double)(length*length);
+ long double avg_score = 0.0;
+// generate Array from Matrix
+ for( r=0; r<length; r++) {
+ for( c=r; c<length; c++) {
+ // check whether it is a regular acid or a special character like '$',...
+ if( (r<length-additional) && (c<length-additional)) {
+ fscanf( fp, "%i", &is);
+ } else {
+ is = 0;
+ }
+ //tis = is;
+ is +=para->SCR_MATRIX_ADD;
+ if(smatrix->max_score<is) smatrix->max_score =is;
+ avg_score += (long double)is*frac;
+ data[length*r+c] = is;
+ // ensure symmetry of the weight matrix
+ data[length*c+r] = is;
+ }
+ fscanf(fp, "%s\n", rline);
+ }
+ fclose(fp);
+
+// Array is a symmetric Matrix
+/************************************ vvv Vorsicht !!! ***********/
+ smatrix->avg_sim_score = para->PROT_SIM_SCORE_THRESHOLD;
+ int ms = smatrix->max_score;
+
+ int *dist = (smatrix->dist=calloc(ms+1, sizeof(int)));
+ for(r=0;r<ms;r++) {
+ dist[r]=0;
+ }
+// count how often score x appears and save in dist[x]
+ for(r=0;r<length;r++) {
+ for(c=0;c<length;c++) {
+ if(num2char[r]!='X' && (num2char[r] >='A') && (num2char[r]<='Z'))
+ if(num2char[c]!='X' && (num2char[c] >='A') && (num2char[c]<='Z'))
+ dist[data[length*r+c]]++;
+ }
+ }
+ return smatrix;
+}
+
+/**
+ * reads the probability distribution for diagonal lengths from the file
+ * indicated by filename parameter.
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+struct prob_dist* read_diag_prob_dist(struct scr_matrix* smatrix, char *filename) {
+
+ if(para->DEBUG>1)
+ printf("DEBUG read_diag_prob_dist(): Processing input file: %s\n", filename);
+
+ int length = 0;
+
+ struct prob_dist *pdist = calloc(1, sizeof(struct prob_dist));
+ pdist->smatrix = smatrix;
+
+ if(pdist==NULL) error("read_diag_prob_dist(): Out of memory !");
+
+ FILE *fp;
+
+
+ if( (fp = fopen( filename , "r")) == NULL) {
+ merror("read_diag_prob_dist(): Cannot open input file", filename );
+ }
+
+ int sret;
+ sret=fscanf(fp, "%i\n", &length);
+ if(sret<=0)
+ merror("read_diag_prob_dist(): Invalid format in file", filename );
+
+ if(length==0) merror("read_scr_matrix(): Invalid format of file ",filename);
+
+ // fscanf(fp, "%s\n", rline);
+ // printf("rline:%s %i\n",rline, length);
+
+ // length=40;
+
+ pdist->max_dlen = length;
+ pdist->data = calloc(length+1, sizeof(long double *));
+ long double **dist =pdist->data;
+ if(dist==NULL) error("read_diag_prob_dist(): (1) Out of memory when allocating data !");
+
+ pdist->log_data = calloc(length+1, sizeof(double *));
+ double **log_dist =pdist->log_data;
+ if(log_dist==NULL) error("read_diag_prob_dist(): (1.1) Out of memory when allocating data !");
+
+
+ // read the entries
+ unsigned long i, scr, mxscr, sm_max_scr=smatrix->max_score;
+ unsigned long ti, tscr;
+ long double weight;
+ long size=0;
+
+ for( i=1; i<=length; i++) {
+ mxscr = i*sm_max_scr;
+ size += mxscr+1;
+ dist[i] = calloc(mxscr+1, sizeof(long double ));
+ log_dist[i] = calloc(mxscr+1, sizeof(long double ));
+ if(dist[i]==NULL) error("read_diag_prob_dist(): (3) Out of memory at iteration" );
+ for(scr=0;scr<=mxscr;scr++) {
+ dist[i][scr]=1.0;
+ }
+ for(scr=0;scr<=mxscr;scr++) {
+ dist[i][scr]=1.0;
+ fscanf( fp, "%li %li %Le\n", &ti,&tscr,&weight );
+ //if(i!=ti || tscr!=scr) merror("read_scr_matrix(): (4) Invalid format of file ",filename);
+ scr = tscr;
+ if(weight==0.0) weight = 1.0;
+ dist[i][scr]=weight;
+ log_dist[i][scr]=-log(weight);
+ if(para->DEBUG>5)printf("%li %li %Le\n", i, scr,dist[i][scr] );
+ }
+ }
+ if(para->DEBUG >1) printf("DEBUG: PROB DIST SIZE: %li bytes\n", size*sizeof(long double)+length*sizeof(long double *));
+
+ //pdist->avg_sim_score = 4;
+
+ return pdist;
+}
+
+
+/**
+ * reads sequence collection (seq_col) from the file
+ * indicated by filename parameter.
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+struct seq_col* read_fasta(char *filename) {
+
+ if(para->DEBUG)
+ printf("DEBUG read_seq_col(): Processing input file: %s\n", filename);
+
+ struct seq_col *scol = calloc(1, sizeof(struct seq_col));
+ struct seq* seqs = (scol->seqs = calloc(para->MAX_SEQ_AMOUNT, sizeof(struct seq)));
+ struct seq* seq;
+
+ if(scol==NULL || seqs==NULL) error("read_fasta(): Out of memory !");
+
+ FILE *fp;
+
+ char rline[para->MAX_FASTA_LINE_LENGTH];
+
+ if( (fp = fopen( filename , "r")) == NULL) {
+ merror("read_fasta(): Cannot open input FASTA file", filename );
+ }
+
+ scol->length = 0;
+ char *data; char ch;
+ unsigned int *slen;
+ int data_maxlen;
+ int c, rlen;
+ int valid =0;
+ char long_name=0;
+ int name_length;
+
+ while( fgets( rline , para->MAX_FASTA_LINE_LENGTH+1, fp ) != NULL ) {
+ // if(para->DEBUG)
+ // printf(rline);
+
+ strip_leading_ws(rline);
+
+ rlen = strlen(rline);
+
+ if(rline[0] == '>') {
+ valid = 1;
+ long_name=1;
+
+ seq = &(scol->seqs[scol->length]);
+ seq->max_seen = 0;
+ seq->name = calloc(rlen, sizeof(char));
+ seq->num = scol->length;
+ seq->orf_frame=0;
+ seq->crick_strand=0;
+ strncpy(seq->name, &(rline[1]), rlen-2);
+ slen = (unsigned int *) &(seq->length);
+
+ *slen = 0;
+
+ data_maxlen = 1024;
+ seq->data = (data = calloc(data_maxlen, sizeof(char)));
+ if(data==NULL) error("read_fasta(): Out of memory: seq->data alloc");
+
+ scol->length++;
+ if(rlen < para->MAX_FASTA_LINE_LENGTH)
+ {
+ long_name = 0; // if relen = then line is longer
+ }
+
+ }
+ else if(long_name)
+ {
+ long_name=1;
+ if(rlen < para->MAX_FASTA_LINE_LENGTH)
+ {
+ long_name = 0; // if relen = then line is longer
+ rline[rlen-1]='\0';
+ }
+
+
+ name_length = strlen(seq->name);
+ if(NULL == (seq->name = realloc(seq->name,rlen + name_length) ) )
+ {
+ error("read_fasta(): Out of memory: seq->data realloc");
+ }
+
+ strcat(seq->name, rline);
+
+ }
+ else {
+ for( c=0;c<rlen;c++) {
+ ch = rline[c];
+ if(ch=='?' || ch=='$' || ch=='#') ch='X';
+ if( (ch >= 65 && ch < 91) || (ch >= 97 && ch < 123)) {
+ if(! valid) merror("read_fasta(): File is not in FASTA format:", filename);
+
+ // realloc memory when necessary
+ if(*slen >= data_maxlen)
+ {
+ data_maxlen += 1024;
+ seq->data = (data = realloc(data, data_maxlen*sizeof(char)));
+ if(data==NULL) error("read_fasta(): Out of memory: seq->data alloc");
+ }
+ data[(*slen)++] = ((ch >= 97) ? toupper(ch) : ch);
+ }
+ }
+ }
+ }
+
+ int avg=0;
+ for(c=0;c<scol->length;c++) {
+ avg += scol->seqs[c].length;
+ }
+ scol->avg_length = avg/scol->length;
+
+ if(para->DEBUG)
+ printf("\n");
+
+ fclose(fp);
+ return scol;
+}
+
+/**
+ * reads the given anchor file and returns the accordingly created
+ * simple_diag_col structure pointer
+ */
+struct simple_diag_col* read_anchors(char *filename, struct seq_col* scol) {
+
+ if(para->DEBUG)
+ printf("DEBUG read_anchors(): Processing anchor file: %s\n", filename);
+
+ struct simple_diag_col *sdcol = malloc(sizeof(struct simple_diag_col));
+
+ FILE *fp;
+
+ if( (fp = fopen( filename , "r")) == NULL) {
+ merror("read_anchros(): Cannot open input anchor file", filename );
+ }
+
+ //fscanf( fp, "%li %li %Le\n", &ti,&tscr,&weight );
+
+ long int s1,s2,sp1,sp2,len;
+ double score;
+
+ int alloc_size = 64;
+ sdcol->data = malloc(sizeof (struct diag*)*alloc_size);
+ sdcol->length=0;
+
+ while( fscanf(fp,"%li %li %li %li %li %le\n",&s1,&s2,&sp1,&sp2,&len,&score ) == 6) {
+ if(sdcol->length >= alloc_size) {
+ alloc_size+=16;
+ sdcol->data = realloc(sdcol->data,sizeof (struct diag*)*alloc_size);
+ }
+ sdcol->data[sdcol->length]= create_diag(s1-1,&(scol->seqs[s1-1]),sp1-1,
+ s2-1,&(scol->seqs[s2-1]),sp2-1,len);
+ sdcol->data[sdcol->length]->anchor = 1;
+ sdcol->data[sdcol->length]->meetsThreshold = 1;
+ //printf(" total weight %e\n", score);
+ sdcol->data[sdcol->length++]->total_weight = score;
+ }
+
+ if(para->DEBUG) printf("DEBUG read_anchors(): Read %i anchors from file\n", sdcol->length);
+ fclose(fp);
+ return sdcol;
+}
+
+
+/**
+ * prints the given alignment in a simple way.
+ */
+void simple_print_alignment_default(struct alignment *algn) {
+ struct seq_col *scol = algn->scol;
+ unsigned int slen = scol->length;
+
+ unsigned int i,j,s,pos,max,tmax;
+ struct seq* sq;
+ struct algn_pos **ap = algn->algn;
+ int proc[slen];
+ // char proceed[slen];
+
+ for(i=0;i<slen;i++) {
+ proc[i]=0;
+ }
+
+
+ prepare_alignment(algn);
+ max = algn->max_pos;
+ struct algn_pos *ap1;
+
+ //
+ // print block
+ // WARNING! print_info reallocates memory, this loses the algn pointer
+ // since the new one is not stored when it is returned here, so it cannot
+ // be freed later. In the present version the leak is relatively minor and
+ // should not crash anything.
+ //
+ printf("%s",print_info(algn));
+
+ printf("\n ALIGNMENT OUTPUT:\n");
+ printf(" -----------------\n\n");
+ // printf("%i\n", max);
+ for(pos=0;pos<max;pos+=50) {
+ tmax = pos+50;
+ //printf("tmax: %i\n", tmax);
+
+ if(tmax>max) tmax = max;
+ for(s=0;s<slen;s++) {
+ sq = &scol->seqs[s];
+ for(j=pos;j<tmax;j++) {
+
+ if( (j%50)==0) {
+ printf("%12.12s%10i ", sq->name, proc[s]+1);
+ } else if( (j%10)==0) {
+ printf(" ");
+ }
+ if(proc[s]<sq->length) {
+ ap1 = find_eqc(ap,s,proc[s]);
+ if( (*ap1->eqcAlgnPos) < j) {
+ printf ("\nALARM %i %i %i %i\n", s,j, proc[s], *ap1->eqcAlgnPos);
+ }
+ // if(proc[0]==244 && s==0) printf("\nMOVE FORWARD: %i %i %i\n",j, *ap[0][244].eqcAlgnPos, *ap[1][241].eqcAlgnPos);
+
+ if( (*ap1->eqcAlgnPos) == j) {
+ if(ap1->state & para->STATE_ORPHANE) {
+ printf("%c", tolower(sq->data[proc[s]]));
+ } else {
+ printf("%c", toupper(sq->data[proc[s]]));
+ }
+ proc[s]++;
+ } else {
+ printf("-");
+ //printf("%i",*ap[s][proc[s]].maxpos);
+ }
+ } else {
+ printf("-");
+ //printf("%i",*ap[s][proc[s]].maxpos);
+ // printf("\n%i %i %i\n", s, j,proc[s]);
+ }
+ }
+ printf("\n");
+ }
+ printf("\n");
+ printf("\n");
+ }
+}
+
+void simple_print_alignment_dna_retranslate(struct alignment *algn)
+{
+ char *tmp = "000";
+ struct seq_col *scol = algn->scol;
+ unsigned int slen = scol->length;
+
+ unsigned int i,j,s,pos,max,tmax;
+ struct seq* sq;
+ struct algn_pos **ap = algn->algn;
+ int proc[slen];
+ // char proceed[slen];
+
+ for(i=0;i<slen;i++) {
+ proc[i]=0;
+ }
+
+ prepare_alignment(algn);
+ max = algn->max_pos;
+ struct algn_pos *ap1;
+
+ //
+ // print block
+ //
+ printf("%s",print_info(algn));
+ printf("\n ALIGNMENT OUTPUT:\n");
+ printf(" -----------------\n\n");
+ // printf("%i\n", max);
+ for(pos=0;pos<max;pos+=16) {
+ tmax = pos+16;
+ //printf("tmax: %i\n", tmax);
+
+ if(tmax>max) tmax = max;
+ for(s=0;s<slen;s++) {
+ sq = &scol->seqs[s];
+ for(j=pos;j<tmax;j++) {
+
+ if( (j%16)==0) {
+ printf("%12.12s%10i ", sq->name, ((proc[s])*3)+1);
+ } else if( (j%4)==0) {
+ printf(" ");
+ }
+ if(proc[s]<sq->length) {
+ ap1 = find_eqc(ap,s,proc[s]);
+ if( (*ap1->eqcAlgnPos) < j) {
+ printf ("\nALARM %i %i %i %i\n", s,j, proc[s], *ap1->eqcAlgnPos);
+ }
+ // if(proc[0]==244 && s==0) printf("\nMOVE FORWARD: %i %i %i\n",j, *ap[0][244].eqcAlgnPos, *ap[1][241].eqcAlgnPos);
+
+ if( (*ap1->eqcAlgnPos) == j) {
+
+ tmp = retranslate(sq->dna_num[proc[s]]);
+ if(ap1->state & para->STATE_ORPHANE) {
+ printf("%c%c%c", tolower(tmp[0]),tolower(tmp[1]), tolower(tmp[2]) );
+ } else {
+ printf("%c%c%c", toupper(tmp[0]), toupper(tmp[1]), toupper(tmp[2]) );
+ }
+ proc[s]++;
+ } else {
+ printf("---");
+ //printf("%i",*ap[s][proc[s]].maxpos);
+ }
+ } else {
+ printf("---");
+ //printf("%i",*ap[s][proc[s]].maxpos);
+ // printf("\n%i %i %i\n", s, j,proc[s]);
+ }
+ }
+ printf("\n");
+ }
+ printf("\n");
+ printf("\n");
+ }
+
+}
+
+
+/**
+ * prints the given alignment in fasta format
+ * to the given file.
+ */
+void fasta_print_alignment_default(struct alignment *algn, char *filename) {
+ struct seq_col *scol = algn->scol;
+ unsigned int slen = scol->length;
+
+ unsigned int j,s,proc, max;
+ struct seq* sq;
+ struct algn_pos **ap = algn->algn;
+
+ prepare_alignment(algn);
+ max = algn->max_pos;
+ struct algn_pos *ap1;
+
+ FILE *fp;
+ if( (fp = fopen( filename , "w")) == NULL) {
+ merror("fasta_print_alignment(): Cannot open file", filename );
+ }
+// fprintf(fp,"%s",print_info(algn));
+ max = algn->max_pos;
+ for(s=0;s<slen;s++) {
+ sq = &(scol->seqs[s]);
+ fprintf(fp, ">%s",sq->name);
+ proc = 0;
+ for(j=0;j<max;j++) {
+ if(proc <sq->length) {
+ if( (j%60)==0) fprintf(fp,"\n");
+ ap1 = find_eqc(ap,s,proc);
+ if(*ap1->eqcAlgnPos==j) {
+ if(ap1->state & para->STATE_ORPHANE) {
+ fprintf(fp, "%c", tolower(sq->data[proc]));
+ } else {
+ fprintf(fp, "%c", toupper(sq->data[proc]));
+ }
+ proc++;
+ } else {
+ fprintf(fp,"-");
+ }
+ } else {
+ if( (j%60)==0) fprintf(fp,"\n");
+ fprintf(fp,"-");
+ }
+ }
+ fprintf(fp,"\n");
+ }
+ fclose(fp);
+}
+
+void fasta_print_alignment_dna_retranslate(struct alignment *algn, char *filename)
+{
+ char *tmp = "000";
+ struct seq_col *scol = algn->scol;
+ unsigned int slen = scol->length;
+
+ unsigned int j,s,proc, max;
+ struct seq* sq;
+ struct algn_pos **ap = algn->algn;
+
+ prepare_alignment(algn);
+ max = algn->max_pos;
+ struct algn_pos *ap1;
+
+ FILE *fp;
+ if( (fp = fopen( filename , "w")) == NULL) {
+ merror("fasta_print_alignment(): Cannot open file", filename );
+ }
+// fprintf(fp,"%s",print_info(algn));
+ max = algn->max_pos;
+ for(s=0;s<slen;s++)
+ {
+ sq = &(scol->seqs[s]);
+ fprintf(fp, ">%s",sq->name);
+ proc = 0;
+ for(j=0;j<max;j++)
+ {
+ if(proc <sq->length)
+ {
+ if( (j%20)==0) fprintf(fp,"\n");
+ ap1 = find_eqc(ap,s,proc);
+ if(*ap1->eqcAlgnPos==j)
+ {
+ tmp = retranslate(sq->dna_num[proc]);
+// printf(fp,"%c,\n",sq->dna_num[proc]);
+ if(ap1->state & para->STATE_ORPHANE) {
+ fprintf(fp, "%c%c%c", tolower(tmp[0]),tolower(tmp[1]), tolower(tmp[2]));
+ }
+ else
+ {
+ fprintf(fp, "%c%c%c", toupper(tmp[0]), toupper(tmp[1]), toupper(tmp[2]));
+ }
+ proc++;
+ }
+ else
+ {
+ fprintf(fp,"---");
+ }
+ }
+ else
+ {
+ if( (j%20)==0) fprintf(fp,"\n");
+ fprintf(fp,"---");
+ }
+ }
+ fprintf(fp,"\n");
+ }
+ fclose(fp);
+}
+
+char* print_info(struct alignment *algn)
+{
+
+ int i;
+ char *output;
+ char *line, *line2;
+
+ if(NULL == ( output = (calloc(63,sizeof(char)))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ strcat(output, "\n");
+ for(i=0;i!=60; ++i)
+ {
+ strcat(output, "*");
+ }
+ strcat(output, "\n");
+ if (para->DNA_TRANSLATION) {
+ if(para->FIND_ORF){
+ if(!para->ORF_FRAME){
+// -L :
+ if(NULL == ( line = (calloc(62, sizeof(char)))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ if(NULL == ( output = (realloc(output,strlen(output)+15*61))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ line = "Multiple Sequence Alignment (with translation)";
+ line = output_line(line);
+ strcat(output, line);
+ line = "Input sequences in DNA";
+ line = output_line(line);
+ strcat(output, line);
+ if(!para->OUTPUT) line = "Alignment output in aminoacids";
+ else line = "Alignment output in DNA";
+ line = output_line(line);
+ strcat(output, line);
+ line = "Sequences translated into aminoacids";
+ line = output_line(line);
+ strcat(output, line);
+ line = "Only longest open reading frames aligned";
+ line = output_line(line);
+ strcat(output, line);
+ line = "Sequence lengths cut mod 3 = 0";
+ line = output_line(line);
+ strcat(output, line);
+ strcat(output,blank_line());
+ line = "reading frame 1 : 123 123 123 123 ...";
+ line = output_line_left(line);
+ strcat(output, line);
+ line = "reading frame 2 : X 123 123 123 123 ...";
+ line = output_line_left(line);
+ strcat(output, line);
+ line = "reading frame 3 : XX 123 123 123 123 ...";
+ line = output_line_left(line);
+ strcat(output, line);
+ line = "reading frame 4 : ... 321 321 321 321 XX";
+ line = output_line_left(line);
+ strcat(output, line);
+ line = "reading frame 5 : ... 321 321 321 321 X";
+ line = output_line_left(line);
+ strcat(output, line);
+ line = "reading frame 6 : ... 321 321 321 321";
+ line = output_line_left(line);
+ strcat(output, line);
+ strcat(output,blank_line());
+ strcat(output,blank_line());
+ for (i = 0; i != algn->scol->length; ++i)
+ {
+ int k;
+ char *tmp;
+ int tmp2;
+ tmp = " : reading frame = ";
+ line[0] = algn->scol->seqs[i].name[0];
+
+ for(k=1; k!=12 ; ++k)
+ {
+ line[k]=algn->scol->seqs[i].name[k];
+ tmp2=algn->scol->seqs[i].orf_frame+48;
+ }
+
+ line[12]='\0';
+ strcat(line, tmp);
+ line[strlen(line)-1]=tmp2;
+ line[strlen(line)]='\0';
+ if(NULL == ( output = (realloc(output,strlen(output)+62))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ line = output_line(line);
+ strcat(output, line);
+
+ }
+ free(line);
+ }
+
+ else{
+// -O :
+ if(NULL == ( line = (calloc(62, sizeof(char)))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ if(NULL == ( output = (realloc(output,strlen(output)+15*61))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ line = "Multiple Sequence Alignment (with translation)";
+ line = output_line(line);
+ strcat(output, line);
+ line = "Input sequences in DNA";
+ line = output_line(line);
+ strcat(output, line);
+ if(!para->OUTPUT) line = "Alignment output in aminoacids";
+ else line = "Alignment output in DNA";
+ line = output_line(line);
+ strcat(output, line);
+ line = "Sequences translated into aminoacids";
+ line = output_line(line);
+ strcat(output, line);
+ line = "reading frames found due to longest ORF";
+ line = output_line(line);
+ strcat(output, line);
+ line = "Sequence lengths cut mod 3 = 0";
+ line = output_line(line);
+ strcat(output, line);
+ strcat(output,blank_line());
+ line = "reading frame 1 : 123 123 123 123 ...";
+ line = output_line_left(line);
+ strcat(output, line);
+ line = "reading frame 2 : X 123 123 123 123 ...";
+ line = output_line_left(line);
+ strcat(output, line);
+ line = "reading frame 3 : XX 123 123 123 123 ...";
+ line = output_line_left(line);
+ strcat(output, line);
+ line = "reading frame 4 : ... 321 321 321 321 XX";
+ line = output_line_left(line);
+ strcat(output, line);
+ line = "reading frame 5 : ... 321 321 321 321 X";
+ line = output_line_left(line);
+ strcat(output, line);
+ line = "reading frame 6 : ... 321 321 321 321";
+ line = output_line_left(line);
+ strcat(output, line);
+ strcat(output,blank_line());
+ strcat(output,blank_line());
+ for (i = 0; i != algn->scol->length; ++i)
+ {
+ int k;
+ char *tmp;
+ int tmp2;
+ tmp = " : reading frame = ";
+ line[0] = algn->scol->seqs[i].name[0];
+
+ for(k=1; k!=12 ; ++k)
+ {
+ line[k]=algn->scol->seqs[i].name[k];
+ tmp2=algn->scol->seqs[i].orf_frame+48;
+ }
+
+ line[12]='\0';
+ strcat(line, tmp);
+ line[strlen(line)-1]=tmp2;
+ line[strlen(line)]='\0';
+ if(NULL == ( output = (realloc(output,strlen(output)+62))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ line = output_line(line);
+ strcat(output, line);
+
+ }
+ free(line);
+ }
+ }
+ else{
+// -T :
+ if(NULL == ( line = (calloc(62, sizeof(char)))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ if(NULL == ( output = (realloc(output,strlen(output)+5*61))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ line = "Multiple Sequence Alignment (with translation)";
+ line = output_line(line);
+ strcat(output, line);
+ line = "Input sequences in DNA";
+ line = output_line(line);
+ strcat(output, line);
+ if(!para->OUTPUT) line = "Alignment output in aminoacids";
+ else line = "Alignment output in DNA";
+ line = output_line(line);
+ strcat(output, line);
+ line = "Sequences translated into aminoacids";
+ line = output_line(line);
+ strcat(output, line);
+ line = "Sequence lengths cut mod 3 = 0";
+ line = output_line(line);
+ strcat(output, line);
+ free(line);
+ }
+ }
+ else{
+// -D :
+ if(NULL == ( line = (calloc(62, sizeof(char)))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ if(NULL == ( line2 = (calloc(62, sizeof(char)))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ if(NULL == ( output = (realloc(output,strlen(output)+3*61+1))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ (void) strcpy(line,"Multiple Sequence Alignment");
+ line = output_line(line);
+ strcat(output, line);
+ if(para->DNA_PARAMETERS) (void) strcpy(line2,"in DNA");
+ else (void) strcpy(line2,"in aminoacids");
+ sprintf(line,"Input sequences %s", line2);
+ line = output_line(line);
+ strcat(output, line);
+ if(para->DNA_PARAMETERS) (void) strcpy(line2,"in DNA");
+ else (void) strcpy(line2,"in aminoacids");
+ sprintf(line,"Alignment output %s", line2);
+ line = output_line(line);
+ strcat(output, line);
+ free(line);
+ free(line2);
+
+ }
+ if(NULL == ( output = (realloc(output,strlen(output)+63))))
+ {
+ error("print_info(): Out of memory !");
+ }
+
+ for(i=0;i!=60; ++i)
+ {
+ strcat(output, "*");
+ }
+ strcat(output, "\n\n");
+ return output;
+}
+
+
+/*SIDE EFFECT, releases original memory held by string */
+char* output_line(char *string)
+{
+ char *tmp;
+ if(NULL == ( tmp = (calloc(62, sizeof(char)))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ int x, i, y;
+ y = 0;
+ if (strlen(string) %2 == 0) y = 1;
+ x = (60 - strlen(string)) /2 ;
+ strcat(tmp, "*");
+ for (i = 0; i != x-y; ++i)
+ {
+ strcat(tmp, " ");
+ }
+ strcat(tmp,string);
+ for (i = 0; i != x-1; ++i)
+ {
+ strcat(tmp, " ");
+ }
+ strcat(tmp, "*\n");
+ free(string);
+ string=&(tmp[0]);
+ return string;
+}
+
+/*SIDE EFFECT, releases original memory held by string */
+char* output_line_left(char *string)
+{
+ char *tmp;
+ if(NULL == ( tmp = (calloc(62, sizeof(char)))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ int x, i, y;
+ y = 0;
+ x = (60 - strlen(string)-3) ;
+ strcat(tmp, "* ");
+ strcat(tmp,string);
+ for (i = 0; i != x; ++i)
+ {
+ strcat(tmp, " ");
+ }
+ strcat(tmp, "*\n");
+ free(string);
+ string=&(tmp[0]);
+ return string;
+}
+char* blank_line()
+{
+ int i;
+ char *string;
+
+ if(NULL == ( string = (calloc(62,sizeof(char)))))
+ {
+ error("print_info(): Out of memory !");
+ }
+ strcat(string, "*");
+ for (i = 0; i != 58; ++i)
+ {
+ strcat(string, " ");
+ }
+
+ strcat(string, "*\n");
+ return string;
+
+}
+
+void print_pdist_matrix(struct prob_dist *sdist, char *filename)
+{
+ int lh, scr, mxscr;
+ FILE *fp;
+ if( (fp = fopen( filename , "w")) == NULL)
+ {
+ merror("fasta_print_alignment(): Cannot open file", filename );
+ }
+ fprintf(fp,"%d\n",sdist->max_dlen);
+ for(lh=1; lh!=sdist->max_dlen+1; ++lh)
+ {
+ mxscr = lh * sdist->smatrix->max_score;
+ for(scr=0; scr!=mxscr+1; ++scr)
+ {
+ fprintf(fp,"%d %d %Le\n",lh,scr,sdist->data[lh][scr]);
+ }
+ }
+
+}
diff --git a/dialign/io.h b/dialign/io.h
new file mode 100644
index 0000000..93051f0
--- /dev/null
+++ b/dialign/io.h
@@ -0,0 +1,47 @@
+/**
+ *
+ * io.h:
+ *
+ * 2004-08-30 Dorothea Emig Volker Menrad
+ *
+ */
+
+ /************************************************/
+ /* */
+ /* structs */
+ /* */
+ /************************************************/
+
+
+ /************************************************/
+ /* */
+ /* global variable */
+ /* */
+ /************************************************/
+
+ /*********************************************/
+ /* */
+ /* functions from io.c */
+ /* */
+ /*********************************************/
+void version(); // prints version on stdout
+void print_scr_matrix(struct scr_matrix* aSmatrix);
+struct scr_matrix* read_scr_matrix(char *filename);
+void print_seq(struct seq* aSeq);
+struct seq_col* read_fasta(char *filename);
+void print_diag(struct diag* aDiag);
+struct prob_dist* read_diag_prob_dist(struct scr_matrix* smatrix, char *filename);
+void simple_print_alignment_default(struct alignment *algn);
+void simple_print_alignment_dna_retranslate(struct alignment *algn);
+//void simple_print_alignment_dna(struct alignment *algn);
+void fasta_print_alignment_default(struct alignment *algn, char *filename);
+void fasta_print_alignment_dna_retranslate(struct alignment *algn, char *filename);
+//void fasta_print_alignment_dna(struct alignment *algn, char *filename);
+char *print_info(struct alignment *align);
+char *output_line(char *string);
+char *output_line_left(char *string);
+char *blank_line();
+void print_pdist_matrix(struct prob_dist *sdist,char *filename);
+void error(char *message);
+void merror(char *msg1, char *msg2);
+char* build_pathname(char *dir, char *file);
diff --git a/dialign/museq.c b/dialign/museq.c
new file mode 100644
index 0000000..3f11ed6
--- /dev/null
+++ b/dialign/museq.c
@@ -0,0 +1,315 @@
+/**
+ *
+ * museq.c: Main program control
+
+ * Author: A.R.Subramanian
+ *
+ */
+
+
+/**
+ * TODO LIST:
+ * - option: multi diags as optional argument
+ */
+
+
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+
+#include "parameters.h"
+#include "struct.h"
+#include "translate.h"
+#include "orf.h"
+#include "io.h"
+
+/**
+ * external functions definitions
+ */
+
+// diag.c
+//extern struct seq_part* create_seq_part(int num, struct seq* aSeq,
+// unsigned int startpos);
+//extern struct diag* create_diag(struct seq_part* part1, struct seq_part* part2,
+// int dlength);
+//extern void calc_weight(struct diag* dg, struct scr_matrix* smatrix,
+// struct prob_dist *pdist);
+//extern struct diag_col *create_diag_col(int seq_amount);
+extern void free_diag_col(struct diag_col* dcol);
+extern struct diag_col *find_all_diags(struct scr_matrix *smatrix,
+ struct prob_dist *pdist,
+ struct seq_col *in_seq_col, struct alignment *algn, int round);
+
+
+// prob.c
+//extern struct seq* create_random_seq(struct scr_matrix *smatrix, int length);
+//extern double* approx_prob(struct scr_matrix *smatrix, struct prob_dist *sdist,
+// int diaglen, int seqlen);
+extern struct prob_dist* calc_score_dist(struct scr_matrix *smatrix, int mxdlen);
+
+// alig.c
+extern struct alignment* create_empty_alignment(struct seq_col *scol);
+//extern char adapt_diag(struct alignment *algn, struct scr_matrix *smatrix, struct diag* dg);
+extern int simple_aligner(struct seq_col *scol, struct diag_col *dcol,
+ struct scr_matrix* smatrix,
+ struct prob_dist *pdist,
+ struct alignment *algn, int round);
+
+
+
+extern struct simple_diag_col* read_anchors(char *filename, struct seq_col* scol);
+
+extern struct alignment* guided_aligner(struct alignment *palgn,
+ struct seq_col *scol, struct diag_col *dcol,
+ struct scr_matrix* smatrix,
+ struct prob_dist *pdist, struct gt_node *gtn,
+ int round);
+
+
+/**
+ * main program routine
+ */
+int main(int argc, char **argv)
+{
+ parameters(argc, argv);
+ version();
+
+ // read similarity matrix
+ char *smatrixfile = (char *)build_pathname(para->conf_dir,para->SCR_MATRIX_FILE_NAME);
+ struct scr_matrix *smatrix = read_scr_matrix(smatrixfile);
+
+ // print the score matrix
+ if( para->DEBUG >5) {
+ print_scr_matrix(smatrix);
+
+ }
+
+ // read the probability distribution for diagonals
+ char *pdistfilename = (char *)build_pathname(para->conf_dir,para->DIAG_PROB_FILE_NAME);
+
+ int i;
+ struct seq_col *in_seq_col;
+ struct prob_dist *pdist;
+ if(!para->COMPUTE_PROB){
+ pdist = read_diag_prob_dist(smatrix, pdistfilename);
+
+
+ in_seq_col = read_fasta(para->in_file);
+
+ if(para->DNA_TRANSLATION){
+ if(para->FIND_ORF){
+ if(para->ORF_FRAME){
+ translate_sequence_collection_orf_frame(in_seq_col);
+ }
+ else {
+ in_seq_col = set_longest_orf(in_seq_col);
+ }
+ }
+ else{
+ translate_sequence_collection_default(in_seq_col);
+ }
+ }
+ }
+ // print read input sequences
+ if(para->DEBUG>5) {
+ int sc,scl = in_seq_col->length;
+ for(sc=0; sc < scl;sc++) {
+ print_seq(&(in_seq_col->seqs[sc]));
+ printf("\n");
+ }
+ }
+
+ // ----------------------------------------------------------------------
+ // probability table generation area
+ // ----------------------------------------------------------------------
+ if(para->COMPUTE_PROB)
+ {
+ char *prob_table_output_file = (char *)build_pathname(para->conf_dir,"prob_table");
+ struct prob_dist *sdist = calc_score_dist(smatrix, 100);
+ print_pdist_matrix(sdist, prob_table_output_file);
+ exit(0);
+ }
+
+
+ double tim = clock(),tim2;
+
+ // fast mode has higher threshold weights
+ if(para->FAST_MODE) {
+ para->PROT_SIM_SCORE_THRESHOLD += 0.25;
+ }
+
+ // ----------------------------------------------------------------------
+ // Consider Anchors
+ // ----------------------------------------------------------------------
+ struct simple_diag_col *anchors = NULL;
+ struct diag_col adcol;
+ struct alignment *algn= NULL;
+ if(! para->FAST_MODE) {
+ algn = create_empty_alignment(in_seq_col);
+ }
+ struct alignment *salgn = create_empty_alignment(in_seq_col);
+
+ if(para->DO_ANCHOR>0) {
+ anchors = read_anchors(para->ANCHOR_FILE_NAME, in_seq_col);
+
+ adcol.diags = anchors->data;
+ adcol.diag_amount = anchors->length;
+
+
+ simple_aligner(in_seq_col, &adcol,smatrix,pdist,salgn,1);
+ if(! para->FAST_MODE) simple_aligner(in_seq_col, &adcol,smatrix,pdist,algn,1);
+
+
+ if(anchors!=NULL) {
+ for(i=0;i<adcol.diag_amount;i++) {
+ free_diag(adcol.diags[i]);
+ }
+ free(adcol.diags);
+ free(anchors);
+ }
+ }
+
+ // ----------------------------------------------------------------------
+ // Compute pairwise diagonals
+ // ----------------------------------------------------------------------
+ //if(para->DNA_PARAMETERS && (para->SENS_MODE>0)) {
+ // para->DIAG_THRESHOLD_WEIGHT = -log(0.875);
+ //}
+
+ struct diag_col *all_diags = find_all_diags(smatrix, pdist, in_seq_col,salgn,1);
+ double duration = (clock()-tim)/CLOCKS_PER_SEC;
+ if(para->DEBUG >1) printf("Found %i diags in %f secs\n", all_diags->diag_amount, duration);
+ int diag_amount = all_diags->diag_amount;
+
+ // ----------------------------------------------------------------------
+ // Compute alignment
+ // ----------------------------------------------------------------------
+ tim2=clock();
+
+ if(! para->FAST_MODE) {
+ struct diag *cp_diags[all_diags->diag_amount];
+ for(i=0;i<diag_amount;i++) {
+ cp_diags[i] = malloc(sizeof (struct diag));
+ *(cp_diags[i]) = *(all_diags->diags[i]);
+ }
+ guided_aligner(algn, in_seq_col, all_diags,smatrix,pdist,all_diags->gt_root, 1);
+
+
+ for(i=0;i<diag_amount;i++) {
+ all_diags->diags[i] = cp_diags[i];
+ }
+ all_diags->diag_amount = diag_amount;
+ }
+ //struct alignment *algn = salgn;
+ simple_aligner(in_seq_col, all_diags,smatrix,pdist,salgn,1);
+ duration = (clock()-tim2)/CLOCKS_PER_SEC;
+
+ if(! para->FAST_MODE) {
+ if(para->DEBUG >1) printf("First alignment after %f secs. simple: %f guided: %f\n", duration, salgn->total_weight, algn->total_weight);
+ } else {
+ if(para->DEBUG >1) printf("First alignment after %f secs. simple: %f \n", duration, salgn->total_weight);
+ }
+ //if(para->DEBUG >1) printf("First alignment after %f secs. guided: %f\n", duration, algn->total_weight);
+
+ free_diag_col(all_diags);
+
+ para->DO_ANCHOR = 0; // anchors done
+
+ // round 2+
+ int round;
+ char newFound = 0;
+ int type;
+ //printf(" SENS %i\n", para->SENS_MODE);
+
+ // consider sensitivity level
+ if(! para->FAST_MODE) {
+ if(para->SENS_MODE==0) {
+ para->DIAG_THRESHOLD_WEIGHT = 0.0;
+ } else if(para->SENS_MODE==1) {
+ if(para->DNA_PARAMETERS)
+ para->DIAG_THRESHOLD_WEIGHT = -log(0.75);//-log(.875+0.125/2.0);
+ else
+ para->DIAG_THRESHOLD_WEIGHT = -log(0.75);
+ }else if(para->SENS_MODE==2) {
+ if(para->DNA_PARAMETERS)
+ para->DIAG_THRESHOLD_WEIGHT = -log(0.5);//-log(0.875);
+ else
+ para->DIAG_THRESHOLD_WEIGHT = -log(0.5);
+ }
+ }
+
+ int stype = (para->FAST_MODE ? 1 : 0);
+ for(type=stype;type<2;type++) {
+ for(round=2;round<=20;round++) {
+ //for(round=2;round<=1;round++) {
+ tim2=clock();
+ all_diags = find_all_diags(smatrix, pdist, in_seq_col,(type ? salgn : algn), round);
+ //all_diags = find_all_diags(smatrix, pdist, in_seq_col, algn);
+ duration = (clock()-tim2)/CLOCKS_PER_SEC;
+ if(para->DEBUG >1) printf("Found %i diags after %f secs\n", all_diags->diag_amount, duration);
+ if(all_diags->diag_amount ==0) {
+ free_diag_col(all_diags);
+ break;
+ } else {
+ // round 2 and further we use the simple aligner
+ newFound = simple_aligner(in_seq_col, all_diags,smatrix,pdist,(type ? salgn : algn),round);
+ //newFound = simple_aligner(in_seq_col, all_diags,smatrix,pdist,algn,round);
+ // newFound = complex_aligner(in_seq_col, all_diags,smatrix,pdist,algn,round);
+ free_diag_col(all_diags);
+ if(!newFound) break;
+ }
+ }
+ }
+ if(para->DEBUG >1)
+ printf("Alignment ready!\n");
+
+ if(! para->FAST_MODE) {
+ if(para->DEBUG >1) printf("Final alignment simple: %f guided: %f\n", salgn->total_weight, algn->total_weight);
+ } else {
+ if(para->DEBUG >1) printf("Final alignment simple: %f \n", salgn->total_weight);
+ }
+ //if(para->DEBUG >1) printf("Final alignment guided: %f\n", algn->total_weight);
+
+
+ if( ( para->FAST_MODE) || (salgn->total_weight > algn->total_weight)) {
+ if(! para->FAST_MODE) free_alignment(algn);
+ algn = salgn;
+ }
+
+ //algn = salgn;
+
+
+ if(para->out_file==NULL) {
+ if(para->OUTPUT){
+ if(para->DNA_TRANSLATION)
+ simple_print_alignment_dna_retranslate(algn);
+ else
+ simple_print_alignment_default(algn);
+ }
+ else{
+ simple_print_alignment_default(algn);
+ }
+ }else {
+ if(para->OUTPUT){
+ if(para->DNA_TRANSLATION) {
+ fasta_print_alignment_dna_retranslate(algn, para->out_file);
+ }
+ else {
+ fasta_print_alignment_default(algn, para->out_file);
+ }
+ }
+ else{
+ fasta_print_alignment_default(algn, para->out_file);
+ }
+ }
+ duration = (clock()-tim)/CLOCKS_PER_SEC;
+ printf("Total time: %f secs\n", duration);
+ printf("Total weight: %f \n", algn->total_weight);
+ exit(EXIT_SUCCESS);
+}
+
+
+
diff --git a/dialign/orf.c b/dialign/orf.c
new file mode 100644
index 0000000..2dd6971
--- /dev/null
+++ b/dialign/orf.c
@@ -0,0 +1,902 @@
+/**
+ *
+ * orf.c: find the longest Open Reading Frame
+ *
+ * 2004-08-24 Dorothea Emig Volker Menrad
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+
+#include "parameters.h"
+#include "struct.h"
+#include "translate.h"
+#include "orf.h"
+#include "io.h"
+
+struct seq_col* set_longest_orf(struct seq_col *in_seq_col)
+{
+ int i;
+
+ struct seq_col *ret_seq_col;
+ struct seq *seq, *input_seq;
+ if((ret_seq_col = calloc(1,sizeof(struct seq_col)))==NULL)
+ {
+ error("set_longest_orf(): Out of memory ");
+ }
+ if((ret_seq_col->seqs = calloc((in_seq_col->length),sizeof(struct seq)))==NULL)
+ {
+ error("set_longest_orf(): Out of memory ");
+ }
+
+ input_seq = &(in_seq_col->seqs[0]);
+ for(i=0; i!= in_seq_col->length; ++i)
+ {
+ seq = orf_finder(input_seq);
+ ++input_seq;
+ ret_seq_col->seqs[i].dna_num = seq->dna_num;
+ ret_seq_col->seqs[i].orf_frame = seq->orf_frame;
+ ret_seq_col->seqs[i].data = seq->data;
+ ret_seq_col->seqs[i].name = seq->name;
+ ret_seq_col->seqs[i].num = seq->num;
+ ret_seq_col->seqs[i].length = seq->length;
+ ++seq;
+
+ }
+ ret_seq_col->length=in_seq_col->length;
+
+ return ret_seq_col;
+}
+
+
+struct seq* orf_finder(struct seq *in_seq)
+{
+ char flag_no_start = 1;
+ struct seq *ret_seq;
+ struct orf **orfs;
+ int i, max_length, max_orf;
+ char a,b,c,d,e,f; // first three possible reading frames and last three
+ int help, j, x; // XXX........XXX
+ j = (in_seq->length)/3;
+ help = in_seq->length-1; // index of last element in sequence
+ a=0;b=0;c=0;d=0;e=0;f=0;
+
+
+ if((orfs = (calloc (12, sizeof(struct orf *)))) == NULL) // We need 12 because we look for the longest orf in every reading frame
+ // and save the longest for every reading frame = 6
+ // orf[0] && orf[1] for reading frame a
+ // orf[2] && orf[3] for reading frame b
+ // orf[4] && orf[5] for reading frame c
+ // orf[6] && orf[7] for reading frame d
+ // orf[8] && orf[9] for reading frame e
+ // orf[10] && orf[11] for reading frame f
+ {
+
+ error("orf_finder(): Out of memory !");
+ }
+
+ for (x = 0; x != 12; ++x)
+ {
+ if((orfs[x] = (calloc(1,sizeof(struct orf))))==NULL)
+ {
+ error("orf_finder(): Out of memory !");
+ }
+ if((orfs[x]->sequence = (calloc(j+1,sizeof(char))))==NULL)
+ {
+ error("orf_finder(2): Out of memory !");
+ }
+ if((orfs[x]->dna_num = (calloc(j+1,sizeof(char))))==NULL)
+ {
+ error("orf_finder(3): Out of memory !");
+ }
+
+ orfs[x]->finish = 0;
+ }
+
+ for (i = 0; i < (j*3)-3; ++i)
+ {
+/****************************************************************************************/
+ if (a == 1)
+ {
+ if(!(orfs[0]->finish))
+ {
+ if((in_seq->data[i] == 'T' && in_seq->data[i+1] == 'A' && in_seq->data[i+2] == 'A') ||
+ (in_seq->data[i] == 'U' && in_seq->data[i+1] == 'A' && in_seq->data[i+2] == 'A') ||
+ (in_seq->data[i] == 'T' && in_seq->data[i+1] == 'A' && in_seq->data[i+2] == 'G') ||
+ (in_seq->data[i] == 'U' && in_seq->data[i+1] == 'A' && in_seq->data[i+2] == 'G') ||
+ (in_seq->data[i] == 'T' && in_seq->data[i+1] == 'G' && in_seq->data[i+2] == 'A') ||
+ (in_seq->data[i] == 'U' && in_seq->data[i+1] == 'G' && in_seq->data[i+2] == 'A') ) //Stop-Codon then end orf
+ {
+ orfs[0]->finish = 1; // end orf
+ a=0; // wait for new ATG-Start-Codon
+ }
+ orfs[0]->sequence[(orfs[0]->length)] = translate(in_seq->data[i], in_seq->data[i+1], in_seq->data[i+2], &(orfs[0]->dna_num[(orfs[0]->length)]) ); // translate in aminoacid and safe in orf
+ ++orfs[0]->length;
+ }
+ else
+ {
+ if((in_seq->data[i] == 'T' && in_seq->data[i+1] == 'A' && in_seq->data[i+2] == 'A') ||
+ (in_seq->data[i] == 'U' && in_seq->data[i+1] == 'A' && in_seq->data[i+2] == 'A') ||
+ (in_seq->data[i] == 'T' && in_seq->data[i+1] == 'A' && in_seq->data[i+2] == 'G') ||
+ (in_seq->data[i] == 'U' && in_seq->data[i+1] == 'A' && in_seq->data[i+2] == 'G') ||
+ (in_seq->data[i] == 'T' && in_seq->data[i+1] == 'G' && in_seq->data[i+2] == 'A') ||
+ (in_seq->data[i] == 'U' && in_seq->data[i+1] == 'G' && in_seq->data[i+2] == 'A') )
+ {
+ orfs[1]->finish = 1;
+ a=0;
+ }
+ orfs[1]->sequence[(orfs[1]->length)] = translate(in_seq->data[i], in_seq->data[i+1], in_seq->data[i+2],&(orfs[1]->dna_num[(orfs[1]->length)]));
+ ++orfs[1]->length;
+ }
+ }
+
+/****************************************************************************************/
+
+ if (b == 1)
+ {
+ if(!(orfs[2]->finish))
+ {
+ if((in_seq->data[i+1] == 'T' && in_seq->data[i+2] == 'A' && in_seq->data[i+3] == 'A') ||
+ (in_seq->data[i+1] == 'U' && in_seq->data[i+2] == 'A' && in_seq->data[i+3] == 'A') ||
+ (in_seq->data[i+1] == 'T' && in_seq->data[i+2] == 'A' && in_seq->data[i+3] == 'G') ||
+ (in_seq->data[i+1] == 'U' && in_seq->data[i+2] == 'A' && in_seq->data[i+3] == 'G') ||
+ (in_seq->data[i+1] == 'T' && in_seq->data[i+2] == 'G' && in_seq->data[i+3] == 'A') ||
+ (in_seq->data[i+1] == 'U' && in_seq->data[i+2] == 'G' && in_seq->data[i+3] == 'A') ) //Stop-Codon then end orf
+ {
+ orfs[2]->finish = 1; // end orf
+ b=0; // wait for new ATG-Start-Codon
+ }
+ orfs[2]->sequence[(orfs[2]->length)] = translate(in_seq->data[i+1], in_seq->data[i+2], in_seq->data[i+3],&(orfs[2]->dna_num[(orfs[2]->length)]) ); // translate in aminoacid and safe in orf
+ ++orfs[2]->length;
+ }
+ else
+ {
+ if((in_seq->data[i+1] == 'T' && in_seq->data[i+2] == 'A' && in_seq->data[i+3] == 'A') ||
+ (in_seq->data[i+1] == 'U' && in_seq->data[i+2] == 'A' && in_seq->data[i+3] == 'A') ||
+ (in_seq->data[i+1] == 'T' && in_seq->data[i+2] == 'A' && in_seq->data[i+3] == 'G') ||
+ (in_seq->data[i+1] == 'U' && in_seq->data[i+2] == 'A' && in_seq->data[i+3] == 'G') ||
+ (in_seq->data[i+1] == 'T' && in_seq->data[i+2] == 'G' && in_seq->data[i+3] == 'A') ||
+ (in_seq->data[i+1] == 'U' && in_seq->data[i+2] == 'G' && in_seq->data[i+3] == 'A') )
+ {
+ orfs[3]->finish = 1;
+ b=0;
+ }
+ orfs[3]->sequence[(orfs[3]->length)] = translate(in_seq->data[i+1], in_seq->data[i+2], in_seq->data[i+3],&(orfs[3]->dna_num[(orfs[3]->length)]) );
+ ++orfs[3]->length;
+ }
+ }
+
+/****************************************************************************************/
+
+ if (c == 1)
+ {
+ if(!(orfs[4]->finish))
+
+ {
+ if((in_seq->data[i+2] == 'T' && in_seq->data[i+3] == 'A' && in_seq->data[i+4] == 'A') ||
+ (in_seq->data[i+2] == 'U' && in_seq->data[i+3] == 'A' && in_seq->data[i+4] == 'A') ||
+ (in_seq->data[i+2] == 'T' && in_seq->data[i+3] == 'A' && in_seq->data[i+4] == 'G') ||
+ (in_seq->data[i+2] == 'U' && in_seq->data[i+3] == 'A' && in_seq->data[i+4] == 'G') ||
+ (in_seq->data[i+2] == 'T' && in_seq->data[i+3] == 'G' && in_seq->data[i+4] == 'A') ||
+ (in_seq->data[i+2] == 'U' && in_seq->data[i+3] == 'G' && in_seq->data[i+4] == 'A') ) //Stop-Codon then end orf
+ {
+ orfs[4]->finish = 1; // end orf
+ c=0; // wait for new ATG-Start-Codon
+ }
+ orfs[4]->sequence[(orfs[4]->length)] = translate(in_seq->data[i+2], in_seq->data[i+3], in_seq->data[i+4],&(orfs[4]->dna_num[(orfs[4]->length)])); // translate in aminoacid and safe in orf
+ ++orfs[4]->length;
+ }
+ else
+ {
+ if((in_seq->data[i+2] == 'T' && in_seq->data[i+3] == 'A' && in_seq->data[i+4] == 'A') ||
+ (in_seq->data[i+2] == 'U' && in_seq->data[i+3] == 'A' && in_seq->data[i+4] == 'A') ||
+ (in_seq->data[i+2] == 'T' && in_seq->data[i+3] == 'A' && in_seq->data[i+4] == 'G') ||
+ (in_seq->data[i+2] == 'U' && in_seq->data[i+3] == 'A' && in_seq->data[i+4] == 'G') ||
+ (in_seq->data[i+2] == 'T' && in_seq->data[i+3] == 'G' && in_seq->data[i+4] == 'A') ||
+ (in_seq->data[i+2] == 'U' && in_seq->data[i+3] == 'G' && in_seq->data[i+4] == 'A') )
+ {
+ orfs[5]->finish = 1;
+ c=0;
+ }
+ orfs[5]->sequence[(orfs[5]->length)] = translate(in_seq->data[i+2], in_seq->data[i+3], in_seq->data[i+4],&(orfs[5]->dna_num[(orfs[5]->length)]) );
+ ++orfs[5]->length;
+ }
+ }
+
+/****************************************************************************************/
+/****************************************************************************************/
+
+ if (d == 1)
+ {
+ if(!(orfs[6]->finish))
+
+ /* Da Crick-Strand : TAA -> ATT
+ UAA -> AUU
+ TAG -> ATC
+ UAG -> AUC
+ TGA -> ACT
+ UGA -> ACU */
+
+ {
+ if((in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'T' && in_seq->data[help-(i+4)] == 'T') ||
+ (in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'U' && in_seq->data[help-(i+4)] == 'U') ||
+ (in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'T' && in_seq->data[help-(i+4)] == 'C') ||
+ (in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'U' && in_seq->data[help-(i+4)] == 'C') ||
+ (in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'C' && in_seq->data[help-(i+4)] == 'T') ||
+ (in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'C' && in_seq->data[help-(i+4)] == 'U') ) //Stop-Codon then end orf
+ {
+ orfs[6]->finish = 1; // end orf
+ d=0; // wait for new ATG-Start-Codon
+ }
+ orfs[6]->sequence[(orfs[6]->length)] = translate(inverse(in_seq->data[help-(i+2)]), inverse(in_seq->data[help-(i+3)]), inverse(in_seq->data[help-(i+4)]),&(orfs[6]->dna_num[(orfs[6]->length)]) ); // translate in aminoacid and safe in orf
+ ++orfs[6]->length;
+ }
+ else
+ {
+ if((in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'T' && in_seq->data[help-(i+4)] == 'T') ||
+ (in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'U' && in_seq->data[help-(i+4)] == 'U') ||
+ (in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'T' && in_seq->data[help-(i+4)] == 'C') ||
+ (in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'U' && in_seq->data[help-(i+4)] == 'C') ||
+ (in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'C' && in_seq->data[help-(i+4)] == 'T') ||
+ (in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'C' && in_seq->data[help-(i+4)] == 'U') )
+ {
+ orfs[7]->finish = 1;
+ d=0;
+ }
+ orfs[7]->sequence[(orfs[7]->length)] = translate(inverse(in_seq->data[help-(i+2)]), inverse(in_seq->data[help-(i+3)]), inverse(in_seq->data[help-(i+4)]),&(orfs[7]->dna_num[(orfs[7]->length)]) );
+ ++orfs[7]->length;
+ }
+ }
+
+/****************************************************************************************/
+
+ if (e == 1)
+ {
+ if(!(orfs[8]->finish))
+
+ {
+ if((in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'T' && in_seq->data[help-(i+3)] == 'T') ||
+ (in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'U' && in_seq->data[help-(i+3)] == 'U') ||
+ (in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'T' && in_seq->data[help-(i+3)] == 'C') ||
+ (in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'U' && in_seq->data[help-(i+3)] == 'C') ||
+ (in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'C' && in_seq->data[help-(i+3)] == 'T') ||
+ (in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'C' && in_seq->data[help-(i+3)] == 'U') ) //Stop-Codon then end orf
+ {
+ orfs[8]->finish = 1; // end orf
+ e=0; // wait for new ATG-Start-Codon
+ }
+ orfs[8]->sequence[(orfs[8]->length)] = translate(inverse(in_seq->data[help-(i+1)]), inverse(in_seq->data[help-(i+2)]), inverse(in_seq->data[help-(i+3)]),&(orfs[8]->dna_num[(orfs[8]->length)]) ); // translate in aminoacid and safe in orf
+ ++orfs[8]->length;
+ }
+ else
+ {
+ if((in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'T' && in_seq->data[help-(i+3)] == 'T') ||
+ (in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'U' && in_seq->data[help-(i+3)] == 'U') ||
+ (in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'T' && in_seq->data[help-(i+3)] == 'C') ||
+ (in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'U' && in_seq->data[help-(i+3)] == 'C') ||
+ (in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'C' && in_seq->data[help-(i+3)] == 'T') ||
+ (in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'C' && in_seq->data[help-(i+3)] == 'U') )
+ {
+ orfs[9]->finish = 1;
+ e=0;
+ }
+ orfs[9]->sequence[(orfs[9]->length)] = translate(inverse(in_seq->data[help-(i+1)]), inverse(in_seq->data[help-(i+2)]), inverse(in_seq->data[help-(i+3)]), &(orfs[9]->dna_num[(orfs[9]->length)]) );
+ ++orfs[9]->length;
+ }
+ }
+
+/****************************************************************************************/
+
+ if (f == 1)
+ {
+ if(!(orfs[10]->finish))
+
+ {
+ if((in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'T' && in_seq->data[help-(i+2)] == 'T') ||
+ (in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'U' && in_seq->data[help-(i+2)] == 'U') ||
+ (in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'T' && in_seq->data[help-(i+2)] == 'C') ||
+ (in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'U' && in_seq->data[help-(i+2)] == 'C') ||
+ (in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'C' && in_seq->data[help-(i+2)] == 'T') ||
+ (in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'C' && in_seq->data[help-(i+2)] == 'U') ) //Stop-Codon then end orf
+ {
+ orfs[10]->finish = 1; // end orf
+ f=0; // wait for new ATG-Start-Codon
+ }
+ orfs[10]->sequence[(orfs[10]->length)] = translate(inverse(in_seq->data[help-(i)]), inverse(in_seq->data[help-(i+1)]), inverse(in_seq->data[help-(i+2)]), &(orfs[10]->dna_num[(orfs[10]->length)])); // translate in aminoacid and safe in orf
+ ++orfs[10]->length;
+ }
+ else
+ {
+ if((in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'T' && in_seq->data[help-(i+2)] == 'T') ||
+ (in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'U' && in_seq->data[help-(i+2)] == 'T') ||
+ (in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'T' && in_seq->data[help-(i+2)] == 'C') ||
+ (in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'U' && in_seq->data[help-(i+2)] == 'C') ||
+ (in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'C' && in_seq->data[help-(i+2)] == 'T') ||
+ (in_seq->data[help-(i)] == 'A' && in_seq->data[help-(i+1)] == 'C' && in_seq->data[help-(i+2)] == 'U') )
+ {
+ orfs[11]->finish = 1;
+ f=0;
+ }
+ orfs[11]->sequence[(orfs[11]->length)] = translate(inverse(in_seq->data[help-(i)]), inverse(in_seq->data[help-(i+1)]), inverse(in_seq->data[help-(i+2)]), &(orfs[11]->dna_num[(orfs[11]->length)]));
+ ++orfs[11]->length;
+ }
+ }
+
+/****************************************************************************************/
+/****************************************************************************************/
+ if(((in_seq->data[i] == 'A' && in_seq->data[i+1] == 'T' && in_seq->data[i+2] == 'G') && (a==0)) ||
+ ( (in_seq->data[i] == 'A' && in_seq->data[i+1] == 'U' && in_seq->data[i+2] == 'G') && (a==0)))
+ {
+ a=1; // start found in first reading frame
+ flag_no_start=0;
+
+ if(!(orfs[0]->finish)) // orf not yet started in orfs[0]
+ {
+ orfs[0]->length=0;
+ orfs[0]->sequence[(orfs[0]->length)] = translate(in_seq->data[i],in_seq->data[i+1],in_seq->data[i+2], &(orfs[0]->dna_num[(orfs[0]->length)]) );
+ ++orfs[0]->length;
+ }
+
+ else if(!(orfs[1]->finish))// orf not yet started in orfs[1]
+ {
+ orfs[1]->length=0;
+ orfs[1]->sequence[(orfs[1]->length)] = translate(in_seq->data[i],in_seq->data[i+1],in_seq->data[i+2], &(orfs[1]->dna_num[(orfs[1]->length)]) );
+ ++orfs[1]->length;
+ }
+ else // orf finished in orfs[1] and orfs[0], so find the max and delete the min
+ {
+ if((orfs[0]->length) >= (orfs[1]->length)) // orfs[0] = Max
+ {
+ free(orfs[1]->sequence);
+ free(orfs[1]->dna_num);
+ free(orfs[1]);
+ if((orfs[1] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[1]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[1]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ orfs[1]->length=0; // new init
+ orfs[1]->finish = 0;
+ orfs[1]->sequence[(orfs[1]->length)] = translate(in_seq->data[i],in_seq->data[i+1],in_seq->data[i+2], &(orfs[1]->dna_num[(orfs[1]->length)]) );
+ ++orfs[1]->length;
+ }
+ else
+ {
+ free(orfs[0]->dna_num);
+ free(orfs[0]->sequence);
+ free(orfs[0]);
+ if((orfs[0] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[0]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[0]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ orfs[0]->length = 0; // new init
+ orfs[0]->finish = 0;
+ orfs[0]->sequence[(orfs[0]->length)] = translate(in_seq->data[i],in_seq->data[i+1],in_seq->data[i+2], &(orfs[0]->dna_num[(orfs[0]->length)]) );
+ ++orfs[0]->length;
+ }
+ }
+ }
+
+/****************************************************************************************/
+
+ if(((in_seq->data[i+1] == 'A' && in_seq->data[i+2] == 'T' && in_seq->data[i+3] == 'G') && (b==0)) ||
+ ( (in_seq->data[i+1] == 'A' && in_seq->data[i+2] == 'U' && in_seq->data[i+3] == 'G') && (b==0)))
+ {
+ b=1; // start found in second reading frame
+ flag_no_start=0;
+
+ if(!(orfs[2]->finish)) // orf not yet started in orfs[2]
+ {
+ orfs[2]->length=0;
+ orfs[2]->sequence[(orfs[2]->length)] = translate(in_seq->data[i+1],in_seq->data[i+2],in_seq->data[i+3], &(orfs[2]->dna_num[(orfs[2]->length)]) );
+ ++orfs[2]->length;
+ }
+
+ else if(!(orfs[3]->finish))// orf not yet started in orfs[3]
+ {
+ orfs[3]->length=0;
+ orfs[3]->sequence[(orfs[3]->length)] = translate(in_seq->data[i+1],in_seq->data[i+2],in_seq->data[i+3], &(orfs[3]->dna_num[(orfs[3]->length)]) );
+ ++orfs[3]->length;
+ }
+ else // orf finished in orfs[3] and orfs[2], so find the max and delete the min
+ {
+ if((orfs[2]->length) >= (orfs[3]->length)) // orfs[2] = Max
+ {
+ free(orfs[3]->dna_num);
+ free(orfs[3]->sequence);
+ free(orfs[3]);
+ if((orfs[3] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[3]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[3]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+
+ orfs[3]->length=0; // new init
+ orfs[3]->finish = 0;
+ orfs[3]->sequence[(orfs[3]->length)] = translate(in_seq->data[i+1],in_seq->data[i+2],in_seq->data[i+3], &(orfs[3]->dna_num[(orfs[3]->length)]) );
+ ++orfs[3]->length;
+ }
+ else
+ {
+ free(orfs[2]->dna_num);
+ free(orfs[2]->sequence);
+ free(orfs[2]);
+ if((orfs[2] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[2]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[2]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+
+ orfs[2]->length = 0; // new init
+ orfs[2]->finish = 0;
+ orfs[2]->sequence[(orfs[2]->length)] = translate(in_seq->data[i+1],in_seq->data[i+2],in_seq->data[i+3], &(orfs[2]->dna_num[(orfs[2]->length)]) );
+ ++orfs[2]->length;
+ }
+ }
+ }
+/****************************************************************************************/
+
+ if(((in_seq->data[i+2] == 'A' && in_seq->data[i+3] == 'T' && in_seq->data[i+4] == 'G') && (c==0)) ||
+ ( (in_seq->data[i+2] == 'A' && in_seq->data[i+3] == 'U' && in_seq->data[i+4] == 'G') && (c==0) ))
+ {
+ c=1; // start found in third reading frame
+ flag_no_start=0;
+
+ if(!(orfs[4]->finish)) // orf not yet started in orfs[4]
+ {
+ orfs[4]->length=0;
+ orfs[4]->sequence[(orfs[4]->length)] = translate(in_seq->data[i+2],in_seq->data[i+3],in_seq->data[i+4], &(orfs[4]->dna_num[(orfs[4]->length)]) );
+ ++orfs[4]->length;
+ }
+
+ else if(!(orfs[5]->finish))// orf not yet started in orfs[5]
+ {
+ orfs[5]->length=0;
+ orfs[5]->sequence[(orfs[5]->length)] = translate(in_seq->data[i+2],in_seq->data[i+3],in_seq->data[i+4], &(orfs[5]->dna_num[(orfs[5]->length)]) );
+ ++orfs[5]->length;
+ }
+ else // orf finished in orfs[5] and orfs[4], so find the max and delete the min
+ {
+ if((orfs[4]->length) >= (orfs[5]->length)) // orfs[4] = Max
+ {
+ free(orfs[5]->dna_num);
+ free(orfs[5]->sequence);
+ free(orfs[5]);
+ if((orfs[5] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[5]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[5]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ orfs[5]->length=0; // new init
+ orfs[5]->finish = 0;
+ orfs[5]->sequence[(orfs[5]->length)] = translate(in_seq->data[i+2],in_seq->data[i+3],in_seq->data[i+4], &(orfs[5]->dna_num[(orfs[5]->length)]) );
+ ++orfs[5]->length;
+ }
+ else
+ {
+ free(orfs[4]->dna_num);
+ free(orfs[4]->sequence);
+ free(orfs[4]);
+ if((orfs[4] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[4]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[4]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ orfs[4]->length = 0; // new init
+ orfs[4]->finish = 0;
+ orfs[4]->sequence[(orfs[4]->length)] = translate(in_seq->data[i+2],in_seq->data[i+3],in_seq->data[i+4], &(orfs[4]->dna_num[(orfs[4]->length)]) );
+ ++orfs[4]->length;
+ }
+ }
+ }
+
+/****************************************************************************************/
+/****************************************************************************************/
+
+
+ if(((in_seq->data[help-(i+2)] == 'T' && in_seq->data[help-(i+3)] == 'A' && in_seq->data[help-(i+4)] == 'C') && (d==0)) ||
+ ( (in_seq->data[help-(i+2)] == 'U' && in_seq->data[help-(i+3)] == 'A' && in_seq->data[help-(i+4)] == 'C') && (d==0) ))
+ {
+ d=1; // start found in last but two reading frame
+ flag_no_start=0;
+
+ if(!(orfs[6]->finish)) // orf not yet started in orfs[6]
+ {
+ orfs[6]->length=0;
+ orfs[6]->sequence[(orfs[6]->length)] = translate(in_seq->data[help-(i+2)],in_seq->data[help-(i+3)],in_seq->data[help-(i+4)], &(orfs[6]->dna_num[(orfs[6]->length)]) );
+ ++orfs[6]->length;
+ }
+
+ else if(!(orfs[7]->finish))// orf not yet started in orfs[7]
+ {
+ orfs[7]->length=0;
+ orfs[7]->sequence[(orfs[7]->length)] = translate(in_seq->data[help-(i+2)],in_seq->data[help-(i+3)],in_seq->data[help-(i+4)], &(orfs[7]->dna_num[(orfs[7]->length)]) );
+ ++orfs[7]->length;
+ }
+ else // orf finished in orfs[7] and orfs[6], so find the max and delete the min
+ {
+ if((orfs[6]->length) >= (orfs[7]->length)) // orfs[6] = Max
+ {
+ free(orfs[7]->dna_num);
+ free(orfs[7]->sequence);
+ free(orfs[7]);
+ if((orfs[7] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[7]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[7]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ orfs[7]->length=0; // new init
+ orfs[7]->finish = 0;
+ orfs[7]->sequence[(orfs[7]->length)] = translate(in_seq->data[help-(i+2)],in_seq->data[help-(i+3)],in_seq->data[help-(i+4)], &(orfs[7]->dna_num[(orfs[7]->length)]) );
+ ++orfs[7]->length;
+ }
+ else
+ {
+ free(orfs[6]->dna_num);
+ free(orfs[6]->sequence);
+ free(orfs[6]);
+ if((orfs[6] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[6]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[6]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ orfs[6]->length = 0; // new init
+ orfs[6]->finish = 0;
+ orfs[6]->sequence[(orfs[6]->length)] = translate(in_seq->data[help-(i+2)],in_seq->data[help-(i+3)],in_seq->data[help-(i+4)], &(orfs[6]->dna_num[(orfs[6]->length)]) );
+ ++orfs[6]->length;
+ }
+ }
+ }
+
+/****************************************************************************************/
+
+ if(((in_seq->data[help-(i+1)] == 'T' && in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'C') && (e==0)) ||
+ ( (in_seq->data[help-(i+1)] == 'U' && in_seq->data[help-(i+2)] == 'A' && in_seq->data[help-(i+3)] == 'C') && (e==0)))
+ {
+ e=1; // start found in last but one reading frame
+ flag_no_start=0;
+
+ if(!(orfs[8]->finish)) // orf not yet started in orfs[8]
+ {
+ orfs[8]->length=0;
+ orfs[8]->sequence[(orfs[8]->length)] = translate(in_seq->data[help-(i+1)],in_seq->data[help-(i+2)],in_seq->data[help-(i+3)], &(orfs[8]->dna_num[(orfs[8]->length)]) );
+ ++orfs[8]->length;
+ }
+
+ else if(!(orfs[9]->finish))// orf not yet started in orfs[9]
+ {
+ orfs[9]->length=0;
+ orfs[9]->sequence[(orfs[9]->length)] = translate(in_seq->data[help-(i+1)],in_seq->data[help-(i+2)],in_seq->data[help-(i+3)], &(orfs[9]->dna_num[(orfs[9]->length)]) );
+ ++orfs[9]->length;
+ }
+ else // orf finished in orfs[9] and orfs[8], so find the max and delete the min
+ {
+ if((orfs[8]->length) >= (orfs[9]->length)) // orfs[8] = Max
+ {
+ free(orfs[9]->dna_num);
+ free(orfs[9]->sequence);
+ free(orfs[9]);
+ if((orfs[9] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[9]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[9]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ orfs[9]->length=0; // new init
+ orfs[9]->finish = 0;
+ orfs[9]->sequence[(orfs[9]->length)] = translate(in_seq->data[help-(i+1)],in_seq->data[help-(i+2)],in_seq->data[help-(i+3)], &(orfs[9]->dna_num[(orfs[9]->length)]) );
+ ++orfs[9]->length;
+ }
+ else
+ {
+// printf(" im else also orf[0]<orf[1]\n"); // orfs[8] = Min
+ free(orfs[8]->dna_num);
+ free(orfs[8]->sequence);
+ free(orfs[8]);
+ if((orfs[8] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[8]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[8]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ orfs[8]->length = 0; // new init
+ orfs[8]->finish = 0;
+ orfs[8]->sequence[(orfs[8]->length)] = translate(in_seq->data[help-(i+1)],in_seq->data[help-(i+2)],in_seq->data[help-(i+3)], &(orfs[8]->dna_num[(orfs[8]->length)]) );
+ ++orfs[8]->length;
+ }
+ }
+ }
+
+/****************************************************************************************/
+
+ if(((in_seq->data[help-i] == 'T' && in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'C') && (f==0)) ||
+ ( (in_seq->data[help-i] == 'U' && in_seq->data[help-(i+1)] == 'A' && in_seq->data[help-(i+2)] == 'C') && (f==0)))
+ {
+ f=1; // start found in last reading frame
+ flag_no_start=0;
+
+ if(!(orfs[10]->finish)) // orf not yet started in orfs[10]
+ {
+ orfs[10]->length=0;
+ orfs[10]->sequence[(orfs[10]->length)] = translate(in_seq->data[help-(i)],in_seq->data[help-(i+1)],in_seq->data[help-(i+2)], &(orfs[10]->dna_num[(orfs[10]->length)]) );
+ ++orfs[10]->length;
+ }
+
+ else if(!(orfs[11]->finish))// orf not yet started in orfs[11]
+ {
+ orfs[11]->length=0;
+ orfs[11]->sequence[(orfs[11]->length)] = translate(in_seq->data[help-(i)],in_seq->data[help-(i+1)],in_seq->data[help-(i+2)], &(orfs[11]->dna_num[(orfs[11]->length)]) );
+ ++orfs[11]->length;
+ }
+ else // orf finished in orfs[11] and orfs[10], so find the max and delete the min
+ {
+ if((orfs[10]->length) >= (orfs[11]->length)) // orfs[10] = Max
+ {
+ free(orfs[11]->dna_num);
+ free(orfs[11]->sequence);
+ free(orfs[11]);
+ if((orfs[11] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[11]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[11]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ orfs[11]->length=0; // new init
+ orfs[11]->finish = 0;
+ orfs[11]->sequence[(orfs[11]->length)] = translate(in_seq->data[help-(i)],in_seq->data[help-(i+1)],in_seq->data[help-(i+2)], &(orfs[11]->dna_num[(orfs[11]->length)]) );
+ ++orfs[11]->length;
+ }
+ else
+ {
+ free(orfs[10]->dna_num);
+ free(orfs[10]->sequence);
+ free(orfs[10]);
+ if((orfs[10] = calloc(1, sizeof(struct orf))) == NULL) // free memory
+ error("orf_finder(): Out of memory!");
+ if((orfs[10]->sequence = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ if((orfs[10]->dna_num = calloc(j+1, sizeof(char))) == NULL)
+ error("orf_finder(): Out of memory!");
+ orfs[10]->length = 0; // new init
+ orfs[10]->finish = 0;
+ orfs[10]->sequence[(orfs[10]->length)] = translate(in_seq->data[help-(i)],in_seq->data[help-(i+1)],in_seq->data[help-(i+2)], &(orfs[10]->dna_num[(orfs[10]->length)]) );
+ ++orfs[10]->length;
+ }
+ }
+ }
+
+/****************************************************************************************/
+/****************************************************************************************/
+
+ i = i+2;
+ }
+ // if last codon in reading frame is no stop codon -> translate last codon if available
+ if (((help+1) % 3) == 0) // length = last index + 1 ;translate last codon for orf 1 and orf 6
+ {
+// a:
+ if (!orfs[0]->finish && orfs[0]->length) // open orf && already started before
+ {
+ orfs[0]->sequence[(orfs[0]->length)] = translate(in_seq->data[help-2], in_seq->data[help-1], in_seq->data[help], &(orfs[0]->dna_num[(orfs[0]->length)]));
+ ++orfs[0]->length;
+ }
+ else if (!orfs[1]->finish && orfs[1]->length)
+ {
+ orfs[1]->sequence[(orfs[1]->length)] = translate(in_seq->data[help-2], in_seq->data[help-1], in_seq->data[help], &(orfs[1]->dna_num[(orfs[1]->length)]));
+ ++orfs[1]->length;
+ }
+
+// f:
+ if (!(orfs[10]->finish) && orfs[10]->length )
+ {
+ orfs[10]->sequence[(orfs[10]->length)] = translate(inverse(in_seq->data[2]), inverse(in_seq->data[1]), inverse(in_seq->data[0]), &(orfs[10]->dna_num[(orfs[10]->length)]) );
+ ++orfs[10]->length;
+ }
+ else if (!orfs[11]->finish && orfs[11]->length )
+ {
+ orfs[11]->sequence[(orfs[11]->length)] = translate(inverse(in_seq->data[2]), inverse(in_seq->data[1]), inverse(in_seq->data[0]), &(orfs[11]->dna_num[(orfs[11]->length)]) );
+ ++orfs[11]->length;
+ }
+ }
+
+
+ else if (((help+1) % 3) == 1)
+ {
+// a:
+ if (!orfs[0]->finish && orfs[0]->length) // open orf && already started before
+ {
+ orfs[0]->sequence[(orfs[0]->length)] = translate(in_seq->data[help-3], in_seq->data[help-2], in_seq->data[help-1], &(orfs[0]->dna_num[(orfs[0]->length)]) );
+ ++orfs[0]->length;
+ }
+ else if (!orfs[1]->finish && orfs[1]->length)
+ {
+ orfs[1]->sequence[(orfs[1]->length)] = translate(in_seq->data[help-3], in_seq->data[help-2], in_seq->data[help-1], &(orfs[1]->dna_num[(orfs[1]->length)]) );
+ ++orfs[1]->length;
+ }
+
+
+// b:
+ if (!orfs[2]->finish && orfs[2]->length) // open orf && already started before
+ {
+ orfs[2]->sequence[(orfs[2]->length)] = translate(in_seq->data[help-2], in_seq->data[help-1], in_seq->data[help], &(orfs[2]->dna_num[(orfs[2]->length)]) );
+ ++orfs[2]->length;
+ }
+ else if (!orfs[3]->finish && orfs[3]->length)
+ {
+ orfs[3]->sequence[(orfs[3]->length)] = translate(in_seq->data[help-2], in_seq->data[help-1], in_seq->data[help], &(orfs[3]->dna_num[(orfs[3]->length)]) );
+ ++orfs[3]->length;
+ }
+
+
+// e:
+ if (!(orfs[8]->finish) && orfs[8]->length )
+ {
+ orfs[8]->sequence[(orfs[8]->length)] = translate(inverse(in_seq->data[2]), inverse(in_seq->data[1]), inverse(in_seq->data[0]), &(orfs[8]->dna_num[(orfs[8]->length)]) );
+ ++orfs[8]->length;
+ }
+ else if (!orfs[9]->finish && orfs[9]->length )
+ {
+ orfs[9]->sequence[(orfs[9]->length)] = translate(inverse(in_seq->data[2]), inverse(in_seq->data[1]), inverse(in_seq->data[0]), &(orfs[9]->dna_num[(orfs[9]->length)]) );
+ ++orfs[9]->length;
+ }
+
+
+// f:
+ if (!(orfs[10]->finish) && orfs[10]->length )
+ {
+ orfs[10]->sequence[(orfs[10]->length)] = translate(inverse(in_seq->data[3]), inverse(in_seq->data[2]), inverse(in_seq->data[1]), &(orfs[10]->dna_num[(orfs[10]->length)]) );
+ ++orfs[10]->length;
+ }
+ else if (!orfs[11]->finish && orfs[11]->length )
+ {
+ orfs[11]->sequence[(orfs[11]->length)] = translate(inverse(in_seq->data[3]), inverse(in_seq->data[2]), inverse(in_seq->data[1]), &(orfs[11]->dna_num[(orfs[11]->length)]) );
+ ++orfs[11]->length;
+ }
+ }
+ else
+ {
+// a:
+ if (!orfs[0]->finish && orfs[0]->length) // open orf && already started before
+ {
+ orfs[0]->sequence[(orfs[0]->length)] = translate(in_seq->data[help-4], in_seq->data[help-3], in_seq->data[help-2], &(orfs[0]->dna_num[(orfs[0]->length)]) );
+ ++orfs[0]->length;
+ }
+ else if (!orfs[1]->finish && orfs[1]->length)
+ {
+ orfs[1]->sequence[(orfs[1]->length)] = translate(in_seq->data[help-4], in_seq->data[help-3], in_seq->data[help-2], &(orfs[1]->dna_num[(orfs[1]->length)]));
+ ++orfs[1]->length;
+ }
+
+
+// b:
+ if (!orfs[2]->finish && orfs[2]->length) // open orf && already started before
+ {
+ orfs[2]->sequence[(orfs[2]->length)] = translate(in_seq->data[help-3], in_seq->data[help-2], in_seq->data[help-1], &(orfs[2]->dna_num[(orfs[2]->length)]) );
+ ++orfs[2]->length;
+ }
+ else if (!orfs[3]->finish && orfs[3]->length)
+ {
+ orfs[3]->sequence[(orfs[3]->length)] = translate(in_seq->data[help-3], in_seq->data[help-2], in_seq->data[help-1], &(orfs[3]->dna_num[(orfs[3]->length)]) );
+ ++orfs[3]->length;
+ }
+
+
+// c:
+ if (!orfs[4]->finish && orfs[4]->length) // open orf && already started before
+ {
+ orfs[4]->sequence[(orfs[4]->length)] = translate(in_seq->data[help-2], in_seq->data[help-1], in_seq->data[help],&(orfs[4]->dna_num[(orfs[4]->length)]) );
+ ++orfs[4]->length;
+ }
+ else if (!orfs[5]->finish && orfs[5]->length)
+ {
+ orfs[5]->sequence[(orfs[5]->length)] = translate(in_seq->data[help-2], in_seq->data[help-1], in_seq->data[help],&(orfs[5]->dna_num[(orfs[5]->length)]) );
+ ++orfs[5]->length;
+ }
+
+
+// d:
+ if (!(orfs[6]->finish) && orfs[6]->length )
+ {
+ orfs[6]->sequence[(orfs[6]->length)] = translate(inverse(in_seq->data[2]), inverse(in_seq->data[1]), inverse(in_seq->data[0]), &(orfs[6]->dna_num[(orfs[6]->length)]) );
+ ++orfs[6]->length;
+ }
+ else if (!orfs[7]->finish && orfs[7]->length )
+ {
+ orfs[7]->sequence[(orfs[7]->length)] = translate(inverse(in_seq->data[2]), inverse(in_seq->data[1]), inverse(in_seq->data[0]), &(orfs[7]->dna_num[(orfs[7]->length)]) );
+ ++orfs[7]->length;
+ }
+
+
+// e:
+ if (!(orfs[8]->finish) && orfs[8]->length )
+ {
+ orfs[8]->sequence[(orfs[8]->length)] = translate(inverse(in_seq->data[3]), inverse(in_seq->data[2]), inverse(in_seq->data[1]), &(orfs[8]->dna_num[(orfs[8]->length)]) );
+ ++orfs[8]->length;
+ }
+ else if (!orfs[9]->finish && orfs[9]->length )
+ {
+ orfs[9]->sequence[(orfs[9]->length)] = translate(inverse(in_seq->data[3]), inverse(in_seq->data[2]), inverse(in_seq->data[1]), &(orfs[9]->dna_num[(orfs[9]->length)]) );
+ ++orfs[9]->length;
+ }
+
+
+// f:
+ if (!(orfs[10]->finish) && orfs[10]->length )
+ {
+ orfs[10]->sequence[(orfs[10]->length)] = translate(inverse(in_seq->data[4]), inverse(in_seq->data[3]), inverse(in_seq->data[2]), &(orfs[10]->dna_num[(orfs[10]->length)]) );
+ ++orfs[10]->length;
+ }
+ else if (!orfs[11]->finish && orfs[11]->length )
+ {
+ orfs[11]->sequence[(orfs[11]->length)] = translate(inverse(in_seq->data[4]), inverse(in_seq->data[3]), inverse(in_seq->data[2]), &(orfs[11]->dna_num[(orfs[11]->length)]) );
+ ++orfs[11]->length;
+ }
+
+ }
+
+// now we got 12 orfs and we search for the longest
+ if((ret_seq = calloc(1,sizeof(struct seq)))==NULL)
+ {
+ error("orf_finder(): Out of memory");
+ }
+
+ max_length=orfs[0]->length;
+ max_orf=0;
+
+ for (i=1; i != 12; ++i)
+ {
+ if(max_length<orfs[i]->length)
+ {
+ max_length=orfs[i]->length;
+ max_orf=i;
+ }
+ }
+ if((ret_seq->data = calloc(max_length+1, sizeof(char)))==NULL)
+ {
+ error("orf_finder(): Out of memory");
+ }
+ if((ret_seq->dna_num = calloc(max_length+1, sizeof(char)))==NULL)
+ {
+ error("orf_finder(): Out of memory");
+ }
+ if(max_orf >5)ret_seq->crick_strand=1;
+ ret_seq->name=in_seq->name;
+ ret_seq->length = max_length;
+ ret_seq->num=in_seq->num;
+ ret_seq->orf_frame=max_orf/2; // As orf[1] && orf[0] = Reading frame 0 ,...
+ for(i=0; i!= max_length; i++)
+ {
+ ret_seq->dna_num[i]=orfs[max_orf]->dna_num[i];
+ ret_seq->data[i]=orfs[max_orf]->sequence[i];
+ }
+
+// free memory
+ for (x = 0; x != 12; ++x)
+ {
+ free(orfs[x]->dna_num);
+ free(orfs[x]->sequence);
+ free(orfs[x]);
+ }
+ free(orfs);
+
+
+
+ if(flag_no_start){
+ char tmp[300];
+ sprintf(tmp,"orf_finder(): No Startcodon found in Sequence %s !\n", in_seq->name );
+ if(para->ORF_FRAME)
+ printf("\n%sStarting translation for Sequence %s in reading frame 0\n\n", tmp,in_seq->name);
+ else
+ error(tmp);
+ }
+ return ret_seq;
+}
diff --git a/dialign/orf.h b/dialign/orf.h
new file mode 100644
index 0000000..2353c68
--- /dev/null
+++ b/dialign/orf.h
@@ -0,0 +1,39 @@
+/**
+ *
+ * orf.h:
+ *
+ * 2004-08-24 Dorothea Emig Volker Menrad
+ *
+ */
+
+ /************************************************/
+ /* */
+ /* structs */
+ /* */
+ /************************************************/
+
+
+ struct orf
+ {
+ int length; // length of found orf
+ char *sequence; // part of the sequence in the orf
+ char finish;
+ char *dna_num; // retranslation
+ };
+
+
+ /************************************************/
+ /* */
+ /* global variable */
+ /* */
+ /************************************************/
+
+ /*********************************************/
+ /* */
+ /* functions from parameters.c */
+ /* */
+ /*********************************************/
+struct seq_col* set_longest_orf(struct seq_col *in_seq_col);
+struct seq* orf_finder(struct seq *in_seq_col);
+//char inverse(char base);
+//char translate(char first_base, char second_base, char third_base,char* dna_number_for_retranslate);
diff --git a/dialign/parameters.c b/dialign/parameters.c
new file mode 100644
index 0000000..c3eb7f4
--- /dev/null
+++ b/dialign/parameters.c
@@ -0,0 +1,341 @@
+/**
+ *
+ * parameters.c: Read from stdin
+ *
+ *
+ */
+
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <math.h>
+#include <limits.h>
+#include <string.h>
+#include <float.h>
+#include <unistd.h>
+#include "parameters.h"
+#include "struct.h"
+#include "io.h"
+#ifdef __unix__
+ #include <sys/stat.h>
+ #include <sys/types.h>
+#else
+ #include <sys/stat.h>
+#endif
+
+
+extern char *optarg;
+extern int optind, opterr, optopt;
+struct parameters* para;
+/****************************
+* PROTEIN DEFAULT VALUES! *
+****************************/
+void init_parameters()
+{
+ if((para =(struct parameters *) malloc(sizeof(struct parameters)) ) == NULL)
+ {
+ error("init_parameters(): Out of memory when allocating data !");
+ }
+ para->VERSION = "1.0.2";
+ para->DEBUG = 0;
+ para->MAX_SEQ_AMOUNT = 5000;
+ para->MAX_FASTA_LINE_LENGTH = 100;
+ para->PRINT_SEQ_LINE_LENGTH = 80;
+ para->SCR_MATRIX_FILE_NAME="BLOSUM.scr";
+ para->DIAG_CALC_WEIGHT_THRESHOLD = 0.000000065;
+ para->DIAG_PROB_FILE_NAME="BLOSUM.diag_prob_t10";
+ para->SCR_MATRIX_ADD = 0;
+ para->PROT_SIM_SCORE_THRESHOLD = 4.0;
+ //para->PROT_DIAG_MAX_UNDER_THRESHOLD_POS = 4;
+ //para->PROT_DIAG_MIN_LENGTH_THRESHOLD = 10.0;
+ para->PROT_DIAG_MAX_UNDER_THRESHOLD_POS = 4;
+ para->PROT_DIAG_MIN_LENGTH_THRESHOLD = 40.0;
+ para->PROT_DIAG_AVG_SCORE_THRESHOLD = 4.0;
+ para->DO_ANCHOR = 0;
+ para->ANCHOR_FILE_NAME = NULL;
+ para->DO_OVERLAP = 0;
+ para->DIAG_MIN_LENGTH = 1;
+ para->FAST_MODE = 0;
+ para->SENS_MODE = 0;
+ para->DIAG_THRESHOLD_WEIGHT = -log(0.5);
+ para->FAST_PAIRWISE_ALIGNMENT = 0;
+ para->conf_dir = NULL;
+ para->in_file = NULL;
+ para->out_file = NULL;
+ para->COMPUTE_PROB=0;
+ para->STATE_ORPHANE=1;
+ para->STATE_INHERITED=2;
+ para->DNA_PARAMETERS = 0;
+ para->DNA_TRANSLATION = 0;
+ para->FIND_ORF = 0;
+ para->ORF_FRAME = 0;
+ para->OUTPUT = 0;
+}
+
+/****************************
+* DNA DEFAULT VALUES! *
+****************************/
+void set_parameters_dna()
+{
+ para->VERSION = "1.0.2";
+ para->DEBUG = 0;
+ para->MAX_SEQ_AMOUNT = 5000;
+ para->MAX_FASTA_LINE_LENGTH = 100;
+ para->PRINT_SEQ_LINE_LENGTH = 80;
+ para->SCR_MATRIX_FILE_NAME="dna_matrix.scr";
+ para->DIAG_CALC_WEIGHT_THRESHOLD = 0.000000065;
+ para->DIAG_PROB_FILE_NAME="dna_diag_prob_100_exp_550000";
+ para->SCR_MATRIX_ADD = 0;
+ para->PROT_SIM_SCORE_THRESHOLD = 0.25;
+ para->PROT_DIAG_MAX_UNDER_THRESHOLD_POS = 4; // 1
+ para->PROT_DIAG_MIN_LENGTH_THRESHOLD = 40.0;//40.0; // 1
+ para->PROT_DIAG_AVG_SCORE_THRESHOLD = 0.25; //1.0
+ para->DO_ANCHOR = 0;
+ para->ANCHOR_FILE_NAME = NULL;
+ para->DO_OVERLAP = 0;
+ para->DIAG_MIN_LENGTH = 1;
+ para->FAST_MODE = 0;
+ para->SENS_MODE = 0;
+ para->DIAG_THRESHOLD_WEIGHT = -log(0.5);//-log(0.875);
+ para->FAST_PAIRWISE_ALIGNMENT = 0;
+ para->conf_dir = NULL;
+ para->in_file = NULL;
+ para->out_file = NULL;
+ para->COMPUTE_PROB=0;
+ para->STATE_ORPHANE=1;
+ para->STATE_INHERITED=2;
+ para->DNA_PARAMETERS = 1;
+ para->DNA_TRANSLATION = 0;
+ para->FIND_ORF = 0;
+ para->ORF_FRAME = 0;
+ para->OUTPUT = 1;
+}
+
+void check_input(int argc, char** argv)
+{
+ int flag_protein_output = 0;
+ opterr = 1;
+ optind = 0;
+ int opt, only_config_dir = 0;
+
+ while((opt = getopt(argc, argv,"PDTLOCFHhA:d:s:a:c:l:m:w:p:v:t:n:g:o:r:u"))!= -1){
+ switch(opt){
+ case 'd':
+ para->DEBUG = atoi(optarg);
+ break;
+ case 's':
+ para->MAX_SEQ_AMOUNT = atoi(optarg);
+ break;
+ case 'a':
+ para->MAX_FASTA_LINE_LENGTH = atoi(optarg);
+ break;
+ case 'c':
+ para->PRINT_SEQ_LINE_LENGTH = atoi(optarg);
+ break;
+ case 'l':
+ para->SENS_MODE = atoi(optarg);
+ break;
+ case 'A':
+ para->ANCHOR_FILE_NAME = optarg;
+ para->DO_ANCHOR = 1;
+ break;
+ case 'm':
+ para->SCR_MATRIX_FILE_NAME = optarg;
+ break;
+ case 'w':
+ para->DIAG_CALC_WEIGHT_THRESHOLD = atof(optarg);
+ break;
+ case 'p':
+ para->DIAG_PROB_FILE_NAME = optarg;
+ break;
+ case 'v':
+ para->SCR_MATRIX_ADD = atoi(optarg);
+ break;
+ case 't':
+ para->PROT_SIM_SCORE_THRESHOLD = atoi(optarg);
+ break;
+ case 'n':
+ para->PROT_DIAG_MAX_UNDER_THRESHOLD_POS = atoi(optarg);
+ break;
+ case 'g':
+ para->PROT_DIAG_MIN_LENGTH_THRESHOLD = atof(optarg);
+ break;
+ case 'r':
+ para->PROT_DIAG_AVG_SCORE_THRESHOLD = atof(optarg);
+ break;
+ case 'o':
+ para->DO_OVERLAP = atoi(optarg);
+ break;
+ case 'u':
+ para->DIAG_MIN_LENGTH = atoi(optarg);
+ break;
+ case 'h':
+ wrong_input();
+ case 'H':
+ wrong_input();
+ case 'C':
+ only_config_dir = 1;
+ para->COMPUTE_PROB = 1;
+ break;
+ case 'F':
+ para->DIAG_THRESHOLD_WEIGHT = 0.0;
+ para->FAST_MODE = 1;
+ break;
+ case 'O':
+ para->DNA_PARAMETERS = 0;
+ para->DNA_TRANSLATION = 1;
+ para->FIND_ORF = 1;
+ para->ORF_FRAME = 1;
+ para->OUTPUT = 1;
+ break;
+ case 'L':
+ para->DNA_PARAMETERS = 0;
+ para->DNA_TRANSLATION = 1;
+ para->FIND_ORF = 1;
+ para->ORF_FRAME = 0;
+ para->OUTPUT = 1;
+ break;
+ case 'T':
+ para->DNA_PARAMETERS = 0;
+ para->DNA_TRANSLATION = 1;
+ para->FIND_ORF = 0;
+ para->ORF_FRAME = 0;
+ para->OUTPUT = 1;
+ break;
+ case 'D':
+ break;
+ case 'P':
+ flag_protein_output = 1;
+ break;
+ case '?':
+ break;
+ }
+ }
+
+ if(flag_protein_output){
+ para->OUTPUT = 0;
+ }
+
+ if(argc-optind == 0 ){
+ wrong_input();
+ error("conf-directory and infile needed !");
+ }
+ else if(argc-optind > 3){
+ wrong_input();
+ error("too many arguments -> conf-directory, infile, [outfile] !");
+ }
+ else{
+ struct stat attribut_dir;
+ if(only_config_dir){
+ if(stat(argv[optind],&attribut_dir)==-1){
+ wrong_input();
+ error("conf-directory doesn't exist");
+ }
+ else {
+ if(attribut_dir.st_mode & S_IFDIR){
+ para->conf_dir = argv[optind++];
+ }
+ else {
+ wrong_input();
+ error("conf-directory is no directory");
+ }
+ }
+ }
+ else{
+ struct stat attribut_file;
+ if(stat(argv[optind],&attribut_dir)==-1){
+ wrong_input();
+ error("conf-directory doesn't exist");
+ }
+ else{
+ if(attribut_dir.st_mode & S_IFDIR){
+ para->conf_dir = argv[optind++];
+ if(stat(argv[optind],&attribut_file)==-1){
+ wrong_input();
+ error("infile doesn't exist");
+ }
+ else{
+ if(attribut_file.st_mode & S_IFREG){
+ para->in_file = argv[optind++];
+ }
+ else{
+ wrong_input();
+ error("infile isn't a regular file!");
+ }
+ }
+ }
+ else{
+ wrong_input();
+ error("conf-directory is no directory");
+ }
+ }
+ if(argv-optind >0)
+ para->out_file = argv[optind];
+ }
+ }
+ return;
+}
+
+void wrong_input()
+{
+ printf("Usage: dialign-t [OPTIONS] <conf-directory> <fasta-file> [<fasta-out-file>]\n");
+ printf("\n -d\tDebug-Mode [DEFAULT 0]\n");
+ printf(" \t\t 0 no debug statements\n");
+ printf(" \t\t 1 debugs the current phase of the processing\n");
+ printf(" \t\t 2 very loquacious debugging\n");
+ printf(" \t\t 5 hardcore debugging\n");
+ printf(" -s\tmaximum amount of input sequences [DEFAULT 5000]\n");
+ printf(" -a\tmaximum number of characters per line in a FASTA file [DEFAULT 100]\n");
+ printf(" -c\tmaximum amount of characters per line when printing a sequence\n \t[DEFAULT 80]\n");
+ printf(" -l\tsensitivity mode, the higher the level the less likely\n");
+ printf(" \tspurious random fragments are aligned in local alignments \n \t[DEFAULT 0]\n");
+ printf(" \t\t 0 switched off \n");
+ printf(" \t\t 1 level-1, reduced sensitivity\n");
+ printf(" \t\t 2 level-2, strongly reduced sensitivity\n");
+ printf(" -m\tscore matrix file name (in the configuration directory)\n \t\t[DEFAULT PROTEIN: BLOSUM.scr]\n \t\t[DEFAULT DNA: dna_matrix.scr]\n");
+ printf(" -w\tdefines the minimum weight when the weight formula is changed\n \tto 1-pow(1-prob, factor) [DEFAULT 0.000000065]\n");
+ printf(" -p\tprobability distribution file name (in the configuration\n \tdirectory) \n \t\t[DEFAULT PROTEIN: BLOSUM.diag_prob_t10]\n\t\t[DEFAULT DNA: dna_diag_prob_100_exp_550000]\n");
+ printf(" -v\tadd to each score (to prevent negative values) [DEFAULT 0]\n");
+ printf(" -t\t\"even\" threshold for low score for sequences alignment \n \t\t[DEFAULT PROTEIN: 4]\n\t\t[DEFAULT DNA: 0]\n");
+ printf(" -n\tmaximum number of consecutive positions for window containing\n \tlow scoring positions \n \t\t[DEFAULT PROTEIN: 4]\n\t\t[DEFAULT DNA: 4]\n");
+ printf(" -g\tglobal minimum fragment length for stop criterion \n \t\t[DEFAULT PROTEIN: 40] \n\t\t[DEFAULT DNA: 40]\n");
+ printf(" -m\tminimal allowed average score in frag window containing low \n \tscoring positions \n \t\t[DEFAULT PROTEIN: 4.0]\n\t\t[DEFAULT DNA: 0.25]\n");
+ printf(" -o\twether overlap weights are calculated or not [DEFAULT 0]\n");
+ printf(" -f\tminimum fragment length [DEFAULT 1]\n");
+ printf(" -r\tthreshold weight to consider the fragment at all [DEFAULT 0.0]\n");
+ printf(" -u\t[DEFAULT 0]\n");
+ printf(" \t\t1: only use a sqrt(amount_of_seqs) stripe of neighbour\n \t\t sequences to calculate pairwise alignments (increase performance)\n");
+ printf(" \t\t0: all pairwise alignments will be calculated\n");
+ printf(" -A\toptional anchor file [DEFAULT none]\n");
+
+ printf(" -D\tinput is DNA-sequence\n");
+ printf(" -T\ttranslate DNA into aminoacids from begin to end (length will be cut to mod 3 = 0)\n\tWARNING: Do not use -D with this option \n\t(Default values for PROTEIN input will be loaded)\n");
+ printf(" -L\tcompare only longest Open Reading Frame\n\tWARNING: Do not use -D with this option \n\t(Default values for PROTEIN input will be loaded)\n");
+ printf(" -O\ttranslate DNA to aminoacids, reading frame for each sequence calculated due to its longest ORF\n\tWARNING: Do not use -D with this option \n\t(Default values for PROTEIN input will be loaded)\n");
+ printf(" -P\toutput in aminoacids, no retranslation of DNA sequences\n\t[DEFAULT: input = output]\n");
+ printf(" -F\tfast mode (implies -l0, since it already significantly reduces sensitivity)\n");
+ printf(" -C\tgenerate probability table saved in <config_dir>/prob_table and exit\n");
+ printf(" -H -h\tprint this message\n\n");
+ exit(1);
+}
+
+void parameters(int argc, char** argv)
+{
+ init_parameters();
+ int opt_flag = 0;
+ int opt;
+ opterr = 0;
+ while((opt = getopt(argc, argv, "D") )!=-1){
+ switch(opt){
+ case 'D': opt_flag = 1; break;
+ case '?': break;
+ }
+ }
+
+ if(opt_flag)
+ set_parameters_dna();
+
+ check_input(argc, argv);
+}
+
+
diff --git a/dialign/parameters.h b/dialign/parameters.h
new file mode 100644
index 0000000..fdfac94
--- /dev/null
+++ b/dialign/parameters.h
@@ -0,0 +1,163 @@
+/**
+ *
+ * parameters.h:
+ *
+ * 2004-08-13 Dorothea Emig Volker Menrad
+ *
+ */
+
+/************************************************/
+/* */
+/* structs */
+/* */
+/************************************************/
+
+struct parameters
+{
+ char *VERSION;
+ // 0 no debug statements
+ // 1 debugs the current phase of the processing
+ // 2 very loquacious debugging
+ // 5 hardcore debugging
+ int DEBUG; // = 0;
+
+ // maximum amount of input sequences
+ int MAX_SEQ_AMOUNT; // = 5000;
+
+ // maximum number of characters per line in a FASTA file
+ int MAX_FASTA_LINE_LENGTH; // = 100;
+
+ // maximum amount of characters per line when printing a sequence
+ int PRINT_SEQ_LINE_LENGTH; // = 80;
+
+ /*******************************
+ *
+ * PROTEIN SCORING/WEIGHTING SECTION
+ *
+ *****************************/
+
+
+ // score matrix (e.g. BLOSUM) file name (in the configuration directory)
+ //#define SCR_MATRIX_FILE_NAME "BLOSUM75.scr"
+ char *SCR_MATRIX_FILE_NAME; // = "BLOSUM.scr";
+ //#define SCR_MATRIX_FILE_NAME "BLOSUM90.scr"
+
+ // defines the minimum weight when the weight is changed to
+ // 1-pow(1-prob, factor)
+ double DIAG_CALC_WEIGHT_THRESHOLD; // = 0.000000065;
+ //#define DIAG_CALC_WEIGHT_THRESHOLD 0.0000002
+
+
+ // diag prob. distribution file name (in the configuration directory)
+ char *DIAG_PROB_FILE_NAME; // = "BLOSUM.diag_prob_t10";
+ //#define DIAG_PROB_FILE_NAME "BLOSUM.diag_prob_t7" // current
+ //#define DIAG_PROB_FILE_NAME "BLOSUM75.diag_prob_t2" //
+ //#define DIAG_PROB_FILE_NAME "BLOSUM75.diag_prob_t1"
+ //#define DIAG_PROB_FILE_NAME "BLOSUM90.diag_prob"
+ //#define DIAG_PROB_FILE_NAME "BLOSUM75.diag_prob"
+ //#define DIAG_PROB_FILE_NAME "tp400_prot"
+
+ // add to each score (to prevent negative values)
+ int SCR_MATRIX_ADD; // = 0; // BLOSUM(62)
+ //#define SCR_MATRIX_ADD 5 // BLOSUM75
+ //#define SCR_MATRIX_ADD 6 // BLOSUM90
+
+ /*******************************
+ *
+ * PROTEIN QUALITY SECTION
+ *
+ *****************************/
+
+ // "even" sim score threshold for protein sequences alignment
+ //#define PROT_SIM_SCORE_THRESHOLD 6 //BLOSUM90
+ //#define PROT_SIM_SCORE_THRESHOLD 5 //BLOSUM75
+ double PROT_SIM_SCORE_THRESHOLD; // = 4; // BLOSUM62
+
+ // maximum number of consecutive positions for frag-window
+ int PROT_DIAG_MAX_UNDER_THRESHOLD_POS; // = 4; // old was 4
+
+ // minimum diagonal length for breaking
+ double PROT_DIAG_MIN_LENGTH_THRESHOLD; // = 40.0; // old was 40
+
+ // minimal allowed average csore in frag window
+ double PROT_DIAG_AVG_SCORE_THRESHOLD; // = 4.0; // BLOSUM62
+ //#define PROT_DIAG_AVG_SCORE_THRESHOLD 5.0 // BLOSUM75
+
+
+ /*******************************
+ *
+ * GLOBAL QUALITY/SPEED SECTION
+ *
+ *****************************/
+
+ // wether overlap weights are calculated or not
+ int DO_OVERLAP; // = 0;
+
+ // minimum diag length
+ int DIAG_MIN_LENGTH;// = 1;
+
+ // diag threshold weight
+ double DIAG_THRESHOLD_WEIGHT;// = -log(0.5);
+
+ // if there are anchors
+ char DO_ANCHOR; // = 0;
+
+ // name of optional anchor file
+ char *ANCHOR_FILE_NAME; // = NULL;
+
+ // sensitivity mode, does not set
+ // DIAG_THRESHOLD_WEIGHT to 0 four rounds >1
+ char SENS_MODE;// = 0;
+
+ // fast mode - behaves like dialign t 0.2.2
+ char FAST_MODE;// = 0;
+
+ // 1: only use a sqrt(amount_of_seqs) stripe of neighbour sequences to
+ // calculate pairwise alignments
+ // 0: all pairwise alignments will be calculated
+ int FAST_PAIRWISE_ALIGNMENT;// = 0;
+
+ char *conf_dir ;
+ char *in_file ;
+ char *out_file ;
+ char COMPUTE_PROB;
+ int DNA_PARAMETERS; // default Einstellungen f�r DNA holen
+ int DNA_TRANSLATION; // Vergleich auf Proteinebene, input DNA
+ int FIND_ORF; // Vergleich auf Proteinebene, input DNA, mit ORF Finder
+ int ORF_FRAME; // Vergleich auf Proteinebene, input DNA, nur longest ORF wird aligned
+ int OUTPUT; // f�r DNA = 1, f�r Aminos�uren = 0
+
+
+ int STATE_ORPHANE;
+ int STATE_INHERITED;
+
+};
+
+ /************************************************/
+ /* */
+ /* global variable */
+ /* */
+ /************************************************/
+extern struct parameters* para;
+
+
+
+ /*********************************************/
+ /* */
+ /* functions from parameters.c */
+ /* */
+ /*********************************************/
+//struct parameters*
+
+//initialises the parameters with default values
+void init_parameters();
+
+// check, whether there are enough arguments and if options are used
+void check_input(int length, char** arguments);
+
+//error message
+void wrong_input();
+
+void parameters(int argc, char** argv);
+void set_parameters_dna();
+
diff --git a/dialign/prob.c b/dialign/prob.c
new file mode 100644
index 0000000..b66ff86
--- /dev/null
+++ b/dialign/prob.c
@@ -0,0 +1,250 @@
+#include <time.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <ctype.h>
+#include <time.h>
+
+#include "struct.h"
+#include "parameters.h"
+
+extern void error(char *message);
+extern void merror(char *msg1, char *msg2);
+
+// io.c#
+extern void print_diag(struct diag* aDiag);
+
+// diag.c
+//extern struct seq_part* create_seq_part(int num, struct seq* aSeq,
+// long startpos);
+extern struct diag* create_diag(struct seq_part* part1, struct seq_part* part2,
+ int dlength);
+
+/**
+ *
+ * prob.c: Probability measurement (Creation of random sequences, diags,...)
+ *
+ * 2003-10-14 A.R.Subramanian
+ * (Initial)
+ */
+
+
+/**
+ * auxiliary method that fills random data into the sequence (see next func.)
+ */
+void fill_random_seq(struct seq* sq, struct scr_matrix *smatrix) {
+ long length = sq->length;
+ char *data = sq->data;
+
+ int *n2c = smatrix->num2char;
+ float slen = (float)smatrix->length;
+ int pos, rnd;
+ for(pos=0; pos<length;pos++) {
+ do {
+ rnd = (int)( (slen*random())/(RAND_MAX+1.0));
+ data[pos]=(char)(n2c[rnd]);
+ } while(n2c[rnd]=='X' || (n2c[rnd]<'A') || (n2c[rnd]>'Z'));
+ }
+
+}
+
+/**
+ * create random squence of the given length using the characters
+ * of the given score matrix
+ *
+ * The pointer returned (and the ones included in the struct)
+ * has to be deallocted explicitely from memory.
+ */
+struct seq* create_random_seq(struct scr_matrix *smatrix, int length) {
+ struct seq* sq = calloc(1, sizeof(struct seq));
+ sq->length=length;
+ sq->data = calloc(length, sizeof(char));
+ sq->name = calloc(strlen("random")+1, sizeof(char));
+ strcpy(sq->name, "random");
+ fill_random_seq(sq, smatrix);
+ return sq;
+}
+
+
+
+/**
+ * calculates the score distribution up to the given maximum diaglen
+ *
+ * The pointer returned and the included dist pointer has to be deallocted
+ * explicitely from memory.
+ */
+struct prob_dist* calc_score_dist(struct scr_matrix *smatrix, int mxdlen) {
+ long sm_max_scr = smatrix->max_score;
+ long maxdlen = mxdlen;
+ struct prob_dist *sdist = calloc(1, sizeof(struct prob_dist));
+
+ long **edist = (calloc(maxdlen+1, sizeof(long *)));
+ long **tdist = (calloc(maxdlen+1, sizeof(long *)));
+ long double **dist = (sdist->data=calloc(maxdlen+1, sizeof(long double *)));
+
+ if(sdist==NULL || dist==NULL || edist==NULL|| tdist==NULL) error("calc_score_dist(): Out of memory !");
+ sdist->max_dlen = maxdlen;
+ int *sdata = smatrix->data;
+ int *smdist = smatrix->dist;
+
+ sdist->smatrix = smatrix;
+ sdist->max_dlen = maxdlen;
+
+ int reduce = 3; // special characters '?', '#', '%', we don't account for
+ if(smatrix->char2num['X']>0) reduce++; // don't account for 'X'
+
+ long double square = (smatrix->length-reduce) * (smatrix->length-reduce);
+ long scr;
+ unsigned long i,j, scr2, mxscr, omxscr;
+
+ for(i=1;i<=maxdlen;i++) {
+ mxscr = i*sm_max_scr;
+ dist[i] = calloc(mxscr+1, sizeof(long double ));
+ edist[i] = calloc(mxscr+1, sizeof(long ));
+ tdist[i] = calloc(mxscr+1, sizeof(long ));
+ if(dist[i]==NULL) error("calc_score_dist(): Out of memory at iteration" );
+ if(i==1) {
+ for(j=0;j<=mxscr;j++) {
+ dist[i][j] = smdist[j]; //static, wie oft kommt ein score j in der scr-Matrix vor, nur f�r Fragmentl�nge 1, ansonsten initialisiere mit Null
+ edist[i][j]=0;
+ tdist[i][j]=0;
+ }
+ } else {
+ for(scr=0;scr<=mxscr;scr++) {
+ dist[i][scr]=0.0;
+ edist[i][scr]=0;
+ tdist[i][scr]=0;
+ omxscr = (i-1)*sm_max_scr;
+ for(j=0;j<=sm_max_scr;j++) {
+ if((scr-j)<=omxscr) dist[i][scr] += dist[1][j]*dist[i-1][scr-j]; // statisch wenn gr��er eins
+ }
+ }
+ }
+ }
+
+ struct seq *sq1, *sq2;
+ long max_experiment=550000, ex, found;
+ struct diag dg;
+ char *data1;
+ char *data2;
+ int *c2n = smatrix->char2num;
+ int a1, a2,pos,dpos1,dpos2;
+ long double experiment,oldprob,opf,opf2;
+ int dlen = 100;
+ // int maxdlen=100;
+ long double factor = (long double)dlen*dlen;
+
+ //long double expect;
+ for(i=1;i<=maxdlen;i++) {
+// printf(" Diag of length %i\n", i);
+ mxscr = i*sm_max_scr;
+ //expect =0.0;
+ dlen = i;
+ factor = (long double)dlen*dlen;
+ for(scr=0;scr<=mxscr;scr++) {
+ //expect += ((long double)scr) * dist[i][scr]*pow(1.0/square,i);;
+ //printf(" max %i\n", mxscr);
+ for(scr2=scr+1;scr2<=mxscr;scr2++) {
+ dist[i][scr] += dist[i][scr2];
+ }
+
+ dist[i][scr] = dist[i][scr]*pow(1.0/square,i);
+ }
+ }
+ // EXPERIMENTS:
+
+ srandom((int)time(NULL));
+ sq1 = create_random_seq(smatrix, 2*maxdlen);
+ sq2 = create_random_seq(smatrix, 2*maxdlen);
+ dg.seq_p1.sq = sq1;
+ dg.seq_p2.sq = sq2;
+ dg.length =2*maxdlen;
+ //printf(" pre random\n");
+ // for(ex=0;(ex<max_experiment || found==0);ex++) {
+ char seenmax=0;
+ for(ex=0;(ex<max_experiment);ex++) {
+ if( (ex%1000)==0) fprintf(stderr," Experiment %li\n", ex);
+ fill_random_seq(sq1, smatrix);
+ fill_random_seq(sq2, smatrix);
+ data1 = sq1->data;
+ data2 = sq2->data;
+ for(dpos1=0;dpos1<=maxdlen;dpos1++) {
+ for(dpos2=0;dpos2<=maxdlen;dpos2++) {
+ dg.seq_p1.startpos = dpos1;//(int)( (100*random())/(RAND_MAX+1.0));
+ dg.seq_p2.startpos = dpos2; //(int)( (100*random())/(RAND_MAX+1.0));
+ dg.score = 0;
+ for(pos=0;pos<maxdlen;pos++) {
+ a1 = c2n[(int) data1[dg.seq_p1.startpos+pos]];
+ a2 = c2n[(int) data2[dg.seq_p2.startpos+pos]];
+ dg.score+=(long)sdata[smatrix->length*a1+a2];
+ if(dpos1<=pos+1 && dpos2<=pos+1) // t6
+ tdist[pos+1][dg.score]=1; // kann mehrmals dasselbe sein?? kann immer wieder �berschrieben werden, warum?
+ }
+ }
+ }
+ for(i=1;i<=maxdlen;i++) {
+ //printf(" Diag of length %i\n", i);
+ mxscr = i*sm_max_scr;
+ seenmax =0;
+ for(scr=mxscr;scr>=0;scr--) {
+ if(!seenmax) {
+ if(tdist[i][scr]==1) {
+ edist[i][scr]=edist[i][scr]+1; //f�r jedes Exp. maximalen score der jeweiligen Fragmentl�nge hochz�hlen
+ seenmax = 1;
+ }
+ }
+ tdist[i][scr]=0; // alles wieder auf Null setzen !
+ }
+ }
+ }
+ free(sq1);
+ free(sq2);
+
+
+ for(i=1;i<=maxdlen;i++) {
+ // printf(" Diag of length %i\n", i);
+ mxscr = i*sm_max_scr;
+ //expect =0.0;
+ dlen = i;
+ factor = (long double)(dlen+1)*(dlen+1); // t6
+ //factor = (long double)10201.0;
+ for(scr=0;scr<=mxscr;scr++) {
+ for(scr2=scr+1;scr2<=mxscr;scr2++) {
+ edist[i][scr] += edist[i][scr2]; // da in scr2 ja auch schon der scr1 beinhaltet ist; durch aufsummieren bekommen wir die Anzahl, wie viele Fragmente der L�nge i min. den score scr haben (oder mehr)
+ }
+
+ found = edist[i][scr]; // random exp.
+ oldprob = dist[i][scr]; // statisch
+ opf2 = (long double)oldprob*factor;
+ opf = (long double)1.0-pow(1.0-oldprob,factor);
+ experiment =((long double)found)/ ( ((long double)(max_experiment)));
+ //if(switcher==0 && oldprob<0.000001) { // old 0.00001 t3
+
+ //if(found==0)
+ //printf ("%Le %Le %Le %Le %Le %Le %i\n",experiment,opf,opf2,oldprob,factor,square,found);
+
+ if(scr>0 && (found==0 || (experiment>opf || experiment>opf2 || experiment<10.0/max_experiment))) {
+ if( (opf<=dist[i][scr-1]) && ( (opf > opf2) || (opf2 > dist[i][scr-1]))) {
+ experiment = opf;
+ }
+ if( ( (opf2 <= dist[i][scr-1]))) {
+ experiment = opf2;
+ }
+ }
+ if(experiment == 0.0) {
+ experiment = dist[i][scr-1];
+ }
+
+ dist[i][scr] = experiment;
+
+ //if(isnan(dist[i][scr]) || isinf(dist[i][scr])) dist[i][scr]=1.0;
+ if(para->DEBUG>1)printf("%li %li %Le\n", i, scr,dist[i][scr] );
+ }
+ // printf("%i %Le\n", i, expect);
+ }
+
+ return sdist;
+}
+
+
diff --git a/dialign/struct.h b/dialign/struct.h
new file mode 100644
index 0000000..e5bfaa8
--- /dev/null
+++ b/dialign/struct.h
@@ -0,0 +1,222 @@
+/**
+ *
+ * struct.h: Basic data structures
+ *
+ * Author: A.R.Subramanian
+ */
+
+
+/**
+ * score matrix (e.g. BLOSUM62)
+ */
+struct scr_matrix
+{
+ int length; // number of amino acids
+ int max_score; // maximum among all entries in the data array
+ int *char2num; // resolves the character of an amino acid to its number
+ int *num2char; // resolves the number of an amino acid to its character
+ int *data; // contains the matrix indexed by the number of the particular amino acid
+ int *dist; // number of pairs of amino acids (i,j) having score at equal to // the value of the index
+ long double **raw_dist;
+ double avg_sim_score;
+
+};
+
+/**
+ * raw sequence
+ */
+struct seq
+{
+ char *data; // sequence data
+ char *name; // name/description of the sequence
+ int num; // number of the sequence
+ int length; // length of sequence
+ int max_seen;
+ char *dna_num; // Numbers fo retranslation from Protein to DNA
+ int orf_frame; // reading frame of the longest orf
+ char crick_strand; // orf translation or sequence translation on crickstrand
+};
+
+
+/**
+ * sequence collection
+ */
+struct seq_col
+{
+ struct seq *seqs; // array of the sequences
+ int avg_length; // average length of sequences
+ int length; // number of sequences
+};
+
+/**
+ * probability distribution of scores in diagonals
+ */
+struct prob_dist {
+ struct scr_matrix *smatrix; // pointer to the associated score matrix
+ long double **data; // distribution of scores dist[i][j] contains the
+ // probability of a diags of length i having score >=j
+ double **log_data; // distribution of scores dist[i][j] contains the
+ // -log(probability of a diags of length i having score >=j)
+ // long double *expect; // score expectancy for each diaglen
+ unsigned int max_dlen; // maximum diaglength in dist
+};
+
+
+/**
+ * part of a sequence (auxiliary data structure)
+ */
+struct seq_part {
+ int num; // a number that indicates a position in an array
+ struct seq* sq; // the pointer to the sequence
+ int startpos; // startpos in the sequence
+ //int leftmargin;
+ //int rightmargin;
+};
+
+
+/**
+ * diagonal in the dotmatrix
+ */
+struct diag {
+ struct seq_part seq_p1; // first sequence part
+ struct seq_part seq_p2; // seconde sequence part
+ unsigned int length; // length of the diag
+ long score; // score of the diag
+ long orig_score; // orig score of the diag
+
+ struct diag *pred_diag; // predecessor diag for dynamic programming
+ struct diag *col_pred_diag; // col predecessor diag for dynamic programming
+ int pool_pos; // position in diag pool
+
+ char meetsThreshold; // whether diag meets threshold
+
+ // for vertex cover
+ int degree;
+ int max_degree;
+ struct diag **neighbours;
+
+ char anchor; // if this is an anchor diag
+ char marked; // marking flag for arbitrary use
+ char multi_dg; // is >0 if this is a multi dg
+ struct diag **multi_cont; // the contained dgs of this is a multi dg
+ int multi_length; // size of multi_cont
+
+ // char onlyOverThres;
+
+ double weight; // weight of the diag = -log(prob)
+ double weight_sum; // weight sum for dialign
+ double weight_fac; // weight factor
+ double ov_weight; // overlap weight
+ double total_weight; // total_weight = weight+o_weight
+};
+
+/**
+ * collection of diag
+ */
+struct simple_diag_col {
+ unsigned int length; // number of diags
+ double total_weight; // total weight
+ double weight_fac; // weight factor
+ struct diag** data; // the array of diags
+};
+
+/**
+ * guide tree node
+ */
+struct gt_node {
+ char isLeaf; // whether it is leaf
+ int *seq_num; // the sequence numbers
+ int seq_num_length; // length of sequence numbers array
+ struct gt_node *succ1; // successor nodes
+ struct gt_node *succ2;
+};
+
+
+/**
+ * vertex cover node
+struct vc_node {
+ double weight;
+ struct diag *dg;
+ int degree;
+ struct vc_node *adjacents;
+}
+ */
+
+
+/**
+ * collection of all diagonals sorted by the sequences
+ */
+struct diag_col {
+ int seq_amount; // number of sequences involved
+ struct simple_diag_col** diag_matrix; // diag_matrix[i +seq_amount *j] contains
+ // all diags found involving the sequences i and j
+
+ double total_weight; // total weight
+ double average_weight; // average_weight
+ struct diag** diags; // all diags unordered
+ unsigned int diag_amount; // number of diags found
+ struct gt_node *gt_root;
+};
+
+
+/**
+ * diag container
+ */
+struct diag_cont {
+ struct diag* dg;
+ struct diag_cont *next;
+};
+
+/**
+ * alignment position
+ */
+struct algn_pos {
+ // int seq_num; // sequence number
+ // unsigned long pos_in_seq; // position in the sequence
+ char state; // orphane: not aligned to any pos,
+
+ struct diag_cont *dg_cont; // diags that are aligned with that position
+
+ int row;
+ int col;
+ // unsigned int succFPos; // if orphane, the position holding the succF
+ // unsigned int predFPos; // analogous to succFPos
+ // char* isAli; // if alignemnt at the positions exist
+ int* predF; // predecessor frontier, only filled if non-orphane
+ int* succF; // successor frontier, only filled if non-orphane
+
+ char *proceed; // for output
+ //char isInherited; // whether the pointers are inherited
+ int predFPos; // in case of orphane, where to find the predF or succF
+ int succFPos;
+
+ int *eqcAlgnPos; // equivalence class minimum alignment position (for output)
+ struct algn_pos *eqcParent; // equivalence class parent
+ int eqcRank; // equivalence class rank (>= maximum number of children)
+ // unsigned int *maxpos; // needed for output of the alignment
+};
+
+/**
+ * alignment
+ */
+struct alignment {
+ //int seq_amount; // number of sequences involved
+ //char *redo_seqs; // which pairs of sequences are to be aligned again
+ char *seq_is_orphane; // boolean array indicating for each sequence
+ // whether it is orphane or not
+ int max_pos; // the greatest position in the alignment (including all -'s)
+ // if <0: the alignment has not yet been prepared
+ struct seq_col *scol; // all the sequences involved
+ struct algn_pos **algn; // the alignment
+ double total_weight; // the total weight of the alignment
+ struct alignment *next; // pointer to next alignment in the sorted linked list
+ //struct alignment *prev; // pointer to previous alignment in the sorted linked list
+ //unsigned long pos; // position in the sorted linked list
+
+ //struct diag** aligned_diags; // all aligned diags
+ //int aligned_diags_amount;
+ //int max_aligned_diags_amount;
+ //int orig_max_aligned_diags_amount;
+
+ //struct diag_cont* backlog_diags; // all backlog diags
+};
diff --git a/dialign/translate.c b/dialign/translate.c
new file mode 100644
index 0000000..fa401f1
--- /dev/null
+++ b/dialign/translate.c
@@ -0,0 +1,603 @@
+/**
+ *
+ * translate.c:
+ *
+ * 2004-08-30 Dorothea Emig Volker Menrad
+ *
+ */
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "struct.h"
+#include "translate.h"
+#include "parameters.h"
+#include "orf.h"
+#include "io.h"
+
+void translate_sequence_collection_orf_frame(struct seq_col *in_seq_col)
+{
+ int i;
+ struct seq_col* tmp;
+ tmp = set_longest_orf(in_seq_col);
+/**************
+
+ reading frames :
+
+ 0: 123 123 123 123 123 ...
+ 1: X 123 123 123 123 123 ...
+ 2: XX 123 123 123 123 123 ...
+ 3: ... 321 321 321 321 321 XX
+ 4: ... 321 321 321 321 321 X
+ 5: ... 321 321 321 321 321
+
+**************/
+ for(i=0; i!= in_seq_col->length; ++i){
+ in_seq_col->seqs[i].orf_frame = tmp->seqs[i].orf_frame;
+ translate_sequence( &(in_seq_col->seqs[i]) );
+ free(tmp->seqs[i].data);
+ free(tmp->seqs[i].dna_num);
+ }
+
+ free(tmp);
+}
+
+
+void translate_sequence_collection_default(struct seq_col *in_seq_col)
+{
+ int i;
+ for(i=0; i!= in_seq_col->length; ++i)
+ translate_sequence( &(in_seq_col->seqs[i]) );
+}
+
+
+void translate_sequence(struct seq *in_seq)
+{
+ int i, rest;
+// printf("%d\t%s\n%s\n%d\n\n\n",in_seq->num, in_seq->name, in_seq->data, in_seq->orf_frame );
+ switch(in_seq->orf_frame)
+ {
+ case 0: break;
+ case 1: --in_seq->length;
+ in_seq->data=&(in_seq->data[1]);
+ break;
+ case 2: in_seq->length= in_seq->length-2;
+ in_seq->data=&(in_seq->data[2]);
+ break;
+ case 3: in_seq->crick_strand=1;
+ in_seq->length= in_seq->length-2;
+ in_seq->data[in_seq->length]='\0';
+ break;
+ case 4: in_seq->crick_strand=1;
+ --in_seq->length;
+ in_seq->data[in_seq->length]='\0';
+ break;
+ case 5: in_seq->crick_strand=1;
+ break;
+ }
+
+ struct seq* new;
+
+ if(NULL == ( new = (calloc(1,sizeof(struct seq)))))
+ {
+ error("translate_sequence: Out of memory! ");
+ }
+ if(NULL == (new->data = (calloc(in_seq->length/3+1, sizeof(char)))))
+ {
+ error("translate_sequence: Out of memory! ");
+ }
+ if(NULL == (new->dna_num = (calloc(in_seq->length/3+1, sizeof(char)))))
+ {
+ error("translate_sequence: Out of memory! ");
+ }
+
+ rest = in_seq->length%3;
+
+ for(i=0; i < (in_seq->length) - rest ; ++i)
+ {
+ int help = in_seq->length-1;
+
+ if(in_seq->crick_strand==0)
+ {
+ new->data[new->length] = translate(in_seq->data[i], in_seq->data[i+1], in_seq->data[i+2], &(new->dna_num[new->length]) );
+ ++new->length;
+ }
+ else
+ {
+ new->data[new->length] = translate(inverse(in_seq->data[help - i]), inverse(in_seq->data[help - (i+1)]), inverse(in_seq->data[help - (i+2)]), &(new->dna_num[new->length]) );
+ ++new->length;
+ }
+ i=i+2;
+ }
+
+ switch(in_seq->orf_frame)
+ {
+ case 1: --in_seq->data;
+ free(in_seq->data);
+ break;
+ case 2: in_seq->data = in_seq->data-2;
+ free(in_seq->data);
+ break;
+ default: free(in_seq->data);
+ }
+
+ in_seq->data = &(new->data[0]);
+ in_seq->length = new->length;
+ in_seq->dna_num = new->dna_num;
+
+}
+
+char translate(char first_base, char second_base, char third_base, char *dna_number)
+{
+ switch(first_base)
+ {
+ case 'A': switch(second_base)
+ {
+ case 'A': switch(third_base)
+ {
+ case 'A': *dna_number = 0; // AAA
+ return('K'); // Lysin = K
+ case 'T': *dna_number = 1; // AAT
+ return('N'); // Asparagin = N
+ case 'U': *dna_number = 2; // AAU
+ return('N'); // Asparagin = N
+ case 'G': *dna_number = 3; // AAG
+ return('K'); //Lysin = K
+ case 'C': *dna_number = 4; // AAC
+ return('N'); //Asparagin = N
+ default: error("No regular aminoacid !");
+ }
+ case 'T': switch(third_base)
+ {
+ case 'A': *dna_number = 5; // ATA
+ return('I'); // Isoleucin = I
+ case 'T': *dna_number = 6; // ATT
+ return('I'); // Isoleucin = I
+ case 'G': *dna_number = 7; // ATG
+ return('M'); // Methionin = M
+ case 'C': *dna_number = 8; // ATC
+ return('I'); // Isoleucin = I
+ default: error("No regular aminoacid !");
+ }
+ case 'U': switch(third_base)
+ {
+ case 'A': *dna_number = 9; // AUA
+ return('I'); // Isoleucin = I
+ case 'U': *dna_number = 10; // AUU
+ return('I'); // Isoleucin = I
+ case 'G': *dna_number = 11; // AUG
+ return('M'); // Methionin= M
+ case 'C': *dna_number = 12; // AUC
+ return('I'); // Isoleucin = I
+ default: error("No regular aminoacid !");
+ }
+ case 'G': switch(third_base)
+ {
+ case 'A': *dna_number = 13; // AGA
+ return('R'); // Arginin = R
+ case 'T': *dna_number = 14; // AGT
+ return('S'); // Serin = S
+ case 'U': *dna_number = 15; // AGU
+ return('S'); // Serin = S
+ case 'G': *dna_number = 16; // AGG
+ return('R'); // Arginin = R
+ case 'C': *dna_number = 17; // AGC
+ return('S'); // Serin = S
+ default: error("No regular aminoacid !");
+ }
+ case 'C': switch(third_base)
+ {
+ case 'A': *dna_number = 18; // ACA
+ return('T'); // Threonin = T
+ case 'T': *dna_number = 19; // ACT
+ return('T'); // Threonin = T
+ case 'U': *dna_number = 20; // ACU
+ return('T'); // Threonin = T
+ case 'G': *dna_number = 21; // ACG
+ return('T'); // Threonin = T
+ case 'C': *dna_number = 22; // ACC
+ return('T'); // Threonin = T
+ default: error("No regular aminoacid !");
+ }
+
+
+ default: error("No regular aminoacid !");
+ }
+ case 'T': switch(second_base)
+ {
+ case 'A': switch(third_base)
+ {
+ case 'A': *dna_number = 23; // TAA
+ return('X'); // Stop
+ case 'T': *dna_number = 24; // TAT
+ return('Y'); // Tyrosin
+ case 'G': *dna_number = 25; // TAG
+ return('X'); // Stop
+ case 'C': *dna_number = 26; // TAC
+ return('Y'); // Tyrosin
+ default: error("No regular aminoacid !");
+ }
+ case 'T': switch(third_base)
+ {
+ case 'A': *dna_number = 27; // TTA
+ return('L'); // Leucin
+ case 'T': *dna_number = 28; // TTT
+ return('F'); // Phenylalanin
+ case 'G': *dna_number = 29; // TTG
+ return('L'); // Leucin
+ case 'C': *dna_number = 30; // TTC
+ return('F'); // Phenylalanin
+ default: error("No regular aminoacid !");
+ }
+ case 'G': switch(third_base)
+ {
+ case 'A': *dna_number = 31; // TGA
+ return('X'); // Stop
+ case 'T': *dna_number = 32; // TGT
+ return('C'); // Cystein
+ case 'G': *dna_number = 33; // TGG
+ return('W'); // Tryptophan
+ case 'C': *dna_number = 34; // TGC
+ return('C'); // Cystein
+ default: error("No regular aminoacid !");
+ }
+ case 'C': switch(third_base)
+ {
+ case 'A': *dna_number = 35; // TCA
+ return('S'); // Serin
+ case 'T': *dna_number = 36; // TCT
+ return('S'); // Serin
+ case 'G': *dna_number = 37; // TCG
+ return('S'); // Serin
+ case 'C': *dna_number = 38; // TCC
+ return('S'); // Serin
+ default: error("No regular aminoacid !");
+ }
+ default: error("no regular Aminoacid !");
+ }
+ case 'U': switch(second_base)
+ {
+ case 'A': switch(third_base)
+ {
+ case 'A': *dna_number = 39; // UAA
+ return('X'); // Stop
+ case 'U': *dna_number = 40; // UAU
+ return('Y'); // Tyrosin
+ case 'G': *dna_number = 41; // UAG
+ return('X'); // Stop
+ case 'C': *dna_number = 42; // UAC
+ return('Y'); // Tyrosin
+ default: error("No regular aminoacid !");
+ }
+ case 'U': switch(third_base)
+ {
+ case 'A': *dna_number = 43; // UUA
+ return('L'); // Leucin
+ case 'U': *dna_number = 44; // UUU
+ return('F'); // Phenylalanin
+ case 'G': *dna_number = 45; // UUG
+ return('L'); // Leucin
+ case 'C': *dna_number = 46; // UUC
+ return('F'); // Phenylalanin
+ default: error("No regular aminoacid !");
+ }
+ case 'G': switch(third_base)
+ {
+ case 'A': *dna_number = 47; // UGA
+ return('X'); // Stop
+ case 'U': *dna_number = 48; // UGU
+ return('C'); // Cystein
+ case 'G': *dna_number = 49; // UGG
+ return('W'); // Tryptophan
+ case 'C': *dna_number = 50; // UGC
+ return('C'); // Cystein
+ default: error("No regular aminoacid !");
+ }
+ case 'C': switch(third_base)
+ {
+ case 'A': *dna_number = 51; // UCA
+ return('S'); // Serin
+ case 'U': *dna_number = 52; // UCU
+ return('S'); // Serin
+ case 'G': *dna_number = 53; // UCG
+ return('S'); // Serin
+ case 'C': *dna_number = 54; // UCC
+ return('S'); // Serin
+ default: error("No regular aminoacid !");
+ }
+ default: error("no regular Aminoacid !");
+ }
+ case 'G': switch(second_base)
+ {
+ case 'A': switch(third_base)
+ {
+ case 'A': *dna_number = 55; // GAA
+ return('E'); // Glutaminsaeure
+ case 'T': *dna_number = 56; // GAT
+ return('D'); // Asparaginsaeure
+ case 'U': *dna_number = 57; // GAU
+ return('D'); // Asparaginsaeure
+ case 'G': *dna_number = 58; // GAG
+ return('E'); // Glutaminsaeure
+ case 'C': *dna_number = 59; // GAC
+ return('D'); // Asparaginsaeure
+ default: error("No regular aminoacid !");
+ }
+ case 'T': switch(third_base)
+ {
+ case 'A': *dna_number = 60; // GTA
+ return('V'); // Valin
+ case 'T': *dna_number = 61; // GTT
+ return('V'); // Valin
+ case 'G': *dna_number = 62; // GTG
+ return('V'); // Valin
+ case 'C': *dna_number = 63; // GTC
+ return('V'); // Valin
+ default: error("No regular aminoacid !");
+ }
+ case 'U': switch(third_base)
+ {
+ case 'A': *dna_number = 64; // GUA
+ return('V'); // Valin
+ case 'U': *dna_number = 65; // GUU
+ return('V'); // Valin
+ case 'G': *dna_number = 66; // GUG
+ return('V'); // Valin
+ case 'C': *dna_number = 67; // GUC
+ return('V'); // Valin
+ default: error("No regular aminoacid !");
+ }
+ case 'G': switch(third_base)
+ {
+ case 'A': *dna_number = 68; // GGA
+ return('G'); // Glycin
+ case 'T': *dna_number = 69; // GGT
+ return('G'); // Glycin
+ case 'U': *dna_number = 70; // GGU
+ return('G'); // Glycin
+ case 'G': *dna_number = 71; // GGG
+ return('G'); // Glycin
+ case 'C': *dna_number = 72; // GGC
+ return('G'); // Glycin
+ default: error("No regular aminoacid !");
+ }
+ case 'C': switch(third_base)
+ {
+ case 'A': *dna_number = 73; // GCA
+ return('A'); // Alanin
+ case 'T': *dna_number = 74; // GCT
+ return('A'); // Alanin
+ case 'U': *dna_number = 75; // GCU
+ return('A'); // Alanin
+ case 'G': *dna_number = 76; // GCG
+ return('A'); // Alanin
+ case 'C': *dna_number = 77; // GCC
+ return('A'); // Alanin
+ default: error("No regular aminoacid !");
+ }
+ default: error("No regular aminoacid !");
+ }
+ case 'C': switch(second_base)
+ {
+ case 'A': switch(third_base)
+ {
+ case 'A': *dna_number = 78; // CAA
+ return('Q'); // Glutamin
+ case 'T': *dna_number = 79; // CAT
+ return('H'); // Histidin
+ case 'U': *dna_number = 80; // CAU
+ return('H'); // Histidin
+ case 'G': *dna_number = 81; // CAG
+ return('Q'); // Glutamin
+ case 'C': *dna_number = 82; // CAC
+ return('H'); // Histidin
+ default: error("No regular aminoacid !");
+ }
+ case 'T': switch(third_base)
+ {
+ case 'A': *dna_number = 83; // CTA
+ return('L'); // Leucin
+ case 'T': *dna_number = 84; // CTT
+ return('L'); // Leucin
+ case 'G': *dna_number = 85; // CTG
+ return('L'); // Leucin
+ case 'C': *dna_number = 86; // CTC
+ return('L'); // Leucin
+ default: error("No regular aminoacid !");
+ }
+ case 'U': switch(third_base)
+ {
+ case 'A': *dna_number = 87; // CUA
+ return('L'); // Leucin
+ case 'U': *dna_number = 88; // CUU
+ return('L'); // Leucin
+ case 'G': *dna_number = 89; // CUG
+ return('L'); // Leucin
+ case 'C': *dna_number = 90; // CUC
+ return('L'); // Leucin
+ default: error("No regular aminoacid !");
+ }
+ case 'G': switch(third_base)
+ {
+ case 'A': *dna_number = 91; // CGA
+ return('R'); // Arginin
+ case 'T': *dna_number = 92; // CGT
+ return('R'); // Arginin
+ case 'U': *dna_number = 93; // CGU
+ return('R'); // Arginin
+ case 'G': *dna_number = 94; // CGG
+ return('R'); // Arginin
+ case 'C': *dna_number = 95; // CGC
+ return('R'); // Arginin
+ default: error("No regular aminoacid !");
+ }
+ case 'C': switch(third_base)
+ {
+ case 'A': *dna_number = 96; // CCA
+ return('P'); // Prolin
+ case 'T': *dna_number = 97; // CCT
+ return('P'); // Prolin
+ case 'U': *dna_number = 98; // CCU
+ return('P'); // Prolin
+ case 'G': *dna_number = 99; // CCG
+ return('P'); // Prolin
+ case 'C': *dna_number = 100; // CCC
+ return('P'); // Prolin
+ default: error("No regular aminoacid !");
+ }
+ default: error("No regular aminoacid !");
+ }
+ default: error("No regular aminoacid !");
+ }
+ abort();
+}
+
+char inverse(char base)
+{
+ switch(base)
+ {
+ case 'A': return('T');
+ case 'T': return('A');
+ case 'U': return('A');
+ case 'C': return('G');
+ case 'G': return('C');
+ }
+ abort();
+}
+
+void retranslate_sequence(struct seq *in_seq)
+{
+ char *tmp_char= "000";
+ int i;
+ struct seq* tmp;
+ if(NULL == ( tmp =(calloc(1,sizeof(struct seq)))))
+ {
+ error("retranslate_sequence(): Out of memory !");
+ }
+ if(NULL == ( tmp->data =(calloc((in_seq->length)*3+1,sizeof(char)))))
+ {
+ error("retranslate_sequence(): Out of memory !");
+ }
+
+ for(i=0; i!=in_seq->length; ++i)
+ {
+ tmp_char = retranslate(in_seq->dna_num[i]);
+ strcat(tmp->data,tmp_char);
+ }
+
+ in_seq->length = strlen(tmp->data);
+ free(in_seq->data);
+ free(in_seq->dna_num);
+ in_seq->data = tmp->data;
+}
+
+char* retranslate(char amino)
+{
+ switch(amino)
+ {
+ case 0: return "AAA";
+ case 1: return "AAT";
+ case 2: return "AAU";
+ case 3: return "AAG";
+ case 4: return "AAC";
+ case 5: return "ATA";
+ case 6: return "ATT";
+ case 7: return "ATG";
+ case 8: return "ATC";
+ case 9: return "AUA";
+ case 10: return "AUU";
+ case 11: return "AUG";
+ case 12: return "AUC";
+ case 13: return "AGA";
+ case 14: return "AGT";
+ case 15: return "AGU";
+ case 16: return "AGG";
+ case 17: return "AGC";
+ case 18: return "ACA";
+ case 19: return "ACT";
+ case 20: return "ACU";
+ case 21: return "ACG";
+ case 22: return "ACC";
+ case 23: return "TAA";
+ case 24: return "TAT";
+ case 25: return "TAG";
+ case 26: return "TAC";
+ case 27: return "TTA";
+ case 28: return "TTT";
+ case 29: return "TTG";
+ case 30: return "TTC";
+ case 31: return "TGA";
+ case 32: return "TGT";
+ case 33: return "TGG";
+ case 34: return "TGC";
+ case 35: return "TCA";
+ case 36: return "TCT";
+ case 37: return "TCG";
+ case 38: return "TCC";
+ case 39: return "UAA";
+ case 40: return "UAU";
+ case 41: return "UAG";
+ case 42: return "UAC";
+ case 43: return "UUA";
+ case 44: return "UUU";
+ case 45: return "UUG";
+ case 46: return "UUC";
+ case 47: return "UGA";
+ case 48: return "UGU";
+ case 49: return "UGG";
+ case 50: return "UGC";
+ case 51: return "UCA";
+ case 52: return "UCU";
+ case 53: return "UCG";
+ case 54: return "UCC";
+ case 55: return "GAA";
+ case 56: return "GAT";
+ case 57: return "GAU";
+ case 58: return "GAG";
+ case 59: return "GAC";
+ case 60: return "GTA";
+ case 61: return "GTT";
+ case 62: return "GTG";
+ case 63: return "GTC";
+ case 64: return "GUA";
+ case 65: return "GUU";
+ case 66: return "GUG";
+ case 67: return "GUC";
+ case 68: return "GGA";
+ case 69: return "GGT";
+ case 70: return "GGU";
+ case 71: return "GGG";
+ case 72: return "GGC";
+ case 73: return "GCA";
+ case 74: return "GCT";
+ case 75: return "GCU";
+ case 76: return "GCG";
+ case 77: return "GCC";
+ case 78: return "CAA";
+ case 79: return "CAT";
+ case 80: return "CAU";
+ case 81: return "CAG";
+ case 82: return "CAC";
+ case 83: return "CTA";
+ case 84: return "CTT";
+ case 85: return "CTG";
+ case 86: return "CTC";
+ case 87: return "CUA";
+ case 88: return "CUU";
+ case 89: return "CUG";
+ case 90: return "CUC";
+ case 91: return "CGA";
+ case 92: return "CGT";
+ case 93: return "CGU";
+ case 94: return "CGG";
+ case 95: return "CGC";
+ case 96: return "CCA";
+ case 97: return "CCT";
+ case 98: return "CCU";
+ case 99: return "CCG";
+ case 100: return "CCC";
+ default: error("Sorry something wrong while retranslation !");
+ }
+ abort();
+}
diff --git a/dialign/translate.h b/dialign/translate.h
new file mode 100644
index 0000000..938bdfb
--- /dev/null
+++ b/dialign/translate.h
@@ -0,0 +1,35 @@
+/**
+ *
+ * translate.h:
+ *
+ * 2004-08-30 Dorothea Emig Volker Menrad
+ *
+ */
+
+ /************************************************/
+ /* */
+ /* structs */
+ /* */
+ /************************************************/
+
+
+ /************************************************/
+ /* */
+ /* global variable */
+ /* */
+ /************************************************/
+
+ /*********************************************/
+ /* */
+ /* functions from translate.c */
+ /* */
+ /*********************************************/
+
+void translate_sequence_collection(struct seq_col *in_sequence_collection);
+void translate_sequence(struct seq *in_sequence);
+char translate(char first_base, char second_base, char third_base, char *dna_number);
+char inverse(char base);
+void retranslate_sequence(struct seq *in_sequence);
+char* retranslate(char amino);
+void translate_sequence_collection_orf_frame(struct seq_col *in_seq_col);
+void translate_sequence_collection_default(struct seq_col *in_seq_col);
diff --git a/doc/ABYSS.1 b/doc/ABYSS.1
new file mode 100644
index 0000000..d9c26eb
--- /dev/null
+++ b/doc/ABYSS.1
@@ -0,0 +1,86 @@
+.TH ABYSS "1" "2012-May" "ABYSS (ABySS) 1.3.4" "User Commands"
+.SH NAME
+ABYSS \- assemble short reads into contigs
+.SH SYNOPSIS
+.B ABYSS
+[\fIOPTION\fR]... \fIFILE\fR...
+.SH DESCRIPTION
+Assemble all input files, FILE, which may be in FASTA, FASTQ, qseq,
+export, SRA, SAM or BAM format and may be compressed with gz, bz2 or
+xz and may be tarred.
+.TP
+\fB--chastity\fR
+discard unchaste reads [default]
+.TP
+\fB--no-chastity\fR
+do not discard unchaste reads
+.TP
+\fB--trim-masked\fR
+trim masked bases from the ends of reads [default]
+.TP
+\fB--no-trim-masked\fR
+do not trim masked bases from the ends of reads
+.TP
+\fB-q\fR, \fB--trim-quality\fR=\fITHRESHOLD\fR
+trim bases from the ends of reads whose quality is less than the
+threshold
+.TP
+\fB--standard-quality\fR
+zero quality is `!' (33)
+.br
+default for FASTQ and SAM files
+.TP
+\fB--illumina-quality\fR
+zero quality is `@' (64)
+.br
+default for qseq and export files
+.TP
+\fB\-o\fR, \fB\-\-out\fR=\fIFILE\fR
+write the contigs to FILE
+.TP
+\fB\-k\fR, \fB\-\-kmer\fR=\fIKMER_SIZE\fR
+k\-mer size
+.TP
+\fB\-t\fR, \fB\-\-trim\-length\fR=\fITRIM_LENGTH\fR
+maximum length of dangling edges to trim
+.TP
+\fB\-c\fR, \fB\-\-coverage\fR=\fICOVERAGE\fR
+remove contigs with mean k-mer coverage less than this threshold
+.TP
+\fB\-b\fR, \fB\-\-bubbles\fR=\fIN\fR
+pop bubbles shorter than N bp (default: 3*k).
+.TP
+\fB\-b\fR0, \fB\-\-no\-bubbles\fR
+do not pop bubbles
+.TP
+\fB\-e\fR, \fB\-\-erode\fR=\fICOVERAGE\fR
+erode bases at the ends of blunt contigs with coverage less than this
+threshold
+.TP
+\fB\-E\fR, \fB\-\-erode-strand\fR=\fICOVERAGE\fR
+erode bases at the ends of blunt contigs with coverage less than this
+threshold on either strand
+.TP
+\fB\-\-coverage-hist\fR=\fIFILE\fR
+record the k-mer coverage histogram in FILE
+.TP
+\fB\-g\fR, \fB\-\-graph\fR=\fIFILE\fR
+generate a graph in dot format
+.TP
+\fB\-s\fR, \fB\-\-snp\fR=\fIFILE\fR
+record popped bubbles in FILE
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+display verbose output
+.TP
+\fB\-\-help\fR
+display this help and exit
+.TP
+\fB\-\-version\fR
+output version information and exit
+.SH AUTHOR
+Written by Jared Simpson and Shaun Jackman.
+.SH "REPORTING BUGS"
+Report bugs to <abyss-users at bcgsc.ca>.
+.SH COPYRIGHT
+Copyright 2012 Canada's Michael Smith Genome Science Centre
diff --git a/doc/Makefile.am b/doc/Makefile.am
new file mode 100644
index 0000000..add4805
--- /dev/null
+++ b/doc/Makefile.am
@@ -0,0 +1,2 @@
+dist_man_MANS = ABYSS.1 abyss-pe.1 abyss-tofastq.1
+dist_doc_DATA = flowchart.pdf
diff --git a/doc/Makefile.in b/doc/Makefile.in
new file mode 100644
index 0000000..1831227
--- /dev/null
+++ b/doc/Makefile.in
@@ -0,0 +1,471 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+subdir = doc
+DIST_COMMON = $(dist_doc_DATA) $(dist_man_MANS) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
+am__vpath_adj = case $$p in \
+ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
+ *) f=$$p;; \
+ esac;
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+ test -z "$$files" \
+ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+ $(am__cd) "$$dir" && rm -f $$files; }; \
+ }
+man1dir = $(mandir)/man1
+am__installdirs = "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"
+NROFF = nroff
+MANS = $(dist_man_MANS)
+DATA = $(dist_doc_DATA)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+dist_man_MANS = ABYSS.1 abyss-pe.1 abyss-tofastq.1
+dist_doc_DATA = flowchart.pdf
+all: all-am
+
+.SUFFIXES:
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign doc/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+install-man1: $(dist_man_MANS)
+ @$(NORMAL_INSTALL)
+ @list1=''; \
+ list2='$(dist_man_MANS)'; \
+ test -n "$(man1dir)" \
+ && test -n "`echo $$list1$$list2`" \
+ || exit 0; \
+ echo " $(MKDIR_P) '$(DESTDIR)$(man1dir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(man1dir)" || exit 1; \
+ { for i in $$list1; do echo "$$i"; done; \
+ if test -n "$$list2"; then \
+ for i in $$list2; do echo "$$i"; done \
+ | sed -n '/\.1[a-z]*$$/p'; \
+ fi; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man1dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man1dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man1dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man1dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man1:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man1dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.1[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
+install-dist_docDATA: $(dist_doc_DATA)
+ @$(NORMAL_INSTALL)
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ if test -n "$$list"; then \
+ echo " $(MKDIR_P) '$(DESTDIR)$(docdir)'"; \
+ $(MKDIR_P) "$(DESTDIR)$(docdir)" || exit 1; \
+ fi; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
+ done
+
+uninstall-dist_docDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
+tags: TAGS
+TAGS:
+
+ctags: CTAGS
+CTAGS:
+
+cscope cscopelist:
+
+
+distdir: $(DISTFILES)
+ @list='$(MANS)'; if test -n "$$list"; then \
+ list=`for p in $$list; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+ if test -n "$$list" && \
+ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+ echo "error: found man pages containing the 'missing help2man' replacement text:" >&2; \
+ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
+ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+ echo " typically 'make maintainer-clean' will remove them" >&2; \
+ exit 1; \
+ else :; fi; \
+ else :; fi
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(MANS) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(man1dir)" "$(DESTDIR)$(docdir)"; do \
+ test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ done
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-generic
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-dist_docDATA install-man
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man1
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-dist_docDATA uninstall-man
+
+uninstall-man: uninstall-man1
+
+.MAKE: install-am install-strip
+
+.PHONY: all all-am check check-am clean clean-generic distclean \
+ distclean-generic distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-dist_docDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-man1 install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
+ pdf-am ps ps-am uninstall uninstall-am uninstall-dist_docDATA \
+ uninstall-man uninstall-man1
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/doc/abyss-pe.1 b/doc/abyss-pe.1
new file mode 100644
index 0000000..424ef36
--- /dev/null
+++ b/doc/abyss-pe.1
@@ -0,0 +1,224 @@
+.TH abyss-pe "1" "2012-May" "abyss-pe (ABySS) 1.3.4" "User Commands"
+.SH NAME
+abyss-pe - assemble reads into contigs
+.SH SYNOPSIS
+.B abyss-pe
+[\fIOPTION\fR]... [\fIPARAMETER\fR=\fIVALUE\fR]...
+.SH DESCRIPTION
+Assemble the reads of the input files into contigs. The reads may be
+in FASTA, FASTQ, qseq, export, SRA, SAM or BAM format and may be
+compressed with gz, bz2 or xz and may be tarred.
+
+abyss-pe is a Makefile script. Any options of make may also be used
+with abyss-pe.
+
+.SS "Parameters of abyss-pe"
+.TP
+\fBname\fR, \fBJOB_NAME\fR
+The name of this assembly. The resulting scaffolds will be stored in
+${name}-scaffolds.fa.
+.TP
+.B in
+input files. Use this variable when assembling data from a single
+library.
+.TP
+.B lib
+list of paired-end libraries. Use this varible when assembling data
+from multiple fragment libraries. For each library in lib, a variable
+with the same name must specify the files containing those reads.
+.TP
+.B pe
+list of paired-end libraries that will be used only for merging
+unitigs into contigs and will not contribute toward the consensus
+sequence.
+.TP
+.B mp
+list of mate-pair libraries that will be used for scaffolding.
+Mate-pair libraries do not contribute toward the consensus sequence.
+.TP
+.B se
+files containing single-end reads
+.TP
+.B a
+maximum number of branches of a bubble [2]
+.TP
+.B b
+maximum length of a bubble (bp) [10000]
+.TP
+.B c
+minimum mean k-mer coverage of a unitig [sqrt(median)]
+.TP
+.B d
+allowable error of a distance estimate (bp) [6]
+.TP
+.B e
+minimum erosion k-mer coverage [sqrt(median)]
+.TP
+.B E
+minimum erosion k-mer coverage per strand [1]
+.TP
+.B j
+number of threads [2]
+.TP
+.B k
+size of k-mer (bp)
+.TP
+.B l
+minimum alignment length of a read (bp) [k]
+.TP
+.B m
+minimum overlap of two unitigs (bp) [30]
+.TP
+.B n
+minimum number of pairs required for building contigs [10]
+.TP
+.B N
+minimum number of pairs required for building scaffolds [n]
+.TP
+.B p
+minimum sequence identity of a bubble [0.9]
+.TP
+.B q
+minimum base quality [3]
+.br
+Trim bases from the ends of reads whose quality is less q.
+.TP
+.B s
+minimum unitig size required for building contigs (bp) [200]
+.br
+The seed length should be at least twice the value of k. If more
+sequence is assembled than the expected genome size, try increasing s.
+.TP
+.B S
+minimum contig size required for building scaffolds (bp) [s]
+.TP
+.B t
+minimum tip size (bp) [2k]
+.TP
+.B v
+v=-v to enable verbose logging
+.TP
+\fBnp\fR, \fBNSLOTS\fR
+the number of processes of an MPI assembly
+.TP
+.B mpirun
+the path to mpirun
+.TP
+.B aligner
+the program to use to align the reads to the contigs [map]
+.br
+map, kaligner, bwa, bwasw, bowtie or bowtie2
+.TP
+.B cs
+convert colour-space contigs to nucleotide contigs following assembly
+.SS "Options of make"
+.TP
+\fB-n\fR, \fB--dry-run\fR
+Print the commands that would be executed, but do not execute them.
+.SS "Commands of abyss-pe"
+.TP
+.B default
+Equivalent to `scaffolds scaffolds-dot stats'.
+.TP
+.B unitigs
+Assemble unitigs.
+.TP
+.B unitigs-dot
+Output the unitig overlap graph.
+.TP
+.B pe-sam
+Map paired-end reads to the unitigs and output a SAM file.
+.TP
+.B pe-bam
+Map paired-end reads to the unitigs and output a BAM file.
+.TP
+.B pe-index
+Generate an index of the unitigs used by abyss-map.
+.TP
+.B contigs
+Assemble contigs.
+.TP
+.B contigs-dot
+Output the contig overlap graph.
+.TP
+.B mp-sam
+Map mate-pair reads to the contigs and output a SAM file.
+.TP
+.B mp-bam
+Map mate-pair reads to the contigs and output a BAM file.
+.TP
+.B mp-index
+Generate an index of the contigs used by abyss-map.
+.TP
+.B scaffolds
+Assemble scaffolds.
+.TP
+.B scaffolds-dot
+Output the scaffold overlap graph.
+.TP
+.B stats
+Display assembly contiguity statistics.
+.TP
+.B clean
+Remove intermediate files.
+.TP
+.B version
+Display the version of abyss-pe.
+.TP
+.B versions
+Display the versions of all programs used by abyss-pe.
+.TP
+.B help
+Display a helpful message.
+
+.SH "ENVIRONMENT VARIABLES"
+Any parameter that may be specified on the command line may also be
+specified in an environment variable.
+.TP
+.B PATH
+must contain the directory where the ABySS executables are installed.
+Use `abyss-pe versions` to check that PATH is configured correctly.
+.TP
+.B TMPDIR
+specifies a directory to use for temporary files
+.SS "Scheduler integration"
+ABySS integrates well with cluster job schedulers, such as:
+ * SGE (Sun Grid Engine)
+ * Portable Batch System (PBS)
+ * Load Sharing Facility (LSF)
+ * IBM LoadLeveler
+
+The SGE environment variables JOB_NAME, SGE_TASK_ID and NSLOTS may be
+used to specify the parameters name, k and np, respectively, and
+similarly for other schedulers.
+.SH EXAMPLES
+.SS "One paired-end library"
+ abyss-pe k=64 name=ecoli in='reads1.fa reads2.fa'
+.SS "Multiple paired-end libraries"
+ abyss-pe k=64 name=ecoli lib='lib1 lib2' \\
+.br
+ lib1='lib1_1.fa lib1_2.fa' lib2='lib2_1.fa lib2_2.fa' \\
+.br
+ se='se1.fa se2.fa'
+.SS "Paired-end and mate-pair libraries
+ abyss-pe k=64 name=ecoli lib='pe1 pe2' mp='mp1 mp2' \\
+.br
+ pe1='pe1_1.fa pe1_2.fa' pe2='pe2_1.fa pe2_2.fa' \\
+.br
+ mp1='mp1_1.fa mp1_2.fa' mp2='mp2_1.fa mp2_2.fa' \\
+.br
+ se='se1.fa se2.fa'
+.SS MPI
+ abyss-pe np=8 k=64 name=ecoli in='reads1.fa reads2.fa'
+.SS SGE
+ qsub -N ecoli -t 64 -pe openmpi 8 \\
+.br
+ abyss-pe n=10 in='reads1.fa reads2.fa'
+.SH "SEE ALSO"
+make(1), ABYSS(1)
+.SH AUTHOR
+Written by Shaun Jackman.
+.SH "REPORTING BUGS"
+Report bugs to <abyss-users at googlegroups.com>.
+.SH COPYRIGHT
+Copyright 2012 Canada's Michael Smith Genome Science Centre
diff --git a/doc/abyss-tofastq.1 b/doc/abyss-tofastq.1
new file mode 100644
index 0000000..97cbb27
--- /dev/null
+++ b/doc/abyss-tofastq.1
@@ -0,0 +1,21 @@
+.TH abyss-tofastq "1" "2012-May" "ABySS 1.3.4" "User Commands"
+.SH NAME
+abyss-tofastq \- convert various file formats to FASTQ format
+.br
+abyss-tofasta \- convert various file formats to FASTA format
+.SH SYNOPSIS
+\fBabyss-tofastq\fR [\fIFILE\fR]...
+.br
+or
+.br
+\fBabyss-tofasta\fR [\fIFILE\fR]...
+.SH DESCRIPTION
+Convert the input files to FASTA or FASTQ format. FILE may be in
+FASTA, FASTQ, qseq, export, SRA, SAM or BAM format and may be
+compressed with gz, bz2 or xz and may be tarred.
+.SH AUTHOR
+Written by Shaun Jackman.
+.SH "REPORTING BUGS"
+Report bugs to <abyss-users at bcgsc.ca>.
+.SH COPYRIGHT
+Copyright 2012 Canada's Michael Smith Genome Science Centre
diff --git a/doc/flowchart.pdf b/doc/flowchart.pdf
new file mode 100644
index 0000000..1dac27f
Binary files /dev/null and b/doc/flowchart.pdf differ
diff --git a/doxygen.conf b/doxygen.conf
new file mode 100644
index 0000000..9f08a71
--- /dev/null
+++ b/doxygen.conf
@@ -0,0 +1,1252 @@
+# Doxyfile 1.4.7
+
+# This file describes the settings to be used by the documentation system
+# doxygen (www.doxygen.org) for a project
+#
+# All text after a hash (#) is considered a comment and will be ignored
+# The format is:
+# TAG = value [value, ...]
+# For lists items can also be appended using:
+# TAG += value [value, ...]
+# Values that contain spaces should be placed between quotes (" ")
+
+#---------------------------------------------------------------------------
+# Project related configuration options
+#---------------------------------------------------------------------------
+
+# The PROJECT_NAME tag is a single word (or a sequence of words surrounded
+# by quotes) that should identify the project.
+
+PROJECT_NAME = ABySS
+
+# The PROJECT_NUMBER tag can be used to enter a project or revision number.
+# This could be handy for archiving the generated documentation or
+# if some version control system is used.
+
+PROJECT_NUMBER =
+
+# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
+# base path where the generated documentation will be put.
+# If a relative path is entered, it will be relative to the location
+# where doxygen was started. If left blank the current directory will be used.
+
+OUTPUT_DIRECTORY =
+
+# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create
+# 4096 sub-directories (in 2 levels) under the output directory of each output
+# format and will distribute the generated files over these directories.
+# Enabling this option can be useful when feeding doxygen a huge amount of
+# source files, where putting all generated files in the same directory would
+# otherwise cause performance problems for the file system.
+
+CREATE_SUBDIRS = NO
+
+# The OUTPUT_LANGUAGE tag is used to specify the language in which all
+# documentation generated by doxygen is written. Doxygen will use this
+# information to generate all constant output in the proper language.
+# The default language is English, other supported languages are:
+# Brazilian, Catalan, Chinese, Chinese-Traditional, Croatian, Czech, Danish,
+# Dutch, Finnish, French, German, Greek, Hungarian, Italian, Japanese,
+# Japanese-en (Japanese with English messages), Korean, Korean-en, Norwegian,
+# Polish, Portuguese, Romanian, Russian, Serbian, Slovak, Slovene, Spanish,
+# Swedish, and Ukrainian.
+
+OUTPUT_LANGUAGE = English
+
+# This tag can be used to specify the encoding used in the generated output.
+# The encoding is not always determined by the language that is chosen,
+# but also whether or not the output is meant for Windows or non-Windows users.
+# In case there is a difference, setting the USE_WINDOWS_ENCODING tag to YES
+# forces the Windows encoding (this is the default for the Windows binary),
+# whereas setting the tag to NO uses a Unix-style encoding (the default for
+# all platforms other than Windows).
+
+USE_WINDOWS_ENCODING = NO
+
+# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will
+# include brief member descriptions after the members that are listed in
+# the file and class documentation (similar to JavaDoc).
+# Set to NO to disable this.
+
+BRIEF_MEMBER_DESC = YES
+
+# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend
+# the brief description of a member or function before the detailed description.
+# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
+# brief descriptions will be completely suppressed.
+
+REPEAT_BRIEF = YES
+
+# This tag implements a quasi-intelligent brief description abbreviator
+# that is used to form the text in various listings. Each string
+# in this list, if found as the leading text of the brief description, will be
+# stripped from the text and the result after processing the whole list, is
+# used as the annotated text. Otherwise, the brief description is used as-is.
+# If left blank, the following values are used ("$name" is automatically
+# replaced with the name of the entity): "The $name class" "The $name widget"
+# "The $name file" "is" "provides" "specifies" "contains"
+# "represents" "a" "an" "the"
+
+ABBREVIATE_BRIEF =
+
+# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
+# Doxygen will generate a detailed section even if there is only a brief
+# description.
+
+ALWAYS_DETAILED_SEC = NO
+
+# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
+# inherited members of a class in the documentation of that class as if those
+# members were ordinary class members. Constructors, destructors and assignment
+# operators of the base classes will not be shown.
+
+INLINE_INHERITED_MEMB = NO
+
+# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full
+# path before files name in the file list and in the header files. If set
+# to NO the shortest path that makes the file name unique will be used.
+
+FULL_PATH_NAMES = YES
+
+# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag
+# can be used to strip a user-defined part of the path. Stripping is
+# only done if one of the specified strings matches the left-hand part of
+# the path. The tag can be used to show relative paths in the file list.
+# If left blank the directory from which doxygen is run is used as the
+# path to strip.
+
+STRIP_FROM_PATH =
+
+# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of
+# the path mentioned in the documentation of a class, which tells
+# the reader which header file to include in order to use a class.
+# If left blank only the name of the header file containing the class
+# definition is used. Otherwise one should specify the include paths that
+# are normally passed to the compiler using the -I flag.
+
+STRIP_FROM_INC_PATH =
+
+# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter
+# (but less readable) file names. This can be useful is your file systems
+# doesn't support long names like on DOS, Mac, or CD-ROM.
+
+SHORT_NAMES = NO
+
+# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen
+# will interpret the first line (until the first dot) of a JavaDoc-style
+# comment as the brief description. If set to NO, the JavaDoc
+# comments will behave just like the Qt-style comments (thus requiring an
+# explicit @brief command for a brief description.
+
+JAVADOC_AUTOBRIEF = YES
+
+# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen
+# treat a multi-line C++ special comment block (i.e. a block of //! or ///
+# comments) as a brief description. This used to be the default behaviour.
+# The new default is to treat a multi-line C++ comment block as a detailed
+# description. Set this tag to YES if you prefer the old behaviour instead.
+
+MULTILINE_CPP_IS_BRIEF = NO
+
+# If the DETAILS_AT_TOP tag is set to YES then Doxygen
+# will output the detailed description near the top, like JavaDoc.
+# If set to NO, the detailed description appears after the member
+# documentation.
+
+DETAILS_AT_TOP = NO
+
+# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented
+# member inherits the documentation from any documented member that it
+# re-implements.
+
+INHERIT_DOCS = YES
+
+# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce
+# a new page for each member. If set to NO, the documentation of a member will
+# be part of the file/class/namespace that contains it.
+
+SEPARATE_MEMBER_PAGES = NO
+
+# The TAB_SIZE tag can be used to set the number of spaces in a tab.
+# Doxygen uses this value to replace tabs by spaces in code fragments.
+
+TAB_SIZE = 4
+
+# This tag can be used to specify a number of aliases that acts
+# as commands in the documentation. An alias has the form "name=value".
+# For example adding "sideeffect=\par Side Effects:\n" will allow you to
+# put the command \sideeffect (or @sideeffect) in the documentation, which
+# will result in a user-defined paragraph with heading "Side Effects:".
+# You can put \n's in the value part of an alias to insert newlines.
+
+ALIASES =
+
+# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C
+# sources only. Doxygen will then generate output that is more tailored for C.
+# For instance, some of the names that are used will be different. The list
+# of all members will be omitted, etc.
+
+OPTIMIZE_OUTPUT_FOR_C = NO
+
+# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java
+# sources only. Doxygen will then generate output that is more tailored for Java.
+# For instance, namespaces will be presented as packages, qualified scopes
+# will look different, etc.
+
+OPTIMIZE_OUTPUT_JAVA = NO
+
+# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want to
+# include (a tag file for) the STL sources as input, then you should
+# set this tag to YES in order to let doxygen match functions declarations and
+# definitions whose arguments contain STL classes (e.g. func(std::string); v.s.
+# func(std::string) {}). This also make the inheritance and collaboration
+# diagrams that involve STL classes more complete and accurate.
+
+BUILTIN_STL_SUPPORT = YES
+
+# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
+# tag is set to YES, then doxygen will reuse the documentation of the first
+# member in the group (if any) for the other members of the group. By default
+# all members of a group must be documented explicitly.
+
+DISTRIBUTE_GROUP_DOC = NO
+
+# Set the SUBGROUPING tag to YES (the default) to allow class member groups of
+# the same type (for instance a group of public functions) to be put as a
+# subgroup of that type (e.g. under the Public Functions section). Set it to
+# NO to prevent subgrouping. Alternatively, this can be done per class using
+# the \nosubgrouping command.
+
+SUBGROUPING = YES
+
+#---------------------------------------------------------------------------
+# Build related configuration options
+#---------------------------------------------------------------------------
+
+# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in
+# documentation are documented, even if no documentation was available.
+# Private class members and static file members will be hidden unless
+# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES
+
+EXTRACT_ALL = NO
+
+# If the EXTRACT_PRIVATE tag is set to YES all private members of a class
+# will be included in the documentation.
+
+EXTRACT_PRIVATE = NO
+
+# If the EXTRACT_STATIC tag is set to YES all static members of a file
+# will be included in the documentation.
+
+EXTRACT_STATIC = NO
+
+# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs)
+# defined locally in source files will be included in the documentation.
+# If set to NO only classes defined in header files are included.
+
+EXTRACT_LOCAL_CLASSES = YES
+
+# This flag is only useful for Objective-C code. When set to YES local
+# methods, which are defined in the implementation section but not in
+# the interface are included in the documentation.
+# If set to NO (the default) only methods in the interface are included.
+
+EXTRACT_LOCAL_METHODS = NO
+
+# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all
+# undocumented members of documented classes, files or namespaces.
+# If set to NO (the default) these members will be included in the
+# various overviews, but no documentation section is generated.
+# This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_MEMBERS = NO
+
+# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all
+# undocumented classes that are normally visible in the class hierarchy.
+# If set to NO (the default) these classes will be included in the various
+# overviews. This option has no effect if EXTRACT_ALL is enabled.
+
+HIDE_UNDOC_CLASSES = NO
+
+# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all
+# friend (class|struct|union) declarations.
+# If set to NO (the default) these declarations will be included in the
+# documentation.
+
+HIDE_FRIEND_COMPOUNDS = NO
+
+# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any
+# documentation blocks found inside the body of a function.
+# If set to NO (the default) these blocks will be appended to the
+# function's detailed documentation block.
+
+HIDE_IN_BODY_DOCS = NO
+
+# The INTERNAL_DOCS tag determines if documentation
+# that is typed after a \internal command is included. If the tag is set
+# to NO (the default) then the documentation will be excluded.
+# Set it to YES to include the internal documentation.
+
+INTERNAL_DOCS = NO
+
+# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate
+# file names in lower-case letters. If set to YES upper-case letters are also
+# allowed. This is useful if you have classes or files whose names only differ
+# in case and if your file system supports case sensitive file names. Windows
+# and Mac users are advised to set this option to NO.
+
+CASE_SENSE_NAMES = YES
+
+# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen
+# will show members with their full class and namespace scopes in the
+# documentation. If set to YES the scope will be hidden.
+
+HIDE_SCOPE_NAMES = NO
+
+# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen
+# will put a list of the files that are included by a file in the documentation
+# of that file.
+
+SHOW_INCLUDE_FILES = YES
+
+# If the INLINE_INFO tag is set to YES (the default) then a tag [inline]
+# is inserted in the documentation for inline members.
+
+INLINE_INFO = YES
+
+# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen
+# will sort the (detailed) documentation of file and class members
+# alphabetically by member name. If set to NO the members will appear in
+# declaration order.
+
+SORT_MEMBER_DOCS = YES
+
+# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the
+# brief documentation of file, namespace and class members alphabetically
+# by member name. If set to NO (the default) the members will appear in
+# declaration order.
+
+SORT_BRIEF_DOCS = NO
+
+# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be
+# sorted by fully-qualified names, including namespaces. If set to
+# NO (the default), the class list will be sorted only by class name,
+# not including the namespace part.
+# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
+# Note: This option applies only to the class list, not to the
+# alphabetical list.
+
+SORT_BY_SCOPE_NAME = NO
+
+# The GENERATE_TODOLIST tag can be used to enable (YES) or
+# disable (NO) the todo list. This list is created by putting \todo
+# commands in the documentation.
+
+GENERATE_TODOLIST = YES
+
+# The GENERATE_TESTLIST tag can be used to enable (YES) or
+# disable (NO) the test list. This list is created by putting \test
+# commands in the documentation.
+
+GENERATE_TESTLIST = YES
+
+# The GENERATE_BUGLIST tag can be used to enable (YES) or
+# disable (NO) the bug list. This list is created by putting \bug
+# commands in the documentation.
+
+GENERATE_BUGLIST = YES
+
+# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or
+# disable (NO) the deprecated list. This list is created by putting
+# \deprecated commands in the documentation.
+
+GENERATE_DEPRECATEDLIST= YES
+
+# The ENABLED_SECTIONS tag can be used to enable conditional
+# documentation sections, marked by \if sectionname ... \endif.
+
+ENABLED_SECTIONS =
+
+# The MAX_INITIALIZER_LINES tag determines the maximum number of lines
+# the initial value of a variable or define consists of for it to appear in
+# the documentation. If the initializer consists of more lines than specified
+# here it will be hidden. Use a value of 0 to hide initializers completely.
+# The appearance of the initializer of individual variables and defines in the
+# documentation can be controlled using \showinitializer or \hideinitializer
+# command in the documentation regardless of this setting.
+
+MAX_INITIALIZER_LINES = 30
+
+# Set the SHOW_USED_FILES tag to NO to disable the list of files generated
+# at the bottom of the documentation of classes and structs. If set to YES the
+# list will mention the files that were used to generate the documentation.
+
+SHOW_USED_FILES = YES
+
+# If the sources in your project are distributed over multiple directories
+# then setting the SHOW_DIRECTORIES tag to YES will show the directory hierarchy
+# in the documentation. The default is NO.
+
+SHOW_DIRECTORIES = NO
+
+# The FILE_VERSION_FILTER tag can be used to specify a program or script that
+# doxygen should invoke to get the current version for each file (typically from the
+# version control system). Doxygen will invoke the program by executing (via
+# popen()) the command <command> <input-file>, where <command> is the value of
+# the FILE_VERSION_FILTER tag, and <input-file> is the name of an input file
+# provided by doxygen. Whatever the program writes to standard output
+# is used as the file version. See the manual for examples.
+
+FILE_VERSION_FILTER =
+
+#---------------------------------------------------------------------------
+# configuration options related to warning and progress messages
+#---------------------------------------------------------------------------
+
+# The QUIET tag can be used to turn on/off the messages that are generated
+# by doxygen. Possible values are YES and NO. If left blank NO is used.
+
+QUIET = NO
+
+# The WARNINGS tag can be used to turn on/off the warning messages that are
+# generated by doxygen. Possible values are YES and NO. If left blank
+# NO is used.
+
+WARNINGS = YES
+
+# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings
+# for undocumented members. If EXTRACT_ALL is set to YES then this flag will
+# automatically be disabled.
+
+WARN_IF_UNDOCUMENTED = YES
+
+# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for
+# potential errors in the documentation, such as not documenting some
+# parameters in a documented function, or documenting parameters that
+# don't exist or using markup commands wrongly.
+
+WARN_IF_DOC_ERROR = YES
+
+# This WARN_NO_PARAMDOC option can be abled to get warnings for
+# functions that are documented, but have no documentation for their parameters
+# or return value. If set to NO (the default) doxygen will only warn about
+# wrong or incomplete parameter documentation, but not about the absence of
+# documentation.
+
+WARN_NO_PARAMDOC = NO
+
+# The WARN_FORMAT tag determines the format of the warning messages that
+# doxygen can produce. The string should contain the $file, $line, and $text
+# tags, which will be replaced by the file and line number from which the
+# warning originated and the warning text. Optionally the format may contain
+# $version, which will be replaced by the version of the file (if it could
+# be obtained via FILE_VERSION_FILTER)
+
+WARN_FORMAT = "$file:$line: $text"
+
+# The WARN_LOGFILE tag can be used to specify a file to which warning
+# and error messages should be written. If left blank the output is written
+# to stderr.
+
+WARN_LOGFILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the input files
+#---------------------------------------------------------------------------
+
+# The INPUT tag can be used to specify the files and/or directories that contain
+# documented source files. You may enter file names like "myfile.cpp" or
+# directories like "/usr/src/myproject". Separate the files or directories
+# with spaces.
+
+INPUT =
+
+# If the value of the INPUT tag contains directories, you can use the
+# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank the following patterns are tested:
+# *.c *.cc *.cxx *.cpp *.c++ *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh *.hxx
+# *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.py
+
+FILE_PATTERNS =
+
+# The RECURSIVE tag can be used to turn specify whether or not subdirectories
+# should be searched for input files as well. Possible values are YES and NO.
+# If left blank NO is used.
+
+RECURSIVE = YES
+
+# The EXCLUDE tag can be used to specify files and/or directories that should
+# excluded from the INPUT source files. This way you can easily exclude a
+# subdirectory from a directory tree whose root is specified with the INPUT tag.
+
+EXCLUDE =
+
+# The EXCLUDE_SYMLINKS tag can be used select whether or not files or
+# directories that are symbolic links (a Unix filesystem feature) are excluded
+# from the input.
+
+EXCLUDE_SYMLINKS = NO
+
+# If the value of the INPUT tag contains directories, you can use the
+# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
+# certain files from those directories. Note that the wildcards are matched
+# against the file with absolute path, so to exclude all test directories
+# for example use the pattern */test/*
+
+EXCLUDE_PATTERNS =
+
+# The EXAMPLE_PATH tag can be used to specify one or more files or
+# directories that contain example code fragments that are included (see
+# the \include command).
+
+EXAMPLE_PATH =
+
+# If the value of the EXAMPLE_PATH tag contains directories, you can use the
+# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp
+# and *.h) to filter out the source-files in the directories. If left
+# blank all files are included.
+
+EXAMPLE_PATTERNS =
+
+# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
+# searched for input files to be used with the \include or \dontinclude
+# commands irrespective of the value of the RECURSIVE tag.
+# Possible values are YES and NO. If left blank NO is used.
+
+EXAMPLE_RECURSIVE = NO
+
+# The IMAGE_PATH tag can be used to specify one or more files or
+# directories that contain image that are included in the documentation (see
+# the \image command).
+
+IMAGE_PATH =
+
+# The INPUT_FILTER tag can be used to specify a program that doxygen should
+# invoke to filter for each input file. Doxygen will invoke the filter program
+# by executing (via popen()) the command <filter> <input-file>, where <filter>
+# is the value of the INPUT_FILTER tag, and <input-file> is the name of an
+# input file. Doxygen will then use the output that the filter program writes
+# to standard output. If FILTER_PATTERNS is specified, this tag will be
+# ignored.
+
+INPUT_FILTER =
+
+# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
+# basis. Doxygen will compare the file name with each pattern and apply the
+# filter if there is a match. The filters are a list of the form:
+# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further
+# info on how filters are used. If FILTER_PATTERNS is empty, INPUT_FILTER
+# is applied to all files.
+
+FILTER_PATTERNS =
+
+# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
+# INPUT_FILTER) will be used to filter the input files when producing source
+# files to browse (i.e. when SOURCE_BROWSER is set to YES).
+
+FILTER_SOURCE_FILES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to source browsing
+#---------------------------------------------------------------------------
+
+# If the SOURCE_BROWSER tag is set to YES then a list of source files will
+# be generated. Documented entities will be cross-referenced with these sources.
+# Note: To get rid of all source code in the generated output, make sure also
+# VERBATIM_HEADERS is set to NO.
+
+SOURCE_BROWSER = NO
+
+# Setting the INLINE_SOURCES tag to YES will include the body
+# of functions and classes directly in the documentation.
+
+INLINE_SOURCES = NO
+
+# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct
+# doxygen to hide any special comment blocks from generated source code
+# fragments. Normal C and C++ comments will always remain visible.
+
+STRIP_CODE_COMMENTS = YES
+
+# If the REFERENCED_BY_RELATION tag is set to YES (the default)
+# then for each documented function all documented
+# functions referencing it will be listed.
+
+REFERENCED_BY_RELATION = YES
+
+# If the REFERENCES_RELATION tag is set to YES (the default)
+# then for each documented function all documented entities
+# called/used by that function will be listed.
+
+REFERENCES_RELATION = YES
+
+# If the REFERENCES_LINK_SOURCE tag is set to YES (the default)
+# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from
+# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will
+# link to the source code. Otherwise they will link to the documentstion.
+
+REFERENCES_LINK_SOURCE = YES
+
+# If the USE_HTAGS tag is set to YES then the references to source code
+# will point to the HTML generated by the htags(1) tool instead of doxygen
+# built-in source browser. The htags tool is part of GNU's global source
+# tagging system (see http://www.gnu.org/software/global/global.html). You
+# will need version 4.8.6 or higher.
+
+USE_HTAGS = NO
+
+# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen
+# will generate a verbatim copy of the header file for each class for
+# which an include is specified. Set to NO to disable this.
+
+VERBATIM_HEADERS = YES
+
+#---------------------------------------------------------------------------
+# configuration options related to the alphabetical class index
+#---------------------------------------------------------------------------
+
+# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index
+# of all compounds will be generated. Enable this if the project
+# contains a lot of classes, structs, unions or interfaces.
+
+ALPHABETICAL_INDEX = NO
+
+# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then
+# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns
+# in which this list will be split (can be a number in the range [1..20])
+
+COLS_IN_ALPHA_INDEX = 5
+
+# In case all classes in a project start with a common prefix, all
+# classes will be put under the same header in the alphabetical index.
+# The IGNORE_PREFIX tag can be used to specify one or more prefixes that
+# should be ignored while generating the index headers.
+
+IGNORE_PREFIX =
+
+#---------------------------------------------------------------------------
+# configuration options related to the HTML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_HTML tag is set to YES (the default) Doxygen will
+# generate HTML output.
+
+GENERATE_HTML = YES
+
+# The HTML_OUTPUT tag is used to specify where the HTML docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `html' will be used as the default path.
+
+HTML_OUTPUT = html
+
+# The HTML_FILE_EXTENSION tag can be used to specify the file extension for
+# each generated HTML page (for example: .htm,.php,.asp). If it is left blank
+# doxygen will generate files with .html extension.
+
+HTML_FILE_EXTENSION = .html
+
+# The HTML_HEADER tag can be used to specify a personal HTML header for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard header.
+
+HTML_HEADER =
+
+# The HTML_FOOTER tag can be used to specify a personal HTML footer for
+# each generated HTML page. If it is left blank doxygen will generate a
+# standard footer.
+
+HTML_FOOTER =
+
+# The HTML_STYLESHEET tag can be used to specify a user-defined cascading
+# style sheet that is used by each HTML page. It can be used to
+# fine-tune the look of the HTML output. If the tag is left blank doxygen
+# will generate a default style sheet. Note that doxygen will try to copy
+# the style sheet file to the HTML output directory, so don't put your own
+# stylesheet in the HTML output directory as well, or it will be erased!
+
+HTML_STYLESHEET =
+
+# If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes,
+# files or namespaces will be aligned in HTML using tables. If set to
+# NO a bullet list will be used.
+
+HTML_ALIGN_MEMBERS = YES
+
+# If the GENERATE_HTMLHELP tag is set to YES, additional index files
+# will be generated that can be used as input for tools like the
+# Microsoft HTML help workshop to generate a compressed HTML help file (.chm)
+# of the generated HTML documentation.
+
+GENERATE_HTMLHELP = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can
+# be used to specify the file name of the resulting .chm file. You
+# can add a path in front of the file if the result should not be
+# written to the html output directory.
+
+CHM_FILE =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can
+# be used to specify the location (absolute path including file name) of
+# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run
+# the HTML help compiler on the generated index.hhp.
+
+HHC_LOCATION =
+
+# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag
+# controls if a separate .chi index file is generated (YES) or that
+# it should be included in the master .chm file (NO).
+
+GENERATE_CHI = NO
+
+# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag
+# controls whether a binary table of contents is generated (YES) or a
+# normal table of contents (NO) in the .chm file.
+
+BINARY_TOC = NO
+
+# The TOC_EXPAND flag can be set to YES to add extra items for group members
+# to the contents of the HTML help documentation and to the tree view.
+
+TOC_EXPAND = NO
+
+# The DISABLE_INDEX tag can be used to turn on/off the condensed index at
+# top of each HTML page. The value NO (the default) enables the index and
+# the value YES disables it.
+
+DISABLE_INDEX = NO
+
+# This tag can be used to set the number of enum values (range [1..20])
+# that doxygen will group on one line in the generated HTML documentation.
+
+ENUM_VALUES_PER_LINE = 4
+
+# If the GENERATE_TREEVIEW tag is set to YES, a side panel will be
+# generated containing a tree-like index structure (just like the one that
+# is generated for HTML Help). For this to work a browser that supports
+# JavaScript, DHTML, CSS and frames is required (for instance Mozilla 1.0+,
+# Netscape 6.0+, Internet explorer 5.0+, or Konqueror). Windows users are
+# probably better off using the HTML help feature.
+
+GENERATE_TREEVIEW = NO
+
+# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be
+# used to set the initial width (in pixels) of the frame in which the tree
+# is shown.
+
+TREEVIEW_WIDTH = 250
+
+#---------------------------------------------------------------------------
+# configuration options related to the LaTeX output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will
+# generate Latex output.
+
+GENERATE_LATEX = NO
+
+# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `latex' will be used as the default path.
+
+LATEX_OUTPUT = latex
+
+# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
+# invoked. If left blank `latex' will be used as the default command name.
+
+LATEX_CMD_NAME = latex
+
+# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to
+# generate index for LaTeX. If left blank `makeindex' will be used as the
+# default command name.
+
+MAKEINDEX_CMD_NAME = makeindex
+
+# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact
+# LaTeX documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_LATEX = NO
+
+# The PAPER_TYPE tag can be used to set the paper type that is used
+# by the printer. Possible values are: a4, a4wide, letter, legal and
+# executive. If left blank a4wide will be used.
+
+PAPER_TYPE = a4wide
+
+# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX
+# packages that should be included in the LaTeX output.
+
+EXTRA_PACKAGES =
+
+# The LATEX_HEADER tag can be used to specify a personal LaTeX header for
+# the generated latex document. The header should contain everything until
+# the first chapter. If it is left blank doxygen will generate a
+# standard header. Notice: only use this tag if you know what you are doing!
+
+LATEX_HEADER =
+
+# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated
+# is prepared for conversion to pdf (using ps2pdf). The pdf file will
+# contain links (just like the HTML output) instead of page references
+# This makes the output suitable for online browsing using a pdf viewer.
+
+PDF_HYPERLINKS = NO
+
+# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of
+# plain latex in the generated Makefile. Set this option to YES to get a
+# higher quality PDF documentation.
+
+USE_PDFLATEX = NO
+
+# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode.
+# command to the generated LaTeX files. This will instruct LaTeX to keep
+# running if errors occur, instead of asking the user for help.
+# This option is also used when generating formulas in HTML.
+
+LATEX_BATCHMODE = NO
+
+# If LATEX_HIDE_INDICES is set to YES then doxygen will not
+# include the index chapters (such as File Index, Compound Index, etc.)
+# in the output.
+
+LATEX_HIDE_INDICES = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the RTF output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output
+# The RTF output is optimized for Word 97 and may not look very pretty with
+# other RTF readers or editors.
+
+GENERATE_RTF = NO
+
+# The RTF_OUTPUT tag is used to specify where the RTF docs will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `rtf' will be used as the default path.
+
+RTF_OUTPUT = rtf
+
+# If the COMPACT_RTF tag is set to YES Doxygen generates more compact
+# RTF documents. This may be useful for small projects and may help to
+# save some trees in general.
+
+COMPACT_RTF = NO
+
+# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated
+# will contain hyperlink fields. The RTF file will
+# contain links (just like the HTML output) instead of page references.
+# This makes the output suitable for online browsing using WORD or other
+# programs which support those fields.
+# Note: wordpad (write) and others do not support links.
+
+RTF_HYPERLINKS = NO
+
+# Load stylesheet definitions from file. Syntax is similar to doxygen's
+# config file, i.e. a series of assignments. You only have to provide
+# replacements, missing definitions are set to their default value.
+
+RTF_STYLESHEET_FILE =
+
+# Set optional variables used in the generation of an rtf document.
+# Syntax is similar to doxygen's config file.
+
+RTF_EXTENSIONS_FILE =
+
+#---------------------------------------------------------------------------
+# configuration options related to the man page output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_MAN tag is set to YES (the default) Doxygen will
+# generate man pages
+
+GENERATE_MAN = NO
+
+# The MAN_OUTPUT tag is used to specify where the man pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `man' will be used as the default path.
+
+MAN_OUTPUT = man
+
+# The MAN_EXTENSION tag determines the extension that is added to
+# the generated man pages (default is the subroutine's section .3)
+
+MAN_EXTENSION = .3
+
+# If the MAN_LINKS tag is set to YES and Doxygen generates man output,
+# then it will generate one additional man file for each entity
+# documented in the real man page(s). These additional files
+# only source the real man page, but without them the man command
+# would be unable to find the correct page. The default is NO.
+
+MAN_LINKS = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the XML output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_XML tag is set to YES Doxygen will
+# generate an XML file that captures the structure of
+# the code including all documentation.
+
+GENERATE_XML = NO
+
+# The XML_OUTPUT tag is used to specify where the XML pages will be put.
+# If a relative path is entered the value of OUTPUT_DIRECTORY will be
+# put in front of it. If left blank `xml' will be used as the default path.
+
+XML_OUTPUT = xml
+
+# The XML_SCHEMA tag can be used to specify an XML schema,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_SCHEMA =
+
+# The XML_DTD tag can be used to specify an XML DTD,
+# which can be used by a validating XML parser to check the
+# syntax of the XML files.
+
+XML_DTD =
+
+# If the XML_PROGRAMLISTING tag is set to YES Doxygen will
+# dump the program listings (including syntax highlighting
+# and cross-referencing information) to the XML output. Note that
+# enabling this will significantly increase the size of the XML output.
+
+XML_PROGRAMLISTING = YES
+
+#---------------------------------------------------------------------------
+# configuration options for the AutoGen Definitions output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will
+# generate an AutoGen Definitions (see autogen.sf.net) file
+# that captures the structure of the code including all
+# documentation. Note that this feature is still experimental
+# and incomplete at the moment.
+
+GENERATE_AUTOGEN_DEF = NO
+
+#---------------------------------------------------------------------------
+# configuration options related to the Perl module output
+#---------------------------------------------------------------------------
+
+# If the GENERATE_PERLMOD tag is set to YES Doxygen will
+# generate a Perl module file that captures the structure of
+# the code including all documentation. Note that this
+# feature is still experimental and incomplete at the
+# moment.
+
+GENERATE_PERLMOD = NO
+
+# If the PERLMOD_LATEX tag is set to YES Doxygen will generate
+# the necessary Makefile rules, Perl scripts and LaTeX code to be able
+# to generate PDF and DVI output from the Perl module output.
+
+PERLMOD_LATEX = NO
+
+# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be
+# nicely formatted so it can be parsed by a human reader. This is useful
+# if you want to understand what is going on. On the other hand, if this
+# tag is set to NO the size of the Perl module output will be much smaller
+# and Perl will parse it just the same.
+
+PERLMOD_PRETTY = YES
+
+# The names of the make variables in the generated doxyrules.make file
+# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX.
+# This is useful so different doxyrules.make files included by the same
+# Makefile don't overwrite each other's variables.
+
+PERLMOD_MAKEVAR_PREFIX =
+
+#---------------------------------------------------------------------------
+# Configuration options related to the preprocessor
+#---------------------------------------------------------------------------
+
+# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will
+# evaluate all C-preprocessor directives found in the sources and include
+# files.
+
+ENABLE_PREPROCESSING = YES
+
+# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro
+# names in the source code. If set to NO (the default) only conditional
+# compilation will be performed. Macro expansion can be done in a controlled
+# way by setting EXPAND_ONLY_PREDEF to YES.
+
+MACRO_EXPANSION = NO
+
+# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
+# then the macro expansion is limited to the macros specified with the
+# PREDEFINED and EXPAND_AS_DEFINED tags.
+
+EXPAND_ONLY_PREDEF = NO
+
+# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files
+# in the INCLUDE_PATH (see below) will be search if a #include is found.
+
+SEARCH_INCLUDES = YES
+
+# The INCLUDE_PATH tag can be used to specify one or more directories that
+# contain include files that are not input files but should be processed by
+# the preprocessor.
+
+INCLUDE_PATH =
+
+# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
+# patterns (like *.h and *.hpp) to filter out the header-files in the
+# directories. If left blank, the patterns specified with FILE_PATTERNS will
+# be used.
+
+INCLUDE_FILE_PATTERNS =
+
+# The PREDEFINED tag can be used to specify one or more macro names that
+# are defined before the preprocessor is started (similar to the -D option of
+# gcc). The argument of the tag is a list of macros of the form: name
+# or name=definition (no spaces). If the definition and the = are
+# omitted =1 is assumed. To prevent a macro definition from being
+# undefined via #undef or recursively expanded use the := operator
+# instead of the = operator.
+
+PREDEFINED =
+
+# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then
+# this tag can be used to specify a list of macro names that should be expanded.
+# The macro definition that is found in the sources will be used.
+# Use the PREDEFINED tag if you want to use a different macro definition.
+
+EXPAND_AS_DEFINED =
+
+# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then
+# doxygen's preprocessor will remove all function-like macros that are alone
+# on a line, have an all uppercase name, and do not end with a semicolon. Such
+# function macros are typically used for boiler-plate code, and will confuse
+# the parser if not removed.
+
+SKIP_FUNCTION_MACROS = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to external references
+#---------------------------------------------------------------------------
+
+# The TAGFILES option can be used to specify one or more tagfiles.
+# Optionally an initial location of the external documentation
+# can be added for each tagfile. The format of a tag file without
+# this location is as follows:
+# TAGFILES = file1 file2 ...
+# Adding location for the tag files is done as follows:
+# TAGFILES = file1=loc1 "file2 = loc2" ...
+# where "loc1" and "loc2" can be relative or absolute paths or
+# URLs. If a location is present for each tag, the installdox tool
+# does not have to be run to correct the links.
+# Note that each tag file must have a unique name
+# (where the name does NOT include the path)
+# If a tag file is not located in the directory in which doxygen
+# is run, you must also specify the path to the tagfile here.
+
+TAGFILES =
+
+# When a file name is specified after GENERATE_TAGFILE, doxygen will create
+# a tag file that is based on the input files it reads.
+
+GENERATE_TAGFILE =
+
+# If the ALLEXTERNALS tag is set to YES all external classes will be listed
+# in the class index. If set to NO only the inherited external classes
+# will be listed.
+
+ALLEXTERNALS = NO
+
+# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed
+# in the modules index. If set to NO, only the current project's groups will
+# be listed.
+
+EXTERNAL_GROUPS = YES
+
+# The PERL_PATH should be the absolute path and name of the perl script
+# interpreter (i.e. the result of `which perl').
+
+PERL_PATH = /usr/bin/perl
+
+#---------------------------------------------------------------------------
+# Configuration options related to the dot tool
+#---------------------------------------------------------------------------
+
+# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will
+# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base
+# or super classes. Setting the tag to NO turns the diagrams off. Note that
+# this option is superseded by the HAVE_DOT option below. This is only a
+# fallback. It is recommended to install and use dot, since it yields more
+# powerful graphs.
+
+CLASS_DIAGRAMS = YES
+
+# If set to YES, the inheritance and collaboration graphs will hide
+# inheritance and usage relations if the target is undocumented
+# or is not a class.
+
+HIDE_UNDOC_RELATIONS = YES
+
+# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
+# available from the path. This tool is part of Graphviz, a graph visualization
+# toolkit from AT&T and Lucent Bell Labs. The other options in this section
+# have no effect if this option is set to NO (the default)
+
+HAVE_DOT = NO
+
+# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect inheritance relations. Setting this tag to YES will force the
+# the CLASS_DIAGRAMS tag to NO.
+
+CLASS_GRAPH = YES
+
+# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for each documented class showing the direct and
+# indirect implementation dependencies (inheritance, containment, and
+# class references variables) of the class with other documented classes.
+
+COLLABORATION_GRAPH = YES
+
+# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen
+# will generate a graph for groups, showing the direct groups dependencies
+
+GROUP_GRAPHS = YES
+
+# If the UML_LOOK tag is set to YES doxygen will generate inheritance and
+# collaboration diagrams in a style similar to the OMG's Unified Modeling
+# Language.
+
+UML_LOOK = NO
+
+# If set to YES, the inheritance and collaboration graphs will show the
+# relations between templates and their instances.
+
+TEMPLATE_RELATIONS = NO
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT
+# tags are set to YES then doxygen will generate a graph for each documented
+# file showing the direct and indirect include dependencies of the file with
+# other documented files.
+
+INCLUDE_GRAPH = YES
+
+# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and
+# HAVE_DOT tags are set to YES then doxygen will generate a graph for each
+# documented header file showing the documented files that directly or
+# indirectly include this file.
+
+INCLUDED_BY_GRAPH = YES
+
+# If the CALL_GRAPH and HAVE_DOT tags are set to YES then doxygen will
+# generate a call dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable call graphs for selected
+# functions only using the \callgraph command.
+
+CALL_GRAPH = NO
+
+# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then doxygen will
+# generate a caller dependency graph for every global function or class method.
+# Note that enabling this option will significantly increase the time of a run.
+# So in most cases it will be better to enable caller graphs for selected
+# functions only using the \callergraph command.
+
+CALLER_GRAPH = NO
+
+# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen
+# will graphical hierarchy of all classes instead of a textual one.
+
+GRAPHICAL_HIERARCHY = YES
+
+# If the DIRECTORY_GRAPH, SHOW_DIRECTORIES and HAVE_DOT tags are set to YES
+# then doxygen will show the dependencies a directory has on other directories
+# in a graphical way. The dependency relations are determined by the #include
+# relations between the files in the directories.
+
+DIRECTORY_GRAPH = YES
+
+# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
+# generated by dot. Possible values are png, jpg, or gif
+# If left blank png will be used.
+
+DOT_IMAGE_FORMAT = png
+
+# The tag DOT_PATH can be used to specify the path where the dot tool can be
+# found. If left blank, it is assumed the dot tool can be found in the path.
+
+DOT_PATH =
+
+# The DOTFILE_DIRS tag can be used to specify one or more directories that
+# contain dot files that are included in the documentation (see the
+# \dotfile command).
+
+DOTFILE_DIRS =
+
+# The MAX_DOT_GRAPH_WIDTH tag can be used to set the maximum allowed width
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_WIDTH = 1024
+
+# The MAX_DOT_GRAPH_HEIGHT tag can be used to set the maximum allows height
+# (in pixels) of the graphs generated by dot. If a graph becomes larger than
+# this value, doxygen will try to truncate the graph, so that it fits within
+# the specified constraint. Beware that most browsers cannot cope with very
+# large images.
+
+MAX_DOT_GRAPH_HEIGHT = 1024
+
+# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the
+# graphs generated by dot. A depth value of 3 means that only nodes reachable
+# from the root by following a path via at most 3 edges will be shown. Nodes
+# that lay further from the root node will be omitted. Note that setting this
+# option to 1 or 2 may greatly reduce the computation time needed for large
+# code bases. Also note that a graph may be further truncated if the graph's
+# image dimensions are not sufficient to fit the graph (see MAX_DOT_GRAPH_WIDTH
+# and MAX_DOT_GRAPH_HEIGHT). If 0 is used for the depth value (the default),
+# the graph is not depth-constrained.
+
+MAX_DOT_GRAPH_DEPTH = 0
+
+# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
+# background. This is disabled by default, which results in a white background.
+# Warning: Depending on the platform used, enabling this option may lead to
+# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
+# read).
+
+DOT_TRANSPARENT = NO
+
+# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output
+# files in one run (i.e. multiple -o and -T options on the command line). This
+# makes dot run faster, but since only newer versions of dot (>1.8.10)
+# support this, this feature is disabled by default.
+
+DOT_MULTI_TARGETS = NO
+
+# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will
+# generate a legend page explaining the meaning of the various boxes and
+# arrows in the dot generated graphs.
+
+GENERATE_LEGEND = YES
+
+# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will
+# remove the intermediate dot files that are used to generate
+# the various graphs.
+
+DOT_CLEANUP = YES
+
+#---------------------------------------------------------------------------
+# Configuration::additions related to the search engine
+#---------------------------------------------------------------------------
+
+# The SEARCHENGINE tag specifies whether or not a search engine should be
+# used. If set to NO the values of all tags below this one will be ignored.
+
+SEARCHENGINE = NO
diff --git a/install-sh b/install-sh
new file mode 100755
index 0000000..6781b98
--- /dev/null
+++ b/install-sh
@@ -0,0 +1,520 @@
+#!/bin/sh
+# install - install a program, script, or datafile
+
+scriptversion=2009-04-28.21; # UTC
+
+# This originates from X11R5 (mit/util/scripts/install.sh), which was
+# later released in X11R6 (xc/config/util/install.sh) with the
+# following copyright and license.
+#
+# Copyright (C) 1994 X Consortium
+#
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to
+# deal in the Software without restriction, including without limitation the
+# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+#
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+#
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
+# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
+# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+#
+# Except as contained in this notice, the name of the X Consortium shall not
+# be used in advertising or otherwise to promote the sale, use or other deal-
+# ings in this Software without prior written authorization from the X Consor-
+# tium.
+#
+#
+# FSF changes to this file are in the public domain.
+#
+# Calling this script install-sh is preferred over install.sh, to prevent
+# `make' implicit rules from creating a file called install from it
+# when there is no Makefile.
+#
+# This script is compatible with the BSD install script, but was written
+# from scratch.
+
+nl='
+'
+IFS=" "" $nl"
+
+# set DOITPROG to echo to test this script
+
+# Don't use :- since 4.3BSD and earlier shells don't like it.
+doit=${DOITPROG-}
+if test -z "$doit"; then
+ doit_exec=exec
+else
+ doit_exec=$doit
+fi
+
+# Put in absolute file names if you don't have them in your path;
+# or use environment vars.
+
+chgrpprog=${CHGRPPROG-chgrp}
+chmodprog=${CHMODPROG-chmod}
+chownprog=${CHOWNPROG-chown}
+cmpprog=${CMPPROG-cmp}
+cpprog=${CPPROG-cp}
+mkdirprog=${MKDIRPROG-mkdir}
+mvprog=${MVPROG-mv}
+rmprog=${RMPROG-rm}
+stripprog=${STRIPPROG-strip}
+
+posix_glob='?'
+initialize_posix_glob='
+ test "$posix_glob" != "?" || {
+ if (set -f) 2>/dev/null; then
+ posix_glob=
+ else
+ posix_glob=:
+ fi
+ }
+'
+
+posix_mkdir=
+
+# Desired mode of installed file.
+mode=0755
+
+chgrpcmd=
+chmodcmd=$chmodprog
+chowncmd=
+mvcmd=$mvprog
+rmcmd="$rmprog -f"
+stripcmd=
+
+src=
+dst=
+dir_arg=
+dst_arg=
+
+copy_on_change=false
+no_target_directory=
+
+usage="\
+Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+ or: $0 [OPTION]... SRCFILES... DIRECTORY
+ or: $0 [OPTION]... -t DIRECTORY SRCFILES...
+ or: $0 [OPTION]... -d DIRECTORIES...
+
+In the 1st form, copy SRCFILE to DSTFILE.
+In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
+In the 4th, create DIRECTORIES.
+
+Options:
+ --help display this help and exit.
+ --version display version info and exit.
+
+ -c (ignored)
+ -C install only if different (preserve the last data modification time)
+ -d create directories instead of installing files.
+ -g GROUP $chgrpprog installed files to GROUP.
+ -m MODE $chmodprog installed files to MODE.
+ -o USER $chownprog installed files to USER.
+ -s $stripprog installed files.
+ -t DIRECTORY install into DIRECTORY.
+ -T report an error if DSTFILE is a directory.
+
+Environment variables override the default commands:
+ CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
+ RMPROG STRIPPROG
+"
+
+while test $# -ne 0; do
+ case $1 in
+ -c) ;;
+
+ -C) copy_on_change=true;;
+
+ -d) dir_arg=true;;
+
+ -g) chgrpcmd="$chgrpprog $2"
+ shift;;
+
+ --help) echo "$usage"; exit $?;;
+
+ -m) mode=$2
+ case $mode in
+ *' '* | *' '* | *'
+'* | *'*'* | *'?'* | *'['*)
+ echo "$0: invalid mode: $mode" >&2
+ exit 1;;
+ esac
+ shift;;
+
+ -o) chowncmd="$chownprog $2"
+ shift;;
+
+ -s) stripcmd=$stripprog;;
+
+ -t) dst_arg=$2
+ shift;;
+
+ -T) no_target_directory=true;;
+
+ --version) echo "$0 $scriptversion"; exit $?;;
+
+ --) shift
+ break;;
+
+ -*) echo "$0: invalid option: $1" >&2
+ exit 1;;
+
+ *) break;;
+ esac
+ shift
+done
+
+if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
+ # When -d is used, all remaining arguments are directories to create.
+ # When -t is used, the destination is already specified.
+ # Otherwise, the last argument is the destination. Remove it from $@.
+ for arg
+ do
+ if test -n "$dst_arg"; then
+ # $@ is not empty: it contains at least $arg.
+ set fnord "$@" "$dst_arg"
+ shift # fnord
+ fi
+ shift # arg
+ dst_arg=$arg
+ done
+fi
+
+if test $# -eq 0; then
+ if test -z "$dir_arg"; then
+ echo "$0: no input file specified." >&2
+ exit 1
+ fi
+ # It's OK to call `install-sh -d' without argument.
+ # This can happen when creating conditional directories.
+ exit 0
+fi
+
+if test -z "$dir_arg"; then
+ trap '(exit $?); exit' 1 2 13 15
+
+ # Set umask so as not to create temps with too-generous modes.
+ # However, 'strip' requires both read and write access to temps.
+ case $mode in
+ # Optimize common cases.
+ *644) cp_umask=133;;
+ *755) cp_umask=22;;
+
+ *[0-7])
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw='% 200'
+ fi
+ cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
+ *)
+ if test -z "$stripcmd"; then
+ u_plus_rw=
+ else
+ u_plus_rw=,u+rw
+ fi
+ cp_umask=$mode$u_plus_rw;;
+ esac
+fi
+
+for src
+do
+ # Protect names starting with `-'.
+ case $src in
+ -*) src=./$src;;
+ esac
+
+ if test -n "$dir_arg"; then
+ dst=$src
+ dstdir=$dst
+ test -d "$dstdir"
+ dstdir_status=$?
+ else
+
+ # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ # might cause directories to be created, which would be especially bad
+ # if $src (and thus $dsttmp) contains '*'.
+ if test ! -f "$src" && test ! -d "$src"; then
+ echo "$0: $src does not exist." >&2
+ exit 1
+ fi
+
+ if test -z "$dst_arg"; then
+ echo "$0: no destination specified." >&2
+ exit 1
+ fi
+
+ dst=$dst_arg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst;;
+ esac
+
+ # If destination is a directory, append the input filename; won't work
+ # if double slashes aren't ignored.
+ if test -d "$dst"; then
+ if test -n "$no_target_directory"; then
+ echo "$0: $dst_arg: Is a directory" >&2
+ exit 1
+ fi
+ dstdir=$dst
+ dst=$dstdir/`basename "$src"`
+ dstdir_status=0
+ else
+ # Prefer dirname, but fall back on a substitute if dirname fails.
+ dstdir=`
+ (dirname "$dst") 2>/dev/null ||
+ expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$dst" : 'X\(//\)[^/]' \| \
+ X"$dst" : 'X\(//\)$' \| \
+ X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
+ echo X"$dst" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'
+ `
+
+ test -d "$dstdir"
+ dstdir_status=$?
+ fi
+ fi
+
+ obsolete_mkdir_used=false
+
+ if test $dstdir_status != 0; then
+ case $posix_mkdir in
+ '')
+ # Create intermediate dirs using mode 755 as modified by the umask.
+ # This is like FreeBSD 'install' as of 1997-10-28.
+ umask=`umask`
+ case $stripcmd.$umask in
+ # Optimize common cases.
+ *[2367][2367]) mkdir_umask=$umask;;
+ .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
+
+ *[0-7])
+ mkdir_umask=`expr $umask + 22 \
+ - $umask % 100 % 40 + $umask % 20 \
+ - $umask % 10 % 4 + $umask % 2
+ `;;
+ *) mkdir_umask=$umask,go-w;;
+ esac
+
+ # With -d, create the new directory with the user-specified mode.
+ # Otherwise, rely on $mkdir_umask.
+ if test -n "$dir_arg"; then
+ mkdir_mode=-m$mode
+ else
+ mkdir_mode=
+ fi
+
+ posix_mkdir=false
+ case $umask in
+ *[123567][0-7][0-7])
+ # POSIX mkdir -p sets u+wx bits regardless of umask, which
+ # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
+ ;;
+ *)
+ tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
+ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
+
+ if (umask $mkdir_umask &&
+ exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
+ then
+ if test -z "$dir_arg" || {
+ # Check for POSIX incompatibilities with -m.
+ # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
+ # other-writeable bit of parent directory when it shouldn't.
+ # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
+ ls_ld_tmpdir=`ls -ld "$tmpdir"`
+ case $ls_ld_tmpdir in
+ d????-?r-*) different_mode=700;;
+ d????-?--*) different_mode=755;;
+ *) false;;
+ esac &&
+ $mkdirprog -m$different_mode -p -- "$tmpdir" && {
+ ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
+ test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
+ }
+ }
+ then posix_mkdir=:
+ fi
+ rmdir "$tmpdir/d" "$tmpdir"
+ else
+ # Remove any dirs left behind by ancient mkdir implementations.
+ rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
+ fi
+ trap '' 0;;
+ esac;;
+ esac
+
+ if
+ $posix_mkdir && (
+ umask $mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
+ )
+ then :
+ else
+
+ # The umask is ridiculous, or mkdir does not conform to POSIX,
+ # or it failed possibly due to a race condition. Create the
+ # directory the slow way, step by step, checking for races as we go.
+
+ case $dstdir in
+ /*) prefix='/';;
+ -*) prefix='./';;
+ *) prefix='';;
+ esac
+
+ eval "$initialize_posix_glob"
+
+ oIFS=$IFS
+ IFS=/
+ $posix_glob set -f
+ set fnord $dstdir
+ shift
+ $posix_glob set +f
+ IFS=$oIFS
+
+ prefixes=
+
+ for d
+ do
+ test -z "$d" && continue
+
+ prefix=$prefix$d
+ if test -d "$prefix"; then
+ prefixes=
+ else
+ if $posix_mkdir; then
+ (umask=$mkdir_umask &&
+ $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
+ # Don't fail if two instances are running concurrently.
+ test -d "$prefix" || exit 1
+ else
+ case $prefix in
+ *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
+ *) qprefix=$prefix;;
+ esac
+ prefixes="$prefixes '$qprefix'"
+ fi
+ fi
+ prefix=$prefix/
+ done
+
+ if test -n "$prefixes"; then
+ # Don't fail if two instances are running concurrently.
+ (umask $mkdir_umask &&
+ eval "\$doit_exec \$mkdirprog $prefixes") ||
+ test -d "$dstdir" || exit 1
+ obsolete_mkdir_used=true
+ fi
+ fi
+ fi
+
+ if test -n "$dir_arg"; then
+ { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
+ { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
+ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
+ else
+
+ # Make a couple of temp file names in the proper directory.
+ dsttmp=$dstdir/_inst.$$_
+ rmtmp=$dstdir/_rm.$$_
+
+ # Trap to clean up those temp files at exit.
+ trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+
+ # Copy the file name to the temp name.
+ (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+
+ # and set any options; do chmod last to preserve setuid bits.
+ #
+ # If any of these fail, we abort the whole thing. If we want to
+ # ignore errors from any of these, just make sure not to ignore
+ # errors from the above "$doit $cpprog $src $dsttmp" command.
+ #
+ { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
+ { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
+ { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
+ { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
+
+ # If -C, don't bother to copy if it wouldn't change the file.
+ if $copy_on_change &&
+ old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` &&
+ new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` &&
+
+ eval "$initialize_posix_glob" &&
+ $posix_glob set -f &&
+ set X $old && old=:$2:$4:$5:$6 &&
+ set X $new && new=:$2:$4:$5:$6 &&
+ $posix_glob set +f &&
+
+ test "$old" = "$new" &&
+ $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
+ then
+ rm -f "$dsttmp"
+ else
+ # Rename the file to the real destination.
+ $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
+
+ # The rename failed, perhaps because mv can't rename something else
+ # to itself, or perhaps because mv is so ancient that it does not
+ # support -f.
+ {
+ # Now remove or move aside any old file at destination location.
+ # We try this two ways since rm can't unlink itself on some
+ # systems and the destination file might be busy for other
+ # reasons. In this case, the final cleanup might fail but the new
+ # file should still install successfully.
+ {
+ test ! -f "$dst" ||
+ $doit $rmcmd -f "$dst" 2>/dev/null ||
+ { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
+ { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
+ } ||
+ { echo "$0: cannot unlink or rename $dst" >&2
+ (exit 1); exit 1
+ }
+ } &&
+
+ # Now rename the file to the real destination.
+ $doit $mvcmd "$dsttmp" "$dst"
+ }
+ fi || exit 1
+
+ trap '' 0
+ fi
+done
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
diff --git a/kmerprint/Makefile.am b/kmerprint/Makefile.am
new file mode 100644
index 0000000..410bf7d
--- /dev/null
+++ b/kmerprint/Makefile.am
@@ -0,0 +1,11 @@
+noinst_PROGRAMS = kmerprint
+
+kmerprint_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Assembly \
+ -I$(top_srcdir)/Common
+
+kmerprint_LDADD = \
+ $(top_builddir)/Assembly/libassembly.a \
+ $(top_builddir)/Common/libcommon.a
+
+kmerprint_SOURCES = kmerprint.cc
diff --git a/kmerprint/Makefile.in b/kmerprint/Makefile.in
new file mode 100644
index 0000000..931e79f
--- /dev/null
+++ b/kmerprint/Makefile.in
@@ -0,0 +1,486 @@
+# Makefile.in generated by automake 1.12 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+# Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+ at SET_MAKE@
+
+VPATH = @srcdir@
+am__make_dryrun = \
+ { \
+ am__dry=no; \
+ case $$MAKEFLAGS in \
+ *\\[\ \ ]*) \
+ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
+ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
+ *) \
+ for am__flg in $$MAKEFLAGS; do \
+ case $$am__flg in \
+ *=*|--*) ;; \
+ *n*) am__dry=yes; break;; \
+ esac; \
+ done;; \
+ esac; \
+ test $$am__dry = yes; \
+ }
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+noinst_PROGRAMS = kmerprint$(EXEEXT)
+subdir = kmerprint
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(top_srcdir)/depcomp
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+PROGRAMS = $(noinst_PROGRAMS)
+am_kmerprint_OBJECTS = kmerprint-kmerprint.$(OBJEXT)
+kmerprint_OBJECTS = $(am_kmerprint_OBJECTS)
+kmerprint_DEPENDENCIES = $(top_builddir)/Assembly/libassembly.a \
+ $(top_builddir)/Common/libcommon.a
+DEFAULT_INCLUDES = -I. at am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
+ -o $@
+SOURCES = $(kmerprint_SOURCES)
+DIST_SOURCES = $(kmerprint_SOURCES)
+am__can_run_installinfo = \
+ case $$AM_UPDATE_INFO_DIR in \
+ n|no|NO) false;; \
+ *) (install-info --version) >/dev/null 2>&1;; \
+ esac
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AM_CXXFLAGS = @AM_CXXFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXDEPMODE = @CXXDEPMODE@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LTLIBOBJS = @LTLIBOBJS@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MPI_LIBS = @MPI_LIBS@
+OBJEXT = @OBJEXT@
+OPENMP_CXXFLAGS = @OPENMP_CXXFLAGS@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__include = @am__include@
+am__leading_dot = @am__leading_dot@
+am__quote = @am__quote@
+am__tar = @am__tar@
+am__untar = @am__untar@
+bindir = @bindir@
+build_alias = @build_alias@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host_alias = @host_alias@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+kmerprint_CPPFLAGS = -I$(top_srcdir) \
+ -I$(top_srcdir)/Assembly \
+ -I$(top_srcdir)/Common
+
+kmerprint_LDADD = \
+ $(top_builddir)/Assembly/libassembly.a \
+ $(top_builddir)/Common/libcommon.a
+
+kmerprint_SOURCES = kmerprint.cc
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cc .o .obj
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign kmerprint/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --foreign kmerprint/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(am__aclocal_m4_deps):
+
+clean-noinstPROGRAMS:
+ -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
+kmerprint$(EXEEXT): $(kmerprint_OBJECTS) $(kmerprint_DEPENDENCIES) $(EXTRA_kmerprint_DEPENDENCIES)
+ @rm -f kmerprint$(EXEEXT)
+ $(CXXLINK) $(kmerprint_OBJECTS) $(kmerprint_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+ at AMDEP_TRUE@@am__include@ @am__quote at ./$(DEPDIR)/kmerprint-kmerprint.Po at am__quote@
+
+.cc.o:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
+
+.cc.obj:
+ at am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+kmerprint-kmerprint.o: kmerprint.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmerprint_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT kmerprint-kmerprint.o -MD -MP -MF $(DEPDIR)/kmerprint-kmerprint.Tpo -c -o kmerprint-kmerprint.o `test -f 'kmerprint.cc' || echo '$(srcdir)/'`kmerprint.cc
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/kmerprint-kmerprint.Tpo $(DEPDIR)/kmerprint-kmerprint.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='kmerprint.cc' object='kmerprint-kmerprint.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmerprint_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o kmerprint-kmerprint.o `test -f 'kmerprint.cc' || echo '$(srcdir)/'`kmerprint.cc
+
+kmerprint-kmerprint.obj: kmerprint.cc
+ at am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmerprint_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT kmerprint-kmerprint.obj -MD -MP -MF $(DEPDIR)/kmerprint-kmerprint.Tpo -c -o kmerprint-kmerprint.obj `if test -f 'kmerprint.cc'; then $(CYGPATH_W) 'kmerprint.cc'; else $(CYGPATH_W) '$(srcdir)/kmerprint.cc'; fi`
+ at am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/kmerprint-kmerprint.Tpo $(DEPDIR)/kmerprint-kmerprint.Po
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='kmerprint.cc' object='kmerprint-kmerprint.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(kmerprint_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o kmerprint-kmerprint.obj `if test -f 'kmerprint.cc'; then $(CYGPATH_W) 'kmerprint.cc'; else $(CYGPATH_W) '$(srcdir)/kmerprint.cc'; fi`
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+cscopelist: $(HEADERS) $(SOURCES) $(LISP)
+ list='$(SOURCES) $(HEADERS) $(LISP)'; \
+ case "$(srcdir)" in \
+ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
+ *) sdir=$(subdir)/$(srcdir) ;; \
+ esac; \
+ for i in $$list; do \
+ if test -f "$$i"; then \
+ echo "$(subdir)/$$i"; \
+ else \
+ echo "$$sdir/$$i"; \
+ fi; \
+ done >> $(top_builddir)/cscope.files
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ else \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(PROGRAMS)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ if test -z '$(STRIP)'; then \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ install; \
+ else \
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
+ fi
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am:
+
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man:
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am:
+
+.MAKE: install-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-noinstPROGRAMS cscopelist ctags distclean \
+ distclean-compile distclean-generic distclean-tags distdir dvi \
+ dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am
+
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/kmerprint/kmerprint.cc b/kmerprint/kmerprint.cc
new file mode 100644
index 0000000..b0038de
--- /dev/null
+++ b/kmerprint/kmerprint.cc
@@ -0,0 +1,96 @@
+/**
+ * Print a kmer file. A kmer file is a serialized Google sparsehash.
+ * Written by Shaun Jackman <sjackman at bcgsc.ca>.
+ */
+
+#include "SequenceCollection.h"
+#include "Uncompress.h"
+#include <algorithm>
+#include <cassert>
+#include <getopt.h>
+#include <iostream>
+#include <sstream>
+
+using namespace std;
+
+#define PROGRAM "kmerprint"
+
+namespace opt {
+ static unsigned k;
+ static bool strands;
+ static bool sequence;
+ static bool adj;
+}
+
+static const struct option longopts[] = {
+ { "kmer", required_argument, NULL, 'k' },
+};
+
+static const char shortopts[] = "k:";
+
+static void print(const SequenceCollectionHash::value_type& seq)
+{
+ const KmerData& data = seq.second;
+ if (opt::sequence)
+ cout << seq.first.str() << '\t';
+ if (opt::adj)
+ cout << data.getExtension(SENSE) << '\t'
+ << data.getExtension(ANTISENSE) << '\t';
+ cout << data.getMultiplicity() << '\n';
+}
+
+static void print(const SequenceCollectionHash::value_type& seq,
+ extDirection sense)
+{
+ const KmerData& data = seq.second;
+ if (opt::sequence) {
+ if (sense)
+ cout << reverseComplement(seq.first).str();
+ else
+ cout << seq.first.str();
+ cout << '\t';
+ }
+ if (opt::adj)
+ cout << data.getExtension(sense) << '\t';
+ cout << data.getMultiplicity(sense) << '\n';
+}
+
+static void printFile(const char* path)
+{
+ SequenceCollectionHash c;
+ c.load(path);
+ for (SequenceCollectionHash::const_iterator it = c.begin();
+ it != c.end(); ++it) {
+ if (it->second.deleted())
+ continue;
+ if (opt::strands) {
+ print(*it, SENSE);
+ print(*it, ANTISENSE);
+ } else
+ print(*it);
+ }
+}
+
+int main(int argc, char* argv[])
+{
+ assert(argc > 1);
+
+ for (int c; (c = getopt_long(argc, argv,
+ shortopts, longopts, NULL)) != -1;) {
+ istringstream arg(optarg != NULL ? optarg : "");
+ switch (c) {
+ case '?': exit(EXIT_FAILURE);
+ case 'k': arg >> opt::k; break;
+ }
+ }
+
+ if (opt::k <= 0) {
+ cerr << PROGRAM ": " << "missing -k,--kmer option\n";
+ exit(EXIT_FAILURE);
+ }
+
+ Kmer::setLength(opt::k);
+
+ for_each(argv + optind, argv + argc, printFile);
+ return 0;
+}
diff --git a/missing b/missing
new file mode 100755
index 0000000..28055d2
--- /dev/null
+++ b/missing
@@ -0,0 +1,376 @@
+#! /bin/sh
+# Common stub for a few missing GNU programs while installing.
+
+scriptversion=2009-04-28.21; # UTC
+
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
+# Originally by Fran,cois Pinard <pinard at iro.umontreal.ca>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+fi
+
+run=:
+sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p'
+sed_minuso='s/.* -o \([^ ]*\).*/\1/p'
+
+# In the cases where this matters, `missing' is being run in the
+# srcdir already.
+if test -f configure.ac; then
+ configure_ac=configure.ac
+else
+ configure_ac=configure.in
+fi
+
+msg="missing on your system"
+
+case $1 in
+--run)
+ # Try to run requested program, and just exit if it succeeds.
+ run=
+ shift
+ "$@" && exit 0
+ # Exit code 63 means version mismatch. This often happens
+ # when the user try to use an ancient version of a tool on
+ # a file that requires a minimum version. In this case we
+ # we should proceed has if the program had been absent, or
+ # if --run hadn't been passed.
+ if test $? = 63; then
+ run=:
+ msg="probably too old"
+ fi
+ ;;
+
+ -h|--h|--he|--hel|--help)
+ echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
+error status if there is no known handling for PROGRAM.
+
+Options:
+ -h, --help display this help and exit
+ -v, --version output version information and exit
+ --run try to run the given command, and emulate it if it fails
+
+Supported PROGRAM values:
+ aclocal touch file \`aclocal.m4'
+ autoconf touch file \`configure'
+ autoheader touch file \`config.h.in'
+ autom4te touch the output file, or create a stub one
+ automake touch all \`Makefile.in' files
+ bison create \`y.tab.[ch]', if possible, from existing .[ch]
+ flex create \`lex.yy.c', if possible, from existing .c
+ help2man touch the output file
+ lex create \`lex.yy.c', if possible, from existing .c
+ makeinfo touch the output file
+ tar try tar, gnutar, gtar, then tar without non-portable flags
+ yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
+Send bug reports to <bug-automake at gnu.org>."
+ exit $?
+ ;;
+
+ -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+ echo "missing $scriptversion (GNU Automake)"
+ exit $?
+ ;;
+
+ -*)
+ echo 1>&2 "$0: Unknown \`$1' option"
+ echo 1>&2 "Try \`$0 --help' for more information"
+ exit 1
+ ;;
+
+esac
+
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
+# Now exit if we have it, but it failed. Also exit now if we
+# don't have it and --version was passed (most likely to detect
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
+case $1 in
+ lex*|yacc*)
+ # Not GNU programs, they don't have --version.
+ ;;
+
+ tar*)
+ if test -n "$run"; then
+ echo 1>&2 "ERROR: \`tar' requires --run"
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ exit 1
+ fi
+ ;;
+
+ *)
+ if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
+ # We have it, but it failed.
+ exit 1
+ elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
+ # Could not run --version or --help. This is probably someone
+ # running `$TOOL --version' or `$TOOL --help' to check whether
+ # $TOOL exists and not knowing $TOOL uses missing.
+ exit 1
+ fi
+ ;;
+esac
+
+# If it does not exist, or fails to run (possibly an outdated version),
+# try to emulate it.
+case $program in
+ aclocal*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acinclude.m4' or \`${configure_ac}'. You might want
+ to install the \`Automake' and \`Perl' packages. Grab them from
+ any GNU archive site."
+ touch aclocal.m4
+ ;;
+
+ autoconf*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`${configure_ac}'. You might want to install the
+ \`Autoconf' and \`GNU m4' packages. Grab them from any GNU
+ archive site."
+ touch configure
+ ;;
+
+ autoheader*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`acconfig.h' or \`${configure_ac}'. You might want
+ to install the \`Autoconf' and \`GNU m4' packages. Grab them
+ from any GNU archive site."
+ files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
+ test -z "$files" && files="config.h"
+ touch_files=
+ for f in $files; do
+ case $f in
+ *:*) touch_files="$touch_files "`echo "$f" |
+ sed -e 's/^[^:]*://' -e 's/:.*//'`;;
+ *) touch_files="$touch_files $f.in";;
+ esac
+ done
+ touch $touch_files
+ ;;
+
+ automake*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
+ You might want to install the \`Automake' and \`Perl' packages.
+ Grab them from any GNU archive site."
+ find . -type f -name Makefile.am -print |
+ sed 's/\.am$/.in/' |
+ while read f; do touch "$f"; done
+ ;;
+
+ autom4te*)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, but is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them.
+ You can get \`$1' as part of \`Autoconf' from any GNU
+ archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo "#! /bin/sh"
+ echo "# Created by GNU Automake missing as a replacement of"
+ echo "# $ $@"
+ echo "exit 0"
+ chmod +x $file
+ exit 1
+ fi
+ ;;
+
+ bison*|yacc*)
+ echo 1>&2 "\
+WARNING: \`$1' $msg. You should only need it if
+ you modified a \`.y' file. You may need the \`Bison' package
+ in order for those modifications to take effect. You can get
+ \`Bison' from any GNU archive site."
+ rm -f y.tab.c y.tab.h
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.y)
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.c
+ fi
+ SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" y.tab.h
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f y.tab.h; then
+ echo >y.tab.h
+ fi
+ if test ! -f y.tab.c; then
+ echo 'main() { return 0; }' >y.tab.c
+ fi
+ ;;
+
+ lex*|flex*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.l' file. You may need the \`Flex' package
+ in order for those modifications to take effect. You can get
+ \`Flex' from any GNU archive site."
+ rm -f lex.yy.c
+ if test $# -ne 1; then
+ eval LASTARG="\${$#}"
+ case $LASTARG in
+ *.l)
+ SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
+ if test -f "$SRCFILE"; then
+ cp "$SRCFILE" lex.yy.c
+ fi
+ ;;
+ esac
+ fi
+ if test ! -f lex.yy.c; then
+ echo 'main() { return 0; }' >lex.yy.c
+ fi
+ ;;
+
+ help2man*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a dependency of a manual page. You may need the
+ \`Help2man' package in order for those modifications to take
+ effect. You can get \`Help2man' from any GNU archive site."
+
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -f "$file"; then
+ touch $file
+ else
+ test -z "$file" || exec >$file
+ echo ".ab help2man is required to generate this page"
+ exit $?
+ fi
+ ;;
+
+ makeinfo*)
+ echo 1>&2 "\
+WARNING: \`$1' is $msg. You should only need it if
+ you modified a \`.texi' or \`.texinfo' file, or any other file
+ indirectly affecting the aspect of the manual. The spurious
+ call might also be the consequence of using a buggy \`make' (AIX,
+ DU, IRIX). You might want to install the \`Texinfo' package or
+ the \`GNU make' package. Grab either from any GNU archive site."
+ # The file to touch is that specified with -o ...
+ file=`echo "$*" | sed -n "$sed_output"`
+ test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ if test -z "$file"; then
+ # ... or it is the one specified with @setfilename ...
+ infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '
+ /^@setfilename/{
+ s/.* \([^ ]*\) *$/\1/
+ p
+ q
+ }' $infile`
+ # ... or it is derived from the source name (dir/f.texi becomes f.info)
+ test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
+ fi
+ # If the file does not exist, the user really needs makeinfo;
+ # let's fail without touching anything.
+ test -f $file || exit 1
+ touch $file
+ ;;
+
+ tar*)
+ shift
+
+ # We have already tried tar in the generic part.
+ # Look for gnutar/gtar before invocation to avoid ugly error
+ # messages.
+ if (gnutar --version > /dev/null 2>&1); then
+ gnutar "$@" && exit 0
+ fi
+ if (gtar --version > /dev/null 2>&1); then
+ gtar "$@" && exit 0
+ fi
+ firstarg="$1"
+ if shift; then
+ case $firstarg in
+ *o*)
+ firstarg=`echo "$firstarg" | sed s/o//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ case $firstarg in
+ *h*)
+ firstarg=`echo "$firstarg" | sed s/h//`
+ tar "$firstarg" "$@" && exit 0
+ ;;
+ esac
+ fi
+
+ echo 1>&2 "\
+WARNING: I can't seem to be able to run \`tar' with the given arguments.
+ You may want to install GNU tar or Free paxutils, or check the
+ command line arguments."
+ exit 1
+ ;;
+
+ *)
+ echo 1>&2 "\
+WARNING: \`$1' is needed, and is $msg.
+ You might have modified some files without having the
+ proper tools for further handling them. Check the \`README' file,
+ it often tells you about the needed prerequisites for installing
+ this package. You may also peek at any GNU archive site, in case
+ some other package would contain this missing \`$1' program."
+ exit 1
+ ;;
+esac
+
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
+# End:
--
Alioth's /git/debian-med/git-commit-notice on /srv/git.debian.org/git/debian-med/abyss.git
More information about the debian-med-commit
mailing list