bam2fq
bam2fq
原文日期: 2017-04-06
来源: https://github.com/wlz0726/wlz0726.github.io
BAM 转 FASTQ
使用 samtools
单端数据
1 | samtools fastq input.bam > output.fastq |
双端数据
1 | # 输出两个文件 |
参数说明:
-1: 第一个 read 的输出文件-2: 第二个 read 的输出文件-0: 只有一个 read 比对的输出(通常丢弃)-s: 只有一个 read 比对的输出(通常丢弃)-n: 保留原始 read 名
按比对状态过滤
1 | # 仅比对上的 reads |
使用 bedtools
1 | bedtools bamtofastq \ |
使用 Picard
1 | picard SamToFastq \ |
注意事项
质量值格式: 确保与下游工具兼容
双端配对: 保持 read1 和 read2 的顺序一致
文件名: 使用有意义的命名
压缩: 输出 gzip 压缩格式节省空间
1 | samtools fastq input.bam | gzip > output.fastq.gz |
此文档为 GitHub 博客自动归档