Mercurial > repos > iuc > bigwig_outlier_bed
annotate bigwig_outlier_bed.py @ 6:96a3c972424f draft default tip
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit cb9e88d49f51904b8128a64e3ff6778f0ff50ed3
| author | iuc |
|---|---|
| date | Thu, 20 Feb 2025 20:19:33 +0000 |
| parents | 2488bcddaf14 |
| children |
| rev | line source |
|---|---|
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
1 """ |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
2 Ross Lazarus June 2024 for VGP |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
3 Bigwigs are great, but hard to reliably "see" small low coverage or small very high coverage regions. |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
4 Colouring in JB2 tracks will need a new plugin, so this code will find bigwig regions above and below a chosen percentile point. |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
5 0.99 and 0.01 work well in testing with a minimum span of 10 bp. |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
6 Multiple bigwigs **with the same reference** can be combined - bed segments will be named appropriately |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
7 Combining multiple references works but is silly because only display will rely on one reference so others will not be shown... |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
8 Tricksy numpy method from http://gregoryzynda.com/python/numpy/contiguous/interval/2019/11/29/contiguous-regions.html |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
9 takes about 95 seconds for a 17MB test wiggle |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
10 JBrowse2 bed normally displays ignore the score, so could provide separate low/high bed file outputs as an option. |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
11 Update june 30 2024: wrote a 'no-build' plugin for beds to display red/blue if >0/<0 so those are used for scores |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
12 Bed interval naming must be short for JB2 but needs input bigwig name and (lo or hi). |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
13 """ |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
14 |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
15 import argparse |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
16 import os |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
17 import sys |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
18 from pathlib import Path |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
19 |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
20 import numpy as np |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
21 import pybigtools |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
22 |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
23 |
|
2
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
24 class asciihist: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
25 |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
26 def __init__( |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
27 self, |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
28 data, |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
29 bins=10, |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
30 minmax=None, |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
31 str_tag="", |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
32 scale_output=80, |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
33 generate_only=True, |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
34 ): |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
35 """ |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
36 https://gist.github.com/bgbg/608d9ef4fd75032731651257fe67fc81 |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
37 Create an ASCII histogram from an interable of numbers. |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
38 Author: Boris Gorelik boris@gorelik.net. based on http://econpy.googlecode.com/svn/trunk/pytrix/pytrix.py |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
39 License: MIT |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
40 """ |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
41 self.data = data |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
42 self.minmax = minmax |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
43 self.str_tag = str_tag |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
44 self.bins = bins |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
45 self.generate_only = generate_only |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
46 self.scale_output = scale_output |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
47 self.itarray = np.asanyarray(self.data) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
48 if self.minmax == "auto": |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
49 self.minmax = np.percentile(data, [5, 95]) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
50 if self.minmax[0] == self.minmax[1]: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
51 # for very ugly distributions |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
52 self.minmax = None |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
53 if self.minmax is not None: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
54 # discard values that are outside minmax range |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
55 mn = self.minmax[0] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
56 mx = self.minmax[1] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
57 self.itarray = self.itarray[self.itarray >= mn] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
58 self.itarray = self.itarray[self.itarray <= mx] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
59 |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
60 def draw(self): |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
61 values, counts = np.unique(self.data, return_counts=True) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
62 if len(values) <= 20: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
63 self.bins = len(values) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
64 ret = [] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
65 if self.itarray.size: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
66 total = len(self.itarray) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
67 counts, cutoffs = np.histogram(self.itarray, bins=self.bins) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
68 cutoffs = cutoffs[1:] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
69 if self.str_tag: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
70 self.str_tag = "%s " % self.str_tag |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
71 else: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
72 self.str_tag = "" |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
73 if self.scale_output is not None: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
74 scaled_counts = counts.astype(float) / counts.sum() * self.scale_output |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
75 else: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
76 scaled_counts = counts |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
77 footerbar = "{:s}{:s} |{:s} |".format( |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
78 self.str_tag, |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
79 "-" * 12, |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
80 "-" * 12, |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
81 ) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
82 if self.minmax is not None: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
83 ret.append( |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
84 "Trimmed to range (%s - %s)" |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
85 % (str(self.minmax[0]), str(self.minmax[1])) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
86 ) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
87 for cutoff, original_count, scaled_count in zip( |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
88 cutoffs, counts, scaled_counts |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
89 ): |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
90 ret.append( |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
91 "{:s}{:>12.2f} |{:>12,d} | {:s}".format( |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
92 self.str_tag, cutoff, original_count, "*" * int(scaled_count) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
93 ) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
94 ) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
95 ret.append(footerbar) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
96 ret.append("{:s}{:>12s} |{:>12,d} |".format(self.str_tag, "N=", total)) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
97 ret.append(footerbar) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
98 ret.append("") |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
99 else: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
100 ret = [] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
101 if not self.generate_only: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
102 for line in ret: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
103 print(line) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
104 ret = "\n".join(ret) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
105 return ret |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
106 |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
107 |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
108 class findOut: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
109 |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
110 def __init__(self, args): |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
111 self.bwnames = args.bigwig |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
112 self.bwlabels = args.bigwiglabels |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
113 self.bedwin = args.minwin |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
114 self.outbeds = args.outbeds |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
115 self.bedouthi = args.bedouthi |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
116 self.bedoutlo = args.bedoutlo |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
117 self.bedouthilo = args.bedouthilo |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
118 self.tableoutfile = args.tableoutfile |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
119 self.bedwin = args.minwin |
|
4
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
120 self.bedoutzero = args.bedoutzero |
|
1
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
121 self.qlo = None |
|
2
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
122 self.qhi = None |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
123 if args.outbeds != "outtab": |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
124 self.qhi = args.qhi |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
125 if args.qlo: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
126 try: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
127 f = float(args.qlo) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
128 self.qlo = f |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
129 except Exception: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
130 print("qlo not provided") |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
131 nbw = len(args.bigwig) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
132 nlab = len(args.bigwiglabels) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
133 if nlab < nbw: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
134 self.bwlabels += ["Nolabel"] * (nbw - nlab) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
135 self.makeBed() |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
136 |
|
4
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
137 def processVals(self, bw, isTop, isZero): |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
138 """ |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
139 idea from http://gregoryzynda.com/python/numpy/contiguous/interval/2019/11/29/contiguous-regions.html |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
140 Fast segmentation into regions by taking np.diff on the boolean array of over (under) cutpoint indicators in bwex. |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
141 This only gives non-zero values at the segment boundaries where there's a change, so those zeros are all removed in bwexdnz |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
142 leaving an array of segment start/end positions. That's twisted around into an array of start/end coordinates. |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
143 Magical. Fast. Could do the same for means or medians over windows for sparse bigwigs like repeat regions. |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
144 """ |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
145 if isTop: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
146 bwex = np.r_[False, bw >= self.bwtop, False] # extend with 0s |
|
4
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
147 elif isZero: |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
148 bwex = np.r_[False, bw == 0, False] # extend with 0s |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
149 else: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
150 bwex = np.r_[False, bw <= self.bwbot, False] |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
151 bwexd = np.diff(bwex) |
|
3
00b3da7776a0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 06c54e8066ecbc6292167e7c5bdfb8af945a41ba
iuc
parents:
2
diff
changeset
|
152 bwexdnz = bwexd.nonzero()[0] # start and end transition of each segment - nice! |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
153 bwregions = np.reshape(bwexdnz, (-1, 2)) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
154 return bwregions |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
155 |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
156 def writeBed(self, bed, bedfname): |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
157 """ |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
158 potentially multiple |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
159 """ |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
160 bed.sort() |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
161 with open(bedfname, "w") as bedf: |
|
3
00b3da7776a0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 06c54e8066ecbc6292167e7c5bdfb8af945a41ba
iuc
parents:
2
diff
changeset
|
162 for b in bed: |
|
00b3da7776a0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 06c54e8066ecbc6292167e7c5bdfb8af945a41ba
iuc
parents:
2
diff
changeset
|
163 bedf.write("%s\t%d\t%d\t%s\t%d\n" % b) |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
164 |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
165 def makeTableRow(self, bw, bwlabel, chr): |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
166 """ |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
167 called for every contig, but messy inline |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
168 """ |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
169 bwmean = np.mean(bw) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
170 bwstd = np.std(bw) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
171 bwmax = np.max(bw) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
172 nrow = np.size(bw) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
173 bwmin = np.min(bw) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
174 row = "%s\t%s\t%d\t%f\t%f\t%f\t%f" % ( |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
175 bwlabel, |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
176 chr, |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
177 nrow, |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
178 bwmean, |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
179 bwstd, |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
180 bwmin, |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
181 bwmax, |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
182 ) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
183 if self.qhi is not None: |
|
1
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
184 row += "\t%.2f" % self.bwtop |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
185 else: |
|
1
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
186 row += "\tnoqhi" |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
187 if self.qlo is not None: |
|
1
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
188 row += "\t%.2f" % self.bwbot |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
189 else: |
|
1
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
190 row += "\tnoqlo" |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
191 return row |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
192 |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
193 def makeBed(self): |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
194 bedhi = [] |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
195 bedlo = [] |
|
4
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
196 bedzero = [] |
|
2
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
197 restab = [] |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
198 bwlabels = self.bwlabels |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
199 bwnames = self.bwnames |
|
2
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
200 reshead = "bigwig\tcontig\tn\tmean\tstd\tmin\tmax\tqtop\tqbot" |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
201 for i, bwname in enumerate(bwnames): |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
202 bwlabel = bwlabels[i].replace(" ", "") |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
203 fakepath = "in%d.bw" % i |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
204 if os.path.isfile(fakepath): |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
205 os.remove(fakepath) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
206 p = Path(fakepath) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
207 p.symlink_to(bwname) # required by pybigtools (!) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
208 bwf = pybigtools.open(fakepath) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
209 chrlist = bwf.chroms() |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
210 chrs = list(chrlist.keys()) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
211 for chr in chrs: |
|
2
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
212 first_few = None |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
213 bw = bwf.values(chr) |
|
2
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
214 values, counts = np.unique(bw, return_counts=True) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
215 nvalues = len(values) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
216 if nvalues <= 20: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
217 histo = "\n".join( |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
218 [ |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
219 "%s: %f occurs %d times" % (chr, values[x], counts[x]) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
220 for x in range(len(values)) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
221 ] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
222 ) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
223 else: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
224 last10 = range(nvalues - 10, nvalues) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
225 first_few = ["%.2f\t%d" % (values[x], counts[x]) for x in range(10)] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
226 first_few += ["%.2f\t%d" % (values[x], counts[x]) for x in last10] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
227 first_few.insert(0, "First/Last 10 value counts\nValue\tCount") |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
228 ha = asciihist(data=bw, bins=20, str_tag="%s_%s" % (bwlabel, chr)) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
229 histo = ha.draw() |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
230 histo = ( |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
231 "\n".join(first_few) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
232 + "\nHistogram of %s bigwig values\n" % bwlabel |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
233 + histo |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
234 ) |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
235 bw = bw[~np.isnan(bw)] # some have NaN if parts of a contig not covered |
|
4
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
236 if self.bedoutzero is not None: |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
237 bwzero = self.processVals(bw, isTop=False, isZero=True) |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
238 for j, seg in enumerate(bwzero): |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
239 seglen = seg[1] - seg[0] |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
240 if seglen >= self.bedwin: |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
241 score = seglen |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
242 bedzero.append( |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
243 ( |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
244 chr, |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
245 seg[0], |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
246 seg[1], |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
247 "%s_%d" % (bwlabel, score), |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
248 score, |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
249 ) |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
250 ) |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
251 if self.qhi is not None: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
252 self.bwtop = np.quantile(bw, self.qhi) |
|
4
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
253 bwhi = self.processVals(bw, isTop=True, isZero=False) |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
254 for j, seg in enumerate(bwhi): |
|
2
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
255 seglen = seg[1] - seg[0] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
256 if seglen >= self.bedwin: |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
257 score = np.sum(bw[seg[0]:seg[1]]) / float(seglen) |
|
1
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
258 bedhi.append( |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
259 ( |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
260 chr, |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
261 seg[0], |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
262 seg[1], |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
263 "%s_%d" % (bwlabel, score), |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
264 score, |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
265 ) |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
266 ) |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
267 if self.qlo is not None: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
268 self.bwbot = np.quantile(bw, self.qlo) |
|
4
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
269 bwlo = self.processVals(bw, isTop=False, isZero=False) |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
270 for j, seg in enumerate(bwlo): |
|
3
00b3da7776a0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 06c54e8066ecbc6292167e7c5bdfb8af945a41ba
iuc
parents:
2
diff
changeset
|
271 seglen = seg[1] - seg[0] |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
272 if seg[1] - seg[0] >= self.bedwin: |
|
3
00b3da7776a0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 06c54e8066ecbc6292167e7c5bdfb8af945a41ba
iuc
parents:
2
diff
changeset
|
273 score = ( |
|
00b3da7776a0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 06c54e8066ecbc6292167e7c5bdfb8af945a41ba
iuc
parents:
2
diff
changeset
|
274 -1 * np.sum(bw[seg[0]:seg[1]]) / float(seglen) |
|
00b3da7776a0
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 06c54e8066ecbc6292167e7c5bdfb8af945a41ba
iuc
parents:
2
diff
changeset
|
275 ) |
|
1
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
276 bedlo.append( |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
277 ( |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
278 chr, |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
279 seg[0], |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
280 seg[1], |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
281 "%s_%d" % (bwlabel, score), |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
282 score, |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
283 ) |
|
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
284 ) |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
285 if self.tableoutfile: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
286 row = self.makeTableRow(bw, bwlabel, chr) |
|
2
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
287 resheadl = reshead.split("\t") |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
288 rowl = row.split() |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
289 desc = ["%s\t%s" % (resheadl[x], rowl[x]) for x in range(len(rowl))] |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
290 desc.insert(0, "Descriptive measures") |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
291 descn = "\n".join(desc) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
292 restab.append(descn) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
293 restab.append(histo) |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
294 if os.path.isfile(fakepath): |
|
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
295 os.remove(fakepath) |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
296 if self.tableoutfile: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
297 stable = "\n".join(restab) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
298 with open(self.tableoutfile, "w") as t: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
299 t.write(stable) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
300 t.write("\n") |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
301 some = False |
|
4
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
302 if self.outbeds in ["outzero"]: |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
303 self.writeBed(bedzero, self.bedoutzero) |
|
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
304 some = True |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
305 if self.qlo: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
306 if self.outbeds in ["outall", "outlo", "outlohi"]: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
307 self.writeBed(bedlo, self.bedoutlo) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
308 some = True |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
309 if self.qhi: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
310 if self.outbeds in ["outall", "outlohi", "outhi"]: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
311 self.writeBed(bedhi, self.bedouthi) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
312 some = True |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
313 if self.outbeds in ["outall", "outhilo"]: |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
314 allbed = bedlo + bedhi |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
315 self.writeBed(allbed, self.bedouthilo) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
316 some = True |
|
2
61946b8bd43b
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 3cce4c76a60b9353298fdcf759e893b8fcdfaa77
iuc
parents:
1
diff
changeset
|
317 if not ((self.outbeds == "outtab") or some): |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
318 sys.stderr.write( |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
319 "Invalid configuration - no output could be created. Was qlo missing and only low output requested for example?" |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
320 ) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
321 sys.exit(2) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
322 |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
323 |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
324 if __name__ == "__main__": |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
325 parser = argparse.ArgumentParser() |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
326 a = parser.add_argument |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
327 a("-m", "--minwin", default=10, type=int) |
|
1
8377a6abb4da
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 92ffe42a6ad6e81f3f157bbc9b942c000d450416
iuc
parents:
0
diff
changeset
|
328 a("-l", "--qlo", default=None) |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
329 a("-i", "--qhi", default=None, type=float) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
330 a("--bedouthi", default=None) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
331 a("--bedoutlo", default=None) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
332 a("--bedouthilo", default=None) |
|
4
2488bcddaf14
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit d27456ca56231eb9a4eb360c99f44af6c18a0afc
iuc
parents:
3
diff
changeset
|
333 a("--bedoutzero", default=None) |
|
0
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
334 a("-w", "--bigwig", nargs="+") |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
335 a("-n", "--bigwiglabels", nargs="+") |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
336 a("-o", "--outbeds", default="outhilo", help="optional high and low combined bed") |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
337 a("-t", "--tableoutfile", default=None) |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
338 args = parser.parse_args() |
|
ebcd48f183b3
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/bigwig_outlier_bed commit 091caba3c5b066b293745ccee5cd31132fec3b4b
iuc
parents:
diff
changeset
|
339 findOut(args) |
