Problem in genelist levels when running topGO.
0
0
Entering edit mode
peirinl • 0
@peirinl-14078
Last seen 3.9 years ago

I am running multi-level experiment of a dataset using LIMMA,

contrast_matrix_Grade<- makeContrasts(AdvanceVsEarlyinT = A.T-nA.T,

                                      AdvanceVsEarlyinnT = A.nT-nA.nT, 
                                      TVsnTinAdvance = A.T-A.nT, TVsnTinEarly = nA.T-nA.nT,
                                      levels = design_Grade)
fit <- eBayes(contrasts.fit(lmFit(eset,design = design_Grade,block = i,
                                                correlation = corfit_Grade$consensus),
                                          contrast_matrix_Grade))
table_fit <- topTable(fit, number = Inf)

results <- decideTests(fit)

 

Since I want to see the gene that simultaneously differentially expressed in two groups, 

intersection <- results[,"TVsnTinHigh"] & results[,"TVsnTinLow"]
table_Grade <- topTable(fit [intersection,], n=Inf)

DE_genes_Grade <- subset(table_Grade, adj.P.Val < 0.1)$PROBEID

back_genes_idx <- genefinder(eset, as.character(DE_genes_Grade), 
                             method="manhattan", scale="none")
back_genes_idx <- sapply(back_genes_idx, function(x)x$indices)
back_genes <-featureNames(eset)[back_genes_idx]
back_genes <- setdiff(back_genes, DE_genes_Grade)
intersect(back_genes, DE_genes_Grade)
length(back_genes)

gene_IDs <- rownames(table_Grade)
in_universe <- gene_IDs %in% c(DE_genes_Grade, back_genes)
inSelection <-  gene_IDs %in% DE_genes_Grade 
all_genes <- factor(as.integer(inSelection[in_universe]))
names(all_genes) <- gene_IDs[in_universe]

ont <- "BP"
top_Grade_GO_data <- new("topGOdata", ontology = ont, allGenes = all_genes, nodeSize = 10,
                         annot=annFUN.db, affyLib = "hugene10sttranscriptcluster.db")

Error in .local(.Object, ...) : allGenes must be a factor with 2 levels

 

> str(all_genes)

 Factor w/ 1 level "1": 1 1 1 1 1 1 1 1 1 1 ...
 - attr(*, "names")= chr [1:2373] "7924029" "7908072" "8008237" "8037408" ...

But when I used table_fit, there is no problem. 

> str(all_genes)
 Factor w/ 2 levels "0","1": 2 2 2 2 2 2 2 2 2 2 ...
 - attr(*, "names")= chr [1:17425] "7924029" "7908072" "8008237" "8037408" ...

So if I only want to see the GO of the intersected genes of both groups, what should I do?

Thanks

 

topgo • 869 views
ADD COMMENT

Login before adding your answer.

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