-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Also fixed issue with multiple headers being written to splitcode config file when resuming pipeline
- Loading branch information
Showing
10 changed files
with
216 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name: racon-medaka | ||
channels: | ||
- conda-forge | ||
- bioconda | ||
dependencies: | ||
- racon | ||
- medaka | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
process PrepareForConsensus { | ||
label = "PrepareForConsensus" | ||
|
||
publishDir "${params.outdir}/count/${sampleName}" | ||
|
||
conda "${ params.conda_env_location != null && params.conda_env_location != '' ? | ||
params.conda_env_location + '/minimap-samtools' : | ||
projectDir + '/envs/minimap-samtools.yaml' }" | ||
|
||
input: | ||
tuple val(sampleName), path(bam), path(fastq) | ||
|
||
output: | ||
tuple val(sampleName), path("*.sam"), path("*.bz") | ||
|
||
script: | ||
def sample = bam.getSimpleName() | ||
""" | ||
samtools view -h ${bam} > ${sample}.sam | ||
zcat ${fastq} | bgzip -c - > ${sample}.fastq.bz | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
// based on https://github.com/nf-core/modules/blob/master/modules/nf-core/medaka/main.nf | ||
|
||
process Medaka { | ||
tag "${reads.getSimpleName()}" | ||
label 'Medaka' | ||
|
||
publishDir "${params.outdir}/consensus/${sampleName}", mode: 'copy' | ||
|
||
conda "${ params.conda_env_location != null && params.conda_env_location != '' ? | ||
params.conda_env_location + '/racon-medaka' : | ||
projectDir + '/envs/racon-medaka.yaml' }" | ||
|
||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/medaka:1.4.4--py38h130def0_0' : | ||
'biocontainers/medaka:1.4.4--py38h130def0_0' }" | ||
|
||
input: | ||
tuple val(sampleName), path(reads), path(assembly) | ||
val(medaka_model) | ||
|
||
output: | ||
tuple val(sampleName), path("*.fa.gz"), emit: assembly | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: reads.getSimpleName() | ||
""" | ||
medaka_consensus \\ | ||
-t $task.cpus \\ | ||
$args \\ | ||
-i $reads \\ | ||
-d $assembly \\ | ||
-m $medaka_model \\ | ||
-o ./ | ||
mv consensus.fasta ${prefix}.fa | ||
gzip -n ${prefix}.fa | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
medaka: \$( medaka --version 2>&1 | sed 's/medaka //g' ) | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// adapted from https://github.com/nf-core/modules/blob/master/modules/nf-core/racon/main.nf | ||
|
||
process Racon { | ||
tag "${sam.getSimpleName()}" | ||
label 'Racon' | ||
|
||
publishDir "${params.outdir}/consensus/${sampleName}", mode: 'copy' | ||
|
||
conda "${ params.conda_env_location != null && params.conda_env_location != '' ? | ||
params.conda_env_location + '/racon-medaka' : | ||
projectDir + '/envs/racon-medaka.yaml' }" | ||
|
||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/racon:1.4.20--h9a82719_1' : | ||
'biocontainers/racon:1.4.20--h9a82719_1' }" | ||
|
||
input: | ||
tuple val(sampleName), path(sam), path(reads) | ||
path(assembly) | ||
|
||
output: | ||
tuple val(sampleName), path(reads), path('*_racon_consensus.fasta') , emit: racon_consensus | ||
path "versions.yml" , emit: versions | ||
|
||
when: | ||
task.ext.when == null || task.ext.when | ||
|
||
script: | ||
def args = task.ext.args ?: '' | ||
def prefix = task.ext.prefix ?: sam.getSimpleName() | ||
""" | ||
racon -t "$task.cpus" \\ | ||
"${reads}" \\ | ||
"${sam}" \\ | ||
$args \\ | ||
"${assembly}" > \\ | ||
${prefix}_racon_consensus.fasta | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
racon: \$( racon --version 2>&1 | sed 's/^.*v//' ) | ||
END_VERSIONS | ||
""" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
include { Racon } from '../modules/racon' | ||
include { Medaka } from '../modules/medaka' | ||
|
||
process PrepareForConsensus { | ||
label = "PrepareForConsensus" | ||
// convert bam file to sam for racon and | ||
// rezip fastq file using bgzip for medaka | ||
|
||
publishDir "${params.outdir}/count/${sampleName}" | ||
|
||
conda "${ params.conda_env_location != null && params.conda_env_location != '' ? | ||
params.conda_env_location + '/minimap-samtools' : | ||
projectDir + '/envs/minimap-samtools.yaml' }" | ||
|
||
input: | ||
tuple val(sampleName), path(bam), path(fastq) | ||
|
||
output: | ||
tuple val(sampleName), path("*.sam"), path("rezip_*.fastq.gz"), emit: racon_input | ||
|
||
script: | ||
def sample = bam.getSimpleName() | ||
""" | ||
samtools view -h ${bam} > ${sample}.sam | ||
zcat ${fastq} | bgzip -c - > rezip_${sample}.fastq.gz | ||
""" | ||
} | ||
|
||
workflow Consensus { | ||
take: | ||
consensus_input | ||
reference | ||
medaka_model | ||
|
||
main: | ||
PrepareForConsensus(consensus_input) | ||
|
||
Racon(PrepareForConsensus.out.racon_input, reference) | ||
|
||
Medaka(Racon.out.racon_consensus, medaka_model) | ||
|
||
consensus_sequences = Medaka.out.assembly | ||
|
||
emit: | ||
consensus_sequences | ||
} |