view write_tsv_script.py @ 2:e41dcb0e913b draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit 2609367ebbce7e0c3f5b4b2d7c60a82d4bd03246"
author iuc
date Tue, 25 Jan 2022 07:56:22 +0000
parents
children 6aad515a5270
line wrap: on
line source

#!/usr/bin/env python

import re
import sys

search_str = r"^>(NODE|\S+)_(\d+)(?:_|\s)length_(\d+)_cov_(\d+\.*\d*).*\$"

replace_str = r"\1_\2\t\3\t\4"

cmd = re.compile(search_str)

sys.stdout.write("#name\tlength\tcoverage\n")

for i, line in enumerate(sys.stdin):
    if cmd.match(line):
        sys.stdout.write(cmd.sub(replace_str, line))