Description
Hello,
I was trying to use the plotFeatureDist()
function to visualize a set of distances in comparison to a set of background distances. However, the function takes as input the bgdists
parameter but when this parameter is not NULL
, the code block for this feature looks for a parameter named bgDists
.
GenomicDistributions::plotFeatureDist(dists = kataegis_dist,
bgdists = non_clustered_dist,
featureName = "Kataegis Mutations",
size = 5e5)
Error in cutDists(bgDists, divisions = NULL, nbins, size, infBins) :
object 'bgDists' not found
See the block below from GenomicDistributions/R/feature-plots.R
if (!is.null(bgdists)) {
bgDistsDF = cutDists(bgDists, divisions=NULL, nbins, size, infBins)
# bgDistsDF$Freq= scale(bgDistsDF$Freq, center=FALSE)
bgDistsDF$Freq = (bgDistsDF$Freq / sum(bgDistsDF$Freq)) * 100
df$bgFreq = rep(bgDistsDF$Freq, nplots)
df$bgX = rep(seq_len(nrow(bgDistsDF)-1), nplots)
}
I tested changes to the parameter name and it solved that issue. However there was 1 additional error that appears related to the last line in that block:
Error in set(x, j = name, value = value) :
Supplied 99 items to be assigned to 100 items of column 'bgX'. If you wish to 'recycle' the RHS please use rep() to make this intent clear to readers of your code.
A workaround I implemented that produced working plots was the following:
df$bgX = rep(seq_len(nrow(bgDistsDF)-1), nplots)
changed to
df$bgX = rep(seq_len(nrow(bgDistsDF)), nplots)
Hope this description of the error is helpful.
Best,
Patrick
Activity