Mercurial > repos > iuc > circos
annotate karyotype-from-lengths.py @ 11:0ee66defe58b draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit b9ec351920dbc83fa14bd1f8cfdd0a6a19b89473"
| author | iuc | 
|---|---|
| date | Tue, 16 Nov 2021 09:19:09 +0000 | 
| parents | b7c1698df177 | 
| children | 
| rev | line source | 
|---|---|
| 7 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 1 #!/usr/bin/env python | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 2 import csv | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 3 import sys | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 4 | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 5 | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 6 idx = 0 | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 7 with open(sys.argv[1], "r") as csvfile: | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 8 spamreader = csv.reader(csvfile, delimiter="\t", quotechar='"') | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 9 for row in spamreader: | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 10 if len(row) < 2: | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 11 continue | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 12 | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 13 seq_id = row[0] | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 14 length = row[1] | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 15 | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 16 sys.stdout.write( | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 17 "chr - {seq_id} {seq_id} 0 {length} chr{idx}color\n".format( | 
| 8 
b7c1698df177
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit cc96dd4a8aef7d0b6d3057024af0344ab8a9410f"
 iuc parents: 
7diff
changeset | 18 seq_id=seq_id, idx=idx, length=length | 
| 7 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 19 ) | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 20 ) | 
| 
ecaa0210e62b
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit ef20b4968a6d00c49209de6b723f8b96d8bd128a"
 iuc parents: diff
changeset | 21 idx += 1 | 
