Skip to content

Commit

Permalink
Fixes #135, check for number of variables in sample_type
Browse files Browse the repository at this point in the history
  • Loading branch information
borauyar committed Nov 7, 2023
1 parent da0c584 commit 80ee4c9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion scripts/counts_matrix_from_SALMON.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ writeCounts <- function(colDataFile, salmon_output_folder, counts_dir, type) {
names(files) <- rownames(colData)
txi <- tximport::tximport(files, type = "salmon", txOut = TRUE)

dds <- DESeq2::DESeqDataSetFromTximport(txi, colData, ~group)
if(length(unique(colData$sample_type)) < 2) {
dds <- DESeq2::DESeqDataSetFromTximport(txi, colData, ~1)
} else {
dds <- DESeq2::DESeqDataSetFromTximport(txi, colData, ~group)
}

#save raw counts
write.table(x = DESeq2::counts(dds),
Expand Down

0 comments on commit 80ee4c9

Please sign in to comment.