topGO - missing value where TRUE/FALSE needed
0
0
Entering edit mode
mictadlo ▴ 10
@mictadlo-10885
Last seen 4.9 years ago

Hi,

I found here a tutorial how to use topGO. Unfortunately, I got missing value where TRUE/FALSE needed with the below code:

    > tr <- glmTreat(fit, contrast=B.LvsP, lfc=log2(1.5))
    > topTags(tr)
    Coefficient:  -1*Leaves.2 1*Leaves.3 
              logFC unshrunk.logFC logCPM  PValue     FDR
    sp0090975   2.6            2.6    2.8 5.7e-14 2.7e-09
    sp0037632  -3.0           -3.0    3.4 1.7e-13 2.7e-09
    sp0074153  -3.9           -3.9    3.8 1.8e-13 2.7e-09
    sp0008306   3.2            3.2    2.9 1.8e-13 2.7e-09
    sp0073530  -4.5           -4.5    3.4 2.3e-12 2.3e-08
    sp0025713  -3.9           -3.9    4.4 2.6e-12 2.3e-08
    sp0037721   7.8            8.0    2.4 2.7e-12 2.3e-08
    sp0083660   2.0            2.0    4.4 3.2e-12 2.3e-08
    sp0052245  -2.9           -2.9    4.9 3.9e-12 2.6e-08
    sp0071520  -3.3           -3.3    2.7 5.8e-12 3.4e-08

> geneID2GO <- readMappings(file = "~/GOmapping.tsv")
> head(geneID2GO)
$`"V1"`
[1] "\"V14\""

$`"sp0000005"`
[1] "\"GO:0003723\""

$`"sp0000006"`
[1] "\"GO:0016021\""

$`"sp0000007"`
[1] "\"GO:0003700" "GO:0006355"   "GO:0043565\""

$`"sp0000016"`
[1] "\"GO:0046983\""

$`"sp0000017"`
[1] "\"GO:0004672" "GO:0005524"   "GO:0006468\""

> 
> geneList <- tr$table$PValue
> names(geneList) <- rownames(tr)
> head(geneList)
   sp0025247    sp0025250    sp0025268    sp0025270    sp0025282    sp0056834 
9.891807e-01 4.062609e-01 9.633703e-01 1.037051e-03 9.633191e-05 6.661673e-01 
> 
> topDiffGenes = function(allScore) {
+   return (allScore < 1e-2)
+ }
> myGOdata <- new("topGOdata", 
+                 description="My project", 
+                 ontology="BP", 
+                 allGenes=geneList,
+                 geneSelectionFun = topDiffGenes,
+                 annot = annFUN.gene2GO, 
+                 gene2GO = geneID2GO)

Building most specific GOs .....
    ( 0 GO terms found. )

Build GO DAG topology ..........
    ( 0 GO terms and 0 relations. )
Error in if is.na(index) || index < 0 || index > length(nd)) stop("vertex is not in graph: ",  : 
  missing value where TRUE/FALSE needed

What did I miss?

Thank you in advance.

topgo edger • 2.9k views
ADD COMMENT
0
Entering edit mode

Your "geneID2GO" doesn't look well, it has double quotes, have you tried removing one pair of quotes from the characters? This way the `"sp0000017"` will become "sp0000017" and thus will be mapped with the geneList.

 

Also the GOs:"\"GO:0004672" "GO:0005524" "GO:0006468\"", should be splited by space.

ADD REPLY
0
Entering edit mode

The GOmapping.tsv looks like this:

"V1"    "V14"
"sp0000005"    "GO:0003723"
"sp0000006"    "GO:0016021"
"sp0000007"    "GO:0003700,GO:0006355,GO:0043565"
"sp0000016"    "GO:0046983"
"sp0000017"    "GO:0004672,GO:0005524,GO:0006468"

How is possible to fix the problem with the quotes and spaces?

Thank you in advance.

ADD REPLY
0
Entering edit mode

When reading the file with read.delim, check that the quote argument has the ". Also split the second column by comma. strsplit(",", x) where x would be each row in V14.

ADD REPLY

Login before adding your answer.

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