bwa+samtools,ERR: couldn't allocate memory for bam_mem

在运行bwa+samtools时报错,


cmd:bwa mem -t 50 -k 32 -M -R '@RG\tID:1\tSM:1' ~/reference/bwa_index 1_1.clean.fastq.gz 1_2.clean.fastq.gz | samtools sort -@ 20 -O BAM -o 1.sort.bam

查看samtools中sort命令的帮助信息:


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
  -t TAG     Sort by value of TAG. Uses position as secondary index (or read name if -n is set)
  -o FILE    Write final output to FILE rather than standard output
  -T PREFIX  Write temporary files to PREFIX.nnnn.bam
      --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]
  -@, --threads INT
               Number of additional threads to use [0]

单个线程需要768M内存,需要设置合适的-m参数或-@参数。同时,bwa的线程数也要合理设置。

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。