Skip to content
Snippets Groups Projects
Commit 7624b051 authored by Arslan Tariq's avatar Arslan Tariq
Browse files

Add new file

parent 8eab1b92
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Author: Xiaofei Zeng
# Email: xiaofei_zeng@whu.edu.cn
# Created Time: 2023-12-18 15:27
import argparse
import os
def rename_reads(bam):
n = 0
with os.popen('samtools view -h {}'.format(bam)) as f:
for line in f:
if not line.strip():
continue
if line.startswith('@'):
print(line, end='')
elif line.split()[1] != '0':
print('read{}\t{}'.format(n//2, line.split('\t', 1)[-1]), end='')
n += 1
def main():
parser = argparse.ArgumentParser()
parser.add_argument('bam', help='paired-end bam output by wf-pore-c')
args = parser.parse_args()
rename_reads(args.bam)
if __name__ == '__main__':
main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment