annotate graphprot_predict_wrapper.py @ 5:ddcf35a868b8 draft default tip

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
author bgruening
date Wed, 05 Jun 2024 16:40:51 +0000
parents 4ad83aed5c3c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
1 #!/usr/bin/env python3
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
2
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
3 import argparse as ap
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
4 import os
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
5 import subprocess
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
6 import sys
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
7
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
8 import gplib
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
9
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
10 """
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
11
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
12 TOOL DEPENDENCIES
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
13 =================
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
14
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
15 GraphProt 1.1.7
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
16 Best install via:
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
17 https://anaconda.org/bioconda/graphprot
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
18 Tested with: miniconda3, conda 4.7.12
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
19
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
20
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
21 Script: What's my job this time, master?
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
22 Author: It'll be a though one.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
23 Script: I take this as a given.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
24 Author: Oh yeah?
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
25 Script: ... I'm ready.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
26
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
27
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
28 OUTPUT FILES
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
29 ============
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
30
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
31 data_id.avg_profile
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
32 data_id.avg_profile.peaks.bed
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
33 --conf-out
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
34 data_id.avg_profile.p50.peaks.bed
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
35 --gen-site-bed
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
36 data_id.avg_profile.genomic_peaks.bed
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
37 --conf-out --gen-site-bed
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
38 data_id.avg_profile.p50.genomic_peaks.bed
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
39 --ws-pred
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
40 data_id.predictions
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
41 --ws-pred --conf-out
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
42 data_id.predictions
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
43 data_id.p50.predictions
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
44
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
45
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
46 EXAMPLE CALLS
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
47 =============
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
48
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
49 flake8 coming out of hotel room. FB enters.
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
50 FB: Who is this f*** ???
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
51
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
52
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
53 python graphprot_predict_wrapper.py --model test2.model --params test2.params
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
54 --fasta gp_data/test10_predict.fa --data-id test2pred --gp-output
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
55 python graphprot_predict_wrapper.py --model test2.model --params test2.params
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
56 --fasta gp_data/test10_predict.fa --data-id test2pred
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
57 --gen-site-bed gp_data/test10_predict.bed
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
58
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
59 python graphprot_predict_wrapper.py --model test2.model --params test2.params
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
60 --fasta gp_data/test10_predict.fa --data-id test2pred
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
61 --gen-site-bed gp_data/test10_predict.bed --conf-out
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
62
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
63 python graphprot_predict_wrapper.py --model test2.model --params test2.params
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
64 --fasta gp_data/test10_predict.fa --data-id test2pred --conf-out --ws-pred
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
65
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
66 python graphprot_predict_wrapper.py --model test-data/test.model
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
67 --params test-data/test.params --fasta test-data/test_predict.fa
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
68 --data-id predtest
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
69
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
70 python graphprot_predict_wrapper.py --model test-data/test.model
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
71 --params test-data/test.params --fasta test-data/test_predict.fa
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
72 --data-id predtest --gen-site-bed test-data/test_predict.bed
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
73 --sc-thr 0.0 --max-merge-dist 0 --conf-out --ap-extlr 5
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
74
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
75 python graphprot_predict_wrapper.py --data-id GraphProt
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
76 --fasta test-data/test_predict.fa --model test-data/test.model
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
77 --params test-data/test.params --gen-site-bed test-data/test_predict.bed
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
78 --sc-thr 0.0 --max-merge-dist 0 --conf-out --ap-extlr 5
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
79
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
80 """
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
81
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
82
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
83 #######################################################################
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
84
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
85
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
86 def setup_argument_parser():
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
87 """Setup argparse parser."""
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
88 help_description = """
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
89 Galaxy wrapper script for GraphProt (-action predict and -action
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
90 predict_profile) to compute whole site or position-wise scores for input
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
91 FASTA sequences.
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
92 By default, profile predictions are calculated, followed by average
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
93 profiles computions and peak regions extraction from average profiles.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
94 If --ws-pred is set, whole site score predictions on input sequences
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
95 will be run instead.
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
96 If --conf-out is set, sites or peak regions with a score >= the median
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
97 score of positive training sites will be output.
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
98 If --gen-site-bed .bed file is provided, peak regions will be output
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
99 with genomic coordinates too.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
100
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
101 """
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
102 # Define argument parser.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
103 p = ap.ArgumentParser(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
104 add_help=False,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
105 prog="graphprot_predict_wrapper.py",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
106 description=help_description,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
107 formatter_class=ap.MetavarTypeHelpFormatter,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
108 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
109
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
110 # Argument groups.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
111 p_man = p.add_argument_group("REQUIRED ARGUMENTS")
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
112 p_opt = p.add_argument_group("OPTIONAL ARGUMENTS")
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
113
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
114 # Required arguments.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
115 p_opt.add_argument("-h", "--help", action="help", help="Print help message")
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
116 p_man.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
117 "--fasta",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
118 dest="in_fa",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
119 type=str,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
120 required=True,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
121 help="Sequences .fa file to predict" " on (option -fasta)",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
122 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
123 p_man.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
124 "--model",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
125 dest="in_model",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
126 type=str,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
127 required=True,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
128 help="GraphProt model file to use for predictions" " (option -model)",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
129 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
130 p_man.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
131 "--params",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
132 dest="in_params",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
133 type=str,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
134 required=True,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
135 help="Parameter file for given model",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
136 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
137 p_man.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
138 "--data-id",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
139 dest="data_id",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
140 type=str,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
141 required=True,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
142 help="Data ID (option -prefix)",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
143 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
144 # ---> I'm a conditional argument <---
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
145 p_opt.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
146 "--ws-pred",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
147 dest="ws_pred",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
148 default=False,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
149 action="store_true",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
150 help="Run a whole site prediction instead "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
151 "of calculating profiles (default: false)",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
152 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
153 # Additional arguments.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
154 p_opt.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
155 "--sc-thr",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
156 dest="score_thr",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
157 type=float,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
158 default=0,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
159 help="Score threshold for extracting "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
160 "average profile peak regions (default: 0)",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
161 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
162 p_opt.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
163 "--max-merge-dist",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
164 dest="max_merge_dist",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
165 type=int,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
166 default=0,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
167 choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
168 help="Maximum merge distance for nearby peak regions"
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
169 " (default: report all non-overlapping regions)",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
170 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
171 p_opt.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
172 "--gen-site-bed",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
173 dest="genomic_sites_bed",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
174 type=str,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
175 help=".bed file specifying the genomic regions of "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
176 "the input .fa sequences. Corrupt .bed "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
177 "information will be punished (default: false)",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
178 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
179 p_opt.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
180 "--conf-out",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
181 dest="conf_out",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
182 default=False,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
183 action="store_true",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
184 help="Output filtered peak regions BED file or "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
185 "predictions file (if --ws-pred) using the median "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
186 "positive training site score for filtering "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
187 "(default: false)",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
188 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
189 p_opt.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
190 "--gp-output",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
191 dest="gp_output",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
192 default=False,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
193 action="store_true",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
194 help="Print output produced by GraphProt " "(default: false)",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
195 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
196 p_opt.add_argument(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
197 "--ap-extlr",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
198 dest="ap_extlr",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
199 type=int,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
200 default=5,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
201 choices=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10],
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
202 help="Define average profile up- and downstream "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
203 "extension to produce the average profile. "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
204 "The mean over small sequence windows "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
205 "(window length = --ap-extlr*2 + 1) is used to "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
206 "get position scores, thus the average profile "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
207 "is more smooth than the initial profile output "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
208 "by GraphProt (default: 5)",
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
209 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
210 return p
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
211
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
212
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
213 #######################################################################
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
214
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
215 if __name__ == "__main__":
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
216
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
217 # Setup argparse.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
218 parser = setup_argument_parser()
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
219 # Read in command line arguments.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
220 args = parser.parse_args()
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
221
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
222 """
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
223 Do all sorts of sanity checking.
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
224
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
225 """
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
226 # Check for Linux.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
227 assert "linux" in sys.platform, "please use Linux"
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
228 # Check tool availability.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
229 assert gplib.is_tool("GraphProt.pl"), "GraphProt.pl not in PATH"
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
230 # Check file inputs.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
231 assert os.path.exists(args.in_fa), 'input .fa file "%s" not found' % (args.in_fa)
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
232 assert os.path.exists(args.in_model), 'input .model file "%s" not found' % (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
233 args.in_model
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
234 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
235 assert os.path.exists(args.in_params), 'input .params file "%s" not found' % (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
236 args.in_params
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
237 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
238 # Count .fa entries.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
239 c_in_fa = gplib.count_fasta_headers(args.in_fa)
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
240 assert c_in_fa, 'input .fa file "%s" no headers found' % (args.in_fa)
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
241 print("# input .fa sequences: %i" % (c_in_fa))
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
242 # Read in FASTA sequences to check for uppercase sequences.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
243 seqs_dic = gplib.read_fasta_into_dic(args.in_fa)
4
4ad83aed5c3c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit 15c382f71f1984aecff67ef9d268b992528996b2"
bgruening
parents: 3
diff changeset
244 # Check for lowercase only sequences, which cause GP to crash.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
245 error_mess = (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
246 "input sequences encountered containing "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
247 "only lowercase characters or lowercase characters in between "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
248 "uppercase characters. Please provide either all uppercase "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
249 "sequences or sequences containing uppercase regions surrounded "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
250 "by lowercase context regions for structure calculation (see "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
251 "viewpoint concept in original GraphProt publication "
4
4ad83aed5c3c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit 15c382f71f1984aecff67ef9d268b992528996b2"
bgruening
parents: 3
diff changeset
252 "for more details)"
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
253 )
4
4ad83aed5c3c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit 15c382f71f1984aecff67ef9d268b992528996b2"
bgruening
parents: 3
diff changeset
254 if args.ws_pred:
4ad83aed5c3c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit 15c382f71f1984aecff67ef9d268b992528996b2"
bgruening
parents: 3
diff changeset
255 bad_ids = gplib.check_seqs_dic_format(seqs_dic)
4ad83aed5c3c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit 15c382f71f1984aecff67ef9d268b992528996b2"
bgruening
parents: 3
diff changeset
256 assert not bad_ids, "%s" % (error_mess)
4ad83aed5c3c "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit 15c382f71f1984aecff67ef9d268b992528996b2"
bgruening
parents: 3
diff changeset
257
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
258 c_uc_nt = gplib.seqs_dic_count_uc_nts(seqs_dic)
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
259 assert c_uc_nt, (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
260 "no uppercase nucleotides in input .fa sequences. "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
261 "Please change sequences to uppercase (keep in mind "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
262 "GraphProt only scores uppercase regions (according "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
263 "to its viewpoint concept)"
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
264 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
265 if not args.ws_pred:
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
266 # Check for lowercase sequences.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
267 c_lc_nt = gplib.seqs_dic_count_lc_nts(seqs_dic)
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
268 assert not c_lc_nt, (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
269 "lowercase nucleotides in input .fa not allowed"
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
270 " in profile predictions, since GraphProt only scores "
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
271 "uppercase regions (according to its viewpoint concept)"
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
272 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
273 # Check .bed.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
274 if args.genomic_sites_bed:
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
275 # An array of checks, marvelous.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
276 assert os.path.exists(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
277 args.genomic_sites_bed
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
278 ), 'genomic .bed file "%s" not found' % (args.genomic_sites_bed)
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
279 # Check .bed for content.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
280 assert gplib.count_file_rows(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
281 args.genomic_sites_bed
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
282 ), 'genomic .bed file "%s" is empty' % (args.genomic_sites_bed)
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
283 # Check .bed for 6-column format.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
284 assert gplib.bed_check_six_col_format(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
285 args.genomic_sites_bed
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
286 ), 'genomic .bed file "%s" appears to not ' "be in 6-column .bed format" % (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
287 args.genomic_sites_bed
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
288 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
289 # Check for unique column 4 IDs.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
290 assert gplib.bed_check_unique_ids(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
291 args.genomic_sites_bed
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
292 ), 'genomic .bed file "%s" column 4 IDs not unique' % (args.genomic_sites_bed)
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
293 # Read in .bed regions, compare to FASTA sequences.
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
294 seq_len_dic = gplib.get_seq_lengths_from_seqs_dic(seqs_dic)
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
295 reg_len_dic = gplib.bed_get_region_lengths(args.genomic_sites_bed)
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
296 for seq_id in seq_len_dic:
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
297 seq_l = seq_len_dic[seq_id]
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
298 assert (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
299 seq_id in reg_len_dic
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
300 ), 'sequence ID "%s" missing in input .bed "%s"' % (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
301 seq_id,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
302 args.genomic_sites_bed,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
303 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
304 reg_l = reg_len_dic[seq_id]
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
305 assert (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
306 seq_l == reg_l
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
307 ), "sequence length differs from .bed region length (%i != %i)" % (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
308 seq_l,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
309 reg_l,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
310 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
311 # Read in model parameters.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
312 param_dic = gplib.graphprot_get_param_dic(args.in_params)
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
313 # Create GraphProt parameter string.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
314 param_string = gplib.graphprot_get_param_string(args.in_params)
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
315
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
316 """
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
317 Run predictions.
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
318
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
319 """
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
320 if args.ws_pred:
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
321 # Do whole site prediction.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
322 print(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
323 "Starting whole site predictions on input .fa file"
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
324 " (-action predict) ... "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
325 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
326 check_cmd = (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
327 "GraphProt.pl -action predict -prefix "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
328 + args.data_id
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
329 + " -fasta "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
330 + args.in_fa
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
331 + " "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
332 + param_string
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
333 + " -model "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
334 + args.in_model
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
335 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
336 output = subprocess.getoutput(check_cmd)
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
337 assert (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
338 output
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
339 ), "the following call of GraphProt.pl " "produced no output:\n%s" % (check_cmd)
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
340 if args.gp_output:
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
341 print(output)
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
342 ws_predictions_file = args.data_id + ".predictions"
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
343 assert os.path.exists(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
344 ws_predictions_file
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
345 ), 'Whole site prediction output .predictions file "%s" not found' % (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
346 ws_predictions_file
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
347 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
348 if args.conf_out:
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
349 # Filter by pos_train_ws_pred_median median.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
350 assert "pos_train_ws_pred_median" in param_dic, (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
351 "whole site top scores median information " "missing in .params file"
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
352 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
353 pos_tr_ws_pred_med = float(param_dic["pos_train_ws_pred_median"])
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
354 # Filtered file.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
355 filt_ws_predictions_file = args.data_id + ".p50.predictions"
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
356 print(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
357 "Extracting p50 sites from whole site predictions"
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
358 " (score threshold = %f) ... " % (pos_tr_ws_pred_med)
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
359 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
360 gplib.graphprot_filter_predictions_file(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
361 ws_predictions_file, filt_ws_predictions_file, sc_thr=pos_tr_ws_pred_med
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
362 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
363 else:
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
364 # Do profile prediction.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
365 print(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
366 "Starting profile predictions on on input .fa file "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
367 "(-action predict_profile) ... "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
368 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
369 check_cmd = (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
370 "GraphProt.pl -action predict_profile -prefix "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
371 + args.data_id
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
372 + " -fasta "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
373 + args.in_fa
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
374 + " "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
375 + param_string
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
376 + " -model "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
377 + args.in_model
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
378 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
379 output = subprocess.getoutput(check_cmd)
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
380 assert (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
381 output
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
382 ), "the following call of GraphProt.pl produced " "no output:\n%s" % (check_cmd)
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
383 if args.gp_output:
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
384 print(output)
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
385 profile_predictions_file = args.data_id + ".profile"
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
386 assert os.path.exists(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
387 profile_predictions_file
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
388 ), 'Profile prediction output .profile file "%s" not found' % (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
389 profile_predictions_file
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
390 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
391
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
392 # Profile prediction output files.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
393 avg_prof_file = args.data_id + ".avg_profile"
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
394 avg_prof_peaks_file = args.data_id + ".avg_profile.peaks.bed"
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
395 avg_prof_gen_peaks_file = args.data_id + ".avg_profile.genomic_peaks.bed"
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
396 avg_prof_peaks_p50_file = args.data_id + ".avg_profile.p50.peaks.bed"
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
397 avg_prof_gen_peaks_p50_file = (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
398 args.data_id + ".avg_profile.p50.genomic_peaks.bed"
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
399 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
400
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
401 # Get sequence IDs in order from input .fa file.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
402 seq_ids_list = gplib.fasta_read_in_ids(args.in_fa)
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
403 # Calculate average profiles.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
404 print(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
405 "Getting average profile from profile "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
406 "(extlr for smoothing: %i) ... " % (args.ap_extlr)
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
407 )
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
408 gplib.graphprot_profile_calc_avg_profile(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
409 profile_predictions_file,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
410 avg_prof_file,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
411 ap_extlr=args.ap_extlr,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
412 seq_ids_list=seq_ids_list,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
413 method=2,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
414 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
415 # Extract peak regions on sequences with threshold score 0.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
416 print(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
417 "Extracting peak regions from average profile " "(score threshold = 0) ... "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
418 )
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
419 killpep8 = args.max_merge_dist
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
420 gplib.graphprot_profile_extract_peak_regions(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
421 avg_prof_file,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
422 avg_prof_peaks_file,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
423 max_merge_dist=killpep8,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
424 sc_thr=args.score_thr,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
425 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
426 # Convert peaks to genomic coordinates.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
427 if args.genomic_sites_bed:
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
428 print("Converting peak regions to genomic coordinates ... ")
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
429 killit = args.genomic_sites_bed
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
430 gplib.bed_peaks_to_genomic_peaks(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
431 avg_prof_peaks_file,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
432 avg_prof_gen_peaks_file,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
433 print_rows=False,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
434 genomic_sites_bed=killit,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
435 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
436 # Extract peak regions with threshold score p50.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
437 if args.conf_out:
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
438 sc_id = "pos_train_avg_profile_median_%i" % (args.ap_extlr)
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
439 # Filter by pos_tr_ws_pred_med median.
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
440 assert sc_id in param_dic, (
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
441 "average profile extlr %i median "
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
442 "information missing in .params file" % (args.ap_extlr)
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
443 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
444 p50_sc_thr = float(param_dic[sc_id])
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
445 print(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
446 "Extracting p50 peak regions from average profile "
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
447 "(score threshold = %f) ... " % (p50_sc_thr)
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
448 )
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
449 despair = avg_prof_peaks_p50_file
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
450 pain = args.max_merge_dist
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
451 gplib.graphprot_profile_extract_peak_regions(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
452 avg_prof_file, despair, max_merge_dist=pain, sc_thr=p50_sc_thr
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
453 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
454 # Convert peaks to genomic coordinates.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
455 if args.genomic_sites_bed:
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
456 print("Converting p50 peak regions to " "genomic coordinates ... ")
3
ace92c9a4653 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents: 2
diff changeset
457 madness = args.genomic_sites_bed
5
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
458 gplib.bed_peaks_to_genomic_peaks(
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
459 avg_prof_peaks_p50_file,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
460 avg_prof_gen_peaks_p50_file,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
461 genomic_sites_bed=madness,
ddcf35a868b8 planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents: 4
diff changeset
462 )
1
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
463 # Done.
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
464 print("Script: I'm done.")
20429f4c1b95 "planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff changeset
465 print("Author: ... ")