Mercurial > repos > iuc > circos
comparison stack-histogram.py @ 6:b84d385679e2 draft
"planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/circos commit 1584882716a1d2c598e8485da9d73bcf80d9b29a"
| author | iuc |
|---|---|
| date | Fri, 01 May 2020 11:28:11 +0000 |
| parents | |
| children | ecaa0210e62b |
comparison
equal
deleted
inserted
replaced
| 5:5d7a5119a8e7 | 6:b84d385679e2 |
|---|---|
| 1 #!/usr/bin/env python | |
| 2 import logging | |
| 3 import sys | |
| 4 | |
| 5 import pyBigWig | |
| 6 | |
| 7 logging.basicConfig(level=logging.INFO) | |
| 8 log = logging.getLogger() | |
| 9 | |
| 10 if __name__ == "__main__": | |
| 11 files = sys.argv[1:] | |
| 12 bws = [pyBigWig.open(x) for x in files] | |
| 13 | |
| 14 # obtain some chroms. Hope all sets are identical! | |
| 15 k = bws[0].chroms().keys() | |
| 16 | |
| 17 # do magic? | |
| 18 # nah. | |
| 19 # just assert that intervals are identical. | |
| 20 # and crash otherwise. | |
| 21 # sorry not sorry. | |
| 22 | |
| 23 for chrom in k: | |
| 24 for interval_set in zip(*[bw.intervals(chrom) for bw in bws]): | |
| 25 (start, end) = interval_set[0][0:2] | |
| 26 values = ','.join(map(str, [x[2] for x in interval_set])) | |
| 27 sys.stdout.write("%s\t%s\t%s\t%s\n" % (chrom, start, end, values)) |
