comparison tiles-from-bed.py @ 2:014a21767ac4 draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
author iuc
date Tue, 17 Sep 2019 16:54:57 -0400
parents
children
comparison
equal deleted inserted replaced
1:ae9994cf526f 2:014a21767ac4
1 #!/usr/bin/env python
2 import logging
3 import sys
4
5 logging.basicConfig(level=logging.INFO)
6 log = logging.getLogger()
7
8
9 if __name__ == "__main__":
10 with open(sys.argv[1], "r") as handle:
11 for line in handle:
12 lineData = line.strip().split()
13 # BED3+ chrom chromStart chromEnd
14 # BED6+ name score strand
15 # BED9+ thickStart thickEnd itemRgb
16 kv = {}
17 if len(lineData) >= 6:
18 kv["strand"] = lineData[5].replace("+", "1").replace("-", "-1")
19 kv["name"] = lineData[3]
20 kv["value"] = lineData[4]
21
22 line = [
23 lineData[0], # chrom
24 lineData[1], # chromStart
25 lineData[2], # chromEnd
26 ",".join(["%s=%s" % x for x in sorted(kv.items())]),
27 ]
28
29 sys.stdout.write("\t".join(line))
30 sys.stdout.write("\n")