annotate find_str.py @ 2:3f6e5c701945 draft

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