Mercurial > repos > iuc > circos
comparison alignments-to-links.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 import itertools | |
2 import sys | |
3 | |
4 from Bio import AlignIO | |
5 | |
6 | |
7 format_mapping = { | |
8 "xmfa": "mauve", | |
9 "maf": "maf", | |
10 "nex": "nexus", | |
11 # 'phylip': 'phylip-relaxed', | |
12 "stockholm": "stockholm", | |
13 } | |
14 | |
15 for aln in AlignIO.parse(sys.argv[1], format_mapping.get(sys.argv[2], "maf")): | |
16 | |
17 for (a, b) in itertools.combinations(aln, 2): | |
18 a_s = a.annotations["start"] | |
19 b_s = b.annotations["start"] | |
20 | |
21 if "size" in a.annotations: | |
22 a_l = a.annotations["size"] | |
23 b_l = b.annotations["size"] | |
24 a_e = a_l + a_s | |
25 b_e = b_l + b_s | |
26 else: | |
27 a_e = a.annotations["end"] | |
28 b_e = b.annotations["end"] | |
29 | |
30 sys.stdout.write("%s\t%s\t%s\t%s\t%s\t%s\n" % (a.id, a_s, a_e, b.id, b_s, b_e)) |