Mummerplot running errors and solutions

2017/09/13 00:25:27

Mummerplot is a excellent program and it has been a long time since last version 3.23 Here are some trouble-shooting:

1. For large reference genome (>536,870,908 bp) 

Error: mummer: suffix tree construction failed: textlen=ddddddd larger than maximal textlen=536870908

1.1 compile

Explanation: default compiled x86 version only support small genome (less than 536,870,908bp). If you have a larger one, you need to enable x64 version. So compile mummerplot again using

      $ make CPPFLAGS=” -O3 -DSIXTYFOURBITS”

2. modify nucmer

And if you still get that error, you need to modify nucmer program, here is how-to

2.1 open ‘nucmer’ file using text editor like ‘gedit’

2.2 jump to line 336-343

open(ALGO_PIPE, “$algo_path $algo $mdir -l $size -n $pfx.ntref $qry_file ”)

                or $tigr->bail (“ERROR: could not open $algo_path output pipe $!”);

open(CLUS_PIPE, “ $mgaps_path -l $clus -s $gap -d $ddiff -f $dfrac > $pfx.mgaps”)

                or $tigr->bail (“ERROR: could not open $mgaps_path input pipe $!”);

while ( ) {

                print CLUS_PIPE

                or $tigr->bail (“ERROR: could not write to $mgaps_path pipe $!”);

}

$err[0] = close(ALGO_FILE);

$err[1] = close(CLUS_PIPE);

2.3. replace them with

    $err[0] = $tigr->runCommand (“$algo_path $algo $mdir -l $size -n $pfx.ntref $qry_file > $pfx.mummmer”);

    if ( $err[0] != 0 ) {

        $tigr->bail(“ERROR: Error: mummer output error\n”);

    }

    unless (-s “$pfx.mummmer”) {

        die “Error: mummer output error\n”;

    }

    open(ALGO_FILE, “< $pfx.mummmer”)

                or $tigr->bail (“ERROR: could not open $algo_path output file: $pfx.mummmer”);

    open(CLUS_PIPE, “ $mgaps_path -l $clus -s $gap -d $ddiff -f $dfrac > $pfx.mgaps”)

                or $tigr->bail (“ERROR: could not open $mgaps_path input pipe $!”);

    while ( ) {

                print CLUS_PIPE

                or $tigr->bail (“ERROR: could not write to $mgaps_path pipe $!”);

    }

    $err[0] = close(ALGO_FILE);

    $err[1] = close(CLUS_PIPE);

2.4 So use nucmer2 instead of nucmer

Explanation: nucmer use pipe to tranfer mummer output to feed mgaps as input. some times that is problematic. better to separate them. In this case there will be another output file: $prefix.mummer

3. replace mummer with e-mem [[[ OPTIONAL with care ]]]

IF IF IF IF you still have some problem, trying to use multi-thread version of mummer: E-MEM. But do it carefully.

3.1 install e-mem

e-mem website

E-mem was reported to use multithreads and run in low memory requirements

create a file ‘emem’ in the same path as nucmer2/nucmer/mummerplot, and this is the content

#!/bin/bash

numthreads=1

edit this number to use multithreads

/path/to/e-mem -t $numthreads “$@”

edit /path/to/e-mem to where to find e-mem program

if [ $? -ne 0 ]; then

echo “Error: E-mem running failed” >&2

exit 100

else

echo “E-mem running succeeded”

exit 0

fi

3.2 make ’emem’ to be an excutable

$ chmod +x /path/to/emem

3.3 edit nucmer

text editor open ‘nucmer2‘ and save as ‘nucmer_emem‘

Go to line 99, and 247, find ‘$BIN_DIR/mummer‘ and replace them with ‘$BIN_DIR/emem‘

3.4 So use nucmer_emem instead of nucmer

4. modify mummerplot

4.1 text editor open ‘mummerplot’

4.2 go to line 565 and 575, change first + to *

replace :

if ( /^\s+(\d+)\s+(\d+)\s+(\d+)$/ ) {

by :

if ( /^\s*(\d+)\s+(\d+)\s+(\d+)$/ ) {

Quick explanation : it search for a line that begin with one or more space, but when you have a start superior to 9999999, this space do not exist anymore.

So if you change ‘+’ by ‘*’ it search for 0 or more spaces.

4.3 Go line: line 884, 894, 981, 991, 1034, 1044

remove ‘defined’ and the corresponding bracket pairs’()’

replace if (defined(%hash)) { … }

by if (%hash) { … }

Quick explanation : OLD perl grammar may report error in latest perl