Mercurial > repos > iuc > circos
comparison gc_skew.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 sys | |
2 | |
3 import pyBigWig | |
4 from Bio import SeqIO | |
5 from Bio import SeqUtils | |
6 | |
7 | |
8 span = int(sys.argv[2]) | |
9 bw = pyBigWig.open(sys.argv[3], "w") | |
10 | |
11 # Prepare header separately because ugh | |
12 data = [] | |
13 for rec in SeqIO.parse(sys.argv[1], "fasta"): | |
14 data.append((rec.id, len(rec))) | |
15 bw.addHeader(data) | |
16 | |
17 for rec in SeqIO.parse(sys.argv[1], "fasta"): | |
18 gc = SeqUtils.GC_skew(rec.seq, span) | |
19 | |
20 bw.addEntries(rec.id, 0, values=list(gc), span=span, step=span) | |
21 | |
22 bw.close() |