Skip to content

Commit

Permalink
Merge pull request #344 from maxplanck-ie/ksikora_minor_fixe
Browse files Browse the repository at this point in the history
Ksikora minor fixe
  • Loading branch information
katsikora authored Nov 27, 2018
2 parents 040a189 + 6b56c4c commit 1c4c344
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion snakePipes/shared/rscripts/WGBS_stats_report_template.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ knitr::include_graphics(pval_plot)
```

Features were filtered using a threshold on minimum absolute difference in mean methylation `r system('grep minAbsDiff ../WGBS.config.yaml',intern=TRUE)` as well as a threshold on maximum false discovery rate `r system('grep FDR ../WGBS.config.yaml',intern=TRUE)` to produce the list of statistically differentially methylated features.
There were `r get_nrow_topTable(params$outdir,params$stat_category)` features passing these filters.
There were `r ifelse(is.null(get_nrow_topTable(params$outdir,params$stat_category)),"no",get_nrow_topTable(params$outdir,params$stat_category))` features passing these filters.

A volcano plot was produced to visualize the effect of threshold application onto the test results.

Expand Down
2 changes: 2 additions & 0 deletions snakePipes/shared/rscripts/WGBSstats_functions.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ get_nrow_filtered<-function(resdir,statscat){
} else if (statscat %in% "user_intervals"){
nrf<-unlist(lapply(dir(resdir,pattern="*.aggCpG.RData",full.names=TRUE),function(X){load(X);sprintf("%s (%s)",nrow(CGI.limdat.CC),gsub(".aggCpG.RData","",basename(X)))}))
}
if(is.null(nrf)){nrf<-0}
return(nrf)
}

Expand All @@ -41,6 +42,7 @@ get_nrow_topTable<-function(resdir,statscat){
} else if (statscat %in% "user_intervals"){
nrtt<-unlist(lapply(dir(resdir,pattern="*.tT_filt.txt",full.names=TRUE),function(X)sprintf("%s (%s)",length(readLines(X)),gsub(".tT_filt.txt","",basename(X)))))
}
if(is.null(nrtt)){nrtt<-0}
return(nrtt)
}

Expand Down
10 changes: 6 additions & 4 deletions snakePipes/shared/rules/WGBS.snakefile
Original file line number Diff line number Diff line change
Expand Up @@ -540,7 +540,8 @@ if sampleSheet:
input:
Limdat='{}/limdat.LG.RData'.format(get_outdir("singleCpG_stats_limma"))
output:
RDatAll='{}/singleCpG.RData'.format(get_outdir("singleCpG_stats_limma"))
RDatAll='{}/singleCpG.RData'.format(get_outdir("singleCpG_stats_limma")),
sinfo='{}/sessionInfo.txt'.format(get_outdir("singleCpG_stats_limma"))
params:
statdir=os.path.join(outdir,'{}'.format(get_outdir("singleCpG_stats_limma"))),
sampleSheet=sampleSheet,
Expand All @@ -558,7 +559,7 @@ if sampleSheet:
rule CpG_report:
input:
Limdat='{}/limdat.LG.RData'.format(get_outdir("singleCpG_stats_limma")),
RDatAll='{}/singleCpG.RData'.format(get_outdir("singleCpG_stats_limma"))
sinfo='{}/sessionInfo.txt'.format(get_outdir("singleCpG_stats_limma"))
output:
html='{}/Stats_report.html'.format(get_outdir("singleCpG_stats_limma"))
params:
Expand Down Expand Up @@ -682,7 +683,8 @@ if intList:
sampleSheet=sampleSheet,
aux=run_int_aggStats(intList,False)
output:
outFiles=run_int_aggStats(intList,sampleSheet)
outFiles=run_int_aggStats(intList,sampleSheet),
sinfo='{}/sessionInfo.txt'.format(get_outdir("aggregate_stats_limma"))
params:
auxshell=lambda wildcards,input:';'.join(['Rscript --no-save --no-restore ' + os.path.join(workflow_rscripts,'WGBSpipe.interval_stats.limma.R ') + os.path.join(outdir,'{}'.format(get_outdir("aggregate_stats_limma"))) + ' ' + li +' '+ aui +' ' + os.path.join(outdir,input.Limdat) + ' ' + input.sampleSheet + ' ' + str(minAbsDiff) + ' ' + str(FDR) + ' ' + os.path.join(workflow_rscripts, "WGBSstats_functions.R") for li,aui in zip(intList,[os.path.join(outdir,"aux_files",re.sub('.fa',re.sub('.bed','.CpGlist.bed',os.path.basename(x)),os.path.basename(refG))) for x in intList])])
log:
Expand All @@ -695,7 +697,7 @@ if intList:

rule intAgg_report:
input:
outFiles=run_int_aggStats(intList,sampleSheet)
outFiles='{}/sessionInfo.txt'.format(get_outdir("aggregate_stats_limma"))
output:
html='{}/Stats_report.html'.format(get_outdir("aggregate_stats_limma"))
params:
Expand Down
2 changes: 2 additions & 0 deletions snakePipes/workflows/WGBS/cluster.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ downsample_reads:
memory: 6G
conv_rate:
memory: 6G
prep_for_stats:
memory: 30G
CpG_stats:
memory: 30G
cleanup_metilene:
Expand Down

0 comments on commit 1c4c344

Please sign in to comment.