ncborcherding / scRepertoire

A toolkit for single-cell immune profiling
https://www.borch.dev/uploads/screpertoire/
MIT License
310 stars 54 forks source link

measure of clonal expansion #101

Closed Sa753 closed 3 years ago

Sa753 commented 3 years ago

Dear Nick,

Sorry if this is naive question. Which function in the package can closely calculate clonal expansion per sample as in the bulk TCR data, please?

Thank you

ncborcherding commented 3 years ago

Hey Sa753,

My quess is you mean something like the clonalHomeostasis() function? You can find out more here. But it you have something else in mind, let me know and I can direct you better.

Thanks, Nick

Sa753 commented 3 years ago

In bulk TCR sequencing, they refer to clonal expansion as 1-entropy but I wasn't sure if that applies to single cell or not. you can see this in those 2 paper https://doi.org/10.1038/s41588-020-0630-5 https://www.cell.com/iscience/pdf/S2589-0042(21)00021-3.pdf

Is that the same as clonal homeostasis?

ncborcherding commented 3 years ago

No there is not a metric for corrected entropy as a measure of clonality. I will actually add this to a list of to-dos for future implementation.

Sa753 commented 3 years ago

That will be very helpful please also if there is a way to interact or be comparable with bulk TCR seq data. Thank you

Sa753 commented 3 years ago

Sorry One more question, when I add TCR data to Seurat object using combineExpression() then do table(seurat_tcr$cloneType), I only get the clonal cells but not the NA

however , when I draw, a UMAP, I get NA in the figure legend and colour, so why is this discrepency inspite of using the same Seurat object and same metadata slot? Thanks

ncborcherding commented 3 years ago

This is confusing but it is a product of the base function table() - which automatically excludes na values, you can change this by entering:

table(seurat_tcr$cloneType, useNA = "always")

Sa753 commented 3 years ago

Thank you, that makes sense.

It maybe good to have an option to show or not the NA on the occupiedscRepertoire() plot, if possible as they sometimes represent large percentage of the cells in a particular cluster and this may have significance

Sa753 commented 3 years ago

Dear Nick,

I actually found a measure of clonal expansion in startrac package that you incorporated in your work.... It is explained in the methods how it is done and seems similar mathematically similar to the bulk TCR but more stringent. May I ask how can I do pairwise index comparisons in your function similar to startrac?

Thx

ncborcherding commented 3 years ago

Unfortunately, I do not see a way to use Startrac methods per-say in a pairwise comparison. The method incorporates entropy, but the 3 metrics it calculates relies on sample, tissue and cluster specific information derived from the Seurat or single-cell object.

Sa753 commented 3 years ago

Ok thanks so much

ncborcherding commented 3 years ago

The inverse Pielou's eveness metric is now implemented in the clonalDiversity() - so this essentially is 1 - shannon entropy/ln(length of clones), what you linked to above. Thanks for the suggestion.

Sa753 commented 3 years ago

HI Nick,

Does that replace Shannon diversity calculated by this function?. How is that in the clonalDiversity() function?. 1-shannon entropy is a measure of clonal expansion not diversity

What does clonalDiversity() now calculates? Thanks

ncborcherding commented 3 years ago

No, just adds a 5th metric to clonalDiversity().

Pielou's eveness metric is a measure of diversity. It is based on the shannon entropy and the length of the unique clonal repertoire being analyzed. The articles you cited actually don't use 1-shannon entropy for clonality, but rather 1- normalized entropy value (Pielou's eveness). To me, it fits within the clonalDiversity(), which has the added benefit of automatically bootstrapping the values.

That being said, it looks like Pielou's eveness metric is used by some in the AIRR field for clonality (it is not universal), by adding it to the clonalDiversity(), I don't create additional dependencies and users can use it for whatver they'd like.

This was my thought process.

Sa753 commented 3 years ago

Hi Nick,

Yes you are correct. the clonality is 1- normalised Shannon entropy (sorry for my typo above). but that means that 1- pielou 's evenness is a clonal expansion measure but Pielou ' evens itself is a diversity measure . is that what you meant?