girke-lab / drugTargetInteractions

1 stars 0 forks source link

Error in getParalogs #2

Closed komalsrathi closed 3 years ago

komalsrathi commented 3 years ago

I am facing another issue with few genes in getParalogs function:

Code:

library(drugTargetInteractions)
genes <- c("FGFBP2", "HOXC6", "FREM2", "HOXC9", "AC105052.1")
chembldb <- system.file("extdata", "chembl_sample.db", package="drugTargetInteractions")
resultsPath <- system.file("extdata", "results", package="drugTargetInteractions")
config <- genConfig(chemblDbPath=chembldb, resultsPath=resultsPath)
downloadUniChem(config=config)
cmpIdMapping(config=config)

# convert to ensembl gene id - gene symbol vector
idMap <- getSymEnsUp(EnsDb = "EnsDb.Hsapiens.v86", ids = genes, idtype = "GENE_NAME")
ens_gene_id <- idMap$ens_gene_id
queryBy <- list(molType="gene", idType = "ensembl_gene_id", ids = names(ens_gene_id))
res_list <- getParalogs(queryBy)

Error:

Error in rep(seq_along(resultDF$ENSEMBL), index) : 
  invalid 'times' argument
tgirke commented 3 years ago

I believe you have the same problem as in your previous comment, as you are using the path from system.file()?

komalsrathi commented 3 years ago

I downloaded the full database and still getting the same error:

library(drugTargetInteractions)
genes <- c("FGFBP2", "HOXC6", "FREM2", "HOXC9", "AC105052.1")

# obtained from ftp://ftp.ebi.ac.uk/pub/databases/chembl/ChEMBLdb/chembl_29_sqlite.tar.gz
chembldb <- file.path(ref_dir, "chembl", "chembl_29_sqlite", "chembl_29.db")
resultsPath <- system.file("extdata", "results", package = "drugTargetInteractions")
config <- genConfig(chemblDbPath = chembldb, resultsPath = resultsPath)
downloadUniChem(config = config)
cmpIdMapping(config = config)

idMap <- getSymEnsUp(EnsDb = "EnsDb.Hsapiens.v86", ids = genes, idtype = "GENE_NAME")
ens_gene_id <- idMap$ens_gene_id
queryBy <- list(molType="gene", idType = "ensembl_gene_id", ids = names(ens_gene_id))
res_list <- getParalogs(queryBy)

Error in rep(seq_along(resultDF$ENSEMBL), index) : 
  invalid 'times' argument
tgirke commented 3 years ago

This works for me. Perhaps first install the updated package as instructed in your other issue. Also pay attention to the other line with system.file. Just in case this is the code I tested with your gene ids:

1. Load package and enrionment settings

Same as in other issue...

2. Query with gene symbols for paralogs

gene_name <- c("FGFBP2", "HOXC6", "FREM2", "HOXC9", "AC105052.1")                                                                                                                                                                                                          
idMap <- getSymEnsUp(EnsDb = "EnsDb.Hsapiens.v86", ids = gene_name, idtype = "GENE_NAME")                                                                                                                                                                                  
ens_gene_id <- idMap$ens_gene_id                                                                                                                                                                                                                                           
queryBy <- list(molType="gene", idType = "ensembl_gene_id", ids = names(ens_gene_id))                                                                                                                                                                                      
res_list <- getParalogs(queryBy)  
komalsrathi commented 3 years ago

Works as expected, thanks!