sanger-pathogens / iva

de novo virus assembler of Illumina paired reads
http://sanger-pathogens.github.io/iva/
Other
53 stars 18 forks source link

samtools sort command fails for samtools 1.3.1 #75

Closed ChrisHIV closed 6 years ago

ChrisHIV commented 6 years ago

$ iva -f new_1.fastq -r new_2.fastq IVAout The following command failed with exit code 1 samtools sort -@1 -m 500M IVAout/tmp.trim_strand_biased_ends.iqmm5fcr/out.unsorted.bam IVAout/tmp.trim_strand_biased_ends.iqmm5fcr/out

The output was:

[bam_sort] Use -T PREFIX / -o FILE to specify temporary and final output files Usage: samtools sort [options...] [in.bam] Options: -l INT Set compression level, from 0 (uncompressed) to 9 (best) -m INT Set maximum memory per thread; suffix K/M/G recognized [768M] -n Sort by read name -o FILE Write final output to FILE rather than standard output -T PREFIX Write temporary files to PREFIX.nnnn.bam -@, --threads INT Set number of sorting and compression threads [1] --input-fmt-option OPT[=VAL] Specify a single input file format option in the form of OPTION or OPTION=VALUE -O, --output-fmt FORMAT[,OPT[=VAL]]... Specify output format (SAM, BAM, CRAM) --output-fmt-option OPT[=VAL] Specify a single output file format option in the form of OPTION or OPTION=VALUE --reference FILE Reference sequence FASTA FILE [null]

andrewjpage commented 6 years ago

Hi, I've extend the automated tests to check more samtools versions (1.3, 1.3.1, 1.4, 1.4.1, 1.5, 1.6). As you can see the tests all pass for all samtools versions which would indicate theres a different problem with your setup. It might be that you need to update PySam. https://travis-ci.org/andrewjpage/iva/builds/286571341 Regards, Andrew

vflorelo commented 4 years ago

In my case str(external_progs.get_version('samtools')) >= '1.2' from the mapping.py file interprets 1.10 as smaller than 1.2 I modified my /usr/lib/python3.6/site-packages/iva/mapping.py and removed the conditional (lines 96-99) from:

if str(external_progs.get_version('samtools')) >= '1.2':
    sort_cmd = 'samtools sort -@' + str(threads) + ' -m ' + str(thread_mem) + 'M -o ' + final_bam + ' ' + intermediate_bam
else:
    sort_cmd = 'samtools sort -@' + str(threads) + ' -m ' + str(thread_mem) + 'M ' + intermediate_bam + ' ' + out_prefix

to

sort_cmd = 'samtools sort -@' + str(threads) + ' -m ' + str(thread_mem) + 'M -o ' + final_bam + ' 

It worked but I don't recommend doing this in a shared environment

Alqueno commented 2 years ago

In my case str(external_progs.get_version('samtools')) >= '1.2' from the mapping.py file interprets 1.10 as smaller than 1.2 I modified my /usr/lib/python3.6/site-packages/iva/mapping.py and removed the conditional (lines 96-99) from:

if str(external_progs.get_version('samtools')) >= '1.2':
    sort_cmd = 'samtools sort -@' + str(threads) + ' -m ' + str(thread_mem) + 'M -o ' + final_bam + ' ' + intermediate_bam
else:
    sort_cmd = 'samtools sort -@' + str(threads) + ' -m ' + str(thread_mem) + 'M ' + intermediate_bam + ' ' + out_prefix

to

sort_cmd = 'samtools sort -@' + str(threads) + ' -m ' + str(thread_mem) + 'M -o ' + final_bam + ' 

It worked but I don't recommend doing this in a shared environment

I've the same issue. could it be related with locale? in my setting "." is not the decimal separator (it is "," instead, because the system language is spanish) so maybe it is sorting or comparing as text.