Input (X) data type is not numeric if read from GRanges obj
1
0
Entering edit mode
@mohammad-alkhamis-10862
Last seen 7.9 years ago
Canada/ Victoria, BC / University of Vi…

Hello Gunter,

I noticed a minor issue in the source code (cn.mops.R) that if X is originated from a GRanges object, we end up with a matrix of integers instead of numeric/double. I guess the matrix in this case is supposed to be numeric just as if we provide X as a matrix or a vector. While it is is a minor issue, I thought I should still report it since this got me in a bit of trouble while modifying the C++ side of cn.MOPS when using the macros REAL/INTEGER.

 

    if(class(input)=="GRanges"){
        ...
        X <- IRanges::as.matrix(IRanges::values(input))
        ...
        
    } else if (is.matrix(input)){
        if (nrow(input)> 1){
            ...
            X <- input
            X <- matrix(as.numeric(X),nrow=nrow(X))
            ...
        } else{...}
    } else if (is.vector(input)) {
        ...
        X <- matrix(as.numeric(X),nrow=nrow(X))
        ...
    }else{
        stop("GRanges object or read count matrix needed as input.")
    }
 
cn.mops • 997 views
ADD COMMENT
0
Entering edit mode
@gunter-klambauer-5426
Last seen 3.8 years ago
Austria
Hello Mohammad, Your comments are very welcome - as always! Thanks for flagging this issue. I will make the changes to cn.mops accordingly. Regards, Günter On 2016-12-28 07:20, Mohammad Alkhamis [bioc] wrote: > Activity on a post you are following on support.bioconductor.org > <https: support.bioconductor.org=""> > > User Mohammad Alkhamis <https: support.bioconductor.org="" u="" 10862=""/> > wrote Question: Input (X) data type is not numeric if read from > GRanges obj <https: support.bioconductor.org="" p="" 90622=""/>: > > Hello Gunter, > > I noticed a minor issue in the source code (cn.mops.R) that if *X* is > originated from a /GRanges/ object, we end up with a matrix of > integers instead of numeric/double. I guess the matrix in this case is > supposed to be numeric just as if we provide *X* as a matrix or a > vector. While it is is a minor issue, I thought I should still report > it since this got me in a bit of trouble while modifying the C++ side > of cn.MOPS when using the macros REAL/INTEGER. > > if(class(input)=="GRanges"){ > ... > # X <- IRanges::as.matrix(IRanges::values(input)) *X <- > as.numeric(IRanges::as.matrix(IRanges::values(input)))* > ... > > } else if (is.matrix(input)){ > if (nrow(input)> 1){ > ... > X <- input > X <- matrix(as.numeric(X),nrow=nrow(X)) > ... > } else{...} > } else if (is.vector(input)) { > ... > X <- matrix(as.numeric(X),nrow=nrow(X)) > ... > }else{ > stop("GRanges object or read count matrix needed as input.") > } > > ------------------------------------------------------------------------ > > Post tags: cn.mops > > You may reply via email or visit > Input (X) data type is not numeric if read from GRanges obj > -- Günter Klambauer, PhD Institute of Bioinformatics Johannes Kepler University, Linz, Austria http://www.bioinf.jku.at/people/klambauer/
ADD COMMENT

Login before adding your answer.

Traffic: 515 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6