Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spelling error in parameter for plotFeatureDist #210

Open
pblaney opened this issue Feb 10, 2025 · 0 comments
Open

Spelling error in parameter for plotFeatureDist #210

pblaney opened this issue Feb 10, 2025 · 0 comments

Comments

@pblaney
Copy link

pblaney commented Feb 10, 2025

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)

Image

Hope this description of the error is helpful.
Best,
Patrick

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant