samtools线程数对 sam文件转换为bam文件效率的影响

samtools线程数对 sam文件转换为bam文件效率的影响

001、

(base) [b20223040323@admin1 batch_test02]$ ls ## 测试模板、测试sam文件

template.slurm test.sam

(base) [b20223040323@admin1 batch_test02]$ cat template.slurm ## 程序模板

#!/bin/bash

#SBATCH -J xxxx

#SBATCH -p Cnode2

##SBATCH -o %j.xxxx.result

##SBATCH -e %j.xxxx.error

#SBATCH -N 1

#SBATCH -n xxxx

#SBATCH --cpus-per-task=1

STIME=`date +%s`

samtools view -@ xxxx -b -S test.sam > xxxx.bam

let ETIME=`date +%s`-$STIME

echo thread_xxxx Elapsed time: $ETIME s > xxxx.time ## 分别给与4、16、32和64线程,并记录程序运行的时间

(base) [b20223040323@admin1 batch_test02]$ for i in 4 16 32 64; do sed "s/xxxx/$i/g" template.slurm > $i.slurm; done

(base) [b20223040323@admin1 batch_test02]$ find *.slurm | grep -v "template.slurm" | xargs -n 1 sbatch ## 投递任务

Submitted batch job 396049

Submitted batch job 396050

Submitted batch job 396051

Submitted batch job 396052

002、运行结果:

(base) [b20223040323@admin1 batch_test02]$ cat *.time | sort -V ## 查看运行的时间

thread_4 Elapsed time: 159 s

thread_16 Elapsed time: 46 s

thread_32 Elapsed time: 24 s

thread_64 Elapsed time: 13 s

003、结论

在其他参数不变的情况下,转化的效率与线程数几乎是成正比,线程数越多,运行速度越快。

相关文章

[天下足球]点杀阿根廷 贝克汉姆上演完美复仇
365bet稳定备用网站

[天下足球]点杀阿根廷 贝克汉姆上演完美复仇

⌛ 08-09 💥 6693
2025年创维电视选购全攻略,热门十款电视深度测评,屏幕显示效果究竟怎么样?附各型号价格参考,闭眼入不踩坑!
被欠薪后发现只有口头约定 工资该找谁要?
英国上市公司官网365

被欠薪后发现只有口头约定 工资该找谁要?

⌛ 02-02 💥 6530