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

Fix contrast pairs #250

Merged
merged 5 commits into from
Nov 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## dev

### Added

- [#250](https://github.com/qbic-pipelines/rnadeseq/pull/250) Added clearer error message for incorrect contrast_pairs

### Fixed

- [#250](https://github.com/qbic-pipelines/rnadeseq/pull/250) Fixed incorrect reading and indexing of contrast_pairs

## 2.4 - A Pair of Shoes

### Added
Expand Down
14 changes: 8 additions & 6 deletions assets/RNAseq_report.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -1526,19 +1526,21 @@ if (isProvided(params$path_contrast_list)) {
contrast_names <- append(contrast_names, contname)
}
}

if (isProvided(params$path_contrast_pairs)) {
contrasts <- read.table(path_contrast_pairs, sep="\t", header = T, colClasses = "character")
contrasts <- read.table(params$path_contrast_pairs, sep="\t", header = T, colClasses = "character")
write.table(contrasts, file="differential_gene_expression/metadata/contrast_pairs.tsv", sep="\t", quote=F, col.names = T, row.names = F)

# Contrast calculation for contrast pairs
for (i in c(1:nrow(contrasts))) {
cont <- as.character(contrasts[i,])
contname <- cont[0]
if (!(cont[2] %in% coefficients & cont[3] %in% coefficients)){
stop(paste("Provided contrast name is invalid, it needs to be contained in", coefficients))
contname <- cont[1]
if (!(cont[2] %in% coefficients)){
stop(paste0("Provided contrast name ", cont[2], " is invalid, it needs to be contained in ", paste(coefficients, collapse=", ")))
}
if (!(cont[3] %in% coefficients)){
stop(paste0("Provided contrast name ", cont[3], " is invalid, it needs to be contained in ", paste(coefficients, collapse=", ")))
}
results_DEseq_contrast <- results(cds, contrast=list(cont[1],cont[2]))
results_DEseq_contrast <- results(cds, contrast=list(cont[2],cont[3]))
results_DEseq_contrast <- as.data.frame(results_DEseq_contrast)
print("Analyzing contrast:")
print(contname)
Expand Down
Loading