Mercurial > repos > fubar > microsatbed
annotate find_str.py @ 24:94c5f834c0cc draft
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
| author | fubar | 
|---|---|
| date | Fri, 19 Jul 2024 05:20:35 +0000 | 
| parents | 45f690db0eaf | 
| children | 8d0b8a75350f | 
| 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 | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
3 | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
4 import pybigtools | 
| 
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): | 
| 
24
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
15 nwin = int(chrlen / winwidth) | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
16 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
 | 
17 for b in bed: | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
18 nt = b[5] | 
| 
24
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
19 bin = int(b[1] / winwidth) | 
| 
20
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
20 d[bin] += nt | 
| 
24
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
21 dw = [ | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
22 (name, (x * winwidth)+1, (x + 1) * winwidth, float(d[x])) | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
23 for x in range(nwin + 1) | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
24 if (x + 1) * winwidth <= chrlen | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
25 ] | 
| 
20
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
26 return dw | 
| 
1
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
27 | 
| 
24
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
28 | 
| 
1
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
29 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
 | 
30 """ | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
31 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
 | 
32 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
 | 
33 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
 | 
34 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
 | 
35 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
 | 
36 """ | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
37 bed = [] | 
| 
20
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
38 wig = [] | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
39 chrlens = {} | 
| 
1
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
40 specific = None | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
41 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
 | 
42 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
 | 
43 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
 | 
44 for name, seq in fa: | 
| 
20
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
45 cbed = [] | 
| 
19
 
db5523378e5c
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
17 
diff
changeset
 | 
46 for ssr in pytrf.STRFinder( | 
| 
24
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
47 name, | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
48 seq, | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
49 args.monomin, | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
50 args.dimin, | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
51 args.trimin, | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
52 args.tetramin, | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
53 args.pentamin, | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
54 args.hexamin, | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
55 ): | 
| 
1
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
56 row = ( | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
57 ssr.chrom, | 
| 
19
 
db5523378e5c
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
17 
diff
changeset
 | 
58 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
 | 
59 ssr.end, | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
60 ssr.motif, | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
61 ssr.repeat, | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
62 ssr.length, | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
63 ) | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
64 # 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
 | 
65 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
 | 
66 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
 | 
67 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
 | 
68 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
 | 
69 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
 | 
70 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
 | 
71 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
 | 
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.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
 | 
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.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
 | 
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.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
 | 
78 cbed.append(row) | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
79 bed += cbed | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
80 if args.bigwig: | 
| 
24
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
81 chrlen = len(seq) | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
82 chrlens[name] = chrlen | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
83 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
 | 
84 wig += w | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
85 if args.bigwig: | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
86 wig.sort() | 
| 
24
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
87 bw = pybigtools.open("temp.bw", "w") | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
88 bw.write(chrlens, wig) | 
| 
 
94c5f834c0cc
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
23 
diff
changeset
 | 
89 bw.close() | 
| 
20
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
90 shutil.move("temp.bw", args.bed) | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
91 else: | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
92 bed.sort() | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
93 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
 | 
94 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
 | 
95 outbed.write("\n".join(obed)) | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
96 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
 | 
97 | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
98 | 
| 
 
1085e094cf5f
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 7ceb6658309a7ababe622b5d92e729e5470e22f0-dirty
 
fubar 
parents:  
diff
changeset
 | 
99 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
 | 
100 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
 | 
101 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
 | 
102 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
 | 
103 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
 | 
104 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
 | 
105 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
 | 
106 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
 | 
107 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
 | 
108 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
 | 
109 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
 | 
110 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
 | 
111 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
 | 
112 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
 | 
113 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
 | 
114 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
 | 
115 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
 | 
116 a("--bigwig", action="store_true") | 
| 
 
410144c7b2d6
planemo upload for repository https://github.com/fubar2/microsatbed commit d952bc313f408735456747c3d33e09a3170c8f59-dirty
 
fubar 
parents: 
19 
diff
changeset
 | 
117 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
 | 
118 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
 | 
119 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
 | 
120 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
 | 
121 write_ssrs(args) | 
