view write_tsv_script.py @ 18:dd7ad84f3943 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/spades commit b47891020e4aa3a165daad952d7e38cc7a2130ac"
author iuc
date Mon, 21 Feb 2022 10:17:34 +0000
parents d2d1df21dfb9
children 78ced22d09a2
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))