Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting colors for different conditions of cells #29

Open
loversaber opened this issue Dec 11, 2023 · 2 comments
Open

Setting colors for different conditions of cells #29

loversaber opened this issue Dec 11, 2023 · 2 comments

Comments

@loversaber
Copy link

I'm trying to figure out how to display cells with two conditions in two different colors. I don't think there are specific cell labels for each cell input into SPRING because only the X matrix and the gene list are used in the function make_spring_subplot. However, I suppose the indexes from 0 to the total number of cells can be used automatically as cell labels,

I guessed that the build_categ_colors function would be used to make the input for parameter cell_groupings. Then, cell_groupings was set to d_condition_labels as shown in the code below in make_spring_subplot. But the graph generated in SPRING is not what I want. So I don't think I set it up right. Can you help me to solve this problem? Thank you very much!

# test #0-5 indicate the cell label 
# Dict d_condition_labels contains cell labels belonging to the corrsponding condition
d_condition_labels = {"Infected":['3','4','5'],"Control":['0','1','2']}

# Then I tested the function to check the structure of cell_groupings
build_categ_colors({},d_condition_labels)
{'Control': {'label_colors': {'0': '#00d4ff', '1': '#00007f', '2': '#ffe500'},
  'label_list': ['0', '1', '2']},
 'Infected': {'label_colors': {'3': '#00007f', '4': '#ffe500', '5': '#00d4ff'},
  'label_list': ['3', '4', '5']}}
@calebweinreb
Copy link
Collaborator

Hello,

Sorry for the lack of documentation. You would indeed using the cell_groupings input of make_spring_plot to color cells by condition. The way to format it is that there should be one key/value pair for partition that you want to visualize (e.g. timepoint, genotype, batch, etc.). In your case, there would just be a single key/value pair because there is only one partition you want to visualize. The key should be the same of the partition (in your case "condition") and the value should be a list of labels, one for each cell in the expression matrix. For example, if cells 0,1,2 are "Control" and cells 3,4,5 are "Infected", the full dictionary would be

cell_groupings = {"Condition": ["Control", "Control", "Control", "Infected", "Infected", "Infected"]}

@loversaber
Copy link
Author

Hello,

Sorry for the lack of documentation. You would indeed using the cell_groupings input of make_spring_plot to color cells by condition. The way to format it is that there should be one key/value pair for partition that you want to visualize (e.g. timepoint, genotype, batch, etc.). In your case, there would just be a single key/value pair because there is only one partition you want to visualize. The key should be the same of the partition (in your case "condition") and the value should be a list of labels, one for each cell in the expression matrix. For example, if cells 0,1,2 are "Control" and cells 3,4,5 are "Infected", the full dictionary would be

cell_groupings = {"Condition": ["Control", "Control", "Control", "Infected", "Infected", "Infected"]}

Thank you very much! It really helped me out!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants