Skip to content

Commit

Permalink
Merge branch 'release/v4.0beta'
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillaume Marcais committed Apr 6, 2017
2 parents 7157121 + db8bf8a commit 0970c41
Show file tree
Hide file tree
Showing 34 changed files with 522 additions and 625 deletions.
32 changes: 0 additions & 32 deletions Makefile

This file was deleted.

26 changes: 17 additions & 9 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@
ACLOCAL_AMFLAGS = -I m4

AM_CPPFLAGS = -Wall -I$(srcdir)/include
AM_CXXFLAGS = $(EXTRA_CXXFLAGS)
AM_CXXFLAGS = -std=c++11 $(EXTRA_CXXFLAGS)
AM_LDFLAGS = -lpthread

# Pre-declare all used variables.
bin_PROGRAMS =
bin_SCRIPTS =
pkglibexec_PROGRAMS =
noinst_SCRIPTS =
noinst_HEADERS =
EXTRA_DIST =
Expand All @@ -21,6 +22,9 @@ TESTS =
TEST_EXTENSIONS =
BUILT_SOURCES =

# Where to install
script_libdir = $(pkglibdir)

# Special cleaning rules. Like CLEANFILES and DISTCLEANFILES, but for
# directories.
CLEANDIRS =
Expand Down Expand Up @@ -82,7 +86,8 @@ noinst_HEADERS += include/mummer/48bit_index.hpp \
noinst_HEADERS += include/mummer/dset.hpp \
include/mummer/openmp_qsort.hpp \
include/mt_skip_list/common.hpp \
include/mt_skip_list/set.hpp
include/mt_skip_list/set.hpp \
include/mummer/redirect_to_pager.hpp

###########
# essaMEM #
Expand All @@ -93,9 +98,10 @@ mummer_SOURCES = src/essaMEM/fasta.cpp src/essaMEM/mummer.cpp
########
# tigr #
########
bin_PROGRAMS += mgaps postnuc show-coords show-aligns show-snps \
show-tiling show-diff repeat-match annotate \
combineMUMs delta-filter prepro postpro
bin_PROGRAMS += show-coords show-aligns show-snps show-tiling \
show-diff repeat-match annotate combineMUMs \
delta-filter
pkglibexec_PROGRAMS += mgaps postnuc prepro postpro
mgaps_SOURCES = src/tigr/mgaps_main.cc
postnuc_SOURCES = src/tigr/postnuc_main.cc
show_coords_SOURCES = src/tigr/show-coords.cc src/tigr/delta.cc
Expand All @@ -121,7 +127,7 @@ EXTRA_DIST += src/tigr/gaps.cc
# what LIBTOOLS does.

# List of scripts to install
perl_scripts = mummerplot dnadiff
perl_scripts = mummerplot dnadiff promer
shell_scripts = exact-tandems
all_scripts = $(perl_scripts) $(shell_scripts)

Expand All @@ -139,10 +145,13 @@ CLEANFILES += $(libs_scripts) $(all_scripts)
# Rules to generate the scripts, in .libs and in build directory.
script_inst_subst = sed -e 's,[@]PERL[@],$(PERL),g' \
-e 's,[@]BIN_DIR[@],$(bindir),g' \
-e 's,[@]LIB_DIR[@],$(script_libdir),g'
-e 's,[@]LIB_DIR[@],$(script_libdir),g' \
-e 's,[@]LIBEXEC_DIR[@],$(pkglibexecdir),g'
script_local_subst = sed -e 's,[@]PERL[@],$(PERL),g' \
-e 's,[@]BIN_DIR[@],$(abs_builddir),g' \
-e 's,[@]LIB_DIR[@],$(abs_srcdir)/scripts,g'
-e 's,[@]LIB_DIR[@],$(abs_srcdir)/scripts,g' \
-e 's,[@]LIBEXEC_DIR[@],$(abs_builddir),g'

