# HG changeset patch # User iuc # Date 1726316222 0 # Node ID 5f8efb080f49237ebda6694a1ef6dc7e8095a054 # Parent 8c8299e553ec595359fb7b72401a8a97554a9dae planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 891fc6321cd94c9a63c880d75989d79521f1a9b6 diff -r 8c8299e553ec -r 5f8efb080f49 find_str.py --- a/find_str.py Thu Sep 12 15:41:01 2024 +0000 +++ b/find_str.py Sat Sep 14 12:17:02 2024 +0000 @@ -7,6 +7,7 @@ """ Allows all STR or those for a subset of motifs to be written to a bed file Designed to build some of the microsatellite tracks from https://github.com/arangrhie/T2T-Polish/tree/master/pattern for the VGP. +Note that there are only four possible types of dinucleotide repeat, because CA = AC = GT = TG, GA = AG = CT = TC, AT = TA, and GC = CG. """ @@ -22,7 +23,7 @@ bin = int(b[1] / winwidth) d[bin] += nt bedg = [ - (name, (x * winwidth), ((x + 1) * winwidth) - 1, float(d[x])) + (name, (x * winwidth), ((x + 1) * winwidth), float(d[x])) for x in range(nwin + 1) if (x + 1) * winwidth <= chrlen ] @@ -82,13 +83,13 @@ cbed.append(row) if args.bigwig: w = getDensity(name, cbed, chrlen, args.winwidth) - wig += w - bed += cbed + wig.extend(w) + bed.extend(cbed) if args.bigwig: wig.sort() - bedg = ["%s %d %d %.2f" % x for x in wig] with open("temp.bedg", "w") as bw: - bw.write("\n".join(bedg)) + for row in wig: + bw.write("%s %d %d %.2f\n" % row) chroms = ["%s\t%s" % (x, chrlens[x]) for x in chrlens.keys()] with open("temp.chromlen", "w") as cl: cl.write("\n".join(chroms)) @@ -96,10 +97,9 @@ subprocess.run(cmd) else: bed.sort() - obed = ["%s\t%d\t%d\t%s_%d\t%d" % x for x in bed] with open(args.bed, "w") as outbed: - outbed.write("\n".join(obed)) - outbed.write("\n") + for row in bed: + outbed.write("%s\t%d\t%d\t%s_%d\t%d\n" % row) if __name__ == "__main__": diff -r 8c8299e553ec -r 5f8efb080f49 microsatbed.xml --- a/microsatbed.xml Thu Sep 12 15:41:01 2024 +0000 +++ b/microsatbed.xml Sat Sep 14 12:17:02 2024 +0000 @@ -3,7 +3,7 @@ Short Tandem Repeats to bed features from fasta 1.3.3 - 0 + 1 3.12.3 - + - + diff -r 8c8299e553ec -r 5f8efb080f49 test-data/dibed_indexed_sample Binary file test-data/dibed_indexed_sample has changed diff -r 8c8299e553ec -r 5f8efb080f49 test-data/dibed_wig_sample Binary file test-data/dibed_wig_sample has changed