CW-2308 remove real path use

This commit is contained in:
Sarah Griffiths 2023-06-28 17:37:49 +00:00
parent a730e13ac8
commit d0e7fc4b26
3 changed files with 15 additions and 14 deletions

View File

@ -2,6 +2,13 @@
suppressMessages(library("DRIMSeq"))
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")
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$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")
annotationtype <- de_params$annotation_type[[1]]
txdb <- makeTxDbFromGFF("annotation.gtf", format = annotationtype)
txdb <- makeTxDbFromGFF(ref_annotation, format = annotation_type)
txdf <- select(txdb, keys(txdb,"GENEID"), "TXNAME", "GENEID")
tab <- table(txdf$GENEID)
txdf$ntx<- tab[match(txdf$GENEID, names(tab))]
@ -47,8 +51,8 @@ cat("Filtering counts using DRIMSeq.\n")
d <- dmDSdata(counts=counts, samples=coldata)
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]],
min_gene_expr = de_params$min_gene_expr[[1]], min_feature_expr = de_params$min_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 = min_gene_expr, min_feature_expr = min_feature_expr)
cat("Building model matrix.\n")
design <- model.matrix(~condition, data=DRIMSeq::samples(d))

View File

@ -505,6 +505,8 @@ workflow pipeline {
stats = reads.map {
it[2] ? it[2].resolve('per-read-stats.tsv') : null
}
| collectFile ( keepHeader: true )
| ifEmpty ( OPTIONAL_FILE )
if (!params.direct_rna){
preprocess_reads(input_reads)

View File

@ -46,7 +46,7 @@ process deAnalysis {
input:
path condition_sheet
path merged_tsv
path annotation
path "annotation.gtf"
output:
path "de_analysis/results_dtu_stageR.tsv", emit: stageR
path "merged/all_counts_filtered.tsv", emit: flt_counts
@ -61,17 +61,12 @@ process deAnalysis {
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 de_analysis
mv $merged_tsv merged/all_counts.tsv
mv params.tsv de_analysis/de_params.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
"""
}