Dfam-consortium / RepeatMasker

RepeatMasker is a program that screens DNA sequences for interspersed repeats and low complexity DNA sequences.
Other
226 stars 49 forks source link

Illegal division by zero at RepeatMasker line 8162 #195

Closed carsonhh closed 1 year ago

carsonhh commented 1 year ago

RepeatMasker version 4.1.4 Dfam version 3.7 Error occurs whenever -species is set to a node near the base of the tree, i.e. 'cellular organism'

Example command --> RepeatMasker contig.fa -species 'cellular organism' -dir output

Error --> Illegal division by zero at RepeatMasker line 8162

When generating thresholds from the 'preThresh' files, the regular expression used to parse the file on line 8141 fails to account for negative numbers

So a line like this in the preThresh file under the cache directory generates a failure --> STATS LOCAL FORWARD -4.5297 0.70202

Changing the regular expression used on RepeatMasker line 8141 fixes the issue

#instead of this
if ( /^STATS\s+LOCAL\s+FORWARD\s+([\d\.]+)\s+([\d\.]+)/ ) {
#do this instead
if ( /^STATS\s+LOCAL\s+FORWARD\s+([\-\d\.]+)\s+([\d\.]+)/ ) {

Also when using Dfam together with option -species of 'root' or 'all' cause the program to fail with --> Species "root" is not known to RepeatMasker

Example command --> RepeatMasker contig.fa -species 'root' -dir output

This is inconsistent with the alternate behavior when using RepeatMasker with RepBase where 'root' and 'all' both function just fine. Note that 'root' is valid for NCBI taxonomy.

Fix the issue by changing RepeatMasker line 7718 from this --> if ( $lineage eq "") {

To this --> if ( $lineage eq "" && $species ne 'root' && $species ne 'all') {

tolender commented 1 year ago

I have this issue as well when building 'rodents' using nhmmr with dfam

"Illegal division by zero at /home/###/###/###/###/RepeatMasker/RepeatMasker line 8162, line 1098"

Using the suggested code fix at line 8141 suggested by carsonhh also fixed the issue at line 8141

rmhubley commented 1 year ago

Indeed this is a bug and the fix suggested by carsonhh is correct. I will be releasing a patch to this shortly.

rmhubley commented 1 year ago

This has been fixed in RepeatMasker 4.1.5, released today.