---
title: "01-data-explore"
format: html
editor: visual
---

### Metadata

<https://github.com/epigeneticstoocean/2018OAExp_larvae>

<https://github.com/epigeneticstoocean/2018_L18_OAExp_Cvirginica_DNAm/blob/main/data/L18_larvae_meta.csv>

### Raw reads:

<https://owl.fish.washington.edu/nightingales/C_virginica/2018OALarvae_DNAm_discovery/>

### Trimmed reads:

<https://gannet.fish.washington.edu/Atumefaciens/20220826-cvir-larvae_zygote-BSseq-fastp_trimming/>

#### MultiQC report:

<https://gannet.fish.washington.edu/Atumefaciens/20220826-cvir-larvae_zygote-BSseq-fastp_trimming/multiqc_report.html>

#### Trimming notebook:

<https://robertslab.github.io/sams-notebook/posts/2022/2022-08-29-FastQ-Trimming-and-QC---C.virginica-Larval-BS-seq-Data-from-Lotterhos-Lab-and-Part-of-CEABIGR-Project-Using-fastp-on-Mox/index.html>

# BISMARK

```{bash}
# Directories
reads_dir="../data/"
genome_folder="../data/genome"
output_dir="../output/06-bismark-xarg"

# Ensure the output directory exists
mkdir -p ${output_dir}

# Find and process samples
find ../data/*_R1_001.fastp-trim.20220827.fq.gz \
| xargs -n 1 basename -s _R1_001.fastp-trim.20220827.fq.gz \
| while read sample; do
    # Check if the output file already exists
    if [ -f ${output_dir}/${sample}_PE_report.txt ]; then
        echo "Skipping ${sample}: output already exists."
        continue
    fi

    # Run bismark
    echo "Processing ${sample}..."
    bismark \
        -genome ${genome_folder} \
        -p 8 \
        -score_min L,0,-0.8 \
        --non_directional \
        -1 ${reads_dir}${sample}_R1_001.fastp-trim.20220827.fq.gz \
        -2 ${reads_dir}${sample}_R2_001.fastp-trim.20220827.fq.gz \
        -o ${output_dir} \
        --basename ${sample} \
        >> ${output_dir}/output.log 2>&1
done
```
