compbiomed / singleCellTK

Interactively analyze single cell genomic data
https://camplab.net/sctk/
Other
175 stars 77 forks source link

Providing a vector for the mitoID argument in runCellQC causes an error. #715

Open fitz-meyer opened 1 year ago

fitz-meyer commented 1 year ago

I am trying to provide custom mitochondrial geneIDs for QCMetrics in runCellQC like so:

library(singleCellTK)
library(tidyverse)

sce <- importCellRanger(sampleDirs = "Desktop/scRNAseq/cellranger_outs/mg1_c/",
                         dataType = c("filtered"),
                         matrixFileNames = "matrix.mtx.gz",
                         featuresFileNames = "features.tsv.gz",
                         barcodesFileNames = "barcodes.tsv.gz",
                         gzipped = TRUE)

mito_genes <- c("nbis-gene-5", "nbisL1-trna-20", "nbisL1-trna-6", 
                "nbisL1-trna-3", "nbisL1-trna-7", "nbisL1-trna-9", 
                "nbis-gene-2", "nbis-gene-3", "nbisL1-trna-10", 
                "nbisL1-trna-16", "nbisL1-trna-17", "nbis-gene-4", 
                "nbisL1-trna-19")

sce <- runCellQC(sce, sample = NULL, algorithms = "QCMetrics",
                 geneSetListLocation = "rownames",
                 mitoID = mito_genes,
                 mitoIDType = "symbol")

But it produces this error:

Error in (function (inSCE, useAssay = "counts", collectionName = NULL,  : 
  unused arguments (mitoID1 = "nbis-gene-5", mitoID2 = "nbisL1-trna-20", mitoID3 = "nbisL1-trna-6", mitoID4 = "nbisL1-trna-3", mitoID5 = "nbisL1-trna-7", mitoID6 = "nbisL1-trna-9", mitoID7 = "nbis-gene-2", mitoID8 = "nbis-gene-3", mitoID9 = "nbisL1-trna-10", mitoID10 = "nbisL1-trna-16", mitoID11 = "nbisL1-trna-17", mitoID12 = "nbis-gene-4", mitoID13 = "nbisL1-trna-19")

The documentation for mitoID states that it can accept a character vector of mito genes to be quantified. I have also tried reading the geneIDs in from a .txt file but this didn't change anything. Running mitoID = "nbis-gene-5" works as expected, but I need a way to identify all of those geneIDs as mitochondrial genes. I would prefer not to edit the .gtf file at this stage.

I am running SCTK version 2.8.0 on R version 4.3.1.

Cheers, Fitz

joshua-d-campbell commented 1 year ago

Hi @fitz-meyer, thanks for pointing this out. I was able to reproduce the error. We will work on fixing this in the next release. In the meantime, I believe you can run the following code to use your genes as a custom gene set:

sce <- runCellQC(sce, algorithms = "QCMetrics", mitoGeneLocation = NULL, mitoPrefix="$$", geneSetList = list(mito = mito_genes), geneSetListLocation = "rownames")

Note that by default it will still try to match with genes that start with "MT-". That is why I set mitoPrefix to something random like "$$" so it won't match anything.

Just let us know if you run into other issues.

fitz-meyer commented 1 year ago

Hi @joshua-d-campbell, Thanks for the reply, the suggested work around did the trick! Cheers, Fitz