-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #136 from reichan1998/map_reduce_pacbio_filter
Integrate filtering steps into map-reduce
- Loading branch information
Showing
5 changed files
with
139 additions
and
88 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,46 @@ | ||
process CRAM_FILTER { | ||
tag "$meta.chunk_id" | ||
label "process_high" | ||
|
||
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | ||
'https://depot.galaxyproject.org/singularity/mulled-v2-1a6fe65bd6674daba65066aa796ed8f5e8b4687b:688e175eb0db54de17822ba7810cc9e20fa06dd5-0' : | ||
'biocontainers/mulled-v2-1a6fe65bd6674daba65066aa796ed8f5e8b4687b:688e175eb0db54de17822ba7810cc9e20fa06dd5-0' }" | ||
|
||
input: | ||
tuple val(meta), path(cramfile), path(cramindex), val(from), val(to), val(base), val(chunkid), val(rglines), path(reference) | ||
|
||
output: | ||
tuple val(meta), path("*.cram"), emit: cram | ||
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}" | ||
def VERSION = "1.15" // Staden_io versions break the pipeline | ||
""" | ||
cram_filter -n ${from}-${to} ${cramfile} ${prefix}_${base}_${chunkid}.cram | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ) | ||
staden_io: $VERSION | ||
END_VERSIONS | ||
""" | ||
|
||
stub: | ||
def prefix = task.ext.prefix ?: "${meta.id}" | ||
def base = "45022_3#2" | ||
def chunkid = "1" | ||
""" | ||
touch ${prefix}_${base}_${chunkid}_filtered.cram | ||
cat <<-END_VERSIONS > versions.yml | ||
"${task.process}": | ||
samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//' ) | ||
staden_io: $VERSION | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
include { CRAM_FILTER } from '../../modules/local/cram_filter' | ||
|
||
workflow CREATE_CRAM_FILTER_INPUT { | ||
take: | ||
csv_ch | ||
fasta | ||
|
||
main: | ||
ch_versions = Channel.empty() | ||
|
||
// Generate input channel for CRAM_FILTER | ||
csv_ch | ||
|splitCsv() | ||
|combine(fasta) | ||
|map { cram_id, cram_info, ref_id, ref_dir -> | ||
tuple([ | ||
id: cram_id.id, | ||
chunk_id: cram_id.id + "_" + cram_info[5], | ||
genome_size: ref_id.genome_size, | ||
read_count: cram_id.read_count, | ||
read_group: cram_id.read_group, | ||
datatype: cram_id.datatype, | ||
], | ||
file(cram_info[0]), | ||
cram_info[1], | ||
cram_info[2], | ||
cram_info[3], | ||
cram_info[4], | ||
cram_info[5], | ||
cram_info[6], | ||
ref_dir | ||
) | ||
} | ||
| set { ch_cram_filter_input } | ||
|
||
CRAM_FILTER(ch_cram_filter_input) | ||
ch_versions = ch_versions.mix(CRAM_FILTER.out.versions) | ||
|
||
emit: | ||
chunked_cram = CRAM_FILTER.out.cram | ||
versions = ch_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