Mercurial > repos > greg > ideas_genome_tracks
changeset 99:07e803c77850 draft
Uploaded
author | greg |
---|---|
date | Fri, 16 Feb 2018 11:17:39 -0500 |
parents | 4b8133b9d569 |
children | 3eb3000360c1 |
files | ideas_genome_tracks.R |
diffstat | 1 files changed, 11 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ideas_genome_tracks.R Fri Feb 16 10:40:13 2018 -0500 +++ b/ideas_genome_tracks.R Fri Feb 16 11:17:39 2018 -0500 @@ -91,12 +91,12 @@ 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); cmd = paste("LC_COLLATE=C sort -k1,1 -k2,2n < ", track_file_name_bed_unsorted, " > ", track_file_name_bed); - system(cmd); + run_cmd(cmd); track_file_name_bigbed <- get_track_file_name(base_track_file_name, i, "bigbed"); cmd = paste("bedToBigBed ", track_file_name_bed, chrom_len_file, " ", track_file_name_bigbed); - system(cmd); - system(paste("rm ", track_file_name_bed_unsorted)); - system(paste("rm ", track_file_name_bed)); + run_cmd(cmd); + run_cmd(paste("rm ", track_file_name_bed_unsorted)); + run_cmd(paste("rm ", track_file_name_bed)); } } @@ -260,6 +260,13 @@ return(track_file_name); } +run_cmd = function(cmd) { + rc = system(cmd); + if (rc != 0) { + quit(save="no", status=rc); + } +} + # Create the directory that will contain all trackhub files. trackhub_dir <- paste(opt$output_trackhub_files_path, "/", "myHub", "/", sep=""); dir.create(trackhub_dir, showWarnings=FALSE);