Mercurial > repos > matthias > dada2_dada
annotate user_input_functions.R @ 8:441a137f4fbc draft
planemo upload for repository https://github.com/bernt-matthias/mb-galaxy-tools/tree/topic/dada2/tools/dada2 commit 977f22125c9ad5c3c5560de8946017305c5633c1
| author | matthias | 
|---|---|
| date | Mon, 27 May 2019 13:27:16 -0400 | 
| parents | 38959bdb0956 | 
| children | 
| rev | line source | 
|---|---|
| 0 
38959bdb0956
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 | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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---------------------------------------------------------- | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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)) | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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------------------------------------------------------------ | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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!='' | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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.") | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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---------------------------------------------------------- | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 == '') { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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.") | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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--------------------------------------------------------- | 
| 
38959bdb0956
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' | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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)){ | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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)) | 
| 
38959bdb0956
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] | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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!='' | 
| 
38959bdb0956
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.") | 
| 
38959bdb0956
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)) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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)){ | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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='. ') | 
| 
38959bdb0956
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')) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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:") | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 == '') { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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] | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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] | 
| 
38959bdb0956
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)) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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----------------------------------------------------------- | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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)) { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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, | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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.") | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 { | 
| 
38959bdb0956
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)) | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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)) { | 
| 
38959bdb0956
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, | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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", | 
| 
38959bdb0956
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=', ')) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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------------------------------------------------------------------- | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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") | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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)) { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) { | 
| 
38959bdb0956
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.") | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 { | 
| 
38959bdb0956
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)) | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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)) { | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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='. ') | 
| 
38959bdb0956
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')) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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:") | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 == '') { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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]) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 { | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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])) | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 } | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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 | 
| 
38959bdb0956
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) | 
| 
38959bdb0956
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 } | 
