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

PlotModuleTraitCorrelation for one trait #322

Closed
shiave opened this issue Oct 24, 2024 · 1 comment
Closed

PlotModuleTraitCorrelation for one trait #322

shiave opened this issue Oct 24, 2024 · 1 comment
Labels
question Further information is requested

Comments

@shiave
Copy link

shiave commented Oct 24, 2024

Hi, I'm trying to check one trait (treatment vs control) against the MEs to figure out which modules show strong correlation with the trait. When I try this code:

seurat_obj$group1 <- factor(seurat_obj$group1, levels = c("AV", "MV"))

cur_traits <- c('group1')

seurat_obj <- ModuleTraitCorrelation(
seurat_obj,
traits = cur_traits
)

PlotModuleTraitCorrelation(
seurat_obj,
label = 'fdr',
label_symbol = 'stars',
text_size = 2,
text_digits = 2,
text_color = 'white',
high_color = 'yellow',
mid_color = 'black',
low_color = 'purple',
plot_max = 0.2,
combine=TRUE
)

I get this error:
Error in PlotModuleTraitCorrelation(seurat_obj, label = "fdr", label_symbol = "stars", :
ModuleTraitCorrelation was run only for one trait. Heatmaps are not suggested for visualizing only one variable!

So what is another method I could use to check the correlation?

Some background: We have a treatment group and control group and the seurat object has many brain cell clusters (group column). We only want to look into the microglia group so I ran the following functions on just microglia earlier in my code:

seurat_obj <- SetDatExpr(
seurat_obj,
group_name = "Microglia", # the name of the group of interest in the group.by column
group.by='cluster_id', # the metadata column containing the cell type info.
assay = 'RNA', # using RNA assay
slot = 'counts' # using normalized data
)

compute eigengene-based connectivity (kME):

seurat_obj <- ModuleConnectivity(
seurat_obj,
group.by = 'cluster_id', group_name = 'Microglia'
)

I'm confused about whether this impacts my final correlations when I look at traits versus module eigengene (I don't think it does but I want to make sure).

@shiave shiave added the question Further information is requested label Oct 24, 2024
@smorabit
Copy link
Owner

Hi,

Based on what you are saying:

Some background: We have a treatment group and control group and the seurat object has many brain cell clusters (group column). We only want to look into the microglia group so I ran the following functions on just microglia earlier in my code:

Instead of module trait correlation I suggest that you run differential module eigengene analysis to compare treatment vs control.

@smorabit smorabit closed this as completed Dec 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants