Defining the design matrix
1
0
Entering edit mode
@humberto_munoz-10903
Last seen 8.4 years ago

 

I am defining my design matrix with the following results below.

> RG<-calcNormFactors(RG, method=c("TMM"),
+                 refColumn=1, logratioTrim=.3, sumTrim=0.05, doWeighting=TRUE,
+                 Acutoff=-1e10, p=0.75)
> RG$samples
              files group lib.size norm.factors
ARef1     ARef1.csv     1  2911652    1.1218729
ARef24   ARef24.csv     1  2911652    1.1218729
CO21       CO21.csv     2 11198918    1.0289838
CO224     CO224.csv     2 11294616    0.7995743
Light1   Light1.csv     3 12454627    0.7104398
Light24 Light24.csv     3  8668044    0.7049407
NaCl1     NaCl1.csv     4  6550232    0.7554182
NaCl24   NaCl24.csv     4 11475570    0.8774054
NaNO31   NaNO31.csv     5 10521142    1.3035997
NaNO324 NaNO324.csv     5  9045259    1.4339691
pH1         pH1.csv     6 11850666    1.0481779
pH24       pH24.csv     6  9275757    0.7866712
Temp1     Temp1.csv     7 11726477    1.2511421
Temp24   Temp24.csv     7  8120977    1.5085468
> # plotMDS(RG)
> # nrow(RG)
> Condition<- factor(c(ARef,ARef,CO2,CO2,Light,Light,NaCl,NaCl,NaNO3,NaNO3,pH,pH,Temp,Temp))
Error in factor(c(ARef, ARef, CO2, CO2, Light, Light, NaCl, NaCl, NaNO3,  : 
  object 'ARef' not found
> Time<- factor(c("1","24", "1", "24", "1", "24", "1", "24", "1", "24","1", "24", "1", "24"))
> data.frame(Sample=colnames(RG),Condition,Time)
Error in data.frame(Sample = colnames(RG), Condition, Time) : 
  object 'Condition' not found                                                                                                                      I do not understand why the object ARef is not found when currently is appearing in RG. I will appreciate any solution to this issue.

Thanks 

 

design matrix • 1.0k views
ADD COMMENT
0
Entering edit mode

The following lines are executed very well.

Condition<-factor(c("ARef","ARef","CO2","CO2","Light","Light","NaCl","NaCl","NaNO3","NaNO3","pH","pH","Temp","Temp"))

Time<- factor(c("1", "24","1", "24", "1", "24", "1", "24", "1", "24","1", "24", "1", "24"))
data.frame(Sample=colnames(RG),Condition,Time)
design <-model.matrix(~~Condition+Time)
rownames(design)<-colnames(RG)
design

----------------------------------------

Now, I would like to create the following plots:

1) The # of false discoveries vs the # of genes selected for the Fisher test (total reads) and the Fisher test (TMM)

2)  The # of false discoveries vs the # of genes selected for the Poisson-Exact and Poisson-LR-TMM normalized with my datasets.

Any helpful to perform these plots will be appreciated.

ADD REPLY
1
Entering edit mode
Aaron Lun ★ 28k
@alun
Last seen 32 minutes ago
The city by the bay

You need to read up on how R works. Your Condition assignment is looking for a variable named ARef, which doesn't exist in the current session. What you really want is the string "ARef", so you should be doing:

Condition <- factor(c("ARef","ARef","CO2","CO2","Light","Light",
    "NaCl","NaCl","NaNO3","NaNO3","pH","pH","Temp","Temp"))

... or even easier:

Condition <- factor(sub("(1|24)$", "", rownames(RGsamples)))

Obviously, once Condition is defined, then the second error will also be resolved.

ADD COMMENT
0
Entering edit mode

Thanks for your answer. Everything now works very well.

ADD REPLY

Login before adding your answer.

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