Merge branch 'CW-3516' into 'dev'
Remove need to retry based on GTF/GFF Closes CW-3516 See merge request epi2melabs/workflows/wf-transcriptomes!162
This commit is contained in:
commit
914c4a0c58
@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
|
||||
## [unreleased]
|
||||
### Changed
|
||||
- Improved handling of different annotation file types (eg. `.gtf/.gff/.gff3`) in `de_analysis` mode.
|
||||
- Improved handling of annotation files that do not contain version numbers in transcript_id (such as gtf's from Ensembl).
|
||||
### Fixed
|
||||
- Differential expression failing with 10 or more samples.
|
||||
|
||||
@ -9,7 +9,6 @@ min_samps_gene_expr <- as.numeric(args[2])
|
||||
min_samps_feature_expr <- as.numeric(args[3])
|
||||
min_gene_expr <- as.numeric(args[4])
|
||||
min_feature_expr <- as.numeric(args[5])
|
||||
annotation_type <- args[6]
|
||||
|
||||
cat("Loading counts, conditions and parameters.\n")
|
||||
cts <- as.matrix(read.csv("all_counts.tsv", sep="\t", row.names="Reference", stringsAsFactors=FALSE))
|
||||
@ -25,6 +24,23 @@ if(!"control" %in% coldata$condition)
|
||||
condition - unable to set reference.")
|
||||
coldata$condition <- relevel(coldata$condition, ref = "control")
|
||||
|
||||
# a .gff annotation file extension may be gff2(gtf) or gff3 so check in files for use of = in the attribute field
|
||||
# if '=' present it is gff3 if not it is gtf.
|
||||
# see https://www.ensembl.org/info/website/upload/gff.html
|
||||
# and http://gmod.org/wiki/GFF2#Converting_GFF2_to_GFF3
|
||||
cat("Checking annotation file type.\n")
|
||||
lines <- readLines(file(ref_annotation), n=10000)
|
||||
# If transcript_id containing '=' (format eg. transcript_id=xxx)
|
||||
# annotation type is gff3
|
||||
check_file_type <- sum(grepl("transcript_id=", lines))
|
||||
if (check_file_type != 0){
|
||||
cat("Annotation file type is gff3.\n")
|
||||
annotation_type <- "gff3"
|
||||
} else {
|
||||
# otherwise gtf
|
||||
cat("Annotation file type is gtf.\n")
|
||||
annotation_type <- "gtf"
|
||||
}
|
||||
|
||||
# Transcript_id versions (eg. ENTXXX.1, eg. ENTXXX.2) represent how many times that transcript reference has been changed
|
||||
# during its time in the database.
|
||||
|
||||
@ -60,10 +60,6 @@ process mergeTPM {
|
||||
|
||||
process deAnalysis {
|
||||
label "isoforms"
|
||||
errorStrategy "retry"
|
||||
// Retry if it fails to make makeTxDbFromGFF
|
||||
// Because a file with .gff extension may be gff2(gtf) or gff3
|
||||
maxRetries 1
|
||||
cpus 4
|
||||
memory "16 GB"
|
||||
input:
|
||||
@ -79,17 +75,10 @@ process deAnalysis {
|
||||
path "de_analysis/results_dexseq.tsv", emit: dexseq
|
||||
path "de_analysis", emit: de_analysis
|
||||
path "de_analysis/cpm_gene_counts.tsv", emit: cpm
|
||||
script:
|
||||
// Just try both annotation file type because a .gff extension may be gff2(gtf) or gff3
|
||||
String annotation_type = "gtf"
|
||||
if (task.attempt == 2){
|
||||
annotation_type = "gff3"
|
||||
log.info("Retry deAnalysis with gff format setting.")
|
||||
}
|
||||
"""
|
||||
mkdir merged
|
||||
mkdir de_analysis
|
||||
de_analysis.R annotation.gtf $params.min_samps_gene_expr $params.min_samps_feature_expr $params.min_gene_expr $params.min_feature_expr $annotation_type
|
||||
de_analysis.R annotation.gtf $params.min_samps_gene_expr $params.min_samps_feature_expr $params.min_gene_expr $params.min_feature_expr
|
||||
"""
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user