liger icon indicating copy to clipboard operation
liger copied to clipboard

getProportionMito() is currently mouse-specific

Open jowkar opened this issue 2 years ago • 1 comments

The function getProportionMito() is currently written such that it expects mouse gene symbols (i.e., lower case). See the second line in the body of the function code below. Could be fixed by making the grep pattern a parameter perhaps, with either "^mt-" or "^MT-" as default.

function (object, use.norm = FALSE) 
{
    all.genes <- Reduce(union, lapply([email protected], rownames))
    mito.genes <- grep(pattern = "^mt-", x = all.genes, value = TRUE)
    data.use <- [email protected]
    if (use.norm) {
        data.use <- [email protected]
    }
    percent_mito <- unlist(lapply(unname(data.use), function(x) {
        colSums(x[mito.genes, ])/colSums(x)
    }), use.names = TRUE)
    return(percent_mito)
}

Suggestion:

function (object, use.norm = FALSE, mito_pattern = "^mt-") 
{
    all.genes <- Reduce(union, lapply([email protected], rownames))
    mito.genes <- grep(pattern = mito_pattern, x = all.genes, value = TRUE)
    data.use <- [email protected]
    if (use.norm) {
        data.use <- [email protected]
    }
    percent_mito <- unlist(lapply(unname(data.use), function(x) {
        colSums(x[mito.genes, ])/colSums(x)
    }), use.names = TRUE)
    return(percent_mito)
}

jowkar avatar Oct 05 '22 05:10 jowkar

Hi @jowkar,

This is a great suggestion! Really appreciate it. We will look into this and make a modification.

Best,

cgao90 avatar Oct 14 '22 18:10 cgao90