Skip to content

Instantly share code, notes, and snippets.

@fwip

fwip/1.nf Secret

Created June 18, 2018 16:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fwip/5cb28c350e8f3d9e2e2a1f7fc5762eda to your computer and use it in GitHub Desktop.
Save fwip/5cb28c350e8f3d9e2e2a1f7fc5762eda to your computer and use it in GitHub Desktop.
Optional process practices?
process trim_to_length {
input:
file(r1) from fastq
output:
file('r1.trim.fastq.gz') into trimmed_fastq
when:
params.trim_to != 0
script:
"""
zcat $r1 | awk 'NR%2==0 {print substr(\$0, 1, $params.trim_to)} NR%2!=0' | gzip -c -1 > r1.trim.fastq.gz
"""
}
if params.trim_to == 0
fastq.into(trimmed_fastq)
process trim_to_length {
input:
file(r1) from fastq
output:
file('r1.trim.fastq.gz') into trimmed_fastq
script:
if (params.trim_to != 0)
"""
zcat $r1 | awk 'NR%2==0 {print substr(\$0, 1, $params.trim_to)} NR%2!=0' | gzip -c -1 > r1.trim.fastq.gz
"""
else
"""
ln -s $r1 r1.trim.fastq.gz
"""
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment