Mercurial > repos > matthias > dada2_removebimeradenovo
annotate user_input_functions.R @ 2:8b1355f37137 draft
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit 5b1603bbcd3f139cad5c876be83fcb39697b5613-dirty
| author | matthias | 
|---|---|
| date | Tue, 09 Apr 2019 07:06:24 -0400 | 
| parents | 01159d734fc9 | 
| children | 
| rev | line source | 
|---|---|
| 
0
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
1 # defining functions for checking user inputs | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
2 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
3 # requesting directory input---------------------------------------------------------- | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
4 dir_input <- function(prompt) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
5 check <- FALSE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
6 while(check == FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
7 user_input <- readline(prompt) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
8 check <- dir.exists(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
9 if(check==FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
10 msg <- sprintf("The directory: %s not found.", user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
11 message(msg) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
12 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
13 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
14 return(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
15 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
16 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
17 # requesting file input | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
18 file_input <- function(prompt, directory) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
19 check <- FALSE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
20 while(check == FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
21 user_input <- readline(prompt) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
22 check <- file.exists(file.path(directory, user_input)) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
23 if(check==FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
24 msg <- sprintf("File: %s not found.", user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
25 message(msg) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
26 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
27 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
28 return(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
29 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
30 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
31 # requesting string input------------------------------------------------------------ | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
32 string_input <- function(prompt) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
33 check <- FALSE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
34 while(check == FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
35 user_input <- readline(prompt) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
36 check <- user_input!='' | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
37 if(check == FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
38 message("Input can't be empty.") | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
39 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
40 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
41 return(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
42 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
43 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
44 # requesting integer input---------------------------------------------------------- | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
45 numeric_input <- function(prompt, default) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
46 check <- FALSE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
47 while(check == FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
48 user_input <- readline(prompt) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
49 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
50 # if blank, set user_input to defalut | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
51 if(user_input == '') { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
52 user_input <- default | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
53 msg <- sprintf("No input supplied, default of %s used.", default) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
54 message(msg) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
55 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
56 # coerce input to be numeric | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
57 else { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
58 user_input <- as.numeric(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
59 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
60 # check if number supplied | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
61 check <- !is.na(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
62 if(check == FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
63 message("Input must be a number.") | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
64 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
65 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
66 return(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
67 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
68 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
69 # request constrained string--------------------------------------------------------- | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
70 # default is numeric, referring to the index of desired option in 'choices' | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
71 cons_string_input <- function(prompt, choices, default) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
72 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
73 if(missing(default)){ | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
74 check <- FALSE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
75 while(check == FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
76 user_input <- as.numeric(menu(choices, graphics=FALSE, title=prompt)) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
77 user_input <- choices[user_input] | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
78 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
79 check <- user_input!='' | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
80 if(check == FALSE) message("Input can't be empty.") | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
81 else message(sprintf("\nSelected: %s", user_input)) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
82 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
83 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
84 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
85 if(!missing(default)){ | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
86 # setting up prompt with menu | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
87 num_choices <- str_c(1:length(choices), choices, sep='. ') | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
88 menu_prompt <- sprintf("%s\n\t%s\n", prompt, str_c(num_choices, collapse='\n\t')) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
89 message(menu_prompt) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
90 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
91 # requesting user input | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
92 user_input <- readline("Selection:") | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
93 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
94 # setting default | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
95 if(user_input == '') { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
96 user_input <- as.numeric(default) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
97 user_input <- choices[user_input] | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
98 msg <- sprintf("No input supplied, default of %s used.", user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
99 message(msg) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
100 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
101 else { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
102 user_input <- as.numeric(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
103 user_input <- choices[user_input] | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
104 message(sprintf("\nSelected: %s", user_input)) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
105 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
106 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
107 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
108 return(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
109 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
110 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
111 # request multiple inputs----------------------------------------------------------- | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
112 ## default is optional; can set default to NULL if want to allow blank entry | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
113 cons_string_mult <- function(prompt, choices, default) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
114 if(missing(default)) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
115 check <- FALSE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
116 while(check == FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
117 user_input <- select.list(choices=choices, multiple=TRUE, title=prompt, | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
118 graphics = FALSE) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
119 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
120 if(length(user_input)==0) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
121 message("Input can't be empty.") | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
122 check <- FALSE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
123 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
124 else { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
125 message(sprintf("\nSelected: %s", user_input)) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
126 check <- TRUE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
127 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
128 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
129 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
130 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
131 if(!missing(default)) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
132 user_input <- select.list(choices=choices, multiple=TRUE, title=prompt, | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
133 graphics=FALSE) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
134 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
135 if(length(user_input)==0) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
136 if(is.null(default)) user_input <- default | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
137 else user_input <- default | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
138 msg <- sprintf("No input supplied, using default:%s", | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
139 paste(user_input, collapse=', ')) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
140 message(msg) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
141 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
142 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
143 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
144 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
145 return(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
146 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
147 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
148 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
149 # yesno input------------------------------------------------------------------- | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
150 # default is TRUE or FALSE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
151 yn_input <- function(prompt, default) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
152 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
153 choices <- c("Yes", "No") | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
154 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
155 if(missing(default)) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
156 check <- FALSE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
157 while(check == FALSE) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
158 user_input <- menu(choices, graphics=FALSE, title=prompt) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
159 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
160 if(length(user_input)==0) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
161 message("Input can't be empty.") | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
162 check <- FALSE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
163 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
164 else { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
165 message(sprintf("\nSelected: %s", user_input)) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
166 check <- TRUE | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
167 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
168 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
169 user_input <- ifelse(user_input == 1L, TRUE, FALSE) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
170 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
171 if(!missing(default)) { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
172 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
173 # setting up prompt with menu | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
174 num_choices <- str_c(1:length(choices), choices, sep='. ') | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
175 menu_prompt <- sprintf("%s\n\t%s\n", prompt, str_c(num_choices, collapse='\n\t')) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
176 message(menu_prompt) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
177 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
178 # requesting user input | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
179 user_input <- readline("Selection:") | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
180 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
181 # setting default | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
182 if(user_input == '') { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
183 user_input <- as.numeric(default) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
184 msg <- sprintf("No input supplied, default of %s used.", choices[user_input]) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
185 message(msg) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
186 user_input <- ifelse(user_input == 1L, TRUE, FALSE) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
187 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
188 else { | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
189 user_input <- as.numeric(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
190 message(sprintf("\nSelected: %s", choices[user_input])) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
191 user_input <- ifelse(user_input == 1L, TRUE, FALSE) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
192 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
193 } | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
194 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
195 | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
196 return(user_input) | 
| 
 
01159d734fc9
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit d63c84012410608b3b5d23e130f0beff475ce1f8-dirty
 
matthias 
parents:  
diff
changeset
 | 
197 } | 
