Question: Matrix index error when using dnet package to calculate semantic similarity of genes
gravatar for dolevrahat
3.8 years ago by
dolevrahat10 wrote:


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

#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),
parallel=TRUE, verbose=TRUE)
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

dnet R semantic-similarity • 1.1k views
ADD COMMENTlink modified 3.7 years ago • written 3.8 years ago by dolevrahat10
gravatar for dolevrahat
3.7 years ago by
dolevrahat10 wrote:

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 COMMENTlink written 3.7 years ago by dolevrahat10
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1315 users visited in the last hour