annotate find_str.py @ 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 26e9575c2c83
children 53c4f91c6031
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
1 import argparse
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
2 import shutil
26
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
3 import subprocess
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
4
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
5 import pytrf # 1.3.0
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
6 from pyfastx import Fastx # 0.5.2
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
7
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
8 """
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
9 Allows all STR or those for a subset of motifs to be written to a bed file
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
10 Designed to build some of the microsatellite tracks from https://github.com/arangrhie/T2T-Polish/tree/master/pattern for the VGP.
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
11 """
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
12
24
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
13
23
45f690db0eaf planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 20
diff changeset
14 def getDensity(name, bed, chrlen, winwidth):
29
efc775ab30fe planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 26
diff changeset
15 """
efc775ab30fe planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 26
diff changeset
16 pybigtools can write bigwigs and they are processed by other ucsc tools - but jb2 will not read them.
efc775ab30fe planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 26
diff changeset
17 Swapped the conversion to use a bedgraph file processed by bedGraphToBigWig
efc775ab30fe planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 26
diff changeset
18 """
24
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
19 nwin = int(chrlen / winwidth)
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
20 d = [0.0 for x in range(nwin + 1)]
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
21 for b in bed:
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
22 nt = b[5]
24
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
23 bin = int(b[1] / winwidth)
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
24 d[bin] += nt
29
efc775ab30fe planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 26
diff changeset
25 bedg = [
26
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
26 (name, (x * winwidth), ((x + 1) * winwidth) - 1, float(d[x]))
24
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
27 for x in range(nwin + 1)
26
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
28 if (x + 1) * winwidth <= chrlen
24
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
29 ]
29
efc775ab30fe planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 26
diff changeset
30 return bedg
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
31
24
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
32
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
33 def write_ssrs(args):
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
34 """
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
35 The integers in the call change the minimum repeats for mono-, di-, tri-, tetra-, penta-, hexa-nucleotide repeats
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
36 ssrs = pytrf.STRFinder(name, seq, 10, 6, 4, 3, 3, 3)
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
37 NOTE: Dinucleotides GA and AG are reported separately by https://github.com/marbl/seqrequester.
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
38 The reversed pair STRs are about as common in the documentation sample.
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
39 Sequence read bias might be influenced by GC density or some other specific motif.
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
40 """
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
41 bed = []
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
42 wig = []
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
43 chrlens = {}
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
44 specific = None
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
45 if args.specific:
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
46 specific = args.specific.upper().split(",")
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
47 fa = Fastx(args.fasta, uppercase=True)
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
48 for name, seq in fa:
25
8d0b8a75350f planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 24
diff changeset
49 chrlen = len(seq)
8d0b8a75350f planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 24
diff changeset
50 chrlens[name] = chrlen
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
51 cbed = []
19
db5523378e5c planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 17
diff changeset
52 for ssr in pytrf.STRFinder(
24
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
53 name,
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
54 seq,
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
55 args.monomin,
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
56 args.dimin,
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
57 args.trimin,
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
58 args.tetramin,
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
59 args.pentamin,
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
60 args.hexamin,
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
61 ):
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
62 row = (
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
63 ssr.chrom,
19
db5523378e5c planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 17
diff changeset
64 ssr.start,
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
65 ssr.end,
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
66 ssr.motif,
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
67 ssr.repeat,
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
68 ssr.length,
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
69 )
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
70 # pytrf reports a 1 based start position so start-1 fixes the bed interval lengths
19
db5523378e5c planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 17
diff changeset
71 if args.specific and ssr.motif in specific:
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
72 cbed.append(row)
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
73 elif args.mono and len(ssr.motif) == 1:
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
74 cbed.append(row)
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
75 elif args.di and len(ssr.motif) == 2:
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
76 cbed.append(row)
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
77 elif args.tri and len(ssr.motif) == 3:
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
78 cbed.append(row)
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
79 elif args.tetra and len(ssr.motif) == 4:
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
80 cbed.append(row)
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
81 elif args.penta and len(ssr.motif) == 5:
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
82 cbed.append(row)
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
83 elif args.hexa and len(ssr.motif) == 6:
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
84 cbed.append(row)
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
85 if args.bigwig:
24
94c5f834c0cc planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 23
diff changeset
86 w = getDensity(name, cbed, chrlen, args.winwidth)
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
87 wig += w
26
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
88 bed += cbed
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
89 if args.bigwig:
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
90 wig.sort()
26
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
91 bedg = ['%s %d %d %.3f' % x for x in wig]
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
92 with open("temp.bedg", "w") as bw:
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
93 bw.write('\n'.join(bedg))
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
94 chroms = ["%s\t%s" % (x, chrlens[x]) for x in chrlens.keys()]
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
95 with open("temp.chromlen", "w") as cl:
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
96 cl.write('\n'.join(chroms))
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
97 cmd = ["bedGraphToBigWig", "temp.bedg", "temp.chromlen", "temp.bw" ]
26e9575c2c83 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 25
diff changeset
98 subprocess.run(cmd)
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
99 shutil.move("temp.bw", args.bed)
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
100 else:
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
101 bed.sort()
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
102 obed = ["%s\t%d\t%d\t%s_%d\t%d" % x for x in bed]
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
103 with open(args.bed, "w") as outbed:
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
104 outbed.write("\n".join(obed))
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
105 outbed.write("\n")
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
106
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
107
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
108 if __name__ == "__main__":
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
109 parser = argparse.ArgumentParser()
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
110 a = parser.add_argument
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
111 a("--di", action="store_true")
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
112 a("--tri", action="store_true")
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
113 a("--tetra", action="store_true")
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
114 a("--penta", action="store_true")
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
115 a("--hexa", action="store_true")
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
116 a("--mono", action="store_true")
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
117 a("--dimin", default=2, type=int)
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
118 a("--trimin", default=2, type=int)
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
119 a("--tetramin", default=2, type=int)
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
120 a("--pentamin", default=2, type=int)
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
121 a("--hexamin", default=2, type=int)
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
122 a("--monomin", default=2, type=int)
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
123 a("-f", "--fasta", default="humsamp.fa")
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
124 a("-b", "--bed", default="humsamp.bed")
20
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
125 a("--bigwig", action="store_true")
410144c7b2d6 planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
fubar
parents: 19
diff changeset
126 a("--winwidth", default=128, type=int)
1
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
127 a("--specific", default=None)
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
128 a("--minreps", default=2, type=int)
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
129 args = parser.parse_args()
1085e094cf5f planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
fubar
parents:
diff changeset
130 write_ssrs(args)