annotate fasta-to-karyotype.py @ 3:fd59d783248a draft

"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit f04fe62fb7dbad75e597da8cd674cfe36ed3d80a"
author iuc
date Mon, 02 Dec 2019 08:14:29 -0500
parents 014a21767ac4
children 740057a5126d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ef5f8bbf7730 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit a41493893bdcbe330434db9c5851719012b62fa8
iuc
parents:
diff changeset
1 #!/usr/bin/env python
ef5f8bbf7730 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit a41493893bdcbe330434db9c5851719012b62fa8
iuc
parents:
diff changeset
2 import sys
ef5f8bbf7730 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit a41493893bdcbe330434db9c5851719012b62fa8
iuc
parents:
diff changeset
3
ef5f8bbf7730 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit a41493893bdcbe330434db9c5851719012b62fa8
iuc
parents:
diff changeset
4 from Bio import SeqIO
ef5f8bbf7730 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit a41493893bdcbe330434db9c5851719012b62fa8
iuc
parents:
diff changeset
5
2
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
6 # Process fasta data, extracting only headers
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
7 for idx, seq in enumerate(SeqIO.parse(sys.argv[1], "fasta")):
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
8 sys.stdout.write(
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
9 "chr - {seq_id} {seq_id} 0 {length} {theme}-{color}\n".format(
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
10 seq_id=seq.id,
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
11 idx=idx,
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
12 length=len(seq),
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
13 color=((idx + 1) % 12),
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
14 theme=sys.argv[2],
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
15 )
014a21767ac4 "planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 076837a2e9c2b6ececcea4aa286ea7a412387a96"
iuc
parents: 0
diff changeset
16 )