Input (X) data type is not numeric if read from GRanges obj
1
0
Entering edit mode
Last seen 5.6 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 • 533 views
0
Entering edit mode
@gunter-klambauer-5426
Last seen 19 months 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/