changeset 63:ff5bd57b1fdd draft

Uploaded
author greg
date Tue, 19 Dec 2017 12:46:16 -0500
parents ce217f091366
children 875dc1e164fc
files ideas_genome_tracks.R
diffstat 1 files changed, 11 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/ideas_genome_tracks.R	Tue Dec 19 12:29:48 2017 -0500
+++ b/ideas_genome_tracks.R	Tue Dec 19 12:46:16 2017 -0500
@@ -102,24 +102,25 @@
     # Create a trackDb.txt file that includes each state.
     base_track_file_name <- paste(tracks_dir, hub_name, sep="");
     cells = create_track(input_dir_state, chrom_len_file, base_track_file_name);
-    if (is.null(state_indexes)) {
-        # Create a a character vector of 1024 viridis color hex codes.
-        viridis_vector <- viridis(1024, alpha=1, begin=0, end=1, direction=1, option="D");
-        colors_used <- vector();
-    } else {
+    # Create a a character vector of 1024 viridis color hex codes.
+    # This vector could be used even if the state_colors were received
+    # since colors may not have been chosen for all states.
+    viridis_vector <- viridis(1024, alpha=1, begin=0, end=1, direction=1, option="D");
+    colors_used <- vector();
+    if (!is.null(state_indexes)) {
         # Split state_indexes into a list of integers.
-        indexes <- c();
+        s_indexes <- c();
         index_str <- as.character(state_indexes);
         items <- strsplit(index_str, ",")
         for (item in items) {
-            indexes <- c(indexes, as.integer(item));
+            s_indexes <- c(s_indexes, as.integer(item));
         }
         # Split state_colors into a list of strings.
-        colors <- c();
+        s_colors <- c();
         color_str <- as.character(state_colors);
         items <- strsplit(color_str, ",");
         for (item in items) {
-            colors <- c(colors, item);
+            s_colors <- c(s_colors, item);
         }
     }
     track_db = NULL;
@@ -138,7 +139,7 @@
             color_hex_code <- viridis_vector[color_index];
         } else {
             # Use the selected color for the current state.
-            color_hex_code <- colors[i];
+            color_hex_code <- s_colors[i];
         }
         big_data_url <- get_big_data_url(galaxy_url, encoded_dataset_id, tracks_dir, i, build);
         # trackDb.txt track entry.