channotation / chap

CHAP is a tool for the functional annotation of ion channel structures:
http://www.channotation.org
Other
18 stars 10 forks source link

Error while running heuristic_prediction.R #27

Closed k79-cyber closed 4 years ago

k79-cyber commented 4 years ago

Hello,

I am running heuristic prediction for the example/example-03/ for the 6mhs.pdb. When I run ./heuristic_prediction.R I get the following error:

divide <- ggplot_build(mapped)[[1]][[1]] Warning message: Computation failed in stat_contour(): Number of x coordinates must match number of columns in density matrix. matrix <- matrix(c(divide$x, divide$y), ncol = 2) Error in matrix(c(divide$x, divide$y), ncol = 2) : 'data' must be of a vector type, was 'NULL' Execution halted

I am not familiar with R and hence I will be grateful if you could help me here.

Thanks. Koushik

shanlin-rao commented 4 years ago

Hi Koushik,

Thank you for reporting the issue!

I am afraid I have not been successful in reproducing it so far - may I ask what version of R you are using?

Please could you also let me know if an output plot is generated, and whether it contains a dashed contour line as in the provided example, if the following modifications are made to the script (to remove the calculation of a score):

  1. deletion of lines 176-211, i.e. starting from divide <- ggplot_build(mapped)[[1]][[1]] until the end of the 'Heuristic prediction for structure' section; and
  2. substitute the "labelled" with "mapped" on line 217, under the 'Arrange and save plots' section

Best wishes, Shanlin

k79-cyber commented 4 years ago

Hi Shanlin,

Many thanks for your reply. I am using R 3.4.4.

I do not get a plot. I get the following error when I implement the changes you mentioned: Error in grid.Call.graphics(C_text, as.graphicsAnnot(x$label), x$x, x$y, : invalid font type Calls: grid.arrange ... drawDetails -> drawDetails.text -> grid.Call.graphics In addition: There were 50 or more warnings (use warnings() to see the first 50) Execution halted

Cheers, Koushik

shanlin-rao commented 4 years ago

Hi Koushik,

Thank you very much for your reply and my apologies that it did not work..

I wonder if the warnings remain if all occurrences of family = "Ubuntu" are removed (which should resolve the font type error, resorting to the default font), and what they say if they persist?

Best wishes, Shanlin

k79-cyber commented 4 years ago

Hi Shanlin,

Thanks again for the input. Now I get the output plots as published in your paper but I do not see the contoured line. heuristic_prediction

I also get a warning message Warning message: Computation failed in stat_contour(): Number of x coordinates must match number of columns in density matrix.

Cheers, Koushik

shanlin-rao commented 4 years ago

Hi Koushik,

Thank you!! This really helped narrow down the problem.. The calculation of a prediction score relies on the contour, which geom_contour() seems unable to plot in this case..

Please could I further ask you to add these to the end of the (now edited) script: head(grid) tail(grid)

And let me know if the console output reads: hydrophobicity radius energy 1 -0.4500 0.1 -0.1673 2 -0.4424 0.1 -0.1891 3 -0.4348 0.1 -0.2052 4 -0.4273 0.1 -0.2156 5 -0.4197 0.1 -0.2204 6 -0.4121 0.1 -0.2194 hydrophobicity radius energy 9995 0.2621 0.6 -0.2821 9996 0.2697 0.6 -0.2952 9997 0.2773 0.6 -0.3072 9998 0.2848 0.6 -0.3183 9999 0.2924 0.6 -0.3284 10000 0.3000 0.6 -0.3373

Or whether it is something different?

Best wishes, Shanlin

k79-cyber commented 4 years ago

Hi Shanlin,

I implemented the new changes and I get the the same output as you mentioned.

Cheers, Koushik

shanlin-rao commented 4 years ago

Hi Koushik,

Thank you - and thank you for bearing with me!

Just to be certain, does adding the following: class(grid$radius) class(grid$hydrophobicity) class(grid$energy)

All give "numeric" as console output? And does the same warning remain if geom_contour in the script is substituted with stat_contour?

Best wishes, Shanlin

k79-cyber commented 4 years ago

Hi Shanlin,

Thank you for your time. Yes, they all give "numeric" output. Changing geom_contour to stat_contour gives the same warning.

Cheers, Koushik

shanlin-rao commented 4 years ago

Hi Koushik,

Thank you very much for the confirmation!

I am uncertain as to why the contour-plotting function has failed, but as a potential workaround, please find attached:

  1. an additional data file (contour_line.json) containing the 1 RT contour line coordinates, in a format that should hopefully be easier to plot; and
  2. a modified version of the R script (heuristic_alternative.R) to replace the original; this now needs three data files in the directory: the output.json and heuristic_grid.json as before, plus the contour_line.json file; it should otherwise function exactly the same as the previous, and the calculation of prediction scores is unchanged

    Please let me know if the new script still gives errors?

Best wishes, Shanlin

heuristic_new.zip

k79-cyber commented 4 years ago

Hi Shanlin,

Thank you for the new code and for your time. This works perfectly and I get the heuristic score also now. Just two brackets missing in the plot appearance section for axis title and text. Thanks a lot!

Cheers, Koushik

shanlin-rao commented 4 years ago

Hi Koushik,

..Whoops, I'm so sorry for the missing brackets! Must have deleted them by accident when deleting the family = "Ubuntu"s!

Thank you so much for letting me know, I'm glad it's functioning now and all the best with your work!

Best wishes, Shanlin