Mercurial > repos > fubar > microsatbed
changeset 29:efc775ab30fe draft
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
author | fubar |
---|---|
date | Fri, 19 Jul 2024 23:32:59 +0000 |
parents | 4cb6cc083620 |
children | 53c4f91c6031 |
files | dibed.bw find_str.py microsatbed.xml test.bw |
diffstat | 4 files changed, 7 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/find_str.py Fri Jul 19 22:32:44 2024 +0000 +++ b/find_str.py Fri Jul 19 23:32:59 2024 +0000 @@ -2,7 +2,6 @@ import shutil import subprocess -import pybigtools import pytrf # 1.3.0 from pyfastx import Fastx # 0.5.2 @@ -13,18 +12,22 @@ def getDensity(name, bed, chrlen, winwidth): + """ + pybigtools can write bigwigs and they are processed by other ucsc tools - but jb2 will not read them. + Swapped the conversion to use a bedgraph file processed by bedGraphToBigWig + """ nwin = int(chrlen / winwidth) d = [0.0 for x in range(nwin + 1)] for b in bed: nt = b[5] bin = int(b[1] / winwidth) d[bin] += nt - dw = [ + bedg = [ (name, (x * winwidth), ((x + 1) * winwidth) - 1, float(d[x])) for x in range(nwin + 1) if (x + 1) * winwidth <= chrlen ] - return dw + return bedg def write_ssrs(args): @@ -86,7 +89,6 @@ if args.bigwig: wig.sort() 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()] @@ -94,8 +96,6 @@ 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()
--- a/microsatbed.xml Fri Jul 19 22:32:44 2024 +0000 +++ b/microsatbed.xml Fri Jul 19 23:32:59 2024 +0000 @@ -1,10 +1,9 @@ -<tool name="STR to bed" id="microsatbed" version="1.3.2.0" profile="22.05"> +<tool name="STR to bed" id="microsatbed" version="1.3.2" profile="22.05"> <description>Short Tandem Repeats to bed features from fasta</description> <requirements> <requirement version="3.12.3" type="package">python</requirement> <requirement version="2.1.0" type="package">pyfastx</requirement> <requirement version="1.3.2" type="package">pytrf</requirement> - <requirement version="0.2.0" type="package">pybigtools</requirement> <requirement version="455" type="package">ucsc-bedgraphtobigwig</requirement> </requirements>