comparison ks_distribution.R @ 37:ee4ebdf2935e draft

Uploaded
author greg
date Mon, 26 Jun 2017 11:22:20 -0400
parents 6aeba53e195b
children 686ea47c0ce3
comparison
equal deleted inserted replaced
36:6aeba53e195b 37:ee4ebdf2935e
1 #!/usr/bin/env Rscript 1 #!/usr/bin/env Rscript
2 2
3 suppressPackageStartupMessages(library("optparse")) 3 suppressPackageStartupMessages(library("optparse"))
4 suppressPackageStartupMessages(library("rjson"))
5 4
6 option_list <- list( 5 option_list <- list(
7 make_option(c("-c", "--components_input"), action="store", dest="components_input", help="Ks significant components input dataset"), 6 make_option(c("-c", "--components_input"), action="store", dest="components_input", help="Ks significant components input dataset"),
8 make_option(c("-k", "--kaks_input"), action="store", dest="kaks_input", help="KaKs analysis input dataset"), 7 make_option(c("-k", "--kaks_input"), action="store", dest="kaks_input", help="KaKs analysis input dataset"),
9 make_option(c("-n", "--number_comp"), action="store", dest="number_comp", type="integer", help="Number of significant components in the Ks distribution"), 8 make_option(c("-n", "--number_comp"), action="store", dest="number_comp", type="integer", help="Number of significant components in the Ks distribution"),
24 specified_colors <- c('red', 'yellow', 'green', 'black', 'blue', 'darkorange') 23 specified_colors <- c('red', 'yellow', 'green', 'black', 'blue', 'darkorange')
25 } 24 }
26 else 25 else
27 { 26 {
28 # Handle selected colors for components. 27 # Handle selected colors for components.
29 parser <- newJSONParser()
30 parser$addData(colors)
31 raw_colors <- parser$getObject()
32 specified_colors <- c() 28 specified_colors <- c()
33 for (raw_color in raw_colors) 29 cStr <- unlist(colors)
30 items <- strsplit(cStr, ",")
31 for (item in items)
34 { 32 {
35 specified_colors <- c(specified_colors, raw_color) 33 specified_colors <- c(specified_colors, item)
36 } 34 }
37 num_colors_specified = length(specified_colors) 35 num_colors_specified = length(specified_colors)
38 if (num_colors_specified < number_comp) 36 if (num_colors_specified < number_comp)
39 { 37 {
40 for (i in num_colors_specified:number_comp) 38 for (i in num_colors_specified:number_comp)