diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 128756e1c26f5b1b7d4d9609675e67ca593c31f5..3e6393ed8d83c8b402f9b37d1713fe2244c49433 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,7 +1,7 @@ before_script: - module add python/3.6.1-2-anaconda - pip install --user pytest-pythonpath==0.7.1 pytest-cov==2.5.1 - - module load nextflow/0.31.0 + - module load nextflow/0.31.0 - ln -s /project/shared/bicf_workflow_ref/workflow_testdata/chipseq/*fastq.gz test_data/ stages: @@ -76,7 +76,7 @@ single_end_skip: only: - master script: - - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_SE.txt" --genome 'GRCm38' --skipDiff true --skipMotif true --astrocyte false -resume + - nextflow run workflow/main.nf --designFile "$CI_PROJECT_DIR/test_data/design_diff_SE.txt" --genome 'GRCm38' --skipDiff true --skipMotif true --skipPlotProfile true --astrocyte false -resume - pytest -m singleskip_true artifacts: expire_in: 2 days diff --git a/astrocyte_pkg.yml b/astrocyte_pkg.yml index ff68685e488ac30e45c0d2a863cdf131b71c41cc..704bc8fa415a0e624163971f225f034115f4c9f3 100644 --- a/astrocyte_pkg.yml +++ b/astrocyte_pkg.yml @@ -142,6 +142,15 @@ workflow_parameters: description: | Skip motif calling + - id: skipPlotProfile + type: select + required: true + choices: + - [ 'true', 'true'] + - [ 'false', 'false'] + description: | + Skip Plot Profile Analysis + - id: astrocyte type: select choices: diff --git a/workflow/conf/biohpc.config b/workflow/conf/biohpc.config index 6e2e885661a011956aaf1bac1e4fb0da3969d686..c514d076c9628538f1e9ed0af484a42e9a56c5e4 100644 --- a/workflow/conf/biohpc.config +++ b/workflow/conf/biohpc.config @@ -44,6 +44,10 @@ process { module = ['python/3.6.1-2-anaconda', 'macs/2.1.0-20151222', 'UCSC_userApps/v317', 'bedtools/2.26.0', 'phantompeakqualtools/1.2'] queue = '128GB,256GB,256GBv1' } + withName: plotProfile { + module = ['deeptools/2.5.0.1'] + cpus = 32 + } withName: consensusPeaks { module = ['python/3.6.1-2-anaconda', 'bedtools/2.26.0'] executor = 'local' @@ -74,18 +78,21 @@ params { genomesize = 'hs' chromsizes = '/project/shared/bicf_workflow_ref/GRCh38/genomefile.txt' fasta = '/project/shared/bicf_workflow_ref/GRCh38/genome.fa' + gta = '/project/shared/bicf_workflow_ref/GRCh38/gencode.gtf' } 'GRCh37' { bwa = '/project/shared/bicf_workflow_ref/GRCh37' genomesize = 'hs' chromsizes = '/project/shared/bicf_workflow_ref/GRCh37/genomefile.txt' fasta = '/project/shared/bicf_workflow_ref/GRCh37/genome.fa' + gta = '/project/shared/bicf_workflow_ref/GRCh37/gencode.gtf' } 'GRCm38' { bwa = '/project/shared/bicf_workflow_ref/GRCm38' genomesize = 'mm' chromsizes = '/project/shared/bicf_workflow_ref/GRCm38/genomefile.txt' fasta = '/project/shared/bicf_workflow_ref/GRCm38/genome.fa' + gta = '/project/shared/bicf_workflow_ref/GRCm38/gencode.gtf' } } } diff --git a/workflow/main.nf b/workflow/main.nf index 9b45adb8235ef8964ac0d00fc86fd47b12d5cf0a..f392faa9114e2e2850b26230d2e1f38a3bfabecb 100644 --- a/workflow/main.nf +++ b/workflow/main.nf @@ -25,8 +25,10 @@ params.topPeakCount = 600 params.astrocyte = false params.skipDiff = false params.skipMotif = false +params.skipPlotProfile = false params.references = "$baseDir/../docs/references.md" params.multiqc = "$baseDir/conf/multiqc_config.yaml" +params.gtf = "/project/shared/bicf_workflow_ref/$params.genome/gencode.gtf" // Assign variables if astrocyte if (params.astrocyte) { @@ -78,8 +80,10 @@ extendReadsLen = params.extendReadsLen topPeakCount = params.topPeakCount skipDiff = params.skipDiff skipMotif = params.skipMotif +skipPlotProfile = params.skipPlotProfile references = params.references multiqc = params.multiqc +gtfFile = Channel.fromPath(params.gtf) // Check design file for errors process checkDesignFile { @@ -424,6 +428,7 @@ process callPeaksMACS { set sampleId, file('*.narrowPeak'), file('*.fc_signal.bw'), file('*.pvalue_signal.bw'), experimentId, biosample, factor, treatment, replicate, controlId into experimentPeaks file '*.xls' into callPeaksMACSsummit file('version_*.txt') into callPeaksMACSVersions + file("*.fc_signal.bw") into bigwigs script: @@ -456,6 +461,26 @@ peaksDesign = experimentPeaks "$sampleId\t$peak\t$fcSignal\t$pvalueSignal\t$experimentId\t$biosample\t$factor\t$treatment\t$replicate\t$controlId\n"} .collectFile(name:'design_peak.tsv', seed:"sample_id\tpeaks\tfc_signal\tpvalue_signal\texperiment_id\tbiosample\tfactor\ttreatment\treplicate\tcontrol_id\n", storeDir:"$outDir/design") +//plotProfile +process plotProfile { + publishDir "$outDir/${task.process}", mode: 'copy' + + input: + + file ("*.pooled.fc_signal.bw") from bigwigs.collect() + file gtf from gtfFile + + when: + + !skipPlotProfile + + script: + """ + module load deeptools/2.5.0.1 + bash $baseDir/scripts/plotProfile.sh + """ +} + // Calculate Consensus Peaks process consensusPeaks { @@ -575,7 +600,6 @@ process diffPeaks { // Generate Multiqc Report, gerernate Software Versions and references process multiqcReport { - publishDir "$outDir/${task.process}", mode: 'copy' input: @@ -611,6 +635,7 @@ process multiqcReport { module load multiqc/1.7 echo $workflow.nextflow.version > version_nextflow.txt multiqc --version > version_multiqc.txt + python --version &> version_python.txt python3 $baseDir/scripts/generate_references.py -r $references -o software_references python3 $baseDir/scripts/generate_versions.py -o software_versions multiqc -c $multiqc . diff --git a/workflow/nextflow.config b/workflow/nextflow.config index f9fbe846df7cbce559c0e8ec87097921792640a2..e1dd50f4e24db974e055d648003c901258f2c8c2 100644 --- a/workflow/nextflow.config +++ b/workflow/nextflow.config @@ -7,8 +7,8 @@ profiles { manifest { name = 'chipseq_analysis' description = 'BICF ChIP-seq Analysis Workflow.' - homePage = 'https://github.com/nf-core/rnaseq' - version = '1.0.0' + homePage = 'https://git.biohpc.swmed.edu/BICF/Astrocyte/chipseq_analysis' + version = '1.0.6' mainScript = 'main.nf' nextflowVersion = '>=0.31.0' } diff --git a/workflow/scripts/generate_versions.py b/workflow/scripts/generate_versions.py index 98c319331b7ff3574cb89bda39e0cc41397e7ded..4f0d8b143b36efbe207a303b2eb164d0de1a0e8a 100644 --- a/workflow/scripts/generate_versions.py +++ b/workflow/scripts/generate_versions.py @@ -46,6 +46,7 @@ SOFTWARE_REGEX = { 'MEME-ChIP': ['motifSearch_vf/version_memechip.txt', r"Version (\S+)"], 'DiffBind': ['diffPeaks_vf/version_DiffBind.txt', r"Version (\S+)\""], 'deepTools': ['experimentQC_vf/version_deeptools.txt', r"deeptools (\S+)"], + 'Python': ['version_python.txt', r"python, version (\S+)"], 'MultiQC': ['version_multiqc.txt', r"multiqc, version (\S+)"], } @@ -108,6 +109,7 @@ def main(): results['DiffBind'] = '<span style="color:#999999;\">Not Run</span>' results['deepTools'] = '<span style="color:#999999;\">Not Run</span>' results['MultiQC'] = '<span style="color:#999999;\">Not Run</span>' + results['Python'] = '<span style="color:#999999;\">Not Run</span>' # list all files files = glob.glob('**/*.txt', recursive=True) diff --git a/workflow/scripts/plotProfile.sh b/workflow/scripts/plotProfile.sh new file mode 100644 index 0000000000000000000000000000000000000000..3ab4d901ee4a3c9da7cc1aa55c8215f831805f02 --- /dev/null +++ b/workflow/scripts/plotProfile.sh @@ -0,0 +1,15 @@ +#!/bin/bash +#plotProfile.sh + +bws=`ls *.bw` +gtf=`ls *.gtf *.bed` + +computeMatrix reference-point \ + --referencePoint TSS \ + -S $bws \ + -R $gtf \ + --skipZeros \ + -o computeMatrix.gz + +plotProfile -m computeMatrix.gz \ + -out plotProfile.png \