Manual creation of qPCRset does not work
1
0
Entering edit mode
Ed Siefker ▴ 230
@ed-siefker-5136
Last seen 5 months ago
United States

Trying to build a qPCRset, and found example code here and more recently here:

mat <- matrix(rnorm(6*96), ncol = 6, nrow = 96,  byrow = FALSE)
raw <- new("qPCRset", exprs = mat, featureCategory =
as.data.frame(array("OK",  dim=dim(mat))))
sampleNames(raw) <- paste("S", 1:6, sep = "")
featureNames(raw) <- paste("A", 1:96, sep = "")

This code does not work.

> mat <- matrix(rnorm(6*96), ncol = 6, nrow = 96,  byrow = FALSE)
> raw <- new("qPCRset", exprs = mat, featureCategory =
+ as.data.frame(array("OK",  dim=dim(mat))))
> sampleNames(raw) <- paste("S", 1:6, sep = "")
Error in (function (od, vd)  : 
  object and replacement value dimnames differ
> featureNames(raw) <- paste("A", 1:96, sep = "")

I did correct the typo in the matrix() call, but this had no effects on assigning sampleNames(). The error appears to be incorrect. Both the object and replacement dimnames are NULL.

> dimnames(sampleNames(raw))
NULL
> dimnames(paste("S", 1:6, sep = ""))
NULL
> 

Does anyone have working code to manually create a qPCRset?

bug nondetects HTqPCR • 587 views
ADD COMMENT
1
Entering edit mode
@james-w-macdonald-5106
Last seen 15 hours ago
United States
> mat <- matrix(rnorm(6*96), ncol = 6, nrow = 96,  byrow = FALSE)
> pd <- new("AnnotatedDataFrame", data = data.frame(1:6, row.names = paste0("S", 1:6)), varMetadata = data.frame(labelDescription = "Sample numbering", row.names = "Sample names"))
> fd <- new("AnnotatedDataFrame", data = data.frame(featureNames = paste0("A", 1:96), varMetadata = data.frame(labelDescription = "Super fakeo")))
> fc <- as.data.frame(array("OK",  dim=dim(mat)))
> raw <- new("qPCRset", exprs = mat, phenoData = pd, featureData = fd, featureCategory = fc)
> raw
An object of class "qPCRset"
Size:  96 features, 6 samples
Feature types:        
Feature names:       A1 A2 A3 ...
Feature classes:          
Feature categories:  OK 
Sample names:        S1 S2 S3 ...
0
Entering edit mode

Thanks! This works for me.

ADD REPLY
0
Entering edit mode

How do we feed in the data from a data frame containing our Ct values into this object? That's the part I am stuck on, sorry if that's an obvious question (I am new to R and using this package).

ADD REPLY
0
Entering edit mode

The answer I provided above explains exactly how to do that, with the exception of needing to coerce a data.frame to a matrix.

ADD REPLY
0
Entering edit mode

Ah sorry yes, my question was not specific enough (again, new to R and programming in general), but what you have said makes sense,

"coerce a data.frame to a matrix." I'll look into how to do that, thanks.

ADD REPLY

Login before adding your answer.

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