Error when running Metaphlan

Dear All,

I run metaphlan in a couple of samples with the following commands:

#!/bin/bash
#BSUB -J metagenomics
#BSUB -o metaphaln/meta-%J.out
#BSUB -e metaphaln/meta-%J.err
#BSUB -q normal
#BSUB -n 100

module add miniconda3
conda activate mpa

cd /data/azomorrodi/SLeo/multiple_samples/fastq/nohost

for R1 in ls no_host*__1_paired.fastq

do

R2=${R1//__1_paired.fastq/__2_paired.fastq}

samplename=${R1%%__1_paired.fastq}""

metaphlan $R1,$R2 -o /data/azomorrodi/SLeo/multiple_samples/metaphlan/$samplename"_results.txt" --bowtie2out /data/azomorrodi/SLeo/multiple_samples/metaphlan/$samplename"results.bz2" -s /data/azomorrodi/SLeo/multiple_samples/metaphlan/"results_sam"$samplename".sam.bz2" --input_type fastq

done

Unfortunately, I got this error message:

Traceback (most recent call last):
File “/PHShome/sl1533/.conda/envs/mpa/bin/read_fastx.py”, line 10, in
sys.exit(main())
File “/PHShome/sl1533/.conda/envs/mpa/lib/python3.7/site-packages/metaphlan/utils/read_fastx.py”, line 173, in main
f_nreads, f_avg_read_length = read_and_write_raw(f, opened=False, min_len=min_len, prefix_id=prefix_id)
File “/PHShome/sl1533/.conda/envs/mpa/lib/python3.7/site-packages/metaphlan/utils/read_fastx.py”, line 135, in read_and_write_raw
nreads, avg_read_length = read_and_write_raw_int(inf, min_len=min_len, prefix_id=prefix_id)
File “/PHShome/sl1533/.conda/envs/mpa/lib/python3.7/site-packages/metaphlan/utils/read_fastx.py”, line 109, in read_and_write_raw_int
print_record(description + “__{}{}{}”.format(prefix_id, ‘.’ if prefix_id else ‘’, idx), sequence, qual, fmt))
BrokenPipeError: [Errno 32] Broken pipe
Error reading _ebwt array: 5640, 3756053120Error Reading File!
Error: Encountered internal Bowtie 2 exception (#1)
Command: /PHShome/sl1533/.conda/envs/mpa/bin/bowtie2-align-l --wrapper basic-0 --seed 1992 --quiet --very-sensitive -x /PHShome/sl1533/.conda/envs/mpa/lib/python3.7/site-packages/metaphlan/metaphlan_databases/mpa_vJun23_CHOCOPhlAnSGB_202307 -p 4 --passthrough -U -
(ERR): bowtie2-align exited with value 1

Can somebody help in this?

Many thanks

Stefano

Hi Stefano,
Did it resolve? I also got the same ‘broken pipe’ when creating a taxonomic profile by running metaphlan 4.

#I ran the following command:
metaphlan SRS014459-Stool.fasta.gz --input_type fasta > stool_mgx_profile.txt
#And got this error
(ERR): bowtie2-align died with signal 9 (KILL)
Traceback (most recent call last):
File “/g/data/fi66/apps/mp/4.1.1/bin/read_fastx.py”, line 8, in
sys.exit(main())
^^^^^^
File “/g/data/fi66/apps/mp/4.1.1/lib/python3.12/site-packages/metaphlan/utils/read_fastx.py”, line 173, in main
f_nreads, f_avg_read_length = read_and_write_raw(f, opened=False, min_len=min_len, prefix_id=prefix_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/g/data/fi66/apps/mp/4.1.1/lib/python3.12/site-packages/metaphlan/utils/read_fastx.py”, line 135, in read_and_write_raw
nreads, avg_read_length = read_and_write_raw_int(inf, min_len=min_len, prefix_id=prefix_id)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/g/data/fi66/apps/mp/4.1.1/lib/python3.12/site-packages/metaphlan/utils/read_fastx.py”, line 108, in read_and_write_raw_int
_ = sys.stdout.write(
^^^^^^^^^^^^^^^^^
BrokenPipeError: [Errno 32] Broken pipe

Thanks,
Sourav

Hi Sourav,

in my case, I guess it was a problem with bowtie2.

I have done the following:
pip3 install pyOpenSSl --upgrade and then run the command with LSF in interactive mode and it worked.

Hope that it is of help.

Hi Stefano,
I did that. But it is still not working for me.

I tried to delete and reinstall the metaphlan database again. But still I am getting the same broken pipe error.

Sourav