Create `Copy Number Array' Data Object error
1
0
Entering edit mode
El • 0
@el-24188
Last seen 3.9 years ago

I was running this function

CNA <- function(genomdat, chrom, maploc, data.type=c("logratio","binary"),
                sampleid=NULL, presorted=FALSE)
{
  if (is.data.frame(genomdat)) genomdat <- as.matrix(genomdat)
  if (!is.numeric(genomdat)) stop("genomdat must be numeric")
  if (!is.numeric(maploc)) stop("maploc must be numeric")
  data.type <- match.arg(data.type)
  ina <- (!is.na(chrom) & is.finite(maploc))
  if (sum(!ina)>0)
    warning("markers with missing chrom and/or maploc removed\n")
  if (!presorted) {
    sortindex <- which(ina)[order(chrom[ina], maploc[ina])]
  } else {
    sortindex <- which(ina)
  }
  if (is.factor(chrom)) chrom <- as.character(chrom)
  # added to allow arrays of single dimension - results from data.frame ops
  if (is.array(genomdat)) {
    if (length(dim(genomdat)) == 1) {
      genomdat <- as.matrix(genomdat)
    }
  }
  if (is.vector(genomdat)) genomdat <- as.matrix(genomdat)
  if (!missing(sampleid)) {
    if (length(sampleid) != ncol(genomdat)) {
      warning("length(sampleid) and ncol(genomdat) differ, names ignored\n")
      sampleid <- paste("Sample", 1:ncol(genomdat))
    } 
  } else {
    sampleid <- paste("Sample", 1:ncol(genomdat))
  }
  colnames(genomdat) <- sampleid
  zzz <- data.frame(chrom=I(chrom), maploc=maploc, genomdat)
  zzz <- zzz[sortindex,]

  # check for duplicate probes (i.e. repeated maploc within a chromosome)
  if (length(ii <- which(diff(maploc)==0)) > 0) {
    if (any(chrom[ii]==chrom[ii+1])) warning("array has repeated maploc positions\n")
  }

  attr(zzz, "data.type") <- data.type
  class(zzz) <- c("CNA","data.frame")
  zzz
}

# Lead the RDocumentaion packages
library(RDocumentation)

readfile <- function(file=NULL,header=TRUE,use.value.labels=TRUE,to.data.frame=TRUE,sep=",",
                      widths=rep(1,36),f=NULL, filetype=NULL,...)


cn <- readfile("/Users/mac/Desktop/NGS-/ERR439247-pe.wig",header=TRUE)



CNA.object <-CNA( genomdat = cn[1,36], chrom = cn[1,36], maploc = cn[1,36], data.type = 'logratio',sampleid = "E47") ## cn[1,36]`

and I get "genomdat must be numeric"

"Error in cn[1, 36] : incorrect number of dimensions
Called from: is.data.frame(genomdat)" 

how should I fix it thanks after all

DNAcopy • 1.8k views
ADD COMMENT
0
Entering edit mode
Kevin Blighe ★ 4.0k
@kevin
Last seen 16 days ago
Republic of Ireland

What is the output of str(cn) and str(cn[1,36])?

I am neither confident that you are running the CNA function correctly. Can you check the documentation? - https://www.rdocumentation.org/packages/DNAcopy/versions/1.46.0/topics/CNA

ADD COMMENT
0
Entering edit mode

i get list of 1 $ ch: chr(0)

ADD REPLY
0
Entering edit mode

So, it's empty?

Can you please re-check:

  1. all previous steps prior to CNA()
  2. the correct syntax for running CNA() (via https://www.rdocumentation.org/packages/DNAcopy/versions/1.46.0/topics/CNA)

If it helps, please first follow the manual of DNAcopy and / or the vignette, so that you can be sure how to first successfully run the package with the authors' test data. For example, there is some useful code to test here: https://bioconductor.org/packages/release/bioc/vignettes/DNAcopy/inst/doc/DNAcopy.pdf

Kevin

ADD REPLY
0
Entering edit mode

I was running the following command: (DNAcopy)

data <- function(..., list = character(), package = NULL, lib.loc = NULL,
     verbose = getOption("verbose"), envir = .GlobalEnv,
     overwrite = TRUE)

data(correct_copy)

CNA.object <- CNA(cbind(correct_copy$correct_copy.E47),
                  correct_copy$Chromosome,correct_copy$Position,
                  data.type="logratio",sampleid=c("cE47"))

and I got Error in CNA(cbind(correct_copy$correct_copy.E47), correct_copy$Chromosome,  : 
  genomdat must be numeric
Called from: CNA(cbind(correct_copy$correct_copy.E47), correct_copy$Chromosome, 
    correct_copy$Position, data.type = "logratio", sampleid = c("cE47"))

how should I fix it Thank you for all

ADD REPLY
0
Entering edit mode

Please confirm that you have successfully completed the example(s) in the manual for this package.

ADD REPLY
0
Entering edit mode

please, one question ? I have used the output of correctReadCount of HMMcopy like an input of DNAcopy, it's gonna workable, I got some modification like convert the data.table to data frame.....

ADD REPLY
0
Entering edit mode

As you fail to answer my simple questions, I cannot help you anymore.

ADD REPLY
0
Entering edit mode

thank you

ADD REPLY
0
Entering edit mode

hello Mr Kevin I hope you doing good, I got a file " 1106 observations of 11 variable " is output corrected read's HMMcopy package, for leading to CNV I need segmentation step for my data, I was trying to get it input of DNA copy but it didn't work, if someone can help with getting over thank you so much

ADD REPLY
0
Entering edit mode

Sorry, I had asked you twice already if you had successfully completed the examples in the manual? - https://www.rdocumentation.org/packages/DNAcopy/versions/1.46.0/topics/CNA

By successfully completing these steps, it will help you to understand how the package functions work.

ADD REPLY
0
Entering edit mode

thank you so much it's gonna help, and thank you for your time Mr

ADD REPLY

Login before adding your answer.

Traffic: 623 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