Merge branch 'CW-2308' into 'dev'
CW-2308 remove real path use Closes CW-2308 See merge request epi2melabs/workflows/wf-transcriptomes!107
This commit is contained in:
commit
ea2dde72df
@ -2,6 +2,13 @@
|
|||||||
|
|
||||||
suppressMessages(library("DRIMSeq"))
|
suppressMessages(library("DRIMSeq"))
|
||||||
suppressMessages(library("GenomicFeatures"))
|
suppressMessages(library("GenomicFeatures"))
|
||||||
|
args <- commandArgs(trailingOnly=TRUE)
|
||||||
|
ref_annotation <- args[1]
|
||||||
|
min_samps_gene_expr <- args[2]
|
||||||
|
min_samps_feature_expr <- args[3]
|
||||||
|
min_gene_expr <- args[4]
|
||||||
|
min_feature_expr <- args[5]
|
||||||
|
annotation_type <- args[6]
|
||||||
|
|
||||||
cat("Loading counts, conditions and parameters.\n")
|
cat("Loading counts, conditions and parameters.\n")
|
||||||
cts <- as.matrix(read.csv("merged/all_counts.tsv", sep="\t", row.names="Reference", stringsAsFactors=FALSE))
|
cts <- as.matrix(read.csv("merged/all_counts.tsv", sep="\t", row.names="Reference", stringsAsFactors=FALSE))
|
||||||
@ -13,12 +20,9 @@ coldata <- read.csv("de_analysis/coldata.tsv", row.names="sample_id", sep=",", s
|
|||||||
coldata$sample_id <- rownames(coldata)
|
coldata$sample_id <- rownames(coldata)
|
||||||
coldata$condition <- factor(coldata$condition, levels=rev(levels(coldata$condition)))
|
coldata$condition <- factor(coldata$condition, levels=rev(levels(coldata$condition)))
|
||||||
|
|
||||||
de_params <- read.csv("de_analysis/de_params.tsv", sep="\t", stringsAsFactors=FALSE)
|
|
||||||
|
|
||||||
cat("Loading annotation database.\n")
|
cat("Loading annotation database.\n")
|
||||||
|
|
||||||
annotationtype <- de_params$annotation_type[[1]]
|
txdb <- makeTxDbFromGFF(ref_annotation, format = annotation_type)
|
||||||
txdb <- makeTxDbFromGFF("annotation.gtf", format = annotationtype)
|
|
||||||
txdf <- select(txdb, keys(txdb,"GENEID"), "TXNAME", "GENEID")
|
txdf <- select(txdb, keys(txdb,"GENEID"), "TXNAME", "GENEID")
|
||||||
tab <- table(txdf$GENEID)
|
tab <- table(txdf$GENEID)
|
||||||
txdf$ntx<- tab[match(txdf$GENEID, names(tab))]
|
txdf$ntx<- tab[match(txdf$GENEID, names(tab))]
|
||||||
@ -47,8 +51,8 @@ cat("Filtering counts using DRIMSeq.\n")
|
|||||||
d <- dmDSdata(counts=counts, samples=coldata)
|
d <- dmDSdata(counts=counts, samples=coldata)
|
||||||
trs_cts_unfiltered <- counts(d)
|
trs_cts_unfiltered <- counts(d)
|
||||||
|
|
||||||
d <- dmFilter(d, min_samps_gene_expr = de_params$min_samps_gene_expr[[1]], min_samps_feature_expr = de_params$min_samps_feature_expr[[1]],
|
d <- dmFilter(d, min_samps_gene_expr = min_samps_gene_expr, min_samps_feature_expr = min_samps_feature_expr,
|
||||||
min_gene_expr = de_params$min_gene_expr[[1]], min_feature_expr = de_params$min_feature_expr[[1]])
|
min_gene_expr = min_gene_expr, min_feature_expr = min_feature_expr)
|
||||||
|
|
||||||
cat("Building model matrix.\n")
|
cat("Building model matrix.\n")
|
||||||
design <- model.matrix(~condition, data=DRIMSeq::samples(d))
|
design <- model.matrix(~condition, data=DRIMSeq::samples(d))
|
||||||
|
|||||||
2
main.nf
2
main.nf
@ -505,6 +505,8 @@ workflow pipeline {
|
|||||||
stats = reads.map {
|
stats = reads.map {
|
||||||
it[2] ? it[2].resolve('per-read-stats.tsv') : null
|
it[2] ? it[2].resolve('per-read-stats.tsv') : null
|
||||||
}
|
}
|
||||||
|
| collectFile ( keepHeader: true )
|
||||||
|
| ifEmpty ( OPTIONAL_FILE )
|
||||||
|
|
||||||
if (!params.direct_rna){
|
if (!params.direct_rna){
|
||||||
preprocess_reads(input_reads)
|
preprocess_reads(input_reads)
|
||||||
|
|||||||
@ -46,7 +46,7 @@ process deAnalysis {
|
|||||||
input:
|
input:
|
||||||
path condition_sheet
|
path condition_sheet
|
||||||
path merged_tsv
|
path merged_tsv
|
||||||
path annotation
|
path "annotation.gtf"
|
||||||
output:
|
output:
|
||||||
path "de_analysis/results_dtu_stageR.tsv", emit: stageR
|
path "de_analysis/results_dtu_stageR.tsv", emit: stageR
|
||||||
path "merged/all_counts_filtered.tsv", emit: flt_counts
|
path "merged/all_counts_filtered.tsv", emit: flt_counts
|
||||||
@ -61,17 +61,12 @@ process deAnalysis {
|
|||||||
annotation_type = "gff3"
|
annotation_type = "gff3"
|
||||||
}
|
}
|
||||||
"""
|
"""
|
||||||
cp $annotation annotation.gtf
|
|
||||||
echo \$(realpath annotation.gtf)
|
|
||||||
echo Annotation\$'\t'min_samps_gene_expr\$'\t'min_samps_feature_expr\$'\t'min_gene_expr\$'\t'min_feature_expr\$'\t'annotation_type > params.tsv
|
|
||||||
echo \$(realpath $params.ref_annotation)\$'\t'$params.min_samps_gene_expr\$'\t'\
|
|
||||||
$params.min_samps_feature_expr\$'\t'$params.min_gene_expr\$'\t'$params.min_feature_expr\$'\t'$annotation_type >> params.tsv
|
|
||||||
mkdir merged
|
mkdir merged
|
||||||
mkdir de_analysis
|
mkdir de_analysis
|
||||||
mv $merged_tsv merged/all_counts.tsv
|
mv $merged_tsv merged/all_counts.tsv
|
||||||
mv params.tsv de_analysis/de_params.tsv
|
|
||||||
mv $condition_sheet de_analysis/coldata.tsv
|
mv $condition_sheet de_analysis/coldata.tsv
|
||||||
de_analysis.R
|
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
|
||||||
|
|
||||||
"""
|
"""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user