.libs/%: scripts/%.pl
@mkdir -p $(dir $@) && $(script_inst_subst) < $< > $@
%: scripts/%.pl
Expand All @@ -154,7 +163,6 @@ script_local_subst = sed -e 's,[@]PERL[@],$(PERL),g' \

# Supporting modules
script_lib_SCRIPTS = scripts/Foundation.pm scripts/tandem-repeat.awk
script_libdir = $(libdir)/mummer
EXTRA_DIST += $(script_lib_SCRIPTS)

#######
Expand Down
1 change: 0 additions & 1 deletion Tupfile

This file was deleted.

66 changes: 0 additions & 66 deletions Tuprules.tup

This file was deleted.

6 changes: 3 additions & 3 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
AC_INIT([MUMmer], [3.9.4alpha], [gmarcais@umd.edu])
AC_INIT([MUMmer], [4.0.0beta], [gmarcais@umd.edu])
AC_CANONICAL_HOST
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([subdir-objects foreign parallel-tests color-tests])
Expand All @@ -17,7 +17,7 @@ AC_PATH_PROG(ENV_PROG, [env])
# Add -std=c++0x always. Add -DNDEBUG only if CXXFLAGS is not given on command line
CXXFLAGS="-std=c++0x $CXXFLAGS"
AS_IF([test x$cxxflags_given = xno], [CXXFLAGS="-DNDEBUG $CXXFLAGS"])
EXTRA_CXXFLAGS="-std=c++0x"
EXTRA_CXXFLAGS=
AC_SUBST([EXTRA_CXXFLAGS])

# Check for openmp
Expand Down Expand Up @@ -54,7 +54,7 @@ AS_IF([test x$try_nano_sleep = xyes],
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <thread>]],
[[std::this_thread::sleep_for(std::chrono::seconds(1))]])],
[AC_MSG_RESULT([yes])]
[EXTRA_CXXFLAGS="-D_GLIBCXX_USE_NANOSLEEP $CXXFLAGS"],
[EXTRA_CXXFLAGS="-D_GLIBCXX_USE_NANOSLEEP $EXTRA_CXXFLAGS"],
[AC_MSG_RESULT([no])]
[AC_MSG_FAILURE([Compiler does not support std::this_thread::sleep_for])])]
[CXXFLAGS="$save_cxxflags"])
Expand Down
20 changes: 20 additions & 0 deletions include/mummer/nucmer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,27 @@
#include <jellyfish/whole_sequence_parser.hpp>
#include <mt_skip_list/set.hpp>

#ifdef _OPENMP
#include <omp.h>
#endif

