Hello,
I was running the StrainPhlAn tutorial. Things were working fine until I got to the consensus markers step.
I ran the code:
sample2markers.py -i sams/*.sam.bz2 -o consensus_markers -n 8
And it yielded the following message. Let me know if you have ideas for troubleshooting.
Sat Aug 24 19:53:36 2024: Start samples to markers execution
Sat Aug 24 19:53:36 2024: Creating temporary directory…
Sat Aug 24 19:53:36 2024: Done.
Sat Aug 24 19:53:36 2024: Filtering SAM files…
Sat Aug 24 19:54:01 2024: Done.
Sat Aug 24 19:54:01 2024: Converting input files…
Sat Aug 24 19:54:01 2024: Converting samples to BAM format…
Sat Aug 24 19:54:01 2024: Done.
Sat Aug 24 19:54:01 2024: Sorting BAM samples…
Sat Aug 24 19:54:01 2024: Done.
Sat Aug 24 19:54:01 2024: Indexing BAM samples…
Sat Aug 24 19:54:01 2024: Done.
Sat Aug 24 19:54:01 2024: Done.
Sat Aug 24 19:54:01 2024: Getting consensus markers from samples…
Sat Aug 24 19:54:01 2024: Processing sample: consensus_markers/tmpx5ykqzag/SRS*.bam
Sat Aug 24 19:54:01 2024: Loading the bam file and extracting information…
Traceback (most recent call last):
File “/projects/clbd1748/software/anaconda/envs/mpa/bin/sample2markers.py”, line 10, in
sys.exit(main())
File “/projects/clbd1748/software/anaconda/envs/mpa/lib/python3.7/site-packages/metaphlan/utils/sample2markers.py”, line 399, in main
sampletomarkers.run_sample2markers()
File “/projects/clbd1748/software/anaconda/envs/mpa/lib/python3.7/site-packages/metaphlan/utils/sample2markers.py”, line 281, in run_sample2markers
filtered=‘_filtered’ if len(self.clades) > 0 else ‘’)
File “/projects/clbd1748/software/anaconda/envs/mpa/lib/python3.7/site-packages/metaphlan/utils/sample2markers.py”, line 119, in build_consensus_markers
results = self.get_consensuses_for_sample(i)
File “/projects/clbd1748/software/anaconda/envs/mpa/lib/python3.7/site-packages/metaphlan/utils/sample2markers.py”, line 141, in get_consensuses_for_sample
sam_file = pysam.AlignmentFile(input_bam)
File “pysam/libcalignmentfile.pyx”, line 742, in pysam.libcalignmentfile.AlignmentFile.cinit
File “pysam/libcalignmentfile.pyx”, line 991, in pysam.libcalignmentfile.AlignmentFile._open
ValueError: file has no sequences defined (mode=‘r’) - is it SAM/BAM format? Consider opening with check_sq=False
I’m running MetaPhlAn version 4.0.6 (1 Mar 2023).
Thanks,
Cliff