r3fang / SnapTools

A module for working with snap files in Python
Apache License 2.0
35 stars 21 forks source link

snaptools align-paired-end fail to open bam file #39

Open mAGLAVE opened 2 years ago

mAGLAVE commented 2 years ago

Hello, I have an issue when I run snaptools align-paired-end. It fails to open bam file.

Code:

sample_name="pSCHKA_ATAC"
output="/mnt/beegfs/scratch/bioinfo_core/B22005_NADR_02/data_output/"
output_dex_concat=${output}"fastq_dex_concat/"
output_alignment=${output}"SNAPtools_alignment_delgz/"
mkdir -p ${output_alignment}
snaptools align-paired-end \
--input-reference="/mnt/beegfs/scratch/bioinfo_core/B22005_NADR_02/data_output/bwa_delgz/0.7.17-r1188/homo_sapiens/GRCh38/Ensembl/r99/Homo_sapiens.GRCh38.dna.primary_assembly.fa" \
--input-fastq1=${output_dex_concat}${sample_name}"_L001_R1_001.dex.concat.fastq.gz" \
--input-fastq2=${output_dex_concat}${sample_name}"_L001_R3_001.dex.concat.fastq.gz" \
--output-bam=${output_alignment}${sample_name}".bam" \
--aligner="bwa" \
--path-to-aligner="/mnt/beegfs/userdata/m_aglave/.environnement_conda/snaptools/bin/" \
--read-fastq-command="zcat" \
--min-cov=0 \
--num-threads=16 \
--tmp-folder=./ \
--if-sort=True \
--overwrite=TRUE \
--verbose=TRUE

Log:

M::bwa_idx_load_from_disk] read 0 ALT contigs
[M::process] read 1616162 sequences (80000019 bp)...
[M::process] read 1616162 sequences (80000019 bp)...
[M::mem_pestat] # candidate unique pairs for (FF, FR, RF, RR): (998, 599894, 118, 926)
[M::mem_pestat] analyzing insert size distribution for orientation FF...
[M::mem_pestat] (25, 50, 75) percentile: (43, 86, 181)
[...]
[M::mem_pestat] skip orientation FF
[M::mem_pestat] skip orientation RF
[M::mem_pestat] skip orientation RR
[M::mem_process_seqs] Processed 1080384 reads in 377.998 CPU sec, 47.792 real sec
[main] Version: 0.7.17-r1188
[main] CMD: /mnt/beegfs/userdata/m_aglave/.environnement_conda/snaptools/bin//bwa mem -t 8 /mnt/beegfs/scratch/bioinfo_core/B22005_NADR_02/data_output/bwa_delgz/0.7.17-r1188/homo_sapiens/GRCh38/Ensembl/r99/Homo_sapiens.GRCh38.dna.primary_assembly.fa /dev/fd/63 /dev/fd/62
[main] Real time: 40901.275 sec; CPU: 320623.776 sec
[E::hts_open] fail to open file '/mnt/beegfs/scratch/bioinfo_core/B22005_NADR_02/data_output//SNAPtools_alignment_delgz/pSCHKA_ATAC.bam'
Traceback (most recent call last):
  File "/mnt/beegfs/userdata/m_aglave/.environnement_conda/snaptools/bin/snaptools", line 38, in <module>
    parse_args()    
  File "/mnt/beegfs/userdata/m_aglave/.environnement_conda/snaptools/lib/python3.5/site-packages/snaptools/parser.py", line 104, in parse_args
    verbose=args.verbose)
  File "/mnt/beegfs/userdata/m_aglave/.environnement_conda/snaptools/lib/python3.5/site-packages/snaptools/alignment.py", line 379, in run_align_pe
    pysam.sort("-n", "-@", str(num_threads), "-o", output_bam, ftmp.name);
  File "/mnt/beegfs/userdata/m_aglave/.environnement_conda/snaptools/lib/python3.5/site-packages/pysam/__init__.py", line 79, in __call__
    (retval, "\n".join(stderr)))
pysam.SamtoolsError: 'csamtools returned with error 1: [bam_sort_core] fail to open file /mnt/beegfs/scratch/bioinfo_core/B22005_NADR_02/data_output//SNAPtools_alignment_delgz/pSCHKA_ATAC.bam\n'

Thank you for your help!

mAGLAVE commented 2 years ago

The problem seem to come from the python version for samtools. With python3.5 and --if-sort=True : problem! With python3.5 and --if-sort=False : no problem. With python2.7 and --if-sort=True : no problem.