Skip to content

Tweaks (single cell phyloset and more)#74

Merged
nifets merged 14 commits into
masterfrom
sc-phyex-tweaks
Sep 19, 2025
Merged

Tweaks (single cell phyloset and more)#74
nifets merged 14 commits into
masterfrom
sc-phyex-tweaks

Conversation

@nifets

@nifets nifets commented Aug 22, 2025

Copy link
Copy Markdown
Member

still WIP

left to do:

  • add phylostrata labels to x axis of strata distribution plot
  • cache pseudobulking in sc obj
  • cache TAI computation in sc obj
  • parallelise computation of pseudobulking and TAI

@nifets nifets self-assigned this Aug 22, 2025
@LotharukpongJS

Copy link
Copy Markdown
Collaborator

Hi @nifets ,
While doing an unrelated analysis, I thought it could be good to multiply the expression values by 2 (or something between 2 and 10) prior to rounding for the rlog or vst transformation. This would preserve more information for the lower expression values, especially TPM.

ct[["vst"]] <- \(x) DESeq2::vst(round(x, digits=0))
ct[["rlog"]] <- \(x) DESeq2::rlogTransformation(round(x, digits=0))

DESeq2::vst(round(x*1, digits=0))
Screenshot 2025-08-28 at 11 46 19

DESeq2::vst(round(x*2, digits=0))
Screenshot 2025-08-28 at 11 56 58

DESeq2::vst(round(x*10, digits=0))
Screenshot 2025-08-28 at 11 46 02

where x is expression data of class "matrix" "array". For the histogram, I am just showing the fourth column.

Let me know what you think :)

Best,
Sodai

@nifets

nifets commented Aug 28, 2025

Copy link
Copy Markdown
Member Author

Hi @nifets , While doing an unrelated analysis, I thought it could be good to multiply the expression values by 2 (or something between 2 and 10) prior to rounding for the rlog or vst transformation. This would preserve more information for the lower expression values, especially TPM.

ct[["vst"]] <- \(x) DESeq2::vst(round(x, digits=0))
ct[["rlog"]] <- \(x) DESeq2::rlogTransformation(round(x, digits=0))

DESeq2::vst(round(x*1, digits=0)) Screenshot 2025-08-28 at 11 46 19

DESeq2::vst(round(x*2, digits=0)) Screenshot 2025-08-28 at 11 56 58

DESeq2::vst(round(x*10, digits=0)) Screenshot 2025-08-28 at 11 46 02

where x is expression data of class "matrix" "array". For the histogram, I am just showing the fourth column.

Let me know what you think :)

Best, Sodai

Hi Sodai, yes we can definitely do that I think!

LotharukpongJS and others added 8 commits August 28, 2025 17:12
Updated vst and rlog transformation functions to multiply input by 2 before rounding for lower expression value handling.
Refers to #74 (comment)
…aching for pseudobulk and tai computation, implemented pseudobulk and tai in rcpp, made identity management more principled, added option in plot gene heatmap to specify custom gene annotation and colours.
@nifets

nifets commented Sep 18, 2025

Copy link
Copy Markdown
Member Author

Okay, I think I am ready to merge this to master. I have made quite a few changes to the single cell object. The main one is that it no longer wraps around Seurat, but uses the count matrix directly. So we are decoupled from Seurat now (but the user can still build a sc phyloset from seurat if they choose to). The TAI computation for single cell is now cached. I also tried to cache the pseudobulking but I couldn't find an elegant way to do it with S7. I might come back to this in the future. If the user wants to, they can precache the pseudobulk by setting p@.pseudobulk_cache[[identity]] for the grouping they want to cache. I think it would be nice to expand the vignette for single cell or maybe make a new single cell vignette that goes over every feature of the object. I think it's in a stable place now.

And generally I think we can probably push this to CRAN relatively soon. Maybe there are some things which could benefit from more documentation and/or useful messages. I have added back the messages in plot signature but maybe there are other places that would benefit. And I'm still not 100% happy with the single cell plot signature plots, I think we could make them more readable still.

@nifets
nifets merged commit b729e7b into master Sep 19, 2025
3 checks passed
@nifets
nifets deleted the sc-phyex-tweaks branch September 19, 2025 13:45
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

Successfully merging this pull request may close these issues.

2 participants