zoark0

workflow_w

Oct 27th, 2021
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. #!/usr/bin/env nextflow
  2.  
  3. nextflow.enable.dsl=2
  4.  
  5. params.reads = "/mnt/scgc_nfs/lab/ggavelis/sandbox/sample_data/smallest_subset/*02_subseq_R{1,2}.fastq.gz"
  6. params.outdir = "results"
  7.  
  8. Channel
  9. .fromFilePairs( params.reads, checkExists:true )
  10. .set{ read_ch }
  11.  
  12. process fastqc {
  13. tag "FASTQC on $sample_id"
  14. publishDir params.outdir
  15.  
  16. input:
  17. tuple val(sample_id), path(reads)
  18.  
  19. output:
  20. val sample_id, emit: sample_id
  21. path reads, emit: reads
  22.  
  23. shell:
  24. '''
  25. mkdir fastqc_!{sample_id}
  26. fastqc -o fastqc_!{sample_id} -f fastq -q !{reads}
  27. '''
  28. }
  29.  
  30. process trimmomatic {
  31. tag "TRIMMOMATIC on $sample_id"
  32. publishDir params.outdir
  33.  
  34. input:
  35. val(sample_id)
  36. path(reads)
  37.  
  38. output:
  39. val sample_id, emit: sample_id
  40. path "${sample_id}_trimmed_R1.fastq.gz", emit: trimmed_R1_paired
  41. path "${sample_id}_trimmed_R2.fastq.gz", emit: trimmed_R2_paired
  42.  
  43. shell:
  44. '''
  45. trimmomatic \
  46. PE \
  47. -phred33 \
  48. -threads !{task.cpus} \
  49. !{reads} \
  50. !{sample_id}_trimmed_R1.fastq.gz \
  51. !{sample_id}_orphan_R1.fastq.gz \
  52. !{sample_id}_trimmed_R2.fastq.gz \
  53. !{sample_id}_orphan_R2.fastq.gz \
  54. LEADING:0 TRAILING:5 SLIDINGWINDOW:4:15 MINLEN:36
  55.  
  56. '''
  57. }
  58.  
  59. process bbmerge {
  60. tag "MERGING on $sample_id"
  61. publishDir params.outdir
  62. module 'singularity/3.8.0'
  63.  
  64. cache 'lenient'
  65. cpus 4
  66.  
  67. input:
  68. val(sample_id)
  69. path(trimmed_R1_paired)
  70. path(trimmed_R2_paired)
  71.  
  72. output:
  73. path "${sample_id}_merged.fastq", emit: merged
  74.  
  75. shell:
  76. '''
  77. reformat.sh in1=!{trimmed_R1_paired} in2=!{trimmed_R2_paired} out=!{sample_id}_merged.fastq
  78. '''
  79. }
  80.  
  81.  
  82. workflow {
  83. fastqc(read_ch)
  84. trimmomatic(fastqc.output.sample_id, fastqc.output.reads)
  85. bbmerge(fastqc.output.sample_id, trimmomatic.output.trimmed_R1_paired, trimmomatic.output.trimmed_R2_paired)
  86. }
  87.  
  88.  
  89.  
Advertisement
Add Comment
Please, Sign In to add comment