diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gc_skew.py	Tue Sep 17 16:54:57 2019 -0400
@@ -0,0 +1,22 @@
+import sys
+
+import pyBigWig
+from Bio import SeqIO
+from Bio import SeqUtils
+
+
+span = int(sys.argv[2])
+bw = pyBigWig.open(sys.argv[3], "w")
+
+# Prepare header separately because ugh
+data = []
+for rec in SeqIO.parse(sys.argv[1], "fasta"):
+    data.append((rec.id, len(rec)))
+bw.addHeader(data)
+
+for rec in SeqIO.parse(sys.argv[1], "fasta"):
+    gc = SeqUtils.GC_skew(rec.seq, span)
+
+    bw.addEntries(rec.id, 0, values=list(gc), span=span, step=span)
+
+bw.close()