Mercurial > repos > greg > ideas_genome_tracks
changeset 96:cef03f812888 draft
Uploaded
author | greg |
---|---|
date | Fri, 16 Feb 2018 09:18:06 -0500 |
parents | 5102e36941d4 |
children | dc2ad849940b |
files | ideas_genome_tracks.R |
diffstat | 1 files changed, 12 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/ideas_genome_tracks.R Thu Feb 15 11:06:05 2018 -0500 +++ b/ideas_genome_tracks.R Fri Feb 16 09:18:06 2018 -0500 @@ -86,7 +86,7 @@ t0 = c(0, t) + 1; t = c(t, L); np = cbind(chr[t], posst[t0], posed[t], tstate[t]); - x = cbind(np[, 1:3], state_names[as.integer(np[,4])+1], 1000, ".", np[,2:3], color_codes_vector[as.numeric(np[,4])+1]); + x = cbind(np[,1:3], state_names[as.integer(np[,4])+1], 1000, ".", np[,2:3], color_codes_vector[as.numeric(np[,4])+1]); track_file_name_bed_unsorted <- get_track_file_name(base_track_file_name, i, "bed_unsorted"); track_file_name_bed <- get_track_file_name(base_track_file_name, i, "bed"); write.table(as.matrix(x), track_file_name_bed_unsorted, quote=F, row.names=F, col.names=F); @@ -108,11 +108,17 @@ color_codes_vectors_by_para_file = list(); # IDEAS state indexes are zero based. index = 0; - para_files = list.files(path=input_dir_para, full.names=TRUE); - # Generate the default state names and colors. - for (para_file in para_files) { + state_files = list.files(path=input_dir_state, full.names=TRUE); + # Generate the default state names. + for (state_file in state_files) { # Append the default state name. state_names = c(state_names, toString(index)); + index = index + 1; + } + # Generate the default colors. + index = 0; + para_files = list.files(path=input_dir_para, full.names=TRUE); + for (para_file in para_files) { # Append the default color codes vector. data_frame = read.table(para_file, comment="!", header=T); # Here state_color_codes_vector contains an rgb @@ -185,7 +191,7 @@ } } } else { - color_codes_vector = color_codes_vectors_by_para_file[1]; + color_codes_vector = color_codes_vectors_by_para_file[[1]]; } # Create the bigbed track files. create_tracks(input_dir_state, chrom_len_file, base_track_file_name, state_names, color_codes_vector); @@ -287,4 +293,4 @@ write.table(track_db, file=track_db_file_path, quote=F, row.names=F, col.names=F); # Create the primary HTML dataset. -create_primary_html(opt$output_trackhub, trackhub_dir); +create_primary_html(opt$output_trackhub, trackhub_dir); \ No newline at end of file