Mercurial > repos > shians > shrnaseq
diff hairpinTool.R @ 10:8923d4ea858b
- Added check for zero library size, will now filter out zero library size
samples and generate report of filtered samples in html output
author | shian_su <registertonysu@gmail.com> |
---|---|
date | Tue, 12 Aug 2014 14:42:27 +1000 |
parents | f1076bfb0ed1 |
children | c0a76e30d61b |
line wrap: on
line diff
--- a/hairpinTool.R Wed Jul 30 15:13:45 2014 +1000 +++ b/hairpinTool.R Tue Aug 12 14:42:27 2014 +1000 @@ -404,6 +404,14 @@ data$samples$group <- make.names(data$samples$group) } +# Filter out any samples with zero counts +if (any(data$samples$lib.size == 0)) { + sampleSel <- data$samples$lib.size != 0 + filteredSamples <- paste(data$samples$ID[!sampleSel], collapse=", ") + data$counts <- data$counts[, sampleSel] + data$samples <- data$samples[sampleSel, ] +} + # Filter hairpins with low counts preFilterCount <- nrow(data) sel <- rowSums(cpm(data$counts) > cpmReq) >= sampleReq @@ -791,6 +799,12 @@ ListItem(tempStr) } +if (exists("filteredSamples")) { + tempStr <- paste("The following samples were filtered out for having zero", + "library size: ", filteredSamples) + ListItem(tempStr) +} + if (workMode == "classic") { ListItem("An exact test was performed on each hairpin.") } else if (workMode == "glm") {