BradyAJohnston / plasmapR

Creating plasmid maps inside ggplot.
https://bradyajohnston.github.io/plasmapR/
Other
79 stars 8 forks source link

Error adding gb files from Prokka #1

Open D415yAPHA opened 2 years ago

D415yAPHA commented 2 years ago

Hi, I am trying to render a map of a plasmid that has been annotated using Prokka.

When I try to do so I get the following error: Error in if (length < arrow_width) { : missing value where TRUE/FALSE needed

This happens whether I assign an object to the gb file or whether I try to refer to it using file paths. Is this a known error? Thanks!

BradyAJohnston commented 2 years ago

Hi there! Apologies for such a late response, I totally missed this notification and am only now going back through and clearing out old notifications. I haven't tested it at all with something from Prokka, do you have an example file that you could provide?

Nazaalopez commented 1 year ago

Hello, I am experiencing the same issue, using several plasmids. For instance, this pVJ53-GFP, attached and downloaded from here: https://www.ncbi.nlm.nih.gov/nuccore/1006078852. pJV53-GFP.zip

So far, the only plasmid that I have been able to render is the one that you provided: pETM20-avi-dsnPPR10-C2

Debugging a bit, I found that the error comes from the function "create_arrow_positions.R" specifically here: create_arrow_positions <- function(start, end, middle, width, plasmid_length, arrowhead_size = 8) { length <- end - start

arrow_width <- plasmid_length / 360 * arrowhead_size

phlange <- start + length - arrow_width

if (length < arrow_width) { phlange <- start }

The if statement is getting a value different from True/False, maybe a null/NA? I guess at some point the code is not able to calculate one of the variables related to length, start, end or arrow_width.

Can you provide some workaround? Thanks :)

BradyAJohnston commented 1 year ago

Hi @Nazaalopez apologies for the delay in replying. Currently in thesis-writing mode so development for this isn't super high priority.

I've spent a day basically re-writing the entire package, mostly focusing on getting the .gb parser more robust.

Should hopefully now work a bit more robustly, and from testing on my own files and the one that you shared it seems to now work.

The functions in the package have also changed, so check the README for what to use now.

Let me know how you go. The major rework has been done, so I can more easily make minor improvements and changes going forward as well.