Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rscript integration #3

Merged
merged 14 commits into from
Oct 5, 2023
64 changes: 64 additions & 0 deletions conf/modules.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

process {



publishDir = [
path: { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" },
mode: params.publish_dir_mode,
Expand Down Expand Up @@ -45,4 +47,66 @@ process {
ext.args2 = 'ILLUMINACLIP:TruSeq3-PE.fa:2:30:10:2:True LEADING:3 TRAILING:3 MINLEN:36'
}


//
// Alignment options
//






//
// Picard MarkDuplicates and Filtering options
//

withName: '.*BAM_MARKDUPLICATES_PICARD:PICARD_MARKDUPLICATES' {
ext.args = '--ASSUME_SORTED true --REMOVE_DUPLICATES true --VALIDATION_STRINGENCY LENIENT --TMP_DIR tmp'
ext.prefix = { "${meta.id}.md" }
publishDir = [
[
path: { "${params.outdir}/reports/markduplicates" },
mode: params.publish_dir_mode,
pattern: '*metrics.txt',
saveAs: { filename -> filename.equals('versions.yml') ? null : filename }
],
[
path: { "${params.outdir}/markduplicates/bam" },
mode: params.publish_dir_mode,
pattern: '*.md.{bam,bai}',
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
//enable: params.save_markduplicates_bam
]
]
}

withName: '.*BAM_MARKDUPLICATES_PICARD:SAMTOOLS_INDEX' {
ext.prefix = { "${meta.id}.markdup.sorted" }
publishDir = [
path: { "${params.outdir}/markduplicates/bam" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
pattern: '*.{bai,csi}'
]
}

withName: '.*BAM_MARKDUPLICATES_PICARD:BAM_STATS_SAMTOOLS.*' {
ext.args = ""
publishDir = [
path: { "${params.outdir}/reports/samtools_stats/${meta.id}/md/" },
mode: params.publish_dir_mode,
saveAs: { filename -> filename.equals('versions.yml') ? null : filename },
pattern: '*.{stats,flagstat,idxstats}'
]
}









}
66 changes: 65 additions & 1 deletion modules.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,23 @@
"bwa/aln": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
"installed_by": ["fastq_align_bwaaln", "modules"]
},
"bwa/index": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["modules"]
},
"bwa/sampe": {
"branch": "master",
"git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220",
"installed_by": ["fastq_align_bwaaln"]
},
"bwa/samse": {
"branch": "master",
"git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220",
"installed_by": ["fastq_align_bwaaln"]
},
"cat/fastq": {
"branch": "master",
"git_sha": "5c460c5a4736974abde2843294f35307ee2b0e5e",
Expand All @@ -25,6 +35,11 @@
"git_sha": "76cc4938c1f6ea5c7d83fed1eeffc146787f9543",
"installed_by": ["modules"]
},
"deeptools/bamcoverage": {
"branch": "master",
"git_sha": "603ecbd9f45300c9788f197d2a15a005685b4220",
"installed_by": ["modules"]
},
"fastqc": {
"branch": "master",
"git_sha": "c8e35eb2055c099720a75538d1b8adb3fb5a464c",
Expand All @@ -40,6 +55,36 @@
"git_sha": "f2d63bd5b68925f98f572eed70993d205cc694b7",
"installed_by": ["modules"]
},
"picard/markduplicates": {
"branch": "master",
"git_sha": "735e1e04e7e01751d2d6e97055bbdb6f70683cc1",
"installed_by": ["bam_markduplicates_picard", "modules"]
},
"samtools/faidx": {
"branch": "master",
"git_sha": "fd742419940e01ba1c5ecb172c3e32ec840662fe",
"installed_by": ["modules"]
},
"samtools/flagstat": {
"branch": "master",
"git_sha": "570ec5bcfe19c49e16c9ca35a7a116563af6cc1c",
"installed_by": ["bam_stats_samtools"]
},
"samtools/idxstats": {
"branch": "master",
"git_sha": "e662ab16e0c11f1e62983e21de9871f59371a639",
"installed_by": ["bam_stats_samtools"]
},
"samtools/index": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
"installed_by": ["bam_markduplicates_picard", "fastq_align_bwaaln"]
},
"samtools/stats": {
"branch": "master",
"git_sha": "735e1e04e7e01751d2d6e97055bbdb6f70683cc1",
"installed_by": ["bam_stats_samtools"]
},
"trimmomatic": {
"branch": "master",
"git_sha": "911696ea0b62df80e900ef244d7867d177971f73",
Expand All @@ -51,6 +96,25 @@
"installed_by": ["modules"]
}
}
},
"subworkflows": {
"nf-core": {
"bam_markduplicates_picard": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["subworkflows"]
},
"bam_stats_samtools": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["bam_markduplicates_picard"]
},
"fastq_align_bwaaln": {
"branch": "master",
"git_sha": "dedc0e31087f3306101c38835d051bf49789445a",
"installed_by": ["subworkflows"]
}
}
}
}
}
Expand Down
16 changes: 16 additions & 0 deletions modules/local/chromosomes_size.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
process CUT_SIZES_GENOME {
tag "${sample_id}"
publishDir "${params.outdir}/genome", mode: 'copy'

input:
tuple val(meta), path(fai)

output:
path("sizes.genome") , emit: ch_sizes_genome

script:
"""
cut -f1,2 ${fai} > sizes.genome
"""
}

