Skip to content

can't determine keyType automatically; need to set 'keyType' explicitly... #13

Description

@Gavin098

Hello,Dear Dr, When I run the data for non-model species following documents of CBNplot, some code cannot running successfully in Linux.

library(DESeq2)
library(clusterProfiler)
library(ggplot2)
library(CBNplot)
counts = read.table("rsem.merged.gene_counts_SDRE.tsv_round", header=1, row.names=1,sep=' ')
meta = sapply(colnames(counts), function (x) substring(x,1,2))
meta = data.frame(meta)
colnames(meta) = c("Condition")
dds <- DESeqDataSetFromMatrix(countData = counts,
                              colData = meta,
                              design= ~ Condition)
filt <- rowSums(counts(dds) < 10) > dim(meta)[1]*0.9
dds <- dds[!filt,]
## Perform DESeq2()
dds = DESeq(dds)
res = results(dds, pAdjustMethod = "bonferroni")
## apply variance stabilizing transformation
v = vst(dds, blind=FALSE)
vsted = assay(v)
pdf(file = "./PCA_DESeq2QC.pdf", width = 12, height = 9);
DESeq2::plotPCA(v, intgroup="Condition")+
    theme_bw()
dev.off()

sig = subset(res, padj<0.05)
cand.entrez = rownames(sig)
GO_anno <- read.csv("gene_go_annotation_from_ipr_nr.tab", sep = "\t",header = T,check.names = F)                               
GO_description <- read.csv("go_term.list", sep = "\t",header = T,check.names = F)                                              
KEGG_anno <- read.csv("kegg_gene.txt", sep = "\t",header = T,check.names = F)                                                  
KEGG_description <- read.csv("kegg_description.txt", sep = "\t", check.names = F, header = T)
#Go enrichment analysis
pwayGO <- clusterProfiler::enricher(cand.entrez,TERM2GENE=GO_anno,TERM2NAME=GO_description,pvalueCutoff = 0.05, pAdjustMethod = "BH")
## Store the similarity
pwayGO = enrichplot::pairwise_termsim(pwayGO)
## Define including samples
incSample = rownames(subset(meta, Condition=="SD"))
#plot
pdf(file = "./barplot_GO.pdf", width = 12, height = 9);
barplot(pwayGO, showCategory = 15)
dev.off()

pdf(file = "./bngeneplot_GO.pdf", width = 12, height = 9);
bngeneplot(results = pwayGO,
           exp = vsted,
           expSample = incSample,
           pathNum = 13, R = 50, showDir = T,
           convertSymbol = FALSE,
           strThresh = 0.7)
dev.off()

I have encountered problems as follows

> bngeneplot(results = pwayGO,
+            exp = vsted,
+            expSample = incSample,
+            pathNum = 13, R = 50, showDir = T,
+            convertSymbol = T,
+            expRow = "ENSEMBL",
+            strThresh = 0.7)
Error in setReadable(results, OrgDb = orgDb) : 
  can't determine keyType automatically; need to set 'keyType' explicitly...
> dev.off()
null device 
          1 

Good luck.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions