-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'single-read-raw-clean' into single-read-profile
- Loading branch information
Showing
6 changed files
with
94 additions
and
74 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 |
---|---|---|
@@ -1,34 +1,38 @@ | ||
// Truncate concatenated read files for trial run | ||
process TRUNCATE_CONCAT { | ||
process TRUNCATE_CONCAT_PAIRED { | ||
label "single" | ||
label "BBTools" | ||
input: | ||
tuple val(sample), path(reads) | ||
val n_reads | ||
val single_end | ||
output: | ||
|
||
tuple val(sample), path({ | ||
single_end ? | ||
"${sample}_trunc.fastq.gz" : | ||
"${sample}_trunc_{1,2}.fastq.gz" | ||
}), emit: reads | ||
tuple val(sample), path("${sample}_trunc_{1,2}.fastq.gz"), emit: reads | ||
shell: | ||
''' | ||
echo "Number of output reads: !{n_reads}" | ||
n_lines=$(expr !{n_reads} \\* 4) | ||
echo "Number of output lines: ${n_lines}" | ||
if [ $(echo "!{reads}" | wc -w) -eq 2 ]; then | ||
echo "Processing paired-end reads" | ||
o1=!{sample}_trunc_1.fastq.gz | ||
o2=!{sample}_trunc_2.fastq.gz | ||
zcat !{reads[0]} | head -n ${n_lines} | gzip -c > ${o1} | ||
zcat !{reads[1]} | head -n ${n_lines} | gzip -c > ${o2} | ||
else | ||
echo "Processing single-end reads" | ||
o=!{sample}_trunc.fastq.gz | ||
zcat !{reads[0]} | head -n ${n_lines} | gzip -c > ${o} | ||
fi | ||
o1=!{sample}_trunc_1.fastq.gz | ||
o2=!{sample}_trunc_2.fastq.gz | ||
zcat !{reads[0]} | head -n ${n_lines} | gzip -c > ${o1} | ||
zcat !{reads[1]} | head -n ${n_lines} | gzip -c > ${o2} | ||
''' | ||
} | ||
|
||
process TRUNCATE_CONCAT_SINGLE { | ||
label "single" | ||
label "BBTools" | ||
input: | ||
tuple val(sample), path(reads) | ||
val n_reads | ||
output: | ||
tuple val(sample), path("${sample}_trunc.fastq.gz"), emit: reads | ||
shell: | ||
''' | ||
echo "Number of output reads: !{n_reads}" | ||
n_lines=$(expr !{n_reads} \\* 4) | ||
echo "Number of output lines: ${n_lines}" | ||
o=!{sample}_trunc.fastq.gz | ||
zcat !{reads[0]} | head -n ${n_lines} | gzip -c > ${o} | ||
''' | ||
} |
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,45 @@ | ||
/*********** | ||
| WORKFLOW | | ||
***********/ | ||
|
||
workflow LOAD_SAMPLESHET { | ||
take: | ||
sample_sheet | ||
main: | ||
if (params.single_end) { | ||
if (params.grouping) { | ||
samplesheet = Channel | ||
.fromPath(params.sample_sheet) | ||
.splitCsv(header: true) | ||
.map { row -> tuple(row.sample, file(row.fastq), row.group) } | ||
samplesheet_ch = samplesheet.map { sample, read, group -> tuple(sample, [read]) } | ||
group_ch = samplesheet.map { sample, read, group -> tuple(sample, group) } | ||
} else { | ||
samplesheet = Channel | ||
.fromPath(params.sample_sheet) | ||
.splitCsv(header: true) | ||
.map { row -> tuple(row.sample, file(row.fastq)) } | ||
samplesheet_ch = samplesheet.map { sample, read -> tuple(sample, [read]) } | ||
group_ch = Channel.empty() | ||
} | ||
} else { | ||
if (params.grouping) { | ||
samplesheet = Channel | ||
.fromPath(params.sample_sheet) | ||
.splitCsv(header: true) | ||
.map { row -> tuple(row.sample, file(row.fastq_1), file(row.fastq_2), row.group) } | ||
samplesheet_ch = samplesheet.map { sample, read1, read2, group -> tuple(sample, [read1, read2]) } | ||
group_ch = samplesheet.map { sample, read1, read2, group -> tuple(sample, group) } | ||
} else { | ||
samplesheet = Channel | ||
.fromPath(params.sample_sheet) | ||
.splitCsv(header: true) | ||
.map { row -> tuple(row.sample, file(row.fastq_1), file(row.fastq_2)) } | ||
samplesheet_ch = samplesheet.map { sample, read1, read2 -> tuple(sample, [read1, read2]) } | ||
group_ch = Channel.empty() | ||
} | ||
} | ||
emit: | ||
samplesheet = samplesheet_ch | ||
group = group_ch | ||
} |
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