将非标头 SAM 文件转换为 BAM 文件

问题描述 投票:0回答:0

我一直在尝试将 SAM 文件转换为 BAM 文件,但我使用的文件没有标题,我正在使用以下代码进行转换,但它不起作用

有人知道怎么做吗?

import subprocess

sam_file = "/home/x249344/Python_scripts/test.sam"
bam_file = "/home/x249344/Python_scripts/test.bam"

subprocess.run(["samtools", "view", "-Sb", "-o", bam_file, "-H", "/dev/null", sam_file], check=True)
python subprocess
© www.soinside.com 2019 - 2024. All rights reserved.