Hi Sergei,
  maybe you want to try biobambam2 (based on libmaus2). The bamsort is IMO 
superior to samtools. The tricks are to increase write chunk sizes. You can 
eventually for mu Closed issue on github under biobambam2 project where I 
experienced performance issues, resulting in the below tweaks.

Nowoshilow,Sergej napsal(a):
> 
> The reads map beyond 1,073,741,824.
> 
>  
> 
> I guess I’ll just write a small sorting utility.

take_memory=57344 # * 1024 = 56GB through bamsort

sort_bam_file(){
    # samtools sort of a 149GB BAM file takes 1.2TB RAM and uses only a single 
thread despite '-@ 15' argument
    # samtools sort -@ $xthreads -m "$gb_mem_per_thread"G -O bam -T "$1" -o 
"$2".sorted.bam "$2".bam || exit 255
    LIBMAUS2_POSIXFDINPUT_BLOCKSIZE_OVERRIDE==1m
    export LIBMAUS2_POSIXFDINPUT_BLOCKSIZE_OVERRIDE
    bamsort SO=coordinate blockmb="$take_memory" sortthreads="$sort_threads" 
inputthreads="$input_threads" outputthreads="$output_threads" level=9 index=1 
I="$2".bam O="$2".sorted.bam || exit 255
}

sort_bam_file_by_name(){
    # samtools sort of a 149GB BAM file takes 1.2TB RAM and uses only a single 
thread despite '-@ 15' argument
    # samtools sort -@ "${xthreads}" -n -m "${gb_mem_per_thread}"G -O bam -T 
"$1" -o "$2".namesorted.bam "$2".bam || exit 255
    LIBMAUS2_POSIXFDINPUT_BLOCKSIZE_OVERRIDE==1m
    export LIBMAUS2_POSIXFDINPUT_BLOCKSIZE_OVERRIDE
    bamsort SO=queryname blockmb="$take_memory" sortthreads="$sort_threads" 
inputthreads="$input_threads" outputthreads="$output_threads" level=9 index=1 
I="$2".bam O="$2".namesorted.bam || exit 255
}

Hope this helps,
Martin

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Samtools-help mailing list
Samtools-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/samtools-help

Reply via email to