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

taxa_barplot plots all taxa as remainder when a sample has 0 reads #47

Open
jthmiller opened this issue Jul 14, 2022 · 0 comments
Open

Comments

@jthmiller
Copy link

Very low priority but easy update: if there are any failed samples (0 reads) for taxa_barplot, the normalization functions produce NaNs from dividing by zero. This results in all taxa plotted as 'remainder'. I imagine that most would filter out samples with no reads before plotting. But, if taxa_barplot is used for diagnostics in a pipeline (as we do), it can be a difficult to determine why it is happening. I overwrite the qiime2R::make_proportion function to return the 0's for failed samples.

make_proportion2 <- function (features) 
{
    features <- apply(features, 2, function(x) {
        if (sum(x) > 0) { x/sum(x) } else { x }
    })
    return(features)
}

assignInNamespace("make_proportion", value = make_proportion2, ns = "qiime2R")

The same could be done with make_percent
Thanks!

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

No branches or pull requests

1 participant