PoonLab / KaphiShiny

A Shiny web interface for running Kaphi
0 stars 0 forks source link

initConfig branch is to track trying to make the shiny app using a pre-initialized config #2

Closed 0ldM4j0r closed 7 years ago

0ldM4j0r commented 7 years ago

Since I am have been facing difficulties in shiny with dynamically creating inputs for the config (see: #1), I will try to implement other parts of the shiny app using an pre-initialised config.

0ldM4j0r commented 7 years ago

I managed to implement downloading and uploading a config file. Form here i will go on to attempt to initialise the config and implement the features in the app that relies on it.

0ldM4j0r commented 7 years ago

The config initialisation from a file through shiny works. However, after that when running the following:

obs.tree <- parse.input.tree(obs.tree, config)

I get this error from R, while Rstudio just aborts:

invalid Newick format or non-binary tree: syntax error
0ldM4j0r commented 7 years ago

I printed out the tree that is being detected as malformed to the browser by rendering paste0(.to.newick(obs.tree)) to the browser. I got a correct tree. I will trace the parse.input.tree function to see where is the tree being mis-processed.

0ldM4j0r commented 7 years ago
obs.tree <- parse.input.tree(obs.tree, config)

calls

obs.tree <- .preprocess.tree(obs.tree, config)

which in turn calls

tree <- ladderize(tree)
tree <- .rescale.tree(tree, config$norm.mode)
tree$kernel <- tree.kernel(tree, tree, lambda=config$decay.factor, sigma=config$rbf.variance, rho=config$sst.control, normalize=0)

I started calling the three above lines in the server side of the app sequentially as follows:

tree <- ladderize(obs.tree)
tree <- .rescale.tree(obs.tree, config$norm.mode)
tree$kernel <- tree.kernel(obs.tree, obs.tree, lambda=config$decay.factor, sigma=config$rbf.variance, rho=config$sst.control, normalize=0)

The app crashes on the third line, there is a comment above the third line equivalent in the .preprocess.tree function that says # FIXME: this won't work for labelled kernel, which made me try a tree labelled with letter instead of species names eg.((A:1,B:1):1,C:1); and that works. So there seems to be a problem with using labelled trees. I will open an issue in Kaphi referring to this issue.