ShobiStassen / VIA

trajectory inference
https://pyvia.readthedocs.io/en/latest/
MIT License
86 stars 21 forks source link

Using cell idents as root instead of index #3

Closed GabyBG closed 1 year ago

GabyBG commented 2 years ago

Hello,

Thank you so much for writing an alternative to the current Pseudotime packages already available, so fair I am finding VIA very friendly and helpful. I have already applied VIA to a single-celldataset that I have and I was wondering if it could be possible to set the root_user with cell idents instead of Indexes? Or is there a specific reason we want o use indexes?

I tried: root_user =['cell type_X']

But I get: list indices must be integers or slices, not str

Thank you for your help!

ShobiStassen commented 2 years ago

Hi again, This is a good question and actually if you see how the Toy datasets are structured and the toy data examples are called in the example code, the root is actually given as root_user=['M1']. This is done within the code for the function main_Toy() line 3932 of the core.py file in this link https://github.com/ShobiStassen/VIA/blob/master/VIA/core.py So a potential quick fix for you until I'm back in the office and can make a more general fix, is that you set the dataset type to dataset = 'toy' and set up the functions calling via as done in the wrapper function for main_Toy(). This way you can choose the root as whatever name of the cell type is available in the true labels you have. Like root_user = ['early_type_cellname']. You can see line 3973 and 3942 where the root is defined as string and the dataset type is called 'toy'. This is done in order to call the root finding function that can handle strings. https://github.com/ShobiStassen/VIA/blob/master/VIA/core.py

Alternatively, you can relabel your cell names so that the early cell group is 'M1' and then use the main_toy() function as done in the sample code snippets of the readme file

GabyBG commented 2 years ago

Thank you so much for replying even while being out of the office. I will try to set the cell idents to M1 and use the 'toy' option.

Will keep you posted.