100 changes: 100 additions & 0 deletions modules/local/rtwosamplesmle/main.nf
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
// TODO nf-core: If in doubt look at other nf-core/modules to see how we are doing things! :)
// https://github.com/nf-core/modules/tree/master/modules/nf-core/
// You can also ask for help via your pull request or on the #modules channel on the nf-core Slack workspace:
// https://nf-co.re/join
// TODO nf-core: A module file SHOULD only define input and output files as command-line parameters.
// All other parameters MUST be provided using the "task.ext" directive, see here:
// https://www.nextflow.io/docs/latest/process.html#ext
// where "task.ext" is a string.
// Any parameters that need to be evaluated in the context of a particular sample
// e.g. single-end/paired-end data MUST also be defined and evaluated appropriately.
// TODO nf-core: Software that can be piped together SHOULD be added to separate module files
// unless there is a run-time, storage advantage in implementing in this way
// e.g. it's ok to have a single module for bwa to output BAM instead of SAM:
// bwa mem | samtools view -B -T ref.fasta
// TODO nf-core: Optional inputs are not currently supported by Nextflow. However, using an empty
// list (`[]`) instead of a file can be used to work around this issue.

process RTWOSAMPLESMLE {
//tag "$meta.id"
label 'process_medium'

// TODO nf-core: List required Conda package(s).
// Software MUST be pinned to channel (i.e. "bioconda"), version (i.e. "1.10").
// For Conda, the build (i.e. "h9402c20_2") must be EXCLUDED to support installation on different operating systems.
// TODO nf-core: See section in main README for further information regarding finding and adding container addresses to the section below.

//conda "YOUR-TOOL-HERE"

//container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
// 'https://depot.galaxyproject.org/singularity/YOUR-TOOL-HERE':
// 'biocontainers/YOUR-TOOL-HERE' }"

//docker pull lucidif/r_two_samples_mle:0.0.1
//docker image tag ae028b17f7d3 quay.io/lucidif/r_two_samples_mle:0.0.1
//container 'lucidif/r_two_samples_mle:0.0.1'
//container 'https://registry-1.docker.io/v2/lucidif/r_two_samples_mle/blobs/sha256:038e9a5189bd7f946bc85db99ea5c43cce8b643c4e3723d52a2a763b8cf21304'

input:
// TODO nf-core: Where applicable all sample-specific information e.g. "id", "single_end", "read_group"
// MUST be provided as an input via a Groovy Map called "meta".
// This information may not be required in some instances e.g. indexing reference genome files:
// https://github.com/nf-core/modules/blob/master/modules/nf-core/bwa/index/main.nf
// TODO nf-core: Where applicable please provide/convert compressed files as input/output
// e.g. "*.fastq.gz" and NOT "*.fastq", "*.bam" and NOT "*.sam" etc.
//tuple val(meta1), val(meta2), path(bam1), path(bam2)
tuple val(meta), path(bam1), path(bam2)
path chromsizes_file


//output:
// TODO nf-core: Named file extensions MUST be emitted for ALL output channels
//tuple val(meta), path("*.bam"), emit: bam
// TODO nf-core: List additional required output channels/values here
//path "versions.yml" , emit: versions

when:
task.ext.when == null || task.ext.when

script:

//def args = task.ext.args ?: ''
//def prefix = task.ext.prefix ?: "${meta.id}"

// TODO nf-core: Where possible, a command MUST be provided to obtain the version number of the software e.g. 1.10
// If the software is unable to output a version number on the command-line then it can be manually specified
// e.g. https://github.com/nf-core/modules/blob/master/modules/nf-core/homer/annotatepeaks/main.nf
// Each software used MUST provide the software name and version number in the YAML version file (versions.yml)
// TODO nf-core: It MUST be possible to pass additional parameters to the tool as a command-line string via the "task.ext.args" directive
// TODO nf-core: If the tool supports multi-threading then you MUST provide the appropriate parameter
// using the Nextflow "task" variable e.g. "--threads $task.cpus"
// TODO nf-core: Please replace the example samtools command below with your module's command
// TODO nf-core: Please indent the command appropriately (4 spaces!!) to help with readability ;)



// bam_list_ch
// .map { it[0].collate(2) } // Raggruppa ogni due elementi
// .set { paired_bam_list_ch }


template 'two_samples_mle.R'

//stub:

//def args = task.ext.args ?: ''
//def prefix = task.ext.prefix ?: "${meta.id}"

// TODO nf-core: A stub section should mimic the execution of the original module as best as possible
// Have a look at the following examples:
// Simple example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bcftools/annotate/main.nf#L47-L63
// Complex example: https://github.com/nf-core/modules/blob/818474a292b4860ae8ff88e149fbcda68814114d/modules/nf-core/bedtools/split/main.nf#L38-L54
// """
// touch ${prefix}.bam

// cat <<-END_VERSIONS > versions.yml
// "${task.process}":
// : \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ))
// END_VERSIONS
// """
}
Loading
Loading