Hello
I am trying to use the dnet package in R to calculate the semantic similarity of different genes to BRCA1 based on disease ontology (DO).
To do so, I am iterating over the genes list with the following code:
#initalize DAG based on DO
ig.DO <- dRDataLoader(RData = "ig.DO")
g <- ig.DO
org.Hs.egDO <- dRDataLoader(RData = "org.Hs.egDO")
dag <- dDAGannotate(g, annotations=org.Hs.egDO, path.mode="all_paths", verbose=TRUE)
#find genes annotated by DO (used later to avoid querying
#genes that are not annotated, as this invokes an error
annotated<-unique(unlist(V(dag)$annotations))
annotatable<-intersect(entrezID$entrezgene,annotated)
#calculate semantic similarity
DO.similarity<-sapply(entrezID$entrezgene, function(gene){
if(gene%in%annotatable){ # check if gene is the list of DO annotated genes.
sim<-dDAGgeneSim(g=dag, genes=c(BRCA1enterz,gene),
method.gene=combine_method,
method.term=sim_method,
parallel=TRUE, verbose=TRUE)
val<-sim[as.character(BRCA1enterz),as.character(gene)]
return(val)
}
else{return NA}
}
with entrezID and BRCA1enterz being objects defined earlier in the code containing respectively the list of enterz IDs to query, and the entrez ID for BRCA1.
While this works well for some gene, when querying entrez gene 729230 (corresponding to hgnc gene CCR2) I got the following error:
Error in intI(i, n = di[margin], dn = dn[[margin]], give.dn = FALSE) : index larger than maximal 2
Does anyone work with this package and has any idea what the problem might be?
Thanks in advance