You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've recently faced issues when using the function read.nextstrain.json on divergence trees (with divergence units in number of mutations). When using it on a json file (zika-divergence.json) obtained from a modified version of the Zika Nextstrain workflow,, I obtain the following error:
Session Info
library(treeio)
read.nextstrain.json("zika-divergence.json")
Errorin`dplyr::bind_rows()`:!Can't combine `..1$div` <integer> and `..2$div` <character>.Run `rlang::last_trace()` to see where the error occurred.
Proposed solution
Playing with the source code, it looks like the error comes from the following line of code, with some nodes being loaded with a div variable as an integer and some as a character:
if ('div'%in% colnames(id[['data']][[id[['id']]]])){
parent.index<-id[['data']][[id[['id']]]][['parentID']]
# Systematically converting div to a numeric valueid[["data"]][[id[["id"]]]][["div"]] <- as.numeric(id[["data"]][[id[["id"]]]][["div"]])
id[['data']][[id[['id']]]][['branch.length']] <-id[['data']][[id[['id']]]][['div']] -
as.numeric(id[['data']][[parent.index]][['div']])
}
I'd be happy to submit a pull request regarding this. Would you have a preference regarding how to do this and whether it might be valuable to also add the json file (zika-divergence.json) ? I also noticed that read.nextstrain.json does not have a testing file. Would it make sense to include all of this as part of a testing file? If so, do you have suggestions on what the testing should check?
Thank you!
The text was updated successfully, but these errors were encountered:
Description of the issue
I've recently faced issues when using the function
read.nextstrain.json
on divergence trees (with divergence units in number of mutations). When using it on a json file (zika-divergence.json) obtained from a modified version of the Zika Nextstrain workflow,, I obtain the following error:Session Info
Proposed solution
Playing with the source code, it looks like the error comes from the following line of code, with some nodes being loaded with a
div
variable as an integer and some as a character:treeio/R/nextstrain.json.R
Line 53 in 9504617
Locally, I've managed to solve this by replacing:
treeio/R/nextstrain.json.R
Lines 39 to 43 in 9504617
by:
I'd be happy to submit a pull request regarding this. Would you have a preference regarding how to do this and whether it might be valuable to also add the json file (
zika-divergence.json
) ? I also noticed thatread.nextstrain.json
does not have a testing file. Would it make sense to include all of this as part of a testing file? If so, do you have suggestions on what the testing should check?Thank you!
The text was updated successfully, but these errors were encountered: