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