Code Monkey home page Code Monkey logo

Comments (12)

enblacar avatar enblacar commented on June 15, 2024

Hi @cnk113,

Thanks for the interest and the feedback! Happy to hear that you like the package.

This is indeed a very interesting addition. I guess you mean using it as scoring method in SCpubr::do_EnrichmentHeatmap() no?

I will have a look at it and put in the To-Do list!

Best,
Enrique

from scpubr.

cnk113 avatar cnk113 commented on June 15, 2024

Hey Enrique,

Yes that's the function I was thinking of.

Best,
Chang

from scpubr.

enblacar avatar enblacar commented on June 15, 2024

Hi @cnk113,

I have implemented the method in the last commit. Could you please check it out and tell me if it works for you as intended?

devtools::install_github("enblacar/SCpubr", ref = "d6e7617a9c4e7817da8bf9bfde73eb7634991625")

For this, use the following code:

SCpubr::do_EnrichmentHeatmap(sample = sample, 
                             input_gene_list = genes, 
                             ncores = 1, 
                             flavor = "UCell", 
                             storeRanks = TRUE)

With it, I got the following plot:
e419b6cc-b883-4c60-9e4b-f4cbdcbce610

While with Seurat's AddModuleScore:
cca4415d-5957-4d6a-946a-4ab55fcd9396

If it also works as intended for you, then I will do some more aesthetic tweaks and I will add it to the next CRAN update!

A couple of notes though:

  • You need to have R version higher or equal to 4.2.0.
  • You need UCell installed.

Looking forward to your feedback!

Enrique

from scpubr.

cnk113 avatar cnk113 commented on June 15, 2024

Hey Enrique,

I'm getting this error when I run it without the UCell parameter:
SCpubr::do_EnrichmentHeatmap(sample = first, group.by = 'clusters', input_gene_list = sigs)

Error in `[.data.frame`([email protected], , col_name) : 
  undefined columns selected

Do you know why this occurs?

Best,
Chang

from scpubr.

enblacar avatar enblacar commented on June 15, 2024

Hi @cnk113,

Hmm, interesting. Does this happen, under the same parameters, when flavor = "UCell"? Can you maybe double-check if group.by is a metadata variable without NAs and sigs is a named vector?

I will have a look also to the code, but so far it works for me in any combination I provide.

Best,
Enrique

from scpubr.

cnk113 avatar cnk113 commented on June 15, 2024

Ah my named lists had characters that would change in the UCell names due to naming issues. It works!

from scpubr.

cnk113 avatar cnk113 commented on June 15, 2024

image
So something to note, I was wondering if we could get max enrichment percentile cutoff over the group.by metadata? This way we can see the most enriched sig per cluster?
As you can see here the other clusters don't look as enriched due to an outlier and I think the module scores are relative values so I don't see an issue with doing the cutoffs per cluster?

from scpubr.

enblacar avatar enblacar commented on June 15, 2024

Hi @cnk113,

Glad to hear it worked for you!

I do not fully understand what you are trying to suggest here, but it gave me another idea that might work as well as what you say. In the last commit, I implemented a min.cutoff and max.cutoff parameter, which will let you subset the color scale to set the min or max values to a given one. The values have to be comprised in the absolute max or min values in the enrichment matrix.

This is a change affecting all the clusters at the same time, not a single one. But this is basically the aim of the visualization, to put the enrichment in a heatmap and compare between clusters.

Here you have some examples:

# Original heatmap.
SCpubr::do_EnrichmentHeatmap(sample = sample, 
                             input_gene_list = genes, 
                             ncores = 1, 
                             flavor = "UCell", 
                             storeRanks = TRUE)

78897747-9f19-42ea-ab2e-7f95690b52d0

# Set a max value for the scale.
SCpubr::do_EnrichmentHeatmap(sample = sample, 
                             input_gene_list = genes, 
                             ncores = 1, 
                             flavor = "UCell", 
                             storeRanks = TRUE,
                             max.cutoff = 0.5)

9d7bbcdb-07d6-49c8-9cee-b2e5f5642abb

# Set a min value for the scale.
SCpubr::do_EnrichmentHeatmap(sample = sample, 
                             input_gene_list = genes, 
                             ncores = 1, 
                             flavor = "UCell", 
                             storeRanks = TRUE,
                             min.cutoff = 0.5)

194768a3-e3f7-4bbe-81fb-3364fa23a116

# Set a min and a max value for the scale
SCpubr::do_EnrichmentHeatmap(sample = sample, 
                             input_gene_list = genes, 
                             ncores = 1, 
                             flavor = "UCell", 
                             storeRanks = TRUE,
                             min.cutoff = 0.2,
                             max.cutoff = 0.5)

d60cdeaf-117c-429b-aa77-69ea3c77fc0c

Please install the commit using:

devtools::install_github("enblacar/SCpubr", ref = "52429ab0e0dc1d99450f6807bb840f392a577e08")

And be aware this is a dev version so the code might break. Let me know if this works for you! The changes will appear in the next CRAN update.

Best,
Enrique

from scpubr.

cnk113 avatar cnk113 commented on June 15, 2024

Ok this works for me! Thanks for the quick turnaround.

Best,
Chang

from scpubr.

cnk113 avatar cnk113 commented on June 15, 2024

Ah one more thing, could you perhaps have cutoffs also applicable to your other heatmaps like pathways/TF?

from scpubr.

enblacar avatar enblacar commented on June 15, 2024

Hi @cnk113,

Happy to hear it worked for you! I have added min.cutoff and max.cutoff behaviour to all the rest of heatmap functions.

You can access this by:

devtools::install_github("enblacar/SCpubr", ref = "c6e4f7bbc635d49ec349c7b2c4832a5e144745e1")

All the changes will become part of the next CRAN update.

Closing this Issue for now. Thanks for your feedback!
Enrique

from scpubr.

enblacar avatar enblacar commented on June 15, 2024

All the changes have been implemented in SCpubr v1.0.3, currently available on CRAN.

Best,
Enrique

from scpubr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.