Home > other >  Genetic variations analysis after the merger of GEO data error, small white for help
Genetic variations analysis after the merger of GEO data error, small white for help

Time:09-23

LogFoldChange=1
AdjustP=0.05

The library (limma)
Setwd (" C: \ \ Users \ \ acer \ \ Desktop \ \ DEGs \ \ 07 diff ")
Rt=read. Table (" normalize. TXT ", sep="\ t", the header=t, check the names=F)
Rt=as matrix (rt)
Rownames (rt)=rt [1]
Exp=rt [2: ncol (rt)]
Dimnames=list (rownames (exp), colnames (exp))
Rt=matrix (as numeric (as matrix (exp)), nrow=nrow (exp), dimnames=dimnames)

# differential
ModType=c (rep (" normal ", 6), rep (Endometrium, 6), rep (" normal ", 4), rep (Endometrium, 4), rep (" normal ", 9), rep (Endometrium, 9))
The design & lt; - model. Matrix (~ 0 + factor (modType))
Colnames (design) & lt; - c (" con ", "treat")
Fit & lt; - lmFit (rt, design)
Cont. Matrix<- makeContrasts (treat - con, levels=design)
Fit2 & lt; - contrasts. Fit (fit, cont. Matrix)
Fit2 & lt; - eBayes (fit2)

AllDiff=topTable (fit2, adjust='FDR', number=200000)
Write. The table (allDiff, file="limmaTab. XLS", sep="\ t", quote=F, row. Names=F)

# write table
DiffSig & lt; - allDiff [with (allDiff, (abs (logFC) & gt; logFoldChange & amp; adj. P.V al & lt; adjustP)),]
Write. The table (diffSig, file="diff. XLS", sep="\ t", quote=F, row. Names=F)
DiffUp & lt; - allDiff [with (allDiff, (logFC> logFoldChange & amp; adj. P.V al & lt; adjustP)),]
Write. The table (diffUp, file="up. XLS", sep="\ t", quote=F, row. Names=F)
DiffDown & lt; - allDiff [with (allDiff, (logFC<(- logFoldChange) & amp; adj. P.V al & lt; adjustP)),]
Write. The table (diffDown, file="the XLS", sep="\ t", quote=F, row. Names=F)

# write the expression level of diff gene
HmExp=rt [as vector (diffSig [1]),]
the Error in rt [as vector (diffSig [1]),] :
Only 0 's may be mixed with negative subscripts

DiffExp=rbind (id=colnames (hmExp), hmExp) can't find the object
Write. The table (diffExp, file="diffExp. TXT", sep="\ t", quote=F, col. Names=F) can't find the object

# volcano
PDF file (="vol. PDF")
XMax=Max (- log10 (allDiff $adj. P.V al))
YMax=Max (abs (allDiff $logFC))
The plot (- log10 (allDiff $adj. P.V al), allDiff $logFC xlab="- log10 (adj) P.V al)", ylab="logFC",
+ main="Volcano", xlim=c (0, xMax), ylim=c (- yMax, yMax), yaxs="I", PCH=20, cex=0.8)
DiffSub=subset (allDiff, adj. P.V al LogFoldChange)
Points (- log10 (diffSub $adj. P.V al), diffSub $logFC, PCH=20, col="red", cex=0.8)
DiffSub=subset (allDiff, adj. P.V al Points (- log10 (diffSub $adj. P.V al), diffSub $logFC, PCH=20, col="green", cex=0.8)
Abline (h=0, lty=2, LWD=3)
dev.off()
  • Related