我使用包装中的方法创建散点图
p <- noisePlot(data.frame)
但是我希望您知道此函数创建(/绘制)的原始值。有什么想法吗?
P.S。软件包不使用gglot2,而是R中的基本绘图功能
答案 0 :(得分:2)
您可以获取noisePlot函数:
findMethods(noisePlot)$`QDNAseqReadCounts#missing`
对其进行编辑并获取数据作为输出:
dataNoisePlot <- function (x, y, main = "Noise Plot", adjustIncompletes = TRUE,
fit = NULL, sdFUN = "sdDiffTrim", xAxis = c("average reads per bin",
"reciprocal of average reads per bin", "total reads"),
...)
{
if (is.character(sdFUN) && sdFUN == "sdDiffTrim") {
symbol <- quote(hat(sigma)[Delta^"*"]^2)
}
else if (is.character(sdFUN) && length(grep("Diff",
sdFUN)) == 1) {
symbol <- quote(hat(sigma)[Delta]^2)
}
else {
symbol <- quote(hat(sigma)^2)
}
sdFUN <- getAnywhere("sdDiffTrim")[[2]][[1]]
condition <- getAnywhere("binsToUse")[[2]][[1]](x)
counts <- getAnywhere("assayDataElement")[[2]][[1]](x, "counts")[condition,
, drop = FALSE]
usedReads <- colSums(counts)
if (adjustIncompletes) {
counts <- counts/getAnywhere("fData")[[2]][[1]](x)$bases[condition] * 100L
counts[getAnywhere("fData")[[2]][[1]](x)$bases[condition] == 0] <- 0L
}
reciprocalOfAverageUsedReadsPerBin <- getAnywhere("expectedVariance")[[2]][[1]](x)
if (is.null(fit)) {
if (!"fit" %in% getAnywhere("assayDataElementNames")[[2]][[1]](x))
x <- getAnywhere("estimateCorrection")[[2]][[1]](x)
fit <- getAnywhere("assayDataElement")[[2]][[1]](x, "fit")[condition,
, drop = FALSE]
}
signal <- counts/fit
signal[fit <= 0] <- 0
noise <- apply(signal, 2, sdFUN, na.rm = TRUE)
out <- data.frame(reciprocalOfAverageUsedReadsPerBin, noise^2)
return(out)
}
dataNoisePlot(readCountsFiltered)
reciprocalOfAverageUsedReadsPerBin noise.2
LGG150 0.02804484 0.02833476