# HG changeset patch
# User greg
# Date 1512760384 18000
# Node ID 65c6fc10465b23c047b5e073f1197b897df5e155
# Parent 38036d966bf20ad19aa0011063b925cfced20e43
Uploaded
diff -r 38036d966bf2 -r 65c6fc10465b ideas_genome_tracks.R
--- 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('\n
\n \n \n \n', sep="");
for (i in 1:length(track_files)) {
- track_file <- paste("tracks", track_files[i], sep="/");
- s <- paste(s, ' - ', track_file, '
\n', sep="");
+ s <- paste(s, ' - ', track_files[i], '
\n', sep="");
}
s <- paste(s, '
\n \n', 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);