Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
120 changes: 80 additions & 40 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,49 +2,89 @@ name: C/C++ CI

on:
push:
branches: [ master, develop, 'release/**' ]
branches: [master, develop, "release/**", "feature/**"]
pull_request:
branches: [ master, develop ]
branches: [master, develop]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: dependencies
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y yaggo gettext swig python3-dev ruby-dev libperl-dev
- name: autotools
run: autoreconf -fi
- name: configure
run: ./configure --enable-all-binding --enable-swig

- name: make
run: make -j$(nproc)

- name: make check
run: make -j$(nproc) check
- name: Check logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: checklog
path: "**/*tests/*.log"

- name: make distcheck
run: make -j$(nproc) distcheck
- name: Distcheck logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: distchecklog
path: |
**/*tests/*.log
**/*tests/**/tee.*

- name: Distribution tar ball
uses: actions/upload-artifact@v4
with:
name: disttarball
path: "mummer-*.tar.gz"
- uses: actions/checkout@v3
- name: dependencies
run: |
sudo apt-get update
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y yaggo gettext swig python3-dev ruby-dev libperl-dev
- name: autotools
run: autoreconf -fi
- name: configure
run: ./configure --enable-all-binding --enable-swig

- name: make
run: make -j$(nproc)

- name: make check
run: make -j$(nproc) check
- name: Check logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: checklog
path: "**/*tests/*.log"

- name: make distcheck
run: make -j$(nproc) distcheck
- name: Distcheck logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: distchecklog
path: |
**/*tests/*.log
**/*tests/**/tee.*

- name: Distribution tar ball
uses: actions/upload-artifact@v4
with:
name: disttarball
path: "mummer-*.tar.gz"

testbsd:
runs-on: ubuntu-latest
name: Compile on FreeBSD
steps:
- uses: actions/checkout@v4
- name: Test in FreeBSD
id: test
uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
pkg install -y gmake yaggo autoconf automake libtool bash gcc14
run: |
autoreconf -fi && \
./configure MAKE=gmake CC=gcc14 CXX=g++14 LDFLAGS=-Wl,-rpath=/usr/local/lib/gcc14 && \
gmake -j $(sysctl -n hw.ncpu) check

testmacos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: dependencies
run: |
brew install autoconf automake libtool md5sha1sum
gem install yaggo
- name: autotools
run: autoreconf -fi
- name: configure
run: ./configure CC=gcc-14 CXX=g++-14
- name: make
run: make -j$(sysctl -n hw.ncpu)
- name: make check
run: make -j$(sysctl -n hw.ncpu) check
- name: Check logs
if: failure()
uses: actions/upload-artifact@v4
with:
name: checklog
path: "**/*tests/*.log"
11 changes: 11 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
-- Version history --

4.0.0 48bit suffix array. Go past previous sequence length limitations
nucmer is all C++ (not Perl script) and multi-threaded
nucmer can save the SA index for later reuse
Added SAM output format to nucmer
Moved to autoconf compilation system
Bindings to scripting language: Python, Perl, Ruby
Improved mummerplot
Better unittesting and conformance testing
Provide a library with pkg-conig configuration
Moved to artistic license 2.0
Moved to C++17 standard.
3.23 - Added -D and --banded option to nucmer. These options can be used to
specify the largest indel that will be included in an alignment
segment without breaking it in two pieces.
Expand Down
81 changes: 62 additions & 19 deletions INSTALL.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,91 @@
# MUMmer4 INSTALLATION README
# MUMmer4 Compilation README

## Dependencies

If compiling from a [release source tarball](../../releases) you need a
recent version of the GCC compiler (g++ version >= 4.7) and other
essential tools for compilation (GNU make, ar, etc. Install
`build-essentials` on Debian or Ubuntu derivatives). Additional
requirements are needed to compile the SWIG script bindings. See the
[SWIG installation guide](swig/INSTALL.md).
If compiling from a [release source tarball](../../releases) (recommended), you need a recent version of the GCC compiler (see below, only GCC is supported) and other essential tools for compilation (GNU make, ar, etc).
Additional requirements are needed to compile the SWIG script bindings.
See the [SWIG installation guide](swig/INSTALL.md).

