User Tools

Site Tools


talk:scripts:adapter_and_quality_trimming

Quality Control with FastQC and MultiQC

Should we create a separate page for FastQC and MultiQC or have them in adapter trimming section?

I suggest the following codes:

Dauther script

fastqc.sh

# SCRIPT FOR PERFORMING FASTQC
# NOTE: Run this script from the directory where the "log" directory is located,
#       /mnt/proj/ibd/ds-06_cd-fecal/common
#
# PURPOSE:
#   This script performs FastQC.
#
# PARAMETERS:
#   1: input_dir - Directory where FASTQ files are located.
#   2: output_dir - Directory where FastQC reports will be located
# SAMPLE USAGE:
#   In a parent script: src/fastqc.sh <input_dir> <output_dir>
#
# IMPORTANT:
#   - Run from a parent script.

# Check if correct number of arguments are provided
if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <input_dir> <output_dir>"
    exit 1
fi

# Input parameters
input_dir="$1"
output_dir="$2"

echo "Running FastQC on reads..."
mkdir -p "$output_dir"
fastqc -o "$output_dir" "$input_dir/"*.fq.gz
Parent script

fastqc_00.sh

#!/bin/bash
#SBATCH --mem=10gb
#SBATCH --cpus-per-task=10
#SBATCH --job-name=fastqc_multiqc_00
#SBATCH --output=log/fastqc_00%j.log  # %j will be replaced with the job ID

#parameters

input=fq_renamed
output=fastqc

src/fastqc.sh $input $output
Dauther script

multiqc.sh

# SCRIPT FOR PERFORMING MultiQC
# NOTE: Run this script from the directory where the "log" directory is located,
#       /mnt/proj/ibd/ds-06_cd-fecal/common
#
# PURPOSE:
#   This script performs MultiQC.
#
# PARAMETERS:
#   1: input_dir - Directory where FastQC reports are located.
#   2: output_dir - Directory where MultiQC report will be located
# SAMPLE USAGE:
#   In a parent script: src/multiqc.sh <input_dir> <output_dir>
#
# IMPORTANT:
#   - Run from a parent script.

# Check if correct number of arguments are provided
if [ "$#" -ne 2 ]; then
    echo "Usage: $0 <input_dir> <output_dir>"
    exit 1
fi

# Input parameters
input_dir="$1"
output_dir="$2"

echo "Running FastQC on reads..."
mkdir -p "$output_dir"
multiqc -o "$output_dir" "$input_dir/"*.fq.gz
Parent script

multiqc_00.sh

#!/bin/bash
#SBATCH --mem=10gb
#SBATCH --cpus-per-task=10
#SBATCH --job-name=fastqc_multiqc_00
#SBATCH --output=log/fastqc_00%j.log  # %j will be replaced with the job ID

#parameters

input=fastqc
output=multiqc

src/multiqc.sh $input $output

You can also perform them simultaneously with one parent script:

Combined parent script
#!/bin/bash
#SBATCH --mem=10gb
#SBATCH --cpus-per-task=10
#SBATCH --job-name=fastqc_multiqc_00
#SBATCH --output=log/fastqc_multiqc_00%j.log  # %j will be replaced with the job ID

#parameters

input_fqc=fq
output_fqc=fastqc
input_mqc=fastqc
output_mqc=multiqc

src/fastqc.sh $input_fqc $output_fqc
src/multiqc.sh $input_mqc $output_mqc

You can also use the same scripts on trimmed files. Just add “_trimmed” to the inputs and outputs like this.

input=fq_trimmed
output=fastqc_trimmed
talk/scripts/adapter_and_quality_trimming.txt · Last modified: by 37.26.174.181

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki