annotate find_str.py @ 4:5f8efb080f49 draft default tip

planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 891fc6321cd94c9a63c880d75989d79521f1a9b6
author iuc
date Sat, 14 Sep 2024 12:17:02 +0000
parents 2b970db61912
children
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.
4
5f8efb080f49 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 891fc6321cd94c9a63c880d75989d79521f1a9b6
iuc
parents: 0
diff changeset
10 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.
0
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
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
14 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
15 """
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
16 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
17 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
18 """
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
19 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
20 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
21 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
22 nt = b[5]
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
23 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
24 d[bin] += nt
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
25 bedg = [
4
5f8efb080f49 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 891fc6321cd94c9a63c880d75989d79521f1a9b6
iuc
parents: 0
diff changeset
26 (name, (x * winwidth), ((x + 1) * winwidth), float(d[x]))
0
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
27 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
28 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
29 ]
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
30 return bedg
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
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
33 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
34 """
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
35 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
36 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
37 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
38 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
39 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
40 """
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
41 bed = []
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
42 wig = []
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
43 chrlens = {}
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
44 specific = None
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
45 if args.specific:
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
46 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
47 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
48 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
49 chrlen = len(seq)
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
50 chrlens[name] = chrlen
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
51 cbed = []
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
52 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
53 name,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
54 seq,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
55 args.monomin,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
56 args.dimin,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
57 args.trimin,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
58 args.tetramin,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
59 args.pentamin,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
60 args.hexamin,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
61 ):
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
62 row = (
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
63 ssr.chrom,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
64 ssr.start,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
65 ssr.end,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
66 ssr.motif,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
67 ssr.repeat,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
68 ssr.length,
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
69 )
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
70 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
71 cbed.append(row)
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
72 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
73 cbed.append(row)
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
74 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
75 cbed.append(row)
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
76 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
77 cbed.append(row)
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
78 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
79 cbed.append(row)
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
80 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
81 cbed.append(row)
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
82 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
83 cbed.append(row)
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
84 if args.bigwig:
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
85 w = getDensity(name, cbed, chrlen, args.winwidth)
4
5f8efb080f49 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 891fc6321cd94c9a63c880d75989d79521f1a9b6
iuc
parents: 0
diff changeset
86 wig.extend(w)
5f8efb080f49 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 891fc6321cd94c9a63c880d75989d79521f1a9b6
iuc
parents: 0
diff changeset
87 bed.extend(cbed)
0
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
88 if args.bigwig:
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
89 wig.sort()
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:
4
5f8efb080f49 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 891fc6321cd94c9a63c880d75989d79521f1a9b6
iuc
parents: 0
diff changeset
91 for row in wig:
5f8efb080f49 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 891fc6321cd94c9a63c880d75989d79521f1a9b6
iuc
parents: 0
diff changeset
92 bw.write("%s %d %d %.2f\n" % row)
0
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
93 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
94 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
95 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
96 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
97 subprocess.run(cmd)
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
98 else:
2b970db61912 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
99 bed.sort()
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:
4
5f8efb080f49 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 891fc6321cd94c9a63c880d75989d79521f1a9b6
iuc
parents: 0
diff changeset
101 for row in bed:
5f8efb080f49 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 891fc6321cd94c9a63c880d75989d79521f1a9b6
iuc
parents: 0
diff changeset
102 outbed.write("%s\t%d\t%d\t%s_%d\t%d\n" % row)
0
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)