Skip to content

Commit

Permalink
fix: Handle zero-sum samples in generate_taxa_test_single
Browse files Browse the repository at this point in the history
- Add check for samples with zero total counts after filtering
- Remove samples with zero counts before running linda analysis
- Prevent NA values during TSS normalization
- Fix Issue #69

Co-Authored-By: jrotzetter <[email protected]>
  • Loading branch information
cafferychen777 and jrotzetter committed Nov 8, 2024
1 parent 98f7c0d commit 0e7f17f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions R/generate_taxa_test_single.R
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,13 @@ generate_taxa_test_single <- function(data.obj,
mStat_filter(prev.filter = prev.filter,
abund.filter = abund.filter)

# Add this check before linda analysis
if (any(colSums(otu_tax_agg_filter) == 0)) {
keep_samples <- colSums(otu_tax_agg_filter) > 0
otu_tax_agg_filter <- otu_tax_agg_filter[, keep_samples]
meta_tab <- meta_tab[keep_samples, ]
}

# Perform LinDA (Linear models for Differential Abundance) analysis
linda.obj <- linda(
feature.dat = otu_tax_agg_filter,
Expand Down

0 comments on commit 0e7f17f

Please sign in to comment.