-
-
Save andrewcstewart/5207448989c9d5c3819f to your computer and use it in GitHub Desktop.
nextflow alignment example
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
params.path = "/path/to/data" | |
(reads1,reads2) = Channel.fromPath( params.path + "/**.gz").into(2) | |
reads1 = reads1 | |
.filter( ~/.+R1.+/ ) | |
.map { path -> ['pair_id': path.baseName[-17..-14], | |
'sample_id': path.getParent().baseName, | |
'read': path ] } | |
reads2 = reads2 | |
.filter( ~/.+R2.+/ ) | |
.map { path -> ['pair_id': path.baseName[-17..-14], | |
'sample_id': path.getParent().baseName, | |
'read': path ] } | |
read_pairs = reads1 | |
.phase(reads2) | |
.map { pair1, pair2 -> [ pair1.pair_id, pair1.sample_id, pair1.read, pair2.read ] } | |
process alignment { | |
container 'alignment' | |
queue 'highmem.q' | |
input: | |
set pair_id, sample_id, file(read1), file(read2) from read_pairs | |
output: | |
set sample_id, file("alignment.bam") into alignments | |
""" | |
align $read1 $read2 > alignment.bam | |
""" | |
} | |
process merge { | |
container 'merge' | |
queue 'all.q' | |
input: | |
set sample_id, file('alignment.bam') from alignments.groupTuple() | |
output: | |
set file('merged.bam') into merged | |
""" | |
# merge all read_pair bam files into a sample bam file | |
""" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment