Skip to content

Commit

Permalink
Fix #134
Browse files Browse the repository at this point in the history
  • Loading branch information
apeltzer committed Mar 17, 2022
1 parent e5989ae commit 9adca2f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Other enhancements & fixes

* [#134](https://github.com/nf-core/smrnaseq/issues/134) - Fixed colSum of zero issues for edgeR_miRBase.R script

### Parameters

| Old parameter | New parameter |
Expand Down
7 changes: 5 additions & 2 deletions bin/edgeR_miRBase.r
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,14 @@ for (i in 1:2) {
# Remove genes with 0 reads in all samples
row_sub = apply(data, 1, function(row) all(row ==0 ))
# Only subset if at least one sample is remaining
nr_keep <- table(row_sub)
nr_keep <- sum(nr_keep == TRUE)
nr_keep <- sum(row_sub)
if (nr_keep > 0){
data<-data[!row_sub,]
}

#Also check for colSums > 0, otherwise DGEList will fail if samples have entirely colSum == 0 #Fixes #134
drop_colsum_zero <- (colSums(data, na.rm=T) != 0) # T if colSum is not 0, F otherwise
data <- data[, drop_colsum_zero] # all the non-zero columns

write.csv(t(data),file=paste(header,"_counts.csv",sep=""))

Expand Down

0 comments on commit 9adca2f

Please sign in to comment.