If compiling from the github development tree, additionally you need autotools (autoconf, automake and libtools),
[yaggo](https://github.com/gmarcais/yaggo/releases).
You should compile from a [release source tarball](../../releases), unless you plan on modifying the code of MUMmer.
If compiling from the github development tree, additionally you need autotools (autoconf, automake and libtools), [yaggo](https://github.com/gmarcais/yaggo/releases).

On Ubuntu:
### On Ubuntu

From the tarball:
```Shell
sudo apt install git build-essential yaggo autoconf automake libtool gettext
sudo apt install build-essential
# For the bindings to scripting, additionally install
sudo apt install swig python3-dev ruby-dev libperl-dev
```

From the git tree:
```Shell
sudo apt instaoo build-essential git yaggo autoconf automake libtool gettext
# For the bindings to scripting, additionally install
sudo apt install swig python3-dev ruby-dev libperl-dev
```

### On Mac OS

MUMmer must be compiled with GCC, not Clang (and not the Apple provided `gcc` which is really `clang`).
Install with Brew:

```Shell
brew install autoconf automake libtool md5sha1sum
gem install yaggo
```

### On FreeBSD

MUMmer must be compiled with GCC, not Clang.
Install with Brew:

```Shell
brew install autoconf automake libtool md5sha1sum bash
gem install yaggo
```


## Compilation & Installation

To compile and install from a [release source tarball](../../releases):
If compiling from the release tarball (recommended), then the first command `autoreconf -fi` is not necessary.

### On Ubuntu

```Shell
autoreconf -fi # Optional, on if compiling from git tree
./configure --prefix=/path/to/installation
make
make check # Optional
make install
```

If `--prefix` is omitted, the software is installed in
`/usr/local`. One may need `sudo make install` if installing in a
system location.
If `--prefix` is omitted, the software is installed in `/usr/local`.
One may need `sudo make install` if installing in a system location.

### On MacOS

Compile with `gcc-14`.

To compile from the github tree, `autoreconf` must additionally be run:
```Shell
autoreconf -fi
./configure --prefix=/path/to/installation
autoreconf -fi # Optional, on if compiling from git tree
./configure --prefix=/path/to/installation CC=gcc-14 CXX=g++-14
make
make check # Optional
make install
```

### On FreeBSD

Compile with `gcc14`.

```Shell
autoreconf -fi # Optional, on if compiling from git tree
./configure --prefix=/path/to/installation MAKE=gmake CC=gcc14 CXX=g++14 LDFLAGS=-Wl,-rpath=/usr/local/lib/gcc14
gmake
gmake check # Optional
gmake install
```

## SOFTWARE REQUIREMENTS

The MUMmer4.x package requires the following to run successfully. In
Expand Down
1 change: 1 addition & 0 deletions include/thread_pipe.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ class ostream_buffered : public consumer<ostream_buffered, stringstream_wrapper>
std::ostream& os_;
public:
ostream_buffered(std::ostream& os) : os_(os) { }
~ostream_buffered() { close(); }
bool operator()(stringstream_wrapper& e) {
bool res = false;
auto rdbuf = e.p_->rdbuf();
Expand Down
3 changes: 2 additions & 1 deletion src/tigr/show-aligns.cc
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,8 @@ void append(ColoredBuffer& Buff1, ColoredBuffer& Buff2, std::string &Buff3,

void add_prefix(ColoredBuffer& Buff, long int pos, long int seqlen, int frame) {
char b[LINE_BUFFER_LEN + 1];
sprintf(b, PREFIX_FORMAT, toFwd(pos, seqlen, frame));
snprintf(b, sizeof(b), PREFIX_FORMAT, toFwd(pos, seqlen, frame));
b[sizeof(b)-1] = '\0';
Buff.clear();
Buff += b;
}
Expand Down
49 changes: 45 additions & 4 deletions tests/check_cigar.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@

typedef std::map<std::string, std::string> name_seq_map;

name_seq_map read_fasta(const char* path) {
name_seq_map read_fasta(std::istream& is) {
name_seq_map res;
std::ifstream is(path);

int c = is.peek();
if(c != '>')
check_cigar_cmdline::error() << "Invalid fasta file '" << path << '\'';
check_cigar_cmdline::error() << "Invalid fasta file";
std::string line;
while(c != EOF) {
std::getline(is, line);
Expand All @@ -26,6 +25,48 @@ name_seq_map read_fasta(const char* path) {
return res;
}

name_seq_map read_fasta(const char* path) {
std::ifstream is(path);
return read_fasta(is);
}

name_seq_map read_fastq(std::istream& is) {
name_seq_map res;

std::string line;
int c = is.peek();
while(c != EOF) {
std::getline(is, line);
if(c != '@')
check_cigar_cmdline::error() << "Invalid fastq file: " << line;
std::string& seq = res[line.substr(1, line.find_first_of(" \t", 1) - 1)];
for(c = is.peek(); c != EOF && c != '+'; c = is.peek()) {
std::getline(is, line);
seq += line;
}
if(c == '+') {
std::getline(is, line);
std::getline(is, line);
c = is.peek();
}
}

return res;
}

name_seq_map read_seq(const char* path) {
std::ifstream is(path);
switch(is.peek()) {
case '>': return read_fasta(is);
case '@': return read_fastq(is);
default:
check_cigar_cmdline::error() << "Invalid sequence file '" << path << '\'';
}
// should never get there
exit(1);
}


char comp(char c) {
switch(c) {
case 'a': case 'A': return 't';
Expand Down Expand Up @@ -97,7 +138,7 @@ long find_nm(const std::vector<std::string>& fields) {
int main(int argc, char *argv[]) {
check_cigar_cmdline args(argc, argv);
auto ref_map = read_fasta(args.ref_arg);
auto qry_map = read_fasta(args.qry_arg);
auto qry_map = read_seq(args.qry_arg);

std::ifstream is(args.sam_arg);
if(!is.good())
Expand Down
4 changes: 4 additions & 0 deletions tests/gcc10_uniform_dist.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
#ifndef _GCC10_UNIFORM_DIST_H
#define _GCC10_UNIFORM_DIST_H

#ifndef __glibcxx_assert
#define __glibcxx_assert(x)
#endif

#include <type_traits>
#include <limits>

Expand Down
2 changes: 1 addition & 1 deletion tests/genome.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
time sed -e 's/^>\([^[:space:]]\+\).*/>\1/' $D/seed_reads_2.fa | tee genome | nucmer -G --delta /dev/stdout $D/seed_genome.fa /dev/stdin | \
time sed -E 's/^>([^[:space:]]+).*/>\1/' "${D}/seed_reads_2.fa" | tee genome | nucmer -G --delta /dev/stdout "${D}/seed_genome.fa" /dev/stdin | \
tee genome.delta | tail -n +3 | test_md5 8328b1577d8656eaa53aa61a113d89b0
4 changes: 2 additions & 2 deletions tests/mummer.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
mummer -mum $D/seed_reads_1.fa $D/seed_reads_0.fa | ufasta hsort -H | ufasta dsort | test_md5 4e8182c9f745abf59158f69a05b942f3
mummer -maxmatch $D/seed_reads_1.fa $D/seed_reads_0.fa | ufasta hsort -H | ufasta dsort | test_md5 a459f93742d1c36819e53e7a4c128bf7
mummer -mum "${D}/seed_reads_1.fa" "${D}/seed_reads_0.fa" | ufasta hsort -H | ufasta dsort | test_md5 4e8182c9f745abf59158f69a05b942f3
mummer -maxmatch "${D}/seed_reads_1.fa" "${D}/seed_reads_0.fa" | ufasta hsort -H | ufasta dsort | test_md5 a459f93742d1c36819e53e7a4c128bf7
2 changes: 1 addition & 1 deletion tests/sam.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ for i in 1 2; do
[ "$(grep '^@PG' $f | head -c $pglen)" = "$pgline" ]

# Test sequence headers
diff -q <(grep '^@SQ' $f) <(ufasta sizes -H $D/seed_reads_1.fa | sed 's/\([0-9]\+\) \([0-9]\+\)/@SQ\tSN:\1\tLN:\2/')
diff -q <(grep '^@SQ' $f) <(ufasta sizes -H $D/seed_reads_1.fa | sed -E 's/([0-9]+) ([0-9]+)/@SQ\tSN:\1\tLN:\2/')

# Test that samtools can parse our output
if [ -n "$SAMTOOLS" ]; then
Expand Down
11 changes: 8 additions & 3 deletions tests/test_md5
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#! /bin/bash
#! /usr/bin/env bash

md5sum -c <(echo "$1 -") 2>&1 || \
test $(md5) == "$1" 2>&1
# The semantic of md5sum differs in some subtle way. Darwin doesn't support
# /dev/stdin, FreeBSD doesn't support "-". Linux supports both.

case "$(uname)" in
(Darwin) exec md5sum -c <(echo "$1 -") 2>&1 ;;
(*) exec md5sum -c <(echo "$1 /dev/stdin") 2>&1 ;;
esac
Loading