namespace mummer {

// Limit number of threads to use
inline void set_num_threads(int nb) {
#ifdef _OPENMP
omp_set_num_threads(nb);
#endif
}

inline int get_num_threads() {
#ifdef _OPENMP
return omp_get_num_threads();
#else
return 1;
#endif
}

namespace nucmer {
void reverse_complement(std::string& s);

Expand Down
10 changes: 8 additions & 2 deletions include/mummer/openmp_qsort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace openmp_qsort_imp {
template<typename Iterator, class Compare>
void openmp_qsort_(Iterator begin, Iterator end, const size_t sz, Compare Comp) {
typedef typename std::iterator_traits<Iterator>::value_type Type;
assert((size_t)(end - begin) == sz);
auto pivot = begin + sz/2;
auto const pivot_v = *pivot;

Expand All @@ -45,16 +46,21 @@ void openmp_qsort_(Iterator begin, Iterator end, const size_t sz, Compare Comp)
std::swap(*p, *(end - 1));

auto const sz1 = p - begin, sz2 = end - p - 1;
assert(sz1 >= 0);
assert(sz2 >= 0);
assert((size_t)sz2 <= sz);
assert((size_t)sz1 <= sz);
assert((size_t)sz1 + (size_t)sz2 + 1 == sz);
if(sz1 > 1024) {
#pragma omp task
#pragma omp task firstprivate(p, sz1)
openmp_qsort_(begin, p, sz1, Comp);
if(sz2 > 1024)
openmp_qsort_(p + 1, end, sz2, Comp);
else
std::sort(p + 1, end, Comp);
} else {
if(sz2 > 1024)
#pragma omp task
#pragma omp task firstprivate(p, sz2)
openmp_qsort_(p + 1, end, sz2, Comp);
else
std::sort(p + 1, end, Comp);
Expand Down
61 changes: 61 additions & 0 deletions include/mummer/redirect_to_pager.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#ifndef __REDIRECT_TO_PAGER_H__
#define __REDIRECT_TO_PAGER_H__

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>


// Class that will redirect stdout to a pager if: (1) stdout is a tty
// and (2) it can launch a pager. The pager is the content of the
// PAGER environment variables or "more" if not set. This works with
// stdio.
struct stdio_launch_pager {
static constexpr const char* dflt_pager = "less -R";
FILE* pager_handle;

static void clean_exit(int) { exit(0); }

stdio_launch_pager(bool no_pager = false)
: pager_handle(NULL)
{
if(!isatty(1) || no_pager) return;
// Open a pager
const char* pager = getenv("PAGER");
if(pager)
pager_handle = start_pager(pager);
if(!pager_handle) {
pager_handle = start_pager(dflt_pager);
if(!pager_handle)
return;
}

// Close stdout and put pager in its place
if(fileno(pager_handle) == 1)
return; // Done already!
if(dup2(fileno(pager_handle), 1) == -1)
stop_pager();

// Upon SIGPIPE, quit without error
struct sigaction act;
memset(&act, '\0', sizeof(act));
act.sa_handler = clean_exit;
sigaction(SIGPIPE, &act, NULL);
}

~stdio_launch_pager() { stop_pager(); }

FILE* start_pager(const char* cmd) {
return popen(cmd, "w");
}

void stop_pager() {
if(pager_handle) {
pclose(pager_handle);
pager_handle = NULL;
}
}
};

#endif /* __REDIRECT_TO_PAGER_H__ */
8 changes: 7 additions & 1 deletion include/mummer/translate.hh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <cstring>

long int Translate_DNA
(char * A, char * tA, int Frame);
(const char * A, int dnaseq_len, char * tA, int Frame);

// function to translate dna sequence to aminoacid sequence
// uses esttrans' headers and algo
Expand All @@ -17,6 +17,12 @@ long int Translate_DNA
// returns new (strlen(A+1)) or -1 on error
// See end of file for source.

inline long int Translate_DNA
(const char * A, char * tA, int Frame) {
return Translate_DNA(A, (int)strlen(A + 1), tA, Frame);
}


#define BAD_PEP_CHAR -1
#define SKIP_PEP_CHAR -2
#define NUM_DNA_SYMBOLS 16
Expand Down
14 changes: 0 additions & 14 deletions scripts/Tupfile

This file was deleted.

4 changes: 2 additions & 2 deletions scripts/mummerplot.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1189,7 +1189,7 @@ ($$)
$xrange += $rref->{$xlabel}[1];
$tic = $rref->{$xlabel}[0] + 1;
$dir = ($rref->{$xlabel}[2] == 1) ? "" : "*";
print GFILE " \"$dir$xlabel\" $tic, \\\n";
print GFILE " \"$dir$xlabel\" $tic.0, \\\n";
}
print GFILE " \"\" $xrange \\\n\)\n";
$xlabel = "REF";
Expand All @@ -1212,7 +1212,7 @@ ($$)
$yrange += $qref->{$ylabel}[1];
$tic = $qref->{$ylabel}[0] + 1;
$dir = ($qref->{$ylabel}[2] == 1) ? "" : "*";
print GFILE " \"$dir$ylabel\" $tic, \\\n";
print GFILE " \"$dir$ylabel\" $tic.0, \\\n";
}
print GFILE " \"\" $yrange \\\n\)\n";
$ylabel = "QRY";
Expand Down
Loading

0 comments on commit 0970c41

Please sign in to comment.