Help running the nondetects::qpcrImpute on my data?
1
0
Entering edit mode
@djcoulson2-20018
Last seen 5.2 years ago

I am trying to run the qpcrImpute function on the nondetects package on R. I have normalised Ct values for 44 different microRNA for 8 patients and 11 controls, in total there are 836 observations. However some values are missing therefore I am trying to impute them. I have managed to create a qPCR class set, however I run into the following error:

library(HTqPCR)
# Read in table; need to be a matrix, so replace "ND" with NAs
in_data = read.table("C:\\Users\\Admin\\Desktop/david2019_TSV.txt", sep = "\t", stringsAsFactors = FALSE,
                 header = TRUE, row.names = 1, na.strings = "ND")
mat = as.matrix(in_data)

# qPCRset needs featureCategory with "OK", ""Undetermined" or "Unreliable" for each entry
feat_cat = as.data.frame(array("OK", dim=dim(mat)), stringsAsFactors = FALSE)

# Use "Undetermined" for entries corresponding to "ND" in dataset
feat_cat[is.na(mat)] = "Undetermined" 
rownames(feat_cat) = rownames(mat)
colnames(feat_cat) = colnames(mat)


# Create new instance of qPCRset; needs featureNames to be added
 raw = new("qPCRset", exprs = mat, featureCategory = feat_cat)
 featureNames(raw) = rownames(mat)

 # qPRCset object now created:
  raw

  #make identical pData(raw)$sample Name and colnames(exprs(raw) 

  pData(raw)$sampleName <- c("patient","patient.1","patient.2","patient.3","patient.4","patient.5","patient.6","patient.7","hc","hc.1","hc.2","hc.3","hc.4","hc.5","hc.6","hc.7","hc.8","hc.9","hc.10")
   pData(raw)$sampleName


   #deal with target genes
    featureType(raw) <- c    ("Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target","Target")

   #EM algorithim
    raw <- qpcrImpute(raw, dj = TRUE, pyfit = NULL, groupVars=c(NULL),
              batch = NULL, tol = 1, 
              iterMax = 100, outform=c("Single"), formula = NULL, 
              linkglm = "logit")


   **~0 + nrep
   <environment: 0x000000001dea6358>
    Error in Name.s2[ind2] <- names(tst$sigma[i]) : 
     replacement has length zero
     In addition: Warning message:
     Partial NA coefficients for 8 probe(s)**

I have attempted to add a value for length for the replacement using the length function in R but have been successful.

> length(raw$feat_cat) <- "40"
    Warning message:
      In length(raw$feat_cat) <- "40" : length of NULL cannot be changed

I was wondering if anyone would be able to help me with this problem.

nondetects qpcrImpute • 842 views
ADD COMMENT
0
Entering edit mode
@matthew-mccall-4459
Last seen 4.9 years ago
United States

You need to have replicate samples, defined by one or more grouping variables. Please take a look at the example in the qpcrImpute man page:

     data(sagmb2011)
     tst <- qpcrImpute(sagmb2011, groupVars="sampleType", 
                       outform=c("Single"), batch=NULL, linkglm = c("logit"))

For your data, I believe you would need to do something like the following:

pData(raw)$sampleType <- rep(c("patient", "healthy_control"), c(8,11))

And then in the function call:

raw <- qpcrImpute(raw, dj = TRUE, pyfit = NULL, groupVars="sampleType",
              batch = NULL, tol = 1, 
              iterMax = 100, outform=c("Single"), formula = NULL, 
              linkglm = "logit")

Hope that helps, Matt

ADD COMMENT

Login before adding your answer.

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