This is a test version of Biostars. For the public version, visit https://www.biostars.org.
How to run Spades with debug option

I have paired fastq files that I have trimmed (Trm) and dedeplicated (Ded) with BBMap. I then run an assembly with Spades, but I got an error:

$ spades.py -1 1_TrmDed.fq.gz -2 2_TrmDed.fq.gz -o ./Assemble --metaviral 
Command line: ~/SPAdes/bin/spades.py    -1  1_TrmDed.fq.gz  -2  2_TrmDed.fq.gz  -o  Assemble    --metaviral 

System information:
  SPAdes version: 4.2.0
  Python version: 3.13.12
  OS: Linux-6.19.10-100.fc42.x86_64-x86_64-with-glibc2.41

Output dir: Assemble
Mode: read error correction and assembling
Debug mode is turned OFF

Dataset parameters:
  Metagenomic mode
  Reads:
    Library number: 1, library type: paired-end
      orientation: fr
      left reads: ['1_TrmDed.fq.gz']
      right reads: [2_TrmDed.fq.gz']
      interlaced reads: not specified
      single reads: not specified
      merged reads: not specified
Read error correction parameters:
  Iterations: 1
  PHRED offset will be auto-detected
  Corrected reads will be compressed
Assembly parameters:
  k: automatic selection based on read length
  Extrachromosomal mode is turned ON
  Repeat resolution is enabled
  Mismatch careful mode is turned OFF
  MismatchCorrector will be SKIPPED
  Coverage cutoff is turned OFF
  Assembly graph output will use GFA v1.2 format
Other parameters:
  Dir for temp files: Assemble/tmp
  Threads: 16
  Memory limit (in Gb): 62

======= SPAdes pipeline started. Log can be found here: Assemble/spades.log
1_TrmDed.fq.gz: max reads length: 150
2_TrmDed.fq.gz: max reads length: 150
Reads length: 150
Default k-mer sizes were set to [21, 33, 55, 77, 99, 127] because estimated read length (150) is equal to or greater than 150

===== Before start started. 
===== Read error correction started. 
===== Read error correction started. 
== Running: Assemble/corrected/configs/config.info

  0:00:00.000     1M / 19M   INFO    General                 (main.cpp                  :  76)   Starting BayesHammer, built from N/A, git revision 7fee3c1050a732faef8a0d93d70861015a96f44e
  0:00:00.003     1M / 19M   INFO    General                 (main.cpp                  :  77)   Loading config from "Assemble/corrected/configs/config.info"
Exception caught conversion of data to type "std::filesystem::__cxx11::path" failed

== Error ==  system call for: "[~/SPAdes/bin/spades-hammer', 'Assemble/corrected/configs/config.info']" finished abnormally, OS return value: 4
None

In case you have troubles running SPAdes, you can report an issue on our GitHub repository github.com/ablab/spades
Please provide us with params.txt and spades.log files from the output directory.
SPAdes log can be found here: Assemble/spades.log

How can I activate a debug mode?

How can I fix the Read error correction started problem?

How can I assess if the fastq files are good to start with? Is there a sanity checker I could use? The fastq files were processed by BBMap, so they should be good to start with; why did the assembly fail then?

Thank you

debug assembly spades

dedeplicated (Ded) with BBMap

What was the reason for this? What kind of deduplicaiion did you do and which BBMap tool did you use? Perhaps you should have normalized the data with bbnorm than deduplicate. Is this pro or eukaryotic data?

As for

How can I activate a debug mode?

Add --debug to your command line.

Thank you. Now I got

Mode: read error correction and assembling
Debug mode is turned ON

but I still get the Exception caught conversion of data to type "std::filesystem::__cxx11::path" failed error just like before.

How can I fix the Read error correction started problem?

That's not a problem, just output informing you about a step in the workflow being started: Read error correction.

I am not sure what exactly is wrong; however, it must be something unexpected in the input data that is causing this, possibly linked to your preprocessing of the reads. Some things to try:

  1. Check you have the latest version of the software, and your disk isn't full
  2. Use the trimmed data only
  3. Use the raw input data
  4. Change --metaviral for --isolate or just leave it out
  5. If all else fails, try MEGAHIT; you may try it anyway

P.S.: For what it's worth, I suspect the preprocessing messed up your read pairing, less likely with read naming or read length, or left empty reads with no sequence (least likely to cause these problems)

I also asked Google AI and it sounds plausible:

The "conversion of data to type std::filesystem::__cxx11::path failed" error in SPAdes typically occurs because the software is installed in or running from a directory path containing spaces (e.g., /home/user/my folder/spades). To fix this, move the SPAdes directory to a path with no spaces, such as /home/user/spades/. Common Causes and Solutions: Spaces in File/Folder Paths: SPAdes, particularly in version 4.0.0 and later, often fails when the working directory path contains spaces. Move your input files and the SPAdes installation to a path with no spaces. Corrupted Data or Improper Format: Ensure input FASTQ files are not corrupted, properly gzipped (or unzipped), and not using unexpected characters in the headers. Using tools like Trimmomatic to preprocess data can resolve formatting issues. Input File Errors: Ensure paired-end reads are correctly paired, as incorrect file pairing can lead to data parsing failures. If you are running in a Linux environment, verify your working directory path by running pwd.

Even though nothing in your post points to it make sure your home isn't something like /home/general failure/

Thanks, but Spades is located in a space free folder; in fact, I used the same pipeline before without problems. I could even run it with an online version via the PATRIC platform. But I'd prefer do it on my machine for more control...

Some more ideas:

  • set locale to standard: export LC_ALL=C then run again from the same shell (there was a longer post here that has been deleted recommending this)
  • try with the raw unprocessed input data instead
  • check df -h . to ensure your partition isn't full
  • check your input files with seqkit stats, that should at least protect against a broken gzipped file
  • open the input files with fastqc or fastp and look for errors
  • anything peculiar in Assemble/corrected/configs/config.info?

Ofc, all this is pure guesswork, as well as part of my proven debugging "strategy".

1 answer

  1. Can you check if your files are named correctly:
    left reads: ['1_TrmDed.fq.gz'] right reads: [2_TrmDed.fq.gz'] (missing ' on the left)

  2. Tilde (~) in the spades-hammer path (the actual crash): The ~ in ~/SPAdes/bin/spades-hammer is not being expanded to the full home directory path. std::filesystem::path in C++ does not expand ~ — it treats it as a literal character and fails to find the file.

Work around:

Instead of:

~/SPAdes/bin/spades.py

Use the full path:

/home/username/SPAdes/bin/spades.py -1 1_TrmDed.fq.gz -2 2_TrmDed.fq.gz \ -o ./Assemble --metaviral

thank you but spades.py is on the path, I do not need the tilde expansion to run it; however, even using the full path, I get the same error. Also, I removed a space from the folder containing the fastq files, but the error persists...

thank you, spades.py is on the path, I do not need the tilde expansion to run it; it turned out there was a space in the folder's name because the folder is linked to Google drive. I copied the files in another folder and now Spades is running. Thanks

Log in to answer this question.