Mercurial > repos > greg > ideas_genome_tracks
changeset 33:65c6fc10465b draft
Uploaded
author | greg |
---|---|
date | Fri, 08 Dec 2017 14:13:04 -0500 |
parents | 38036d966bf2 |
children | 39a6a32c3dc3 |
files | ideas_genome_tracks.R |
diffstat | 1 files changed, 13 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/ideas_genome_tracks.R Mon Nov 27 11:48:28 2017 -0500 +++ b/ideas_genome_tracks.R Fri Dec 08 14:13:04 2017 -0500 @@ -59,7 +59,7 @@ return(track_file_name); } -get_track_color = function(statemean, markcolor=NULL) { +get_track_color = function(statemean, markcolor=NULL) { sm_width = dim(statemean)[1]; sm_height = dim(statemean)[2]; if (length(markcolor) == 0) { @@ -90,8 +90,7 @@ track_files <- list.files(path=tracks_dir); s <- paste('<html>\n <head>\n </head>\n <body>\n <ul>\n', sep=""); for (i in 1:length(track_files)) { - track_file <- paste("tracks", track_files[i], sep="/"); - s <- paste(s, ' <li><a href="', track_file, '">', track_file, '</a></li>\n', sep=""); + s <- paste(s, ' <li><a href="', track_files[i], '">', track_files[i], '</a></li>\n', sep=""); } s <- paste(s, ' </ul>\n </body>\n</html>', sep=""); cat(s, file=output_trackhub); @@ -106,7 +105,7 @@ t = NULL; for(j in 1:dim(genome_size)[1]) { t = c(t, which(tg[,2]==as.character(genome_size[j, 1]) & as.numeric(tg[,4]) > as.numeric(genome_size[j, 2]))); - } + } if (length(t) > 0) { tg = tg[-t,]; } @@ -178,7 +177,7 @@ track_db = c(track_db, "maxItems 100000"); track_db = c(track_db, paste("color", paste(c(col2rgb(cell_info[ii,4])), collapse=","), sep=" ")); track_db = c(track_db, "visibility dense"); - track_db = c(track_db, ""); + track_db = c(track_db, ""); } return(track_db); } @@ -191,14 +190,21 @@ } # Create the hub.txt output. -contents <- c(paste("hub", opt$hub_name), paste("shortLabel",opt$short_label), paste("longLabel", opt$long_label), paste("genomesFile genomes.txt", sep=""), paste("email", opt$email)); +hub_name_line <- paste("hub ", opt$hub_name, sep = ""); +short_label_line <- paste("shortLabel ", opt$short_label, sep = ""); +long_label_line <- paste("longLabel ", opt$longLabel, sep = ""); +genomes_txt_line <- paste("genomesFile genomes.txt", sep=""); +email_line <- paste("email ", opt$email, sep = ""); +contents <- c(paste(hub_name_line, short_label_line, long_label_line, genomes_txt_line, email_line), sep=""); hub_dir <- paste(opt$output_trackhub_files_path, "/", "myHub", "/", sep=""); dir.create(hub_dir, showWarnings=FALSE); hub_file_path <- paste(hub_dir, "hub.txt", sep=""); write.table(contents, file=hub_file_path, quote=F, row.names=F, col.names=F); # Create the genomes.txt output. -contents <- c(paste("genome", opt$build), paste("trackDb ", opt$build, "/", "trackDb.txt", sep="")); +genome_line <- paste("genome", opt$build, sep=""); +track_db_line <- paste("trackDb ", opt$build, "/", "trackDb.txt", sep=""); +contents <- c(paste(genome_line, track_db_line), sep=""); genomes_file_path <- paste(hub_dir, "genomes.txt", sep=""); write.table(contents, file=genomes_file_path, quote=F, row.names=F, col.names=F);