Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/dstrib/CnR-flow
Browse files Browse the repository at this point in the history
  • Loading branch information
dstrib committed Sep 5, 2020
2 parents 3313bc2 + 21a0a41 commit ae68777
Show file tree
Hide file tree
Showing 83 changed files with 2,115 additions and 299 deletions.
9 changes: 9 additions & 0 deletions Citations.bib
Expand Up @@ -42,6 +42,15 @@ @article{meers2019peak
publisher={Springer}
}

@Manual{,
title = {R: A Language and Environment for Statistical Computing},
author = {{R Core Team}},
organization = {R Foundation for Statistical Computing},
address = {Vienna, Austria},
year = {2017},
url = {https://www.R-project.org/},
}

@article{langmead2012fast,
title={Fast gapped-read alignment with Bowtie 2},
author={Langmead, Ben and Salzberg, Steven L},
Expand Down
5 changes: 4 additions & 1 deletion Citations.txt
Expand Up @@ -10,6 +10,9 @@ Zhu, Qian, et al. "CUT&RUNTools: a flexible pipeline for CUT&RUN processing and
SEACR:
Meers, Michael P., Dan Tenenbaum, and Steven Henikoff. "Peak calling by Sparse Enrichment Analysis for CUT&RUN chromatin profiling." Epigenetics & chromatin 12.1 (2019): 42.

R:
R Core Team (2017). R: A language and environment for statistical computing. R Foundation for Statistical Computing, Vienna, Austria. URL https://www.R-project.org/

Bowtie2:
Langmead, Ben, and Steven L. Salzberg. "Fast gapped-read alignment with Bowtie 2." Nature methods 9.4 (2012): 357.

Expand All @@ -31,6 +34,6 @@ Quinlan AR and Hall IM, 2010. BEDTools: a flexible suite of utilities for compar
bedGraphToBigWig:
BigWig and BigBed tools: Kent WJ, Zweig AS, Barber G, Hinrichs AS, Karolchik D. BigWig and BigBed: enabling browsing of large distributed data sets. Bioinformatics. 2010 Sep 1;26(17):2204-7.

Macs2:
MACS2:
Zhang et al. Model-based Analysis of ChIP-Seq (MACS). Genome Biol (2008) vol. 9 (9) pp. R137

33 changes: 11 additions & 22 deletions CnR-flow.nf
Expand Up @@ -2,21 +2,21 @@
//Daniel Stribling
//Renne Lab, University of Florida
//
//This file is part of CnR-Flow.
//CnR-Flow is free software: you can redistribute it and/or modify
//This file is part of CnR-flow.
//CnR-flow is free software: you can redistribute it and/or modify
//it under the terms of the GNU General Public License as published by
//the Free Software Foundation, either version 3 of the License, or
//(at your option) any later version.
//CnR-Flow is distributed in the hope that it will be useful,
//CnR-flow is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
//GNU General Public License for more details.
//You should have received a copy of the GNU General Public License
//along with CnR-Flow. If not, see <https://www.gnu.org/licenses/>.
//along with CnR-flow. If not, see <https://www.gnu.org/licenses/>.

// To prevent duplication, all required paramaters are listed in the bundled files:
// /CnR-flow/nextflow.config
// /CnR-flow/templates/nextflow.config.master (backup)
// /CnR-flow/templates/nextflow.config.backup

// --------------- Setup Default Pipe Variables: ---------------
params.verbose = false
Expand All @@ -28,7 +28,6 @@ params.out_front_pad = 4
params.out_prop_pad = 17

// --------------- Check (and Describe) "--mode" param: ---------------
//params.mode='run' //DEBUG
modes = ['initiate', 'validate', 'validate_all', 'prep_fasta',
'list_refs', 'dry_run', 'run', 'help', 'version']
usage = """\
Expand Down Expand Up @@ -92,7 +91,6 @@ if( params.help || params.h ) {

print_in_files = []


// If mode is 'prep_fasta', ensure "ref_fasta" has been provided.
if( ['prep_fasta'].contains(params.mode) ) {
test_params_key(params, 'ref_fasta')
Expand Down Expand Up @@ -221,7 +219,7 @@ if( ['prep_fasta'].contains(params.mode) ) {

// Keys and Params for merging langes
if( params.do_merge_lanes ) {
null//No custom settings
null // No custom settings
}
// Keys and Params for FastQC
if( params.do_fastqc ) {
Expand Down Expand Up @@ -448,7 +446,6 @@ if( ['initiate'].contains( params.mode ) ) {
println ""
}


// -- Run Mode: validate
if( ['validate', 'validate_all'].contains( params.mode ) ) {
process CnR_Validate {
Expand Down Expand Up @@ -503,10 +500,8 @@ if( ['validate', 'validate_all'].contains( params.mode ) ) {
validate_outs
.collect()
.view { it -> "\nDependencies Have been Validated, Results:\n $it\n" }

}


def get_refs_locations(params) {
refs_locations = [
'refs_dir': params.refs_dir,
Expand Down Expand Up @@ -612,7 +607,7 @@ if( params.mode == 'prep_fasta' ) {

process CnR_Prep_GetFasta {
tag { name }
d label 'big_mem'
label 'big_mem'
beforeScript { task_details(task) }
stageInMode 'copy'
echo true
Expand Down Expand Up @@ -783,7 +778,6 @@ d label 'big_mem'
["${name}.refinfo.txt", details]
}
.view { "Database Prepared and published in:\n ${params.refs_dir}/${it}\nDetails:\n${it.text}" }

}

// -- Run Mode: 'dry_run'
Expand Down Expand Up @@ -1031,7 +1025,6 @@ if( params.mode == 'run' ) {

// Prepare Step 0/1 Input Channels
use_fastqs.into { fastqcPre_inputs; trim_inputs }


// Step 0, Part C, FastQC Analysis (If Enabled)
if( params.do_fastqc ) {
Expand All @@ -1042,7 +1035,7 @@ if( params.mode == 'run' ) {
conda get_conda(params, 'fastqc')
}
tag { name }
label 'norm_mem'
label 'small_mem'
beforeScript { task_details(task) }
cpus 1 //Multiple CPUS for FastQC are for multiple files.

Expand Down Expand Up @@ -1075,7 +1068,6 @@ if( params.mode == 'run' ) {
}
}


// Step 1, Part A, Trim Reads using Trimmomatic (if_enabled)
if( params.do_trim ) {
process CnR_S1_A_Trim {
Expand Down Expand Up @@ -1210,8 +1202,9 @@ if( params.mode == 'run' ) {
conda get_conda(params, 'fastqc')
}
tag { name }
label 'norm_mem'
label 'small_mem'
beforeScript { task_details(task) }
cpus 1 //Multiple CPUS for FastQC are for multiple files.

input:
tuple val(name), val(cond), val(group), path(fastq) from fastqcPost_inputs
Expand Down Expand Up @@ -1731,7 +1724,6 @@ if( params.mode == 'run' ) {
echo -e "name,fq_pairs,spike_aln_pairs,spike_aln_pct,cross_aln_pairs,cross_aln_pct,adj_aln_pairs,adj_aln_pct" > !{aln_count_csv}
echo -e "!{name},${PAIR_NUM},${SPIKE_COUNT},${SPIKE_PERCENT},${CROSS_COUNT},CROSS_PCT,${ADJ_COUNT},${ADJ_PERCENT}" >> !{aln_count_csv}
echo "Step 3, Part A, Spike-In Alignment, Complete."
'''
Expand Down Expand Up @@ -1830,7 +1822,6 @@ if( params.mode == 'run' ) {
label 'norm_mem'
beforeScript { task_details(task) }
cpus 1
errorStrategy 'ignore' //Debug

input:
tuple val(name), val(cond), val(group), val(aln_type), path(aln) from make_bigwig_alns
Expand Down Expand Up @@ -2078,7 +2069,6 @@ if( params.mode == 'run' ) {
}
}
}


// --------------- Groovy Helper Functions ---------------
def return_as_list(item) {
Expand Down Expand Up @@ -2186,13 +2176,12 @@ def has_conda(params, name, def_val="") {
use_conda != def_val
}

//Return Boolean true if resources exist for name(s).
// Return Boolean true if resources exist for name(s).
def has_resources(params, name) {
def resources = get_resources(params, name, def_val="")
( resources[0].toBoolean() || resources[1].toBoolean() )
}


def test_params_key(params, key, allowed_opts=null) {
if( !params.containsKey(key) ) {
log.error "Required parameter key not provided:"
Expand Down

0 comments on commit ae68777

Please sign in to comment.