Mercurial > repos > rnateam > rbpbench
annotate batch_table_wrapper.py @ 0:7dd2835ce566 draft
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
author | rnateam |
---|---|
date | Sun, 03 Dec 2023 12:51:54 +0000 |
parents | |
children |
rev | line source |
---|---|
0
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
1 #!/usr/bin/env python3 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
2 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
3 import argparse |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
4 import os |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
5 import re |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
6 import subprocess |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
7 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
8 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
9 ############################################################################### |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
10 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
11 def setup_argument_parser(): |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
12 """Setup argparse parser.""" |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
13 help_description = """ |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
14 Python wrapper for RBPBench Galaxy wrapper to work with collections of |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
15 input BED files (i.e. to process them with rbpbench batch). |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
16 """ |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
17 # Define argument parser. |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
18 p = argparse.ArgumentParser(add_help=False, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
19 prog="batch_table_wrapper.py", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
20 description=help_description, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
21 formatter_class=argparse.MetavarTypeHelpFormatter) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
22 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
23 # Required arguments. |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
24 p.add_argument("-h", "--help", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
25 action="help", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
26 help="Print help message") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
27 p.add_argument("--table", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
28 dest="in_table", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
29 type=str, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
30 metavar='str', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
31 required=True, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
32 help="Input table file with data ID, method ID, RBP ID and file name (Galaxy element identifier in dataset collection) for each to be processed dataset by rbpbench batch") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
33 p.add_argument("--paths", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
34 dest="in_paths", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
35 type=str, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
36 metavar='str', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
37 nargs='+', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
38 required=True, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
39 help="List of Galaxy BED file paths (--files path1 path2 .. )") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
40 p.add_argument("--ids", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
41 dest="in_ids", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
42 type=str, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
43 metavar='str', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
44 nargs='+', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
45 required=True, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
46 help="List of Galaxy element identifiers, equal to the BED dataset names in the dataset collection (--ids id1 id2 .. )") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
47 p.add_argument("--genome", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
48 dest="in_genome", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
49 type=str, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
50 metavar='str', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
51 required=True, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
52 help="Genomic sequences file (currently supported formats: FASTA)") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
53 p.add_argument("--out", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
54 dest="out_folder", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
55 type=str, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
56 metavar='str', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
57 required=True, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
58 help="Batch results output folder") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
59 # Optional batch arguments. |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
60 p.add_argument("--ext", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
61 dest="ext_up_down", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
62 type=str, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
63 metavar='str', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
64 default="0", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
65 help="Up- and downstream extension of --in sites in nucleotides (nt). Set e.g. --ext 30 for 30 nt on both sides, or --ext 20,10 for different up- and downstream extension (default: 0)") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
66 p.add_argument("--motif-db", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
67 dest="motif_db", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
68 type=int, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
69 default=1, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
70 choices=[1, 2, 3], |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
71 help="Motif database to use. 1: human RBP motifs full (259 RBPs, 605 motifs, human_v0.1), 2: human RBP motifs full (low frequencies not rounded, human_v0.1_no_round), 3: human RBP motifs eCLIP (107 RBPs, 316 motifs, human_eclip_v0.1) (default: 1)") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
72 p.add_argument("--fimo-nt-freqs", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
73 dest="fimo_nt_freqs", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
74 type=str, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
75 metavar='str', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
76 default=False, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
77 help="Provide FIMO nucleotide frequencies (FIMO option: --bifile) file (default: use internal frequencies file optimized for human transcripts)") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
78 p.add_argument("--fimo-pval", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
79 dest="fimo_pval", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
80 type=float, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
81 metavar='float', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
82 default=0.001, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
83 help="FIMO p-value threshold (FIMO option: --thresh) (default: 0.001)") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
84 p.add_argument("--bed-score-col", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
85 dest="bed_score_col", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
86 type=int, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
87 metavar='int', |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
88 default=5, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
89 help="--in BED score column used for p-value calculations. BED score can be e.g. log2 fold change or -log10 p-value of the region (default: 5)") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
90 p.add_argument("--unstranded", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
91 dest="unstranded", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
92 default=False, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
93 action="store_true", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
94 help="Set if --in BED regions are NOT strand-specific, i.e., to look for motifs on both strands of the provided regions. Note that the two strands of a region will still be counted as one region (change with --unstranded-ct) (default: False)") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
95 p.add_argument("--unstranded-ct", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
96 dest="unstranded_ct", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
97 default=False, |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
98 action="store_true", |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
99 help="Count each --in region twice for RBP hit statistics when --unstranded is enabled. By default, two strands of one region are counted as one region for RBP hit statistics") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
100 return p |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
101 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
102 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
103 ############################################################################### |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
104 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
105 if __name__ == '__main__': |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
106 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
107 parser = setup_argument_parser() |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
108 args = parser.parse_args() |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
109 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
110 assert os.path.exists(args.in_table), "--table file \"%s\" not found" % (args.in_file) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
111 assert os.path.exists(args.in_genome), "--genome file \"%s\" not found" % (args.in_genome) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
112 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
113 c_paths = len(args.in_paths) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
114 c_ids = len(args.in_ids) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
115 assert c_paths == c_ids, "given # paths (--paths) != # ids (--ids) (%i != %i). Please provide one ID for each path" % (c_paths, c_ids) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
116 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
117 """ |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
118 Check given paths and IDs. |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
119 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
120 """ |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
121 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
122 # Paths. |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
123 paths_dic = {} |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
124 paths_list = [] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
125 for path in args.in_paths: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
126 assert os.path.exists(path), "--paths %s file not found" % (path) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
127 if path not in paths_dic: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
128 paths_dic[path] = 1 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
129 else: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
130 assert False, "--paths %s given > 1. Please provide unique paths" % (path) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
131 paths_list.append(path) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
132 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
133 # IDs |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
134 ids_dic = {} |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
135 ids_list = [] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
136 for id in args.in_ids: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
137 if id not in ids_dic: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
138 ids_dic[id] = 1 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
139 else: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
140 assert False, "--ids \"%s\" given > 1. Please provide unique element identifiers (dataset names) inside the dataset collection, in order to unambiguously assign element ID to file path" % (id) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
141 ids_list.append(id) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
142 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
143 id2path_dic = {} |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
144 for idx, id in enumerate(ids_list): |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
145 path = paths_list[idx] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
146 id2path_dic[id] = path |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
147 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
148 """ |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
149 Read in table. |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
150 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
151 Column format: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
152 rbp_id method_id data_id dataset_name |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
153 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
154 """ |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
155 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
156 comb_ids_dic = {} |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
157 id_collect_dic = {} |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
158 id_collect_dic["rbp_id"] = [] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
159 id_collect_dic["method_id"] = [] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
160 id_collect_dic["data_id"] = [] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
161 id_collect_dic["set_name"] = [] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
162 id_collect_dic["path"] = [] # Galaxy file path. |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
163 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
164 print("Read in --table ... ") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
165 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
166 with open(args.in_table) as f: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
167 for line in f: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
168 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
169 if re.search("^#", line): |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
170 continue |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
171 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
172 cols = line.strip().split("\t") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
173 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
174 assert len(cols) == 4, "line in --table with # cols != 4 (%i) encountered:%s" % (len(cols), line) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
175 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
176 rbp_id = cols[0] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
177 method_id = cols[1] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
178 data_id = cols[2] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
179 set_name = cols[3] |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
180 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
181 if rbp_id == "rbp_id": |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
182 continue |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
183 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
184 comb_id = "%s,%s,%s,%s" % (rbp_id, method_id, data_id, set_name) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
185 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
186 if comb_id not in comb_ids_dic: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
187 comb_ids_dic[comb_id] = 1 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
188 else: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
189 assert False, "data combination (\"%s\") appears > 1 in --table file. Please provide unique combinations for rbpbench batch calculation" % (comb_id) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
190 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
191 assert set_name in ids_dic, "given dataset name \"%s\" from --table not part of given --ids. Please provide dataset names present in dataset collection" % (set_name) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
192 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
193 id_collect_dic["rbp_id"].append(rbp_id) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
194 id_collect_dic["method_id"].append(method_id) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
195 id_collect_dic["data_id"].append(data_id) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
196 id_collect_dic["set_name"].append(set_name) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
197 id_collect_dic["path"].append(id2path_dic[set_name]) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
198 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
199 f.closed |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
200 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
201 assert id_collect_dic["rbp_id"], "nothing read in from --table. Please provide non-empty table in correct format (columns: rbp_id method_id data_id dataset_name)" |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
202 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
203 """ |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
204 Construct RBPBench batch call. |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
205 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
206 """ |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
207 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
208 batch_call = "rbpbench batch" |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
209 batch_call += " --out %s" % (args.out_folder) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
210 batch_call += " --genome %s" % (args.in_genome) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
211 batch_call += " --ext %s" % (args.ext_up_down) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
212 batch_call += " --motif-db %i" % (args.motif_db) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
213 if args.fimo_nt_freqs: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
214 batch_call += " --fimo-nt-freqs %s" % (args.fimo_nt_freqs) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
215 batch_call += " --fimo-pval %s" % (str(args.fimo_pval)) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
216 batch_call += " --bed-score-col %i" % (args.bed_score_col) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
217 if args.unstranded: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
218 batch_call += " --unstranded" |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
219 if args.unstranded_ct: |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
220 batch_call += " --unstranded-ct" |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
221 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
222 rbp_ids = (" ").join(id_collect_dic["rbp_id"]) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
223 method_ids = (" ").join(id_collect_dic["method_id"]) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
224 data_ids = (" ").join(id_collect_dic["data_id"]) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
225 paths = (" ").join(id_collect_dic["path"]) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
226 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
227 batch_call += " --rbp-list %s" % (rbp_ids) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
228 batch_call += " --method-list %s" % (method_ids) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
229 batch_call += " --data-list %s" % (data_ids) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
230 batch_call += " --bed %s" % (paths) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
231 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
232 """ |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
233 Execute RBPBench batch call. |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
234 """ |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
235 |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
236 print("") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
237 print("EXECUTING CALL:\n%s" % (batch_call)) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
238 output = subprocess.getoutput(batch_call) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
239 print("") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
240 print("RUN OUTPUT:\n%s" % (output)) |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
241 print("") |
7dd2835ce566
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/rbpbench commit 0e21bd630200c1f199db8ba5d83b81d4214fc59f
rnateam
parents:
diff
changeset
|
242 print("DONE.") |