diff --git a/R/output.R b/R/output.R index ed50670..f142bd7 100644 --- a/R/output.R +++ b/R/output.R @@ -108,11 +108,11 @@ outputParametersToFile <- function(hmmResults, file){ write.table(paste0("Coverage:\t", coverage), file = fc, col.names = FALSE, row.names = FALSE, quote = FALSE, sep = "\t") - if (!is.null(x$chrYCov)){ + if (!is.null(x$chrYCov) || !is.na(x$chrYCov)){ write.table(paste0("ChrY coverage fraction:\t", signif(x$chrYCov[s], digits = 4)), file = fc, col.names = FALSE, row.names = FALSE, quote = FALSE, sep = "\t") } - if (!is.null(x$chrXMedian)){ + if (!is.null(x$chrXMedian) || !is.na(x$chrXMedian)){ write.table(paste0("ChrX median log ratio:\t", signif(x$chrXMedian[s], digits = 4)), file = fc, col.names = FALSE, row.names = FALSE, quote = FALSE, sep = "\t") } diff --git a/R/utils.R b/R/utils.R index 318e589..bf64931 100644 --- a/R/utils.R +++ b/R/utils.R @@ -251,7 +251,7 @@ getGender <- function(rawReads, normReads, gc, map, fracReadsInChrYForMale = 0.0 }else{ gender <- "unknown" # chrX is not provided chrYCov <- NA - chrXMedian <- NULL + chrXMedian <- NA } return(list(gender=gender, chrYCovRatio=chrYCov, chrXMedian=chrXMedian)) }