Coder Social home page Coder Social logo

Comments (4)

JEFworks avatar JEFworks commented on August 19, 2024 1

Hi Erin,

Thanks for the excellent debugging.

retestBoundSnps is a boolean parameter that is passed in the built-in function and by default set to TRUE, along with retestBoundGenes. You can just create a new object called retestBoundSnps=TRUE to fix the not found error. The purpose for both of these parameters is to distinguish between retesting CNVs identified by the allele and expression-based models for comparison purposes.

One possibility is that some of your identified CNVs are too small, on the order of 1 SNP or 1 gene. These would in theory get removed upon retesting. But I think there is an R-related bug with coercing the length 1 list into a 1 row matrix rather than a vector. For example:

> foo = matrix(1:6, 2,3)
> foo
     [,1] [,2] [,3]
[1,]    1    3    5
[2,]    2    4    6
> foo = matrix(1:9,3,3) 
> foo
     [,1] [,2] [,3]
[1,]    1    4    7
[2,]    2    5    8
[3,]    3    6    9
> vi = c(TRUE, TRUE, FALSE) 
> class(foo[vi,]) ## note still matrix
[1] "matrix"
> vi = c(TRUE, FALSE, FALSE) ## since only 1 passed, now not matrix
> class(foo[vi,])
[1] "integer"

Can you please check how large are your identified CNVs? Likewise, how many genes and how many SNPs did you begin with; it is possible that the default filtering is too stringent and you began with very few genes or SNPs for example.

  • Jean

from honeybadger.

JEFworks avatar JEFworks commented on August 19, 2024

Hi Akdes,

The only use of as.vector() is in coercing a table of either snps or genes frequencies into a vector. I've seen similar errors thrown with as.data.frame() before when GenomicRanges wasn't loaded properly, but your session info looks fine on that front.

Can you double check that the bound.genes.final and bound.snps.final slots in your hb object are not empty? These would be the candidate CNVs that HoneyBADGER identified from the allele or gene expression models alone and is trying to go back and reassess again using the combined model. Since both retestBoundGenes and retestBoundSnps are set to TRUE the following code should execute:

if(retestBoundSnps & retestBoundGenes) {
            if(verbose) {
                cat('Retesting bound snps and genes using joint model')
            }
            if(length(bound.genes.final)==0) {
                cat('ERROR NO GENES AFFECTED BY CNVS IDENTIFIED! Run calcGexpCnvBoundaries()? ')
                return();
            }
            if(length(bound.snps.final)==0) {
                cat('ERROR NO SNPS AFFECTED BY CNVS IDENTIFIED! Run calcAlleleCnvBoundaries()? ')
                return();
            }

            gr <- range(genes[unlist(bound.genes.final),])
            sr <- range(snps[unlist(bound.snps.final),])
            if(intersect) {
                rgs <- intersect(gr, sr)
            } else {
                rgs <- union(gr, sr)
            }

            retest <- lapply(seq_len(length(rgs)), function(i) {
                x <- calcCombCnvProb(region=rgs[i], m=dev, verbose=verbose, ...)
                list(x[[1]], x[[2]])
            })
            cnvs[['combine-based']] <<- list()
            cnvs[['combine-based']][['all']] <<- rgs
            results[['combine-based']] <<- retest
        }

It should catch if either of those slots are empty, but maybe you have a unique case that isn't being caught properly.

from honeybadger.

erin-d avatar erin-d commented on August 19, 2024

Hi @JEFworks, I too am having issues with the command in the tutorial returning an error.

hb$retestIdentifiedCnvs(retestBoundGenes=TRUE, retestBoundSnps=TRUE, verbose=FALSE)

Error in as.vector(x) : no method for coercing this S4 class to a vector

I have the genomic ranges library, and ran the test code you suggested above4, but I just got another error.
Error: object 'retestBoundSnps' not found

I also made sure to check that the bound.genes.final and bound.snps.final slots in your hb object are not empty.

Hb class

Do you have any other suggestions or things I should check?
Thanks!

from honeybadger.

erin-d avatar erin-d commented on August 19, 2024

Hi Jean,

I tried your test case code again, and after

retest <- lapply(seq_len(length(rgs)), function(i) {
x <- calcCombCnvProb(region=rgs[i], m=dev, verbose=verbose, ...)
list(x[[1]], x[[2]])

The following error resulted

Error in FUN(X[[i]], ...) : '...' used in an incorrect context

Also, I began with 9 genes and 4 snps
Regions genes
region snps

I think you may be right about it having to do with coercing the length 1 list into a 1 row matrix rather than a vector.

Thank You!
Erin

from honeybadger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.