dynverse / dyno

Inferring, interpreting and visualising trajectories using a streamlined set of packages 🦕
https://dynverse.github.io/dyno
Other
166 stars 32 forks source link

Usage of add_prior_information #38

Closed dallen59 closed 5 years ago

dallen59 commented 5 years ago

Hi,

I am trying to use dyno to run PAGA, which requires the user to define one or multiple starting cells. I tried using add_prior_information to add a vector of cell names that should be used as root cells, and the command appeared to accept that vector as valid input. However, when I try to run PAGA I keep getting this error as if the list of starting cells was not actually added to the dataset object. Any pointers on how to properly add metadata to the dyno objects? Thanks!

Running:

#Annotate starting cells
start_cells = as.vector(cluster35@cell.names)
#Add prior information to dataset
add_prior_information(dataset = dataset_object, start_id = start_cells)
#Run model
model_PAGA <- infer_trajectory(dataset = dataset_object, method = methods_selected[2], verbose = T, give_priors = "start_id")

Gives the error: Error in .method_extract_args(dataset, method$inputs, give_priors) : Prior information start_id is missing from dataset 20190219_155152__data_wrapper__9eeKucfMOk but is required by the method. -> If known, you can add this prior information using add_prior_information(dataset, start_id = ). -> Otherwise, this method cannot be used.

zouter commented 5 years ago

Hi @dallen59

You can add a starting cell to the object by doing:

dataset_object <- add_prior_information(dataset_object, start_id = start_cells)

This code will overwrite the dataset_object with the same dataset but with prior_information added.

No need to use the give_priors = "start_id" for this, because required priors will automatically be given to a method.

We also include an (undocumented) PAGA without start cells, which you can use with: model_PAGA <- infer_trajectory(dataset = dataset_object, method = "projected_paga", verbose = T)

dallen59 commented 5 years ago

Hi @zouter,

Thanks so much for your help. The reassignment fixed the problem!