CW-1167: error if conditionsheet and sample sheet dont match

This commit is contained in:
Sarah Griffiths 2022-11-15 14:59:43 +00:00
parent 248ecdb55b
commit a111cae834
7 changed files with 16 additions and 7 deletions

View File

@ -10,6 +10,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- Demo differential expression data in repository.
- Improved DE explanation in docs
### Fixed
- Error if condition sheet and sample sheet don't match.
## [v0.1.5]
### Added

View File

@ -206,14 +206,14 @@ Differential Expression requires at least 2 replicates of each sample to compare
#### Condition sheet
The condition sheet should be a .tsv with two columns.
- The sample column will need to match the 6 directories in the input fastq directory.
- The sample_id column will need to match the 6 directories in the input fastq directory, if you are additionally using a sample_sheet they will need to correspond to the sample_ids in that.
- The condition column will need to contain one of two keys to indicate the two samples being compared.
In the default `condition_sheet.tsv` available in the test_data directory we have used the following.
eg. condition_sheet.tsv
```
sample,condition
sample_id,condition
barcode01,untreated
barcode02,untreated
barcode03,untreated

View File

@ -7,7 +7,8 @@ cat("Loading counts, conditions and parameters.\n")
cts <- as.matrix(read.csv("merged/all_counts.tsv", sep="\t", row.names="Reference", stringsAsFactors=FALSE))
# Set up sample data frame:
coldata <- read.csv("de_analysis/coldata.tsv", row.names="sample", sep=",", stringsAsFactors=TRUE)
#changed this to sample_id
coldata <- read.csv("de_analysis/coldata.tsv", row.names="sample_id", sep=",", stringsAsFactors=TRUE)
coldata$sample_id <- rownames(coldata)
coldata$condition <- factor(coldata$condition, levels=rev(levels(coldata$condition)))

View File

@ -5,7 +5,7 @@ suppressMessages(library(ggplot2))
suppressMessages(library(tidyr))
# Set up sample data frame:
coldata <- read.csv("de_analysis/coldata.tsv", row.names="sample", sep=",")
coldata <- read.csv("de_analysis/coldata.tsv", row.names="sample_id", sep=",")
coldata$sample_id <- rownames(coldata)
coldata$condition <- factor(coldata$condition, levels=rev(levels(coldata$condition)))
coldata$type <-NULL

View File

@ -124,14 +124,14 @@ Differential Expression requires at least 2 replicates of each sample to compare
#### Condition sheet
The condition sheet should be a .tsv with two columns.
- The sample column will need to match the 6 directories in the input fastq directory.
- The sample_id column will need to match the 6 directories in the input fastq directory, if you are additionally using a sample_sheet they will need to correspond to the sample_ids in that.
- The condition column will need to contain one of two keys to indicate the two samples being compared.
In the default `condition_sheet.tsv` available in the test_data directory we have used the following.
eg. condition_sheet.tsv
```
sample,condition
sample_id,condition
barcode01,untreated
barcode02,untreated
barcode03,untreated

View File

@ -471,6 +471,11 @@ workflow pipeline {
transcriptome = ref_transcriptome
gtf = Channel.fromPath(ref_annotation)
}
check_match = Channel.fromPath(params.condition_sheet)
check_condition_sheet = check_match.splitCsv(header: true).map{ row -> tuple(
row.sample_id)
}
check_condition_sheet.join(summariseConcatReads.out.input_reads, failOnMismatch: true)
de = differential_expression(transcriptome, summariseConcatReads.out.input_reads, condition_sheet, gtf)
de_report = de.all_de
count_transcripts_file = de.count_transcripts

View File

@ -1,6 +1,7 @@
sample,condition
sample_id,condition
barcode01,untreated
barcode02,untreated
barcode03,untreated
barcode04,treated
barcode05,treated
barcode06,treated

1 sample,condition sample_id,condition
2 barcode01,untreated barcode01,untreated
3 barcode02,untreated barcode02,untreated
4 barcode03,untreated
5 barcode04,treated barcode04,treated
6 barcode05,treated barcode05,treated
7 barcode06,treated barcode06,treated