Using nextflow for performing quality control and trimming of reads
1
0
Entering edit mode
4 weeks ago
nithya • 0

I am new to Nextflow scripts. I am trying to build a variant calling pipeline. I have used fastqc and trimmomatic tool for quality checking and trimming a low quality sequences. I have written a script below, program is executed but shows no output.

#!/usr/bin/env nextflow

params {
  fastq_dir = "/mnt/e/Bioinformatics_ppt_learning/mtDNA/nextflow_scripts/*.fastq.gz"
  fastqc_dir = "/mnt/e/Bioinformatics_ppt_learning/mtDNA/nextflow_scripts/fastqc_report"
  trimmed_dir = "/mnt/e/Bioinformatics_ppt_learning/mtDNA/nextflow_scripts/trimmed_fastq"
  trimmomatic_jar = "/mnt/e/Bioinformatics_ppt_learning/mtDNA/nextflow_scripts/trimmomatic-0.39.jar"
}

process FastQC {
  tag "Running FastQC on ${fastq}"
  publishDir "${fastqc_dir}/${fastq.baseName}"
  input: path fastq
  script:
    """
    fastqc -o ${fastqc_dir} ${fastq}
    """
}

process Trimmomatic {
  tag "Trimming ${fastq.baseName}"
  input:
    path read1 from FastQC.output

  output:
    file(joinPath(trimmed_dir, "${read1.baseName}_trimmed.fastq.gz"))

  script:
    """
    java -jar ${params.trimmomatic_jar} PE -threads 4 \
      ${read1} ${joinPath(trimmed_dir, "${read1.baseName}_trimmed.fastq.gz")} \
      ${joinPath(trimmed_dir, "${read1.baseName}_unpaired.fastq.gz")} \
      ${joinPath(trimmed_dir, "${read1.baseName}_unpaired.fastq.gz")}
    """
}

workflow {
  fastq_files = Channel.fromPath(params.fastq_dir)

  fastq_files.each {
    FastQC(fastq: it)
    Trimmomatic(read1: FastQC.output)
  }
}
quality fastqc nextflow trimmomatic • 236 views
ADD COMMENT
0
Entering edit mode

Please do not double post when you've had responses on another forum.

It feels pretty disrespectful to not only ignore those that are trying to help, but to not even make any of the improvements offered and post again shows a clear lack of understanding.

ADD REPLY
0
Entering edit mode
4 weeks ago

someting like (not tested)

workflow {
  fastq_ch = Channel.fromPath(paramTrimmomatics.fastq_dir)
FastQC(fastq_ch)
Trimmomatic(fastq_ch)
}


process FastQC {
  publishDir "${params.fastqc_dir}/${fastq.baseName}"
  input:
     path(fastq)
  output:
     path("${fastq.baseName}.zip")
  script:
    """
    mkdir OUTPUT
    fastqc -o OUTPUT ${fastq}
    zip -r "${fastq.baseName}.zip" OUTPUT
    """
}

process Trimmomatic {
  publishDir "${params.fastqc_dir}/${read1.baseName}"
  input:
    path(read1)
  output:
    path("${read1.baseName}_trimmed.fastq.gz")
  script:
    """
    java -jar ${params.trimmomatic_jar} PE -threads 4 \
      ${read1}  "${read1.baseName}_trimmed.fastq.gz" \
      "${read1.baseName}_unpaired.fastq.gz" \
      "${read1.baseName}_unpaired.fastq.gz"
    """
}
ADD COMMENT

Login before adding your answer.

Traffic: 2885 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6