Matrix index error when using dnet package to calculate semantic similarity of genes
1
0
Entering edit mode
8.0 years ago
dolevrahat ▴ 30

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

r dnet semantic-similarity • 1.7k views
ADD COMMENT
1
Entering edit mode
8.0 years ago
dolevrahat ▴ 30

I have contacted the maintainer of dnet, which quickly and efficiently fixed the bug that triggered the error. The code now works properly on dnet version 1.09

ADD COMMENT

Login before adding your answer.

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