Skip to content
Snippets Groups Projects
Select Git revision
  • f8dba601a8cc93674a449473d085a5a0e32fb9da
  • master default protected
  • star
  • dev
  • v0.4.0
  • v0.3.0
  • v0.2.9
  • v0.2.8
  • v0.2.7
  • v0.2.6
  • v0.1.0
  • v0.2.5
  • v0.2.4
  • v0.2.3
  • v0.2.2
  • v0.2.1
  • v0.2.0
  • v0.1.2
18 results

fasta_sampler.nf

Blame
  • Forked from LBMC / nextflow
    Source project has a limited visibility.
    cutadapt.nf 2.69 KiB
    /*
    * cutadapt :
    * Imputs : fastq files
    * Output : fastq files
    */
    
    /*                      Illumina adaptor removal                             */
    
    /*
    * for paired-end data
    */
    
    params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq"
    
    log.info "fastq files : ${params.fastq}"
    
    Channel
      .fromFilePairs( params.fastq )
      .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
      .set { fastq_files }
    
    process adaptor_removal {
      tag "$pair_id"
      publishDir "results/fastq/adaptor_removal/", mode: 'copy'
    
      input:
      set pair_id, file(reads) from fastq_files
    
      output:
      file "*_cut_R{1,2}.fastq.gz" into fastq_files_cut
    
      script:
      """
      cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT -A AGATCGGAAGAG -G CTCTTCCGATCT \
      -o ${pair_id}_cut_R1.fastq.gz -p ${pair_id}_cut_R2.fastq.gz \
      ${reads[0]} ${reads[1]} > ${pair_id}_report.txt
      """
    }
    
    /*
    * for single-end data
    */
    
    params.fastq = "$baseDir/data/fastq/*.fastq"
    
    log.info "fastq files : ${params.fastq}"
    
    Channel
      .fromPath( params.fastq )
      .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
      .set { fastq_files }
    
    process adaptor_removal {
      tag "$reads.baseName"
      publishDir "results/fastq/adaptor_removal/", mode: 'copy'
    
      input:
      file reads from fastq_files
    
      output:
      file "*_cut.fastq.gz" into fastq_files_cut
    
      script:
      """
      cutadapt -a AGATCGGAAGAG -g CTCTTCCGATCT\
      -o ${reads.baseName}_cut.fastq.gz \
      ${reads} > ${reads.baseName}_report.txt
      """
    }
    
    /*                      quality trimming                                     */
    
    /*
    * for paired-end data
    */
    
    params.fastq = "$baseDir/data/fastq/*_{1,2}.fastq"
    
    log.info "fastq files : ${params.fastq}"
    
    Channel
      .fromFilePairs( params.fastq )
      .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
      .set { fastq_files }
    
    process trimming {
      tag "$pair_id"
      publishDir "results/fastq/trimming/", mode: 'copy'
    
      input:
      set pair_id, file(reads) from fastq_files
    
      output:
      file "*_trim_R{1,2}.fastq.gz" into fastq_files_cut
    
      script:
      """
      cutadapt -q 20,20 \
      -o ${pair_id}_trim_R1.fastq.gz -p ${pair_id}_trim_R2.fastq.gz \
      ${reads[0]} ${reads[1]} > ${pair_id}_report.txt
      """
    }
    
    /*
    * for single-end data
    */
    
    params.fastq = "$baseDir/data/fastq/*.fastq"
    
    log.info "fastq files : ${params.fastq}"
    
    Channel
      .fromPath( params.fastq )
      .ifEmpty { error "Cannot find any fastq files matching: ${params.fastq}" }
      .set { fastq_files }
    
    process trimming {
      tag "$reads.baseName"
      publishDir "results/fastq/trimming/", mode: 'copy'
    
      input:
      file reads from fastq_files
    
      output:
      file "*_trim.fastq.gz" into fastq_files_cut
    
      script:
      """
      cutadapt -q 20,20 \
      -o ${reads.baseName}_trim.fastq.gz \
      ${reads} > ${reads.baseName}_report.txt
      """
    }