RemiAllio / MitoFinder

MitoFinder: efficient automated large-scale extraction of mitogenomic data from high throughput sequencing data
86 stars 14 forks source link

ERROR: MetaSPAdes didn't run well #42

Open pedrogribeiro opened 1 year ago

pedrogribeiro commented 1 year ago

Hello!

I was trying to run MitoFinder and got the error "ERROR: MetaSPAdes didn't run well". When checking the metaspades.log within the created result directory, it showed the following:

The program was terminated by segmentation fault
=== Stack Trace ===
'tuple' object has no attribute 'release'
Traceback (most recent call last):
  File "/opt/MitoFinder/metaspades/bin/metaspades.py", line 626, in main
    executor.execute(commands)
  File "/opt/MitoFinder/metaspades/share/spades/spades_pipeline/executors/executor_local.py", line 37, in execute
    command.run(self.log)
  File "/opt/MitoFinder/metaspades/share/spades/spades_pipeline/commands_parser.py", line 38, in run
    support.sys_call(self.to_list(), log)
  File "/opt/MitoFinder/metaspades/share/spades/spades_pipeline/support.py", line 330, in sys_call
    sys_error(cmd, log, proc.returncode)
  File "/opt/MitoFinder/metaspades/share/spades/spades_pipeline/support.py", line 91, in sys_error
    hints_str = get_error_hints(exit_code)
  File "/opt/MitoFinder/metaspades/share/spades/spades_pipeline/support.py", line 87, in get_error_hints
    return wsl_check()
  File "/opt/MitoFinder/metaspades/share/spades/spades_pipeline/support.py", line 78, in wsl_check
    if in_wsl():
  File "/opt/MitoFinder/metaspades/share/spades/spades_pipeline/support.py", line 76, in in_wsl
    return 'microsoft' in uname().release.lower()
AttributeError: 'tuple' object has no attribute 'release'

I used the following script to run it:

#!/bin/bash

#PBS -N 001_mitofinder_SPopGen_2023
#PBS -l select=1:ncpus=1:mem=70gb:scratch_local=300gb
#PBS -l walltime=23:59:00
#PBS -o /storage/brno2/home/pedroribeiro/Projects/Spicauda_PopGen/PBS/out/001_mitofinder_SPopGen.txt
#PBS -e /storage/brno2/home/pedroribeiro/Projects/Spicauda_PopGen/PBS/err/001_mitofinder_SPopGen.txt

#clean scratch after the end
trap 'clean_scratch' TERM EXIT

# go to scratch directory
cd $SCRATCHDIR || exit 1

export TMPDIR=$SCRATCHDIR

source /storage/brno2/home/pedroribeiro/.bashrc
cd /storage/brno2/home/pedroribeiro/Projects/Spicauda_PopGen/raw_reads

singularity run -B $SCRATCHDIR ~/software/mitofinder_latest.sif \
 --metaspades -j PR001.mitogenome \
 -1 /storage/brno2/home/pedroribeiro/Projects/Spicauda_PopGen/raw_reads/PR001_R1.fastq \
 -2 /storage/brno2/home/pedroribeiro/Projects/Spicauda_PopGen/raw_reads/PR001_R2.fastq \
 -r /storage/brno2/home/pedroribeiro/Projects/Spicauda_PopGen/mito_reference/mito_reference.gb \
 -o 5 \
 -p 8 \
 -m 70

Any tips on how to proceed? Let me know if anything else from my part would help!

Thank you

Pedro Ribeiro

RemiAllio commented 1 year ago

Hi!

Thank you for using MitoFinder!

Not sure it comes from there but I see that you are specifying ncpus=1 in your script while you are asking MitoFinder to use 8 CPUs (-p 8). This can lead to segmentation fault.

Could you please try to run it again using either ncpus=8 and -p 8 or ncpus=1 and -p 1 .

Let me know if it solves the issue! Best, Rémi

pedrogribeiro commented 1 year ago

Hi Remi! Thank you for your fast reply!

I tried your suggestions but it did not work either. I also tried removing the -B $SCRATCHDIR flag from singularity run, but same metaspades.log was given. There was a suggestion from the cluster admin to cp the input files to $SCRATCHDIR, will try it tomorrow along with using megahit instead. I will let you know over here if this works. Otherwise, would you have any other suggestions?

Many thanks!

Best,

Pedro

pedrogribeiro commented 1 year ago

Hey Remi! This is just to let you know that apparently megahit is working. Would be good to know what could be done about metaspades though, so if you still have any suggestions I would greatly appreciate it!

Many thanks!

Best,

Pedro

RemiAllio commented 1 year ago

Hi Pedro,

This is great news that MitoFinder is working with megahit!

Unfortunately I have no idea why metaspades doesn't work in your case. I have some examples where Metaspades never worked without knowing why. Sometimes it was a memory (RAM) issue, sometimes it was something else but I don't know what. Does the program halt quickly or does it take time to halt?

Have you tried to run metaspades alone with the same data? I mean outside of MitoFinder?

If it works like that (and it might since it worked like this for some datasets, again without any logical explanation for me), you can use the resulting assembly in MitoFinder with the -a option and skip the assembly step through MitoFinder.

I am very sorry for the inconvenience but I must admit that Metaspades is kind of mysterious to me sometimes :sweat_smile:

Best, Rémi

pedrogribeiro commented 1 year ago

I totally get that sometimes it might just get mysterious!

Anyway, thank you a lot for your comments, I will try different things suchs as running Metaspades outside of Mitofinder. But the genomes I am working with are quite simple and coverage is not bad, so I believe megahit might do a good job anyway!

Kind regards,

Pedro

RemiAllio commented 1 year ago

Nice, Megahit should indeed do a good job! 👌

I don't know how you've generated your assembly but you can also try to find the mitochondrial contig in your assembly (if not discarded by your assembly method).

Let me know if you get your mitochondrial genome and with what strategy! 😊

Best, Rémi