Mercurial > repos > greg > ks_distribution
diff ks_distribution.R @ 64:b7468c75c4a5 draft
Uploaded
author | greg |
---|---|
date | Tue, 27 Jun 2017 11:00:36 -0400 |
parents | a9c1203d5eb6 |
children | ad406d4702b2 |
line wrap: on
line diff
--- a/ks_distribution.R Tue Jun 27 09:03:06 2017 -0400 +++ b/ks_distribution.R Tue Jun 27 11:00:36 2017 -0400 @@ -17,7 +17,7 @@ set_component_colors = function(colors, number_comp) { # Handle colors for components. - if (is.na(colors)) { + if (is.null(colors)) { # Randomly specify colors for components. component_colors <- c("red", "yellow", "green", "black", "blue", "darkorange") } else { @@ -86,7 +86,7 @@ return(results) } -plot_ks<-function(kaks_input, number_comp, component_colors, output, pi, mu, var) +plot_ks<-function(kaks_input, component_colors, output, pi, mu, var) { # Start PDF device driver to save charts to output. pdf(file=output, bg="white") @@ -138,6 +138,10 @@ # Read in the components data. components_data <- read.delim(opt$components_input, header=TRUE) number_comp <- as.integer(opt$number_comp) +if (number_comp == 0) { + # Default to 1 component to allow functional testing. + number_comp <- 1 +} # Set component colors. component_colors <- set_component_colors(opt$specified_colors, number_comp) @@ -168,7 +172,6 @@ pi <- items[1:6] mu <- items[7:12] var <- items[13:18] -} # Plot the output. -plot_ks(opt$kaks_input, number_comp, component_colors, opt$output, pi, mu, var) +plot_ks(opt$kaks_input, component_colors, opt$output, pi, mu, var)