view sanitize_bed.py @ 16:17f911830a8c draft

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/ivar/ commit 9d25797b06335056930bddede98a2f3f9a303470
author iuc
date Tue, 27 Jun 2023 17:14:55 +0000
parents e319b5b65879
children
line wrap: on
line source

#!/usr/bin/env python

import sys


with open(sys.argv[1]) as i:
    bed_data = i.readlines()

sanitized_data = []
try:
    for record in bed_data:
        if record.strip():
            fields = record.split('\t')
            sanitized_data.append(
                '\t'.join(fields[:4] + ['60'] + fields[5:])
            )
except IndexError:
    pass  # leave column number issue to getmasked
else:
    with open(sys.argv[1], 'w') as o:
        o.writelines(sanitized_data)