From 5a2752145fda053ac654baaf1102ac40961c65b6 Mon Sep 17 00:00:00 2001 From: Bo Li Date: Fri, 9 Mar 2012 07:30:28 -0600 Subject: [PATCH] Improved warning messages in rsem-gen-transcript-plots --- SamParser.h | 20 ++++++-------------- rsem-gen-transcript-plots | 10 ++-------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/SamParser.h b/SamParser.h index c5a5035..9d62eff 100644 --- a/SamParser.h +++ b/SamParser.h @@ -112,8 +112,7 @@ int SamParser::parseNext(SingleRead& read, SingleHit& hit) { bool canR = (samread(sam_in, b) >= 0); if (!canR) return -1; - if (b->core.flag & 0x0001) { fprintf(stderr, "Find a paired end read in the file!\n"); exit(-1); } - //(b->core.flag & 0x0100) && && !(b->core.flag & 0x0004) + general_assert(!(b->core.flag & 0x0001), "Find a paired end read in the file!"); int readType = getReadType(b); std::string name = getName(b); @@ -143,8 +142,7 @@ int SamParser::parseNext(SingleReadQ& read, SingleHit& hit) { bool canR = (samread(sam_in, b) >= 0); if (!canR) return -1; - if (b->core.flag & 0x0001) { fprintf(stderr, "Find a paired end read in the file!\n"); exit(-1); } - //assert(!(b->core.flag & 0x0001)); //(b->core.flag & 0x0100) && && !(b->core.flag & 0x0004) + general_assert(!(b->core.flag & 0x0001), "Find a paired end read in the file!"); int readType = getReadType(b); std::string name = getName(b); @@ -175,11 +173,8 @@ int SamParser::parseNext(PairedEndRead& read, PairedEndHit& hit) { bool canR = ((samread(sam_in, b) >= 0) && (samread(sam_in, b2) >= 0)); if (!canR) return -1; - if (!((b->core.flag & 0x0001) && (b2->core.flag & 0x0001))) { - fprintf(stderr, "One of the mate is not paired-end! (RSEM assumes the two mates of a paired-end read should be adjacent)\n"); - exit(-1); - } - //assert((b->core.flag & 0x0001) && (b2->core.flag & 0x0001)); + general_assert((b->core.flag & 0x0001) && (b2->core.flag & 0x0001), \ + "One of the mate is not paired-end! (RSEM assumes the two mates of a paired-end read should be adjacent)"); bam1_t *mp1 = NULL, *mp2 = NULL; @@ -226,11 +221,8 @@ int SamParser::parseNext(PairedEndReadQ& read, PairedEndHit& hit) { bool canR = ((samread(sam_in, b) >= 0) && (samread(sam_in, b2) >= 0)); if (!canR) return -1; - if (!((b->core.flag & 0x0001) && (b2->core.flag & 0x0001))) { - fprintf(stderr, "One of the mate is not paired-end! (RSEM assumes the two mates of a paired-end read should be adjacent)\n"); - exit(-1); - } - //assert((b->core.flag & 0x0001) && (b2->core.flag & 0x0001)); + general_assert((b->core.flag & 0x0001) && (b2->core.flag & 0x0001), \ + "One of the mate is not paired-end! (RSEM assumes the two mates of a paired-end read should be adjacent)"); bam1_t *mp1 = NULL, *mp2 = NULL; diff --git a/rsem-gen-transcript-plots b/rsem-gen-transcript-plots index 9a806d6..21d1db8 100755 --- a/rsem-gen-transcript-plots +++ b/rsem-gen-transcript-plots @@ -67,7 +67,7 @@ generate_a_page <- function(tids, gene_id = NULL) { for (i in 1:n) { vec <- readdepth[[tids[i]]] - if (is.null(vec)) exit_with_error(paste("Cannot find transcript", tids[i], sep = "")) + if (is.null(vec)) exit_with_error(paste("Unknown transcript detected,", tids[i], "is not included in RSEM's indices.")) if (is.na(vec[[2]])) wiggle <- rep(0, vec[[1]]) else wiggle <- as.numeric(unlist(strsplit(vec[[2]], split = " "))) len <- length(wiggle) if (!show_uniq) { @@ -113,7 +113,7 @@ if (!is_gene) { } } else { for (gene_id in ids) { - if (is.null(t2gmap[[gene_id]])) exit_with_error(paste("Cannot find gene", gene_id, sep = "")) + if (is.null(t2gmap[[gene_id]])) exit_with_error(paste("Unknown gene detected,", gene_id, "is not included in RSEM's in indices.")) generate_a_page(t2gmap[[gene_id]], gene_id) } } @@ -121,9 +121,3 @@ if (!is_gene) { cat("Plots are generated!\n) dev.off.output <- dev.off() - - - - - - -- 2.39.2