Entering edit mode
Sally
▴
250
@sally-2430
Last seen 10.3 years ago
I am getting the following error message:
Error in dim(data) <- dim : attempt to set an attribute on NULL
from the following Limma script (post-pre-processing)
#Load libraries
source("http://bioconductor.org/biocLite.R")
biocLite()
library(limma)
library(Biobase)
#change directory to folder where files are (c:/limmadegenes)
#Change to directory with original data files
#read in expression data file and phenotypic data.
#Note that row.names=1 means that row names are #in column 1,
exprdata<-read.table("exprsData.txt",
header=TRUE,sep="\t",row.names=1,as.is=TRUE,fill=TRUE,)
class(exprdata)
#[1] "data.frame"
dim(exprdata)
#[1] 17328 28
colnames(exprdata)
head(exprdata)
#printout too long to paste
phenotypicdata<-read.table("phenotypicdata.txt",row.names=1,header=TRU
E,sep="\t")
class(phenotypicdata)
#returns: [1] "data.frame"
dim(phenotypicdata)
#returns: [1] 28 2
colnames(phenotypicdata)
#returns: [1] "Species" "Time"
rownames(phenotypicdata)
#Coerse exprdata into a matrix
myexprdata<-as.matrix(exprdata)
write.table(myexprdata,file="myexprdata.txt",sep="\t",col.names=NA)
class(myexprdata)
#[1] "matrix"
rownames(myexprdata)
colnames(myexprdata)
#Coerse phenotypicdata into a data frame
myphenotypicdata<-as.data.frame(phenotypicdata)
write.table(myphenotypicdata,file="myphenotypicdatacheck.txt",sep="\t"
,col.names=NA)
rownames(myphenotypicdata)
colnames(myphenotypicdata)
#[1] "species" "time"
summary(myphenotypicdata)
all(rownames(myphenotypicdata)==colnames(myexprdata))
#[1] TRUE
#Create annotated Data Frame
adf<-new("AnnotatedDataFrame",data=phenotypicdata)
#dim means: dimension of an object.
dim(adf)
#rowNames columnNames
# 28 2
rownames(adf)
#NULL
#read in galfile
readGAL("Galfile.gal")
#Create eset object
eSet<-new("ExpressionSet",exprs=myexprdata,phenoData=adf,annotation="G
alfile.gal")
#Read in targets file
targets <- readTargets("targets.txt")
targets
# Set up character list defining your arrays, include replicates
TS <- paste(targets$Species, targets$Time, sep=".")
#This script returns the following:
TS
# Turn TS into a factor variable which facilitates fitting
TS <- factor(TS)
#This script returns the following
design <- model.matrix(~0+TS)
#write design object to text file
write.table(design,file="design.txt",sep="\t",col.names=NA)
colnames(design) <- levels(TS)
#for eset put in your M values - see ?lmFit for object types
fit <- lmFit(eSet, design)
cont.matrix<-makeContrasts(s0vss24=s.0-s.24, s24vss48=s.24-s.48,
s48vss96=s.48-s.96, c0vsc24=c.0-c.24, c24vsc48=c.24-c.48,
c48vsc96=c.48-c.96, levels=design)
write.table(cont.matrix,file="cont.matrix.txt",sep="\t",col.names=NA)
# estimate the contrasts and put in fit2
fit2 <- contrasts.fit(fit, cont.matrix)
fit2 <- eBayes(fit2)
#print fit2 table
write.table(fit2,file="fit2.txt",sep="\t")
#Filtering: I took the fit2 table and removed all empty and GFP spots,
plus I deleted all rows where the Fpval was greated than 0.01. This
table is called
#fit2readformulttestFp01.txt
filteredfit2<-read.table("fit2readyformulttestFp01.txt", header=TRUE,
sep="\t")
write.table(filteredfit2, file="filteredfit2.txt", sep="\t")
fit3<-as.data.frame(filteredfit2,row.names=NULL)
class(fit3)
#returns data.frame
write.table(fit3, file="fit3.txt",sep="\t")
s0vss24<-topTable(fit3,coef="s0vss24",number=3412,adjust.method="BH",p
.value=1)
write.table(s0vss24,file="s0vss24.txt",sep="\t")
s24vss48<-topTable(fit3,coef="s24vss48",number=3412,adjust.method="BH"
,p.value=1)
write.table(s24vss48,file="s24vss48.txt",sep="\t")
s48vss96<-topTable(fit3,coef="s48vss96",number=3412,adjust.method="BH"
,p.value=1)
write.table(s48vss96,file="s48vss96.txt",sep="\t")
c0vsc24<-topTable(fit3,coef="c0vsc24",number=3412,adjust.method="BH",p
.value=1)
write.table(c0vsc24,file="c0vsc24.txt",sep="\t")
c24vsc48<-topTable(fit3,coef="c24vsc48",number=3412,adjust.method="BH"
,p.value=1)
write.table(c24vsc48,file="c24vsc48.txt",sep="\t")
c48vsc96<-topTable(fit3,coef="c48vsc96",number=3412,adjust.method="BH"
,p.value=1)
write.table(c48vsc96,file="c48vsc96.txt",sep="\t")
ALSO: What does this error message mean?
In addition: Warning messages:
1: In safeSource() : Redefining 'biocinstall'
2: In safeSource() : Redefining 'biocinstallPkgGroups'
3: In safeSource() : Redefining 'biocinstallRepos'
[[alternative HTML version deleted]]