# HG changeset patch # User fubar # Date 1721427643 0 # Node ID 26e9575c2c83f210705e34a066b74ba08d6206e0 # Parent 8d0b8a75350ff5736a1f7a6fbc1c2be40c37653e planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty diff -r 8d0b8a75350f -r 26e9575c2c83 find_str.py --- a/find_str.py Fri Jul 19 06:41:18 2024 +0000 +++ b/find_str.py Fri Jul 19 22:20:43 2024 +0000 @@ -1,5 +1,6 @@ import argparse import shutil +import subprocess import pybigtools import pytrf # 1.3.0 @@ -19,9 +20,9 @@ bin = int(b[1] / winwidth) d[bin] += nt dw = [ - (name, (x * winwidth)+1, (x + 1) * winwidth, float(d[x])) + (name, (x * winwidth), ((x + 1) * winwidth) - 1, float(d[x])) for x in range(nwin + 1) - if (x + 1) * winwidth <= chrlen - 1 + if (x + 1) * winwidth <= chrlen ] return dw @@ -78,14 +79,23 @@ cbed.append(row) elif args.hexa and len(ssr.motif) == 6: cbed.append(row) - bed += cbed if args.bigwig: w = getDensity(name, cbed, chrlen, args.winwidth) wig += w + bed += cbed if args.bigwig: wig.sort() - bw = pybigtools.open("temp.bw", "w") - bw.write(chrlens, wig) + bedg = ['%s %d %d %.3f' % x for x in wig] + # bedg.insert(0,'track type=bedGraph') https://genomebrowser.wustl.edu/goldenPath/help/bigWig.html + with open("temp.bedg", "w") as bw: + bw.write('\n'.join(bedg)) + chroms = ["%s\t%s" % (x, chrlens[x]) for x in chrlens.keys()] + with open("temp.chromlen", "w") as cl: + cl.write('\n'.join(chroms)) + cmd = ["bedGraphToBigWig", "temp.bedg", "temp.chromlen", "temp.bw" ] + subprocess.run(cmd) + #bw = pybigtools.open("temp.bw", "w") + #bw.write(chrlens, wig) shutil.move("temp.bw", args.bed) else: bed.sort() diff -r 8d0b8a75350f -r 26e9575c2c83 microsatbed.xml --- a/microsatbed.xml Fri Jul 19 06:41:18 2024 +0000 +++ b/microsatbed.xml Fri Jul 19 22:20:43 2024 +0000 @@ -5,6 +5,8 @@ pyfastx pytrf pybigtools + ucsc-bedgraphtobigwig +