合并sam文件_如何在Linux上合并SAM文件?

合并sam文件

The samtools merge can merge bam files while it can not work for sam files.

samtools merge可以合并bam 文件,而不能用于sam文件。

How to merge sam files on Linux?

如何在Linux上合并sam文件?

According to the sam format specification, header lines start with @, while alignment lines do not. So you can use grep to merge sam files as follows efficiently.

根据sam格式规范 ,标题行以@ 开头 ,而对齐行则不是。 因此,您可以使用grep如下有效地合并sam文件。

Assume the header is from 0.sam, the files to be merged are 0.sam, 1.sam and 2.sam, and the merged output sam file is out.sam.

假设标头来自0.sam,要合并的文件为0.sam,1.sam和2.sam,并且合并的输出sam文件为out.sam。

header=0.sam
files="0.sam 1.sam 2.sam"
output=out.sam

(grep ^@ $header; for f in $files; do grep -v ^@ $f; done) > $output

It should be much faster than the way of “convert sams to bams, merge bams by samtools merge, convert bam to sam”.

它应该比“将sam转换为bam,通过samtools merge bam,将bam转换为sam”的方式快得多。

Answered by Eric Z Ma.
埃里克·马(Eric Z Ma)回答。

翻译自: https://www.systutorials.com/how-to-merge-sam-files-on-linux/

合并sam文件

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值