SFUStatgen / LDheatmap

14 stars 8 forks source link

External error when using plotGene() and LDheatmap.addGene() #4

Closed zhenhua-zhang closed 1 year ago

zhenhua-zhang commented 4 years ago

https://github.com/SFUStatgen/LDheatmap/blob/00d975138d43a56cf6fea10218d3872ba8e0ccf6/R/plotGenes.R#L106-L108

Hello,

Thanks for the great work of LDheatmap, it helps a lot in my projects. However, I found an issue when using plotGene() function and the LDheatmap.addGene() function. Here is the code I used as posted in the examples:

grid.newpage()
plotGenes(149500000, 150000000, "chr7")

The code gives an error: Error: Internal Server Error or Error: Bad Request. I went through the source code at this commit: https://github.com/SFUStatgen/LDheatmap/commit/00d975138d43a56cf6fea10218d3872ba8e0ccf6. And try the code line by line in R console. Luckily found that the issues are because of lines from 106 to 108. If I comment on line 106 and remove the corresponding argument table in line 108. The issue is gone.

It looks the issue roots in package rtracklayer and consequently affects functions in LDheatmap

Best regards, Zhenhua

mcneney commented 4 years ago

Hi Zhenhua,

Thanks for your interest in LDheatmap. Yes, this is a problem with rtracklayer. Another rtracklayer user and I have reported the issue to the developer https://github.com/lawremi/rtracklayer/issues/27 but I haven't heard of any resolution. I'll let you know once the problem is resolved. Brad

zhenhua-zhang commented 4 years ago

Hi Zhenhua,

Thanks for your interest in LDheatmap. Yes, this is a problem with rtracklayer. Another rtracklayer user and I have reported the issue to the developer lawremi/rtracklayer#27 but I haven't heard of any resolution. I'll let you know once the problem is resolved. Brad

Hi Brad,

Thanks for the reply! I think I solved the issue in LDheatmap by query the whole table then slice it (see the following code). The solution is quick and dirty, although it works.

  tbl <- "kgXref"
  query2<-rtracklayer::ucscTableQuery(session, "knownGene", 
    rtracklayer::GRangesForUCSCGenome(genome,chromosome,IRanges::IRanges(minRange, maxRange)), table=tbl)
  t1<-rtracklayer::getTable(query2)
  t1<-t1[(t1[,"kgID"] %in% t[,"name]),]

Zhenhua

mcneney commented 4 years ago

Thanks Zhanhua! I'll incorporate your patch until the problems with the names argument to ucscTableQuery() get resolved. Cheers, -Brad

zhenhua-zhang commented 4 years ago

Thanks Zhanhua! I'll incorporate your patch until the problems with the names argument to ucscTableQuery() get resolved. Cheers, -Brad

Hi Brad,

Thanks for the quick reply and for fixing work! However, it looks that the rtracklayer::ucscTableQuery() is used twice with names argument. One is the line you fixed already, the other is line 121.

https://github.com/SFUStatgen/LDheatmap/blob/00d975138d43a56cf6fea10218d3872ba8e0ccf6/R/plotGenes.R#L121

Cheers, Zhenhua

mcneney commented 4 years ago

Oops, thanks. Fixed.