mortazavilab / TALON

Technology agnostic long read analysis pipeline for transcriptomes
MIT License
134 stars 31 forks source link

ERROR : [process_sams.py:108:preprocess_sam] when running talon #152

Open Dongxu-Zheng opened 3 months ago

Dongxu-Zheng commented 3 months ago

Hi, thanks for developing TALON for long-read RNA-seq analysis. I was working on the ONT direct RNA-sequencing data. Following the tutorial, I ran talon but there was an ERROR about sam files.

Here is the ERROR I got: [ 2024-06-07 19:45:43 ] : INFO : [talon.py:3146:main] : Started TALON run [ 2024-06-07 19:45:43 ] : WARNING : [talon.py:1902:check_inputs] : Ignoring dataset with name 'cl7dox0h' because it is already in the database. [ 2024-06-07 19:45:44 ] : ERROR : [process_sams.py:108:preprocess_sam] : Problem merging and indexing SAM/BAM files. Check your file paths and make sure that all files have headers. Traceback (most recent call last): File "/software/anaconda3/envs/talon/lib/python3.7/site-packages/talon/process_sams.py", line 92, in preprocess_sam pysam.merge(*merge_args) File "/software/anaconda3/envs/talon/lib/python3.7/site-packages/pysam/utils.py", line 75, in call stderr)) pysam.utils.SamtoolsError: 'samtools returned with error 1: stdout=, stderr=You must specify at least one (and usually two or more) input files.\nUsage: samtools merge [-nurlf] [-h inh.sam] [-b ] [ ... ]\n\nOptions:\n -n Input files are sorted by read name\n -r Attach RG tag (inferred from file names)\n -u Uncompressed BAM output\n -f Overwrite the output BAM if exist\n -1 Compress level 1\n -l INT Compression level, from 0 to 9 [-1]\n -R STR Merge file in the specified region STR [all]\n -h FILE Copy the header in FILE to [in1.bam]\n -c Combine @RG headers with colliding IDs [alter IDs to be distinct]\n -p Combine @PG headers with colliding IDs [alter IDs to be distinct]\n -s VALUE Override random seed\n -b FILE List of input BAM filenames, one per line [null]\n -@, --threads INT\n Number of BAM/CRAM compression threads [0]\n --input-fmt-option OPT[=VAL]\n Specify a single input file format option in the form\n of OPTION or OPTION=VALUE\n -O, --output-fmt FORMAT[,OPT[=VAL]]...\n Specify output format (SAM, BAM, CRAM)\n --output-fmt-option OPT[=VAL]\n Specify a single output file format option in the form\n of OPTION or OPTION=VALUE\n --reference FILE\n Reference sequence FASTA FILE [null]\n'

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/software/anaconda3/envs/talon/bin/talon", line 8, in sys.exit(main()) File "/software/anaconda3/envs/talon/lib/python3.7/site-packages/talon/talon.py", line 3191, in main sam_files, datasets, use_cb_tag, tmp_dir=tmp_dir, n_threads=threads File "/software/anaconda3/envs/talon/lib/python3.7/site-packages/talon/process_sams.py", line 123, in partition_reads merged_bam = preprocess_sam(sam_files, datasets, use_cb_tag, tmp_dir=tmp_dir, n_threads=n_threads) File "/software/anaconda3/envs/talon/lib/python3.7/site-packages/talon/process_sams.py", line 109, in preprocess_sam raise RuntimeError(msg) RuntimeError: Problem merging and indexing SAM/BAM files. Check your file paths and make sure that all files have headers.

The version of TALON I installed is v6.0. The version of samtools is 1.3.1. I also checked the header of my TALON labeled sam file where I can find the headers. Do you know what is the problem I got? Many thanks for any help!

Best, Dongxu

KMbio43 commented 3 weeks ago

I have the same problem. Have you solved it?

Dongxu-Zheng commented 2 weeks ago

I have the same problem. Have you solved it?

Hi, I used a conda environment to run talon. I downgraded pysam and it worked for me properly. My previous version of pysam is 0.22.1. Then I installed 0.21.0. Everything was going well. pip install pysam==0.21.0

KMbio43 commented 2 weeks ago

I have the same problem. Have you solved it?

Hi, I used a conda environment to run talon. I downgraded pysam and it worked for me properly. My previous version of pysam is 0.22.1. Then I installed 0.21.0. Everything was going well. pip install pysam==0.21.0

Ok, thank you for your reply. I will try it according to your method. Thank you very much!

Dongxu-Zheng commented 1 week ago

I have the same problem. Have you solved it?

Hi, I used a conda environment to run talon. I downgraded pysam and it worked for me properly. My previous version of pysam is 0.22.1. Then I installed 0.21.0. Everything was going well. pip install pysam==0.21.0

Ok, thank you for your reply. I will try it according to your method. Thank you very much!

Hi, if this solution doesn't work for you. Another way is to delete your database, then run talon_initialize_database again to initiate your database again. I failed to run talon step due to memory issue. When I rerun it, I got this ERROR. I deleted my database and run talon_initialize_database again. Then everything is going well.

KMbio43 commented 1 week ago

I have the same problem. Have you solved it?

Hi, I used a conda environment to run talon. I downgraded pysam and it worked for me properly. My previous version of pysam is 0.22.1. Then I installed 0.21.0. Everything was going well. pip install pysam==0.21.0

Ok, thank you for your reply. I will try it according to your method. Thank you very much!

Hi, if this solution doesn't work for you. Another way is to delete your database, then run talon_initialize_database again to initiate your database again. I failed to run talon step due to memory issue. When I rerun it, I got this ERROR. I deleted my database and run talon_initialize_database again. Then everything is going well.

I appreciate your prompt reply, although I don't know why I did it. But I will try the solution you gave me. Thank you very much for your detailed reply!