Mercurial > repos > rnateam > graphprot_predict_profile
annotate graphprot_train_wrapper.py @ 5:ddcf35a868b8 draft
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 | ace92c9a4653 |
children |
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:
1
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:
1
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:
1
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:
1
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 OUTPUT FILES |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
22 ============ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
23 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
24 data_id.model |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
25 data_id.params |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
26 if not --disable-cv: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
27 data_id.cv_results |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
28 if not --disable-motifs: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
29 data_id.sequence_motif |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
30 data_id.sequence_motif.png |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
31 if --str-model: |
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.structure_motif |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
33 data_id.structure_motif.png |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
34 Temporary: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
35 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
|
36 data_id.profile |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
37 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
38 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
39 EXAMPLE CALLS |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
40 ============= |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
41 |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
42 python graphprot_train_wrapper.py --pos gp_data/SERBP1_positives.train.fa |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
43 --neg gp_data/SERBP1_negatives.train.fa --data-id test2 --disable-cv |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
44 --gp-output --opt-set-size 200 --min-train 400 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
45 |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
46 python graphprot_train_wrapper.py --pos gp_data/SERBP1_positives.train.fa |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
47 --neg gp_data/SERBP1_negatives.train.fa --data-id test2 --disable-cv |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
48 --opt-set-size 100 --min-train 200 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
49 |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
50 python graphprot_train_wrapper.py --pos test-data/test_positives.train.fa |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
51 --neg test-data/test_negatives.train.fa --data-id gptest2 --disable-cv |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
52 --opt-pos test-data/test_positives.parop.fa |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
53 --opt-neg test-data/test_negatives.parop.fa |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
54 |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
55 python graphprot_train_wrapper.py --pos test-data/test_positives.train.fa |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
56 --neg test-data/test_negatives.train.fa --data-id gptest2 --disable-cv |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
57 --disable-motifs --opt-pos test-data/test_positives.parop.fa --opt-neg |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
58 test-data/test_negatives.parop.fa |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
59 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
60 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
61 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
62 |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
63 |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
64 ####################################################################### |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
65 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
66 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
67 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
|
68 """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
|
69 help_description = """ |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
70 Galaxy wrapper script for GraphProt to train a GraphProt model on |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
71 a given set of input sequences (positives and negatives .fa). By |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
72 default a sequence model is trained (due to structure models |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
73 being much slower to train). Also by default take a portion of |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
74 the input sequences for hyperparameter optimization (HPO) prior to |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
75 model training, and run a 10-fold cross validation and motif |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
76 generation after model training. Thus the following output |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
77 files are produced: |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
78 .model model file, .params model parameter file, .png motif files |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
79 (sequence, or sequence+structure), .cv_results CV results file. |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
80 After model training, predict on positives to get highest whole |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
81 site and profile scores found in binding sites. Take the median |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
82 score out of these to store in .params file, using it later |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
83 for outputting binding sites or peaks with higher confidence. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
84 |
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 # Define argument parser. |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
87 p = ap.ArgumentParser( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
88 add_help=False, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
89 prog="graphprot_train_wrapper.py", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
90 description=help_description, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
91 formatter_class=ap.MetavarTypeHelpFormatter, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
92 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
93 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
94 # Argument groups. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
95 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
|
96 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
|
97 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
98 # Required arguments. |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
99 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:
3
diff
changeset
|
100 p_man.add_argument( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
101 "--pos", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
102 dest="in_pos_fa", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
103 type=str, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
104 required=True, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
105 help="Positive (= binding site) sequences .fa file " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
106 "for model training (option -fasta)", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
107 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
108 p_man.add_argument( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
109 "--neg", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
110 dest="in_neg_fa", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
111 type=str, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
112 required=True, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
113 help="Negative sequences .fa file for model " "training (option -negfasta)", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
114 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
115 p_man.add_argument( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
116 "--data-id", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
117 dest="data_id", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
118 type=str, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
119 required=True, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
120 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:
3
diff
changeset
|
121 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
122 # Additional arguments. |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
123 p_opt.add_argument( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
124 "--opt-set-size", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
125 dest="opt_set_size", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
126 type=int, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
127 default=500, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
128 help="Hyperparameter optimization set size (taken " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
129 "away from both --pos and --neg) (default: 500)", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
130 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
131 p_opt.add_argument( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
132 "--opt-pos", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
133 dest="opt_pos_fa", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
134 type=str, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
135 help="Positive (= binding site) sequences .fa file " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
136 "for hyperparameter optimization (default: take " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
137 "--opt-set-size from --pos)", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
138 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
139 p_opt.add_argument( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
140 "--opt-neg", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
141 dest="opt_neg_fa", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
142 type=str, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
143 help="Negative sequences .fa file for hyperparameter " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
144 "optimization (default: take --opt-set-size " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
145 "from --neg)", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
146 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
147 p_opt.add_argument( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
148 "--min-train", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
149 dest="min_train", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
150 type=int, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
151 default=500, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
152 help="Minimum amount of training sites demanded " "(default: 500)", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
153 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
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:
3
diff
changeset
|
155 "--disable-cv", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
156 dest="disable_cv", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
157 default=False, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
158 action="store_true", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
159 help="Disable cross validation step (default: false)", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
160 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
161 p_opt.add_argument( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
162 "--disable-motifs", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
163 dest="disable_motifs", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
164 default=False, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
165 action="store_true", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
166 help="Disable motif generation step (default: false)", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
167 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
168 p_opt.add_argument( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
169 "--gp-output", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
170 dest="gp_output", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
171 default=False, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
172 action="store_true", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
173 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:
3
diff
changeset
|
174 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
175 p_opt.add_argument( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
176 "--str-model", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
177 dest="train_str_model", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
178 default=False, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
179 action="store_true", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
180 help="Train a structure model (default: train " "a sequence model)", |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
181 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
182 return p |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
183 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
184 |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
185 ####################################################################### |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
186 |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
187 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
|
188 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
189 # Setup argparse. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
190 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
|
191 # 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
|
192 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:
1
diff
changeset
|
193 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
194 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
195 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:
1
diff
changeset
|
196 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
197 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
198 # 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
|
199 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
|
200 # 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
|
201 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
|
202 # Check file inputs. |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
203 assert os.path.exists(args.in_pos_fa), 'positives .fa file "%s" not found' % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
204 args.in_pos_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
205 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
206 assert os.path.exists(args.in_neg_fa), 'negatives .fa file "%s" not found' % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
207 args.in_neg_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
208 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
209 # 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
|
210 c_pos_fa = gplib.count_fasta_headers(args.in_pos_fa) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
211 c_neg_fa = gplib.count_fasta_headers(args.in_neg_fa) |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
212 assert c_pos_fa, 'positives .fa file "%s" no headers found' % (args.in_pos_fa) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
213 assert c_neg_fa, 'negatives .fa file "%s" no headers found' % (args.in_neg_fa) |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
214 print("# positive .fa sequences: %i" % (c_pos_fa)) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
215 print("# negative .fa sequences: %i" % (c_neg_fa)) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
216 # Check additional files. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
217 if args.opt_pos_fa: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
218 assert args.opt_neg_fa, "--opt-pos but no --opt-neg given" |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
219 if args.opt_neg_fa: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
220 assert args.opt_pos_fa, "--opt-neg but no --opt-pos given" |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
221 # 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:
3
diff
changeset
|
222 error_mess = ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
223 "input sequences encountered containing " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
224 "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:
3
diff
changeset
|
225 "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:
3
diff
changeset
|
226 "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:
3
diff
changeset
|
227 "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:
3
diff
changeset
|
228 "viewpoint concept in original GraphProt publication " |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
229 "for more details)" |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
230 ) |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
231 seqs_dic = gplib.read_fasta_into_dic(args.in_pos_fa) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
232 bad_ids = gplib.check_seqs_dic_format(seqs_dic) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
233 assert not bad_ids, "%s" % (error_mess) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
234 seqs_dic = gplib.read_fasta_into_dic(args.in_neg_fa) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
235 bad_ids = gplib.check_seqs_dic_format(seqs_dic) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
236 assert not bad_ids, "%s" % (error_mess) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
237 if args.opt_pos_fa: |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
238 seqs_dic = gplib.read_fasta_into_dic(args.opt_pos_fa) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
239 bad_ids = gplib.check_seqs_dic_format(seqs_dic) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
240 assert not bad_ids, "%s" % (error_mess) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
241 if args.opt_neg_fa: |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
242 seqs_dic = gplib.read_fasta_into_dic(args.opt_neg_fa) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
243 bad_ids = gplib.check_seqs_dic_format(seqs_dic) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
244 assert not bad_ids, "%s" % (error_mess) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
245 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
246 # If parop .fa files given. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
247 if args.opt_pos_fa and args.opt_neg_fa: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
248 c_parop_pos_fa = gplib.count_fasta_headers(args.opt_pos_fa) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
249 c_parop_neg_fa = gplib.count_fasta_headers(args.opt_neg_fa) |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
250 assert c_parop_pos_fa, '--opt-pos .fa file "%s" no headers found' % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
251 args.opt_pos_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
252 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
253 assert c_parop_neg_fa, '--opt-neg .fa file "%s" no headers found' % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
254 args.opt_neg_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
255 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
256 # Less than 500 for training?? You gotta be kidding. |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
257 assert c_pos_fa >= args.min_train, ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
258 "--pos for training < %i, please provide more (try at least " |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
259 "> 1000, the more the better)" % (args.min_train) |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
260 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
261 assert c_neg_fa >= args.min_train, ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
262 "--neg for training < %i, please provide more (try at least " |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
263 "> 1000, the more the better)" % (args.min_train) |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
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 # Looking closer at ratios. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
266 pos_neg_ratio = c_parop_pos_fa / c_parop_neg_fa |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
267 if pos_neg_ratio < 0.8 or pos_neg_ratio > 1.25: |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
268 assert 0, ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
269 "ratio of --opt-pos to --opt-neg < 0.8 or > 1.25 " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
270 "(ratio = %f). Try to keep ratio closer to 1 or better use " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
271 "identical numbers (keep in mind that performance measures " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
272 "such as accuracy or AUROC are not suitable for imbalanced " |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
273 " datasets!)" % (pos_neg_ratio) |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
274 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
275 else: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
276 # Define some minimum amount of training sites for the sake of sanity. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
277 c_pos_train = c_pos_fa - args.opt_set_size |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
278 c_neg_train = c_neg_fa - args.opt_set_size |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
279 # Start complaining. |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
280 assert ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
281 c_pos_fa >= args.opt_set_size |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
282 ), "# positives < --opt-set-size (%i < %i)" % (c_pos_fa, args.opt_set_size) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
283 assert ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
284 c_neg_fa >= args.opt_set_size |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
285 ), "# negatives < --opt-set-size (%i < %i)" % (c_neg_fa, args.opt_set_size) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
286 assert ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
287 c_pos_train >= args.opt_set_size |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
288 ), "# positives remaining for training < --opt-set-size " "(%i < %i)" % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
289 c_pos_train, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
290 args.opt_set_size, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
291 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
292 assert ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
293 c_neg_train >= args.opt_set_size |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
294 ), "# negatives remaining " "for training < --opt-set-size (%i < %i)" % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
295 c_neg_train, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
296 args.opt_set_size, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
297 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
298 # Less than 500?? You gotta be kidding. |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
299 assert c_pos_train >= args.min_train, ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
300 "# positives remaining for training < %i, please provide more " |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
301 " (try at least > 1000, the more the better)" % (args.min_train) |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
302 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
303 assert c_neg_train >= args.min_train, ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
304 "# negatives remaining for training < %i, please provide more " |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
305 "(try at least > 1000, the more the better)" % (args.min_train) |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
306 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
307 # Looking closer at ratios. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
308 pos_neg_ratio = c_pos_train / c_neg_train |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
309 if pos_neg_ratio < 0.8 or pos_neg_ratio > 1.25: |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
310 assert 0, ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
311 "ratio of --pos to --neg < 0.8 or > 1.25 " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
312 "(ratio = %f). Try to keep ratio closer to 1 or better use " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
313 "identical numbers (keep in mind that performance measures " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
314 "such as accuracy or AUROC are not suitable for imbalanced " |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
315 "datasets!)" % (pos_neg_ratio) |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
316 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
317 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
318 """ |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
319 Generate parop + train .fa output files for hyperparameter |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
320 optimization + training. |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
321 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
322 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
323 # Output files for training. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
324 pos_parop_fa = args.data_id + ".positives.parop.fa" |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
325 neg_parop_fa = args.data_id + ".negatives.parop.fa" |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
326 pos_train_fa = args.data_id + ".positives.train.fa" |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
327 neg_train_fa = args.data_id + ".negatives.train.fa" |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
328 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
329 # If parop .fa files given. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
330 if args.opt_pos_fa and args.opt_neg_fa: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
331 # Just copy parop and train files. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
332 gplib.make_file_copy(args.opt_pos_fa, pos_parop_fa) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
333 gplib.make_file_copy(args.opt_neg_fa, neg_parop_fa) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
334 gplib.make_file_copy(args.in_pos_fa, pos_train_fa) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
335 gplib.make_file_copy(args.in_neg_fa, neg_train_fa) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
336 else: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
337 # Generate parop + train .fa files from input .fa files. |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
338 gplib.split_fasta_into_test_train_files( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
339 args.in_pos_fa, pos_parop_fa, pos_train_fa, test_size=args.opt_set_size |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
340 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
341 gplib.split_fasta_into_test_train_files( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
342 args.in_neg_fa, neg_parop_fa, neg_train_fa, test_size=args.opt_set_size |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
343 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
344 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
345 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
346 Do the hyperparameter optimization. |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
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 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
349 print("Starting hyperparameter optimization (-action ls) ... ") |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
350 check_cmd = ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
351 "GraphProt.pl -action ls -prefix " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
352 + args.data_id |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
353 + " -fasta " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
354 + pos_parop_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
355 + " -negfasta " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
356 + neg_parop_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
357 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
358 # If sequence model should be trained (default). |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
359 if not args.train_str_model: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
360 check_cmd += " -onlyseq" |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
361 print(check_cmd) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
362 output = subprocess.getoutput(check_cmd) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
363 params_file = args.data_id + ".params" |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
364 assert os.path.exists( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
365 params_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
366 ), "Hyperparameter optimization output " ' .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:
3
diff
changeset
|
367 params_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
368 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
369 # Add model type to params file. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
370 if args.train_str_model: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
371 gplib.echo_add_to_file("model_type: structure", params_file) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
372 else: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
373 gplib.echo_add_to_file("model_type: sequence", params_file) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
374 # Get parameter string. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
375 param_string = gplib.graphprot_get_param_string(params_file) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
376 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
377 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
378 Do the model training. (Yowza!) |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
379 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
380 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
381 print("Starting model training (-action train) ... ") |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
382 check_cmd = ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
383 "GraphProt.pl -action train -prefix " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
384 + args.data_id |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
385 + " -fasta " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
386 + pos_train_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
387 + " -negfasta " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
388 + neg_train_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
389 + " " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
390 + param_string |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
391 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
392 print(check_cmd) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
393 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:
3
diff
changeset
|
394 assert output, "The following call of GraphProt.pl produced no output:\n%s" % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
395 check_cmd |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
396 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
397 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
|
398 print(output) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
399 model_file = args.data_id + ".model" |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
400 assert os.path.exists(model_file), 'Training output .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:
3
diff
changeset
|
401 model_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
402 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
403 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
404 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
405 Do the 10-fold cross validation. |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
406 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
407 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
408 if not args.disable_cv: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
409 print("Starting 10-fold cross validation (-action cv) ... ") |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
410 check_cmd = ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
411 "GraphProt.pl -action cv -prefix " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
412 + args.data_id |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
413 + " -fasta " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
414 + pos_train_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
415 + " -negfasta " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
416 + neg_train_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
417 + " " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
418 + param_string |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
419 + " -model " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
420 + model_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
421 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
422 print(check_cmd) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
423 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:
3
diff
changeset
|
424 assert output, "The following call of GraphProt.pl produced no output:\n%s" % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
425 check_cmd |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
426 ) |
1
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.gp_output: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
428 print(output) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
429 cv_results_file = args.data_id + ".cv_results" |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
430 assert os.path.exists( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
431 cv_results_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
432 ), 'CV output .cv_results file "%s" not found' % (cv_results_file) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
433 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
434 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
435 Do the motif generation. |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
436 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
437 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
438 if not args.disable_motifs: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
439 print("Starting motif generation (-action motif) ... ") |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
440 check_cmd = ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
441 "GraphProt.pl -action motif -prefix " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
442 + args.data_id |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
443 + " -fasta " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
444 + pos_train_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
445 + " -negfasta " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
446 + neg_train_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
447 + " " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
448 + param_string |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
449 + " -model " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
450 + model_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
451 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
452 print(check_cmd) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
453 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:
3
diff
changeset
|
454 assert output, "The following call of GraphProt.pl produced no output:\n%s" % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
455 check_cmd |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
456 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
457 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
|
458 print(output) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
459 seq_motif_file = args.data_id + ".sequence_motif" |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
460 seq_motif_png_file = args.data_id + ".sequence_motif.png" |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
461 assert os.path.exists( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
462 seq_motif_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
463 ), 'Motif output .sequence_motif file "%s" not found' % (seq_motif_file) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
464 assert os.path.exists( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
465 seq_motif_png_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
466 ), 'Motif output .sequence_motif.png file "%s" not found' % (seq_motif_png_file) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
467 if args.train_str_model: |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
468 str_motif_file = args.data_id + ".structure_motif" |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
469 str_motif_png_file = args.data_id + ".structure_motif.png" |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
470 assert os.path.exists( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
471 str_motif_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
472 ), 'Motif output .structure_motif file "%s" not found' % (str_motif_file) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
473 assert os.path.exists( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
474 str_motif_png_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
475 ), 'Motif output .structure_motif.png file "%s" not found' % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
476 str_motif_png_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
477 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
478 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
479 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
480 Do whole site predictions on positive training set. |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
481 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
482 """ |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
483 print( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
484 "Starting whole site predictions on positive training set " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
485 " (-action predict) ... " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
486 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
487 check_cmd = ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
488 "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:
3
diff
changeset
|
489 + args.data_id |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
490 + " -fasta " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
491 + pos_train_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
492 + " " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
493 + param_string |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
494 + " -model " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
495 + model_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
496 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
497 print(check_cmd) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
498 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:
3
diff
changeset
|
499 assert output, "The following call of GraphProt.pl produced no output:\n%s" % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
500 check_cmd |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
501 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
502 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
|
503 print(output) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
504 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:
3
diff
changeset
|
505 assert os.path.exists( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
506 ws_predictions_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
507 ), '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:
3
diff
changeset
|
508 ws_predictions_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
509 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
510 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
511 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
512 Do profile predictions on positive training set. |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
513 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
514 """ |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
515 print( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
516 "Starting profile predictions on positive training set " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
517 "-action predict_profile) ... " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
518 ) |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
519 check_cmd = ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
520 "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:
3
diff
changeset
|
521 + args.data_id |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
522 + " -fasta " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
523 + pos_train_fa |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
524 + " " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
525 + param_string |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
526 + " -model " |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
527 + model_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
528 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
529 print(check_cmd) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
530 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:
3
diff
changeset
|
531 assert output, "The following call of GraphProt.pl produced no output:\n%s" % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
532 check_cmd |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
533 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
534 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
|
535 print(output) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
536 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:
3
diff
changeset
|
537 assert os.path.exists( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
538 profile_predictions_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
539 ), '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:
3
diff
changeset
|
540 profile_predictions_file |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
541 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
542 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
543 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
544 Get 50 % score (median) for .predictions and .profile file. |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
545 For .profile, first extract for each site the maximum score, and then |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
546 from the list of maximum site scores get the median. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
547 For whole site .predictions, get the median from the site scores list. |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
548 |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
549 """ |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
550 print("Getting .profile and .predictions median scores ... ") |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
551 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
552 # Whole site scores median. |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
553 ws_pred_median = gplib.graphprot_predictions_get_median(ws_predictions_file) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
554 # Profile top site scores median. |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
555 profile_median = gplib.graphprot_profile_get_tsm( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
556 profile_predictions_file, profile_type="profile" |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
557 ) |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
558 ws_pred_string = "pos_train_ws_pred_median: %f" % (ws_pred_median) |
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
559 profile_string = "pos_train_profile_median: %f" % (profile_median) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
560 gplib.echo_add_to_file(ws_pred_string, params_file) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
561 gplib.echo_add_to_file(profile_string, params_file) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
562 # Average profile top site scores median for extlr 1 to 10. |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
563 for i in range(10): |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
564 i += 1 |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
565 avg_profile_median = gplib.graphprot_profile_get_tsm( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
566 profile_predictions_file, profile_type="avg_profile", avg_profile_extlr=i |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
567 ) |
3
ace92c9a4653
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit efcac98677c3ea9039c1c61eaa9e58f78287ccb3"
bgruening
parents:
1
diff
changeset
|
568 |
5
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
569 avg_profile_string = "pos_train_avg_profile_median_%i: %f" % ( |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
570 i, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
571 avg_profile_median, |
ddcf35a868b8
planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit ad60258f5759eaa205fec4af6143c728ea131419
bgruening
parents:
3
diff
changeset
|
572 ) |
1
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
573 gplib.echo_add_to_file(avg_profile_string, params_file) |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
574 |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
575 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
|
576 print("Author: Good. Now go back to your file system directory.") |
20429f4c1b95
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/rna_tools/graphprot commit f3fb925b83a4982e0cf9a0c11ff93ecbb8e4e6d5"
bgruening
parents:
diff
changeset
|
577 print("Script: Ok.") |