From cacbd3ab0449ebb5af9e92fc58d0f81832b6ab1a Mon Sep 17 00:00:00 2001 From: Ryan Routsong Date: Tue, 20 Aug 2024 16:31:12 -0400 Subject: [PATCH] fix: pathing in rmarkdown and syntax in prep_diffbind --- bin/DiffBind_v2_ChIPseq_block.Rmd | 11 ++++++----- bin/prep_diffbind.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/bin/DiffBind_v2_ChIPseq_block.Rmd b/bin/DiffBind_v2_ChIPseq_block.Rmd index a31c3f0..68b9f6a 100755 --- a/bin/DiffBind_v2_ChIPseq_block.Rmd +++ b/bin/DiffBind_v2_ChIPseq_block.Rmd @@ -25,6 +25,7 @@ params: # global variables dateandtime <- format(Sys.time(), "%a %b %d %Y - %X") csvfile <- params$csvfile +outbase <- dirname(csvfile) contrasts <- params$contrasts peakcaller <- params$peakcaller @@ -238,9 +239,9 @@ tryDeseqExport <- function(DBReportDeseq2, outfile2) { ) } -tryDeseqExport(DBReportDeseq2, outfile2) +tryDeseqExport(DBReportDeseq2, file.path(outbase, outfile2)) -write.table(DBReportDeseq2, outfile, quote=F, sep="\t", row.names=F) +write.table(DBReportDeseq2, file.path(outbase, outfile), quote=F, sep="\t", row.names=F) D2i <- length(DBReportDeseq2) if (D2i == 0) { i=1 @@ -255,7 +256,7 @@ report2 <- dba.report(DBAnalysisDeseq2,method = DBA_DESEQ2_BLOCK, th=100,bNormalized=T,bFlip=FALSE,precision=0) outfile3 <- paste0(contrasts, "-", peakcaller, deseq2_bed_fullist) -write.table(report2, outfile3, quote=F, sep="\t", row.names=F) +write.table(report2, file.path(outbase, outfile3), quote=F, sep="\t", row.names=F) ``` ### EdgeR {-} @@ -278,7 +279,7 @@ tryEdgeRExport <- function(edger_report, fout) { tryEdgeRExport(DBReportEdgeR, file.path(outbase, outfile2)) -write.table(DBReportEdgeR, outfile, quote=F, sep="\t", row.names=F) +write.table(DBReportEdgeR, file.path(outbase, outfile), quote=F, sep="\t", row.names=F) Ei <- length(DBReportEdgeR) if (Ei == 0) { i=1 @@ -292,7 +293,7 @@ try(DT::datatable(data.frame(DBReportEdgeR)[1:i,], rownames=F), silent=TRUE) report2 <- dba.report(DBAnalysisEdgeR,method = DBA_EDGER_BLOCK, th=100,bNormalized=T,bFlip=FALSE,precision=0) outfile3 <- paste0(contrasts, "-", peakcaller, edger_bed_fullist) -write.table(report2, outfile3, quote=F, sep="\t", row.names=F) +write.table(report2, file.path(outbase, outfile3), quote=F, sep="\t", row.names=F) ``` ## R tool version information diff --git a/bin/prep_diffbind.py b/bin/prep_diffbind.py index fd1f46f..235c3e4 100755 --- a/bin/prep_diffbind.py +++ b/bin/prep_diffbind.py @@ -6,7 +6,7 @@ def main(group1, group2, peaktool, peakext, peakcaller, csvfile, wp, bam_dir): - config=json.load(open(join(wp, "config.json")) + config = json.load(open(join(wp, "config.json"))) chip2input = config['project']['peaks']['inputs'] groupdata = config['project']['groups'] blocks = config['project']['blocks']