annotate find_str.py @ 3:a1336aae0d6d 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:16:51 +0000
parents dee16d45a2a9
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
1 import argparse
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
2 import subprocess
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
3
dee16d45a2a9 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
dee16d45a2a9 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
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
6
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
7 """
dee16d45a2a9 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
dee16d45a2a9 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.
3
a1336aae0d6d 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
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
11 """
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
12
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
13
dee16d45a2a9 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):
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
15 """
dee16d45a2a9 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.
dee16d45a2a9 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
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
18 """
dee16d45a2a9 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)
dee16d45a2a9 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)]
dee16d45a2a9 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:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
22 nt = b[5]
dee16d45a2a9 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)
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
24 d[bin] += nt
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
25 bedg = [
3
a1336aae0d6d 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
dee16d45a2a9 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)
dee16d45a2a9 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
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
29 ]
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
30 return bedg
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
31
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
32
dee16d45a2a9 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):
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
34 """
dee16d45a2a9 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
dee16d45a2a9 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)
dee16d45a2a9 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.
dee16d45a2a9 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.
dee16d45a2a9 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.
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
40 """
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
41 bed = []
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
42 wig = []
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
43 chrlens = {}
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
44 specific = None
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
45 if args.specific:
dee16d45a2a9 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(",")
dee16d45a2a9 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)
dee16d45a2a9 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:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
49 chrlen = len(seq)
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
50 chrlens[name] = chrlen
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
51 cbed = []
dee16d45a2a9 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(
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
53 name,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
54 seq,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
55 args.monomin,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
56 args.dimin,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
57 args.trimin,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
58 args.tetramin,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
59 args.pentamin,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
60 args.hexamin,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
61 ):
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
62 row = (
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
63 ssr.chrom,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
64 ssr.start,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
65 ssr.end,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
66 ssr.motif,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
67 ssr.repeat,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
68 ssr.length,
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
69 )
dee16d45a2a9 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:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
71 cbed.append(row)
dee16d45a2a9 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:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
73 cbed.append(row)
dee16d45a2a9 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:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
75 cbed.append(row)
dee16d45a2a9 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:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
77 cbed.append(row)
dee16d45a2a9 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:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
79 cbed.append(row)
dee16d45a2a9 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:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
81 cbed.append(row)
dee16d45a2a9 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:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
83 cbed.append(row)
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
84 if args.bigwig:
dee16d45a2a9 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)
3
a1336aae0d6d 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)
a1336aae0d6d 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
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
88 if args.bigwig:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
89 wig.sort()
dee16d45a2a9 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:
3
a1336aae0d6d 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:
a1336aae0d6d 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
dee16d45a2a9 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()]
dee16d45a2a9 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:
dee16d45a2a9 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))
dee16d45a2a9 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]
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
97 subprocess.run(cmd)
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
98 else:
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
99 bed.sort()
dee16d45a2a9 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:
3
a1336aae0d6d 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:
a1336aae0d6d 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
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
103
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
104
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
105 if __name__ == "__main__":
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
106 parser = argparse.ArgumentParser()
dee16d45a2a9 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
dee16d45a2a9 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")
dee16d45a2a9 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")
dee16d45a2a9 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")
dee16d45a2a9 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")
dee16d45a2a9 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")
dee16d45a2a9 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")
dee16d45a2a9 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)
dee16d45a2a9 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)
dee16d45a2a9 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)
dee16d45a2a9 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)
dee16d45a2a9 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)
dee16d45a2a9 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)
dee16d45a2a9 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")
dee16d45a2a9 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")
dee16d45a2a9 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")
dee16d45a2a9 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)
dee16d45a2a9 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)
dee16d45a2a9 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)
dee16d45a2a9 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()
dee16d45a2a9 planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/microsatbed commit 275acb787c01484c6e435c8864090d377c3fde75
iuc
parents:
diff changeset
127 write_ssrs(args)