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

"colors" setting in "add_track" #7

Open
grimwoo opened this issue Nov 2, 2023 · 5 comments
Open

"colors" setting in "add_track" #7

grimwoo opened this issue Nov 2, 2023 · 5 comments

Comments

@grimwoo
Copy link

grimwoo commented Nov 2, 2023

Thank you for the development of Plot1Cell. This issue is related to issue #6.

Here, I set the collor for plot_circlize and add_track. The plot_circlize works perfectly. But the add_track only use the ordered colors for each clusters, rather than use the correct color for each subsets clusters.

The code is as the following :
`
Order_Celltype_Main <- c(
"EC","VSMC",
"FC","CPC","PreHTC","RegC",
"M1 macrophage"
)
color_Celltype_Main <- c(
"#F8766D","#C49A00",
"#53B400","#00C094","#00B6EB","#A58AFF",
"#FB61D7"
)
names(color_Celltype_Main) <- Order_Celltype_Main
Seurat.object$Celltype_Main <- factor(
x = Seurat.object$Celltype_Main,
levels = Order_Celltype_Main
)

Order_Celltype_Subset <- c(
"EC (SELE)",
"VSMC (IL6)","VSMC (RGS5)",

"FC (AQP3)","FC (CFH)",
"FC (ECRG4)","FC (FOS)",
"FC (HSPB1)","FC (POSTN)",
"FC (PRG4)","FC (THBS4)",
"FC (LOC119877775)","FC (MAGI2)",
"FC (MMP3)","FC (MT1E)",
"FC (RBP4)","FC (S100A12)",

"CPC (STMN1)",
"PreHTC (MMP3)",
"RegC (PTGS2)",

"M1 macrophage (CCL23)","M1 macrophage"
)
color_Celltype_Subset <- c(
"#F8766D",
"#e0b311", "#b4900e",

"#9DB400", "#90B405", "#84B40B", "#78B411",
"#6CB417", "#60B41D", "#54B423", "#48B428", "#3CB42E",
"#30B434", "#24B43A", "#18B440", "#0CB446", "#00B44C",

"#00C094",
"#00B6EB",
"#A58AFF",

"#dd40b8", "#df74c6"
)
names(color_Celltype_Subset) <- Order_Celltype_Subset
Seurat.object$Celltype_Subset <- factor(
x = Seurat.object$Celltype_Subset,
levels = Order_Celltype_Subset
)

Plot1Cell.object <- prepare_circlize_data(Seurat.object, scale = 0.8 )

Plot1Cell.object$Celltype_Main <- factor(
x = Plot1Cell.object$Celltype_Main,
levels = Order_Celltype_Main
)
Plot1Cell.object$Celltype_Subset <- factor(
x = Plot1Cell.object$Celltype_Subset,
levels = Order_Celltype_Subset
)
Plot1Cell.object$Sample <- factor(
x = Plot1Cell.object$Sample,
levels = Order_Sample
)

plot_circlize(
Plot1Cell.object,
do.label = T,
contour.levels = c(0.1, 0.5, 0.9),
pt.size = 0.25,
col.use = color_Celltype_Main ,
bg.color = 'white',
kde2d.n = 1000,
repel = T,
label.cex = 0.7)

add_track(
Plot1Cell.object,
group = "Celltype_Subset",
colors = color_Celltype_Subset,
track_num = 2)
`

@grimwoo
Copy link
Author

grimwoo commented Nov 2, 2023

image

@grimwoo
Copy link
Author

grimwoo commented Nov 2, 2023

The left two figures show the correct color I set.

The right figure shows the correct color of "Celltype_Main" by plot_circlize and the wrong color of "Celltype_Subset" by add_track.

Could you please help me?

@grimwoo
Copy link
Author

grimwoo commented Nov 7, 2023

@HaojiaWu

@HaojiaWu
Copy link
Owner

HaojiaWu commented Nov 7, 2023

@grimwoo The issue should have been fixed. Please reinstall the package:

devtools::install_github("HaojiaWu/plot1cell")

Then, use these lines:

color_Celltype_Subset <- c(
"#F8766D",
"#e0b311", "#b4900e",
"#9DB400", "#90B405", "#84B40B", "#78B411",
"#6CB417", "#60B41D", "#54B423", "#48B428", "#3CB42E",
"#30B434", "#24B43A", "#18B440", "#0CB446", "#00B44C",
"#00C094",
"#00B6EB",
"#A58AFF",
"#dd40b8", "#df74c6"
)
add_track(
Plot1Cell.object,
group = "Celltype_Subset",
colors = color_Celltype_Subset,
track_num = 2)

Let me know if it doesn't work.

@grimwoo
Copy link
Author

grimwoo commented Nov 8, 2023

@HaojiaWu Thank you for your quick reply. However, after your guidance, I still cannot get the correct color of the sub-cell types.

My package version is 0.0.0.9000 after reinstall.

Or could you help me with the annotation of the plot ? I can accept the default colors, if the plot shown me which color reference to which sub-celltype.

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