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

[Feature Request] Re-export / migration of quiet[BT]CRgenes() & alternative quieting method #452

Closed
Qile0317 opened this issue Dec 5, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request

Comments

@Qile0317
Copy link
Collaborator

Qile0317 commented Dec 5, 2024

@ncborcherding I feel that it may make more sense to either re-export or migrate the Trex and Ibex quiet[BT]CRgenes functions to scRepertoire, since this is much more known so people would likely have a higher chance of finding this functionality.

Additionally, I also think the following alternative may be superior than simply removing variable genes after already running FindVariableFeatures:

  1. get the assay object of interest as a copy
  2. for all rows on the assay copy that correspond to features that shouldn't factor into the VariableFeatures calculation, set them to 0
  3. run seurat's findvariablefeatures
  4. set the variable features vector of the actual assay itself to the result of 3, and discard the assay copy

I believe that the advantage here is that Seurat is further able to use less variable but still potentially relevant features that were originally ranked below the filtered features - in some cases this may help with excessive features being removed without needing to re-run FindVariableFeatures with a larger nFeatures argument.

Let me know what you think and I can PR immediately. Here is an example of what the function body could look like:

contigGenes <- rownames(seuratObject) %>%
    Ibex::quietBCRgenes() %>%
    Trex::quietTCRgenes()
contigGeneIndices <- which(rownames(seuratObject) %!in% contigGenes)

VariableFeatures(seuratObject) <- GetAssay(seuratObject, "RNA") %>%
    GetAssayData() %>%
    setRow(contigGeneIndices, 0) %>%
    CreateAssayObject() %>%
    FindVariableFeatures(
        selection.method = "mean.var.plot",
        nfeatures = 2000,
        mean.cutoff = c(0.1, Inf),
        dispersion.cutoff = c(0.5, Inf)
    ) %>%
    VariableFeatures()
seuratObject
@Qile0317 Qile0317 changed the title [Feature Request] Re-export / migration of quiet[BT]CRgenes & alternative quieting method [Feature Request] Re-export / migration of quiet[BT]CRgenes() & alternative quieting method Dec 5, 2024
@ncborcherding
Copy link
Member

I think this makes sense - Ibex and Trex rely on data that has been formatted with scRepertoire, so dependencies wouldn't be an issue.

@Qile0317 Qile0317 self-assigned this Dec 5, 2024
@Qile0317 Qile0317 added the enhancement New feature or request label Dec 5, 2024
@Qile0317
Copy link
Collaborator Author

Qile0317 commented Dec 5, 2024

@ncborcherding Great - theres a few details I'm still considering but I'll PR a preliminary version in all 3 repos.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants