Hi,
May I ask a naive question on what could be wrong when I try to run the chimeric alignment using presplit_map.py from diffHic package. It seems an error from samtools but I couldn't figure out what causes it. I updated my samtools version from 1.31 to 1.6 and I still having the same problem. I thank you in advance for any help.
Command
python /pathto/presplit_map.py \
-G /pathto/bowtie2_idx/mm10 \
-1 SRR_1.fastq \
-2 SRR_2.fastq \
--sig AAGCTAGCTT \
-o SRR.bam
Error
Traceback (most recent call last):
File "/home/R/x86_64-pc-linux-gnu-library/3.4/diffHic/python/presplit_map.py", line 197, in <module>
pysam.sort("-n", outbam, bsorted)
File "/home/local/share/bcbio/anaconda/lib/python2.7/site-packages/pysam/utils.py", line 75, in __call__
stderr))
pysam.utils.SamtoolsError: 'samtools returned with error 1: stdout=, stderr=[bam_sort] Use -T PREFIX / -o FILE to specify temporary and final output files\nUsage: samtools sort [options...] [in.bam]\nOptions:\n -l INT Set compression level, from 0 (uncompressed) to 9 (best)\n -m INT Set maximum memory per thread; suffix K/M/G recognized [768M]\n -n Sort by read name\n -o FILE Write final output to FILE rather than standard output\n -T PREFIX Write temporary files to PREFIX.nnnn.bam\n -@, --threads INT\n Set number of sorting and compression threads [1]\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'
Hm... I suspect this may be something to do with my
sort
call in pysam. I will test this myself, but you can try this:presplit_map.py
to your local directory (to avoid changing the installed copy).sort
call (on line 197) topysam.sort("-o", outbam, "-n", bsorted)
.os.rename(bsorted, outbam)
.This should reflect the updates to the SAMtools API. (Make sure you don't mess with the indenting when you edit the code!)
I'll check this myself when I can, so don't worry if you can't get it to work.
P.S. Use the "add comment" button to respond to answers - unless you're answering your own question!
Thank you for the advice, I'm very new in this kind of forum, sorry for any mistake.
So, I've done the suggested changes, but got another errors:
python presplit_map.py -G /home/nagailae/database/mm10/bowtie2_idx/mm10 -1 SRR_1.fastq -2 SRR_2.fastq --sig AAGCTAGCTT -o SRR.bam
[E::hts_open_format] Failed to open file ./tmpkuRGt0/sorted
Traceback (most recent call last):
File "presplit_map.py", line 197, in <module>
pysam.sort("-o", outbam, "-n", bsorted)
File "/home/nagailae/local/share/bcbio/anaconda/envs/py27/lib/python2.7/site-packages/pysam/utils.py", line 75, in __call__
stderr))
pysam.utils.SamtoolsError: 'samtools returned with error 1: stdout=, stderr=samtools sort: can\'t open "./tmpkuRGt0/sorted": No such file or directory\n[bam_sort] Note the <out.prefix> argument has been replaced by -T/-o options\n'
Ugh. Looks like the updated samtools needs an additional field on line 197:
Notice that I've flipped
bsorted
andoutbam
around, I made a mistake in my previous comment.Edit: I realized that you shouldn't need the
-T
at all, the above corrected code should be sufficient.Thank you very much Aaron, it worked perfectly now!!
P.S. there's an extra parenthesis in the end ;)
Ops, another error...
Traceback (most recent call last):
File "presplit_map.py", line 140, in <module>
raise SystemError, "bowtie2 failed for presplit alignment"
My bowtie2 version is 2.3.3.1.
Sorry, this error was caused because an interruption of the job here. I ran using qsub and seems like it is working well so far. As soon as I get results from alignment I report here again.