---
# System prepended metadata

title: process real data

---

# process real data





#### need to do this for pilot reads so that I can concatenate them OK. 
```
for file in *.gz; do
    mv "$file" "${file//L001/L003}"
done
```

#### merge across lanes

```
#!/bin/bash

for i in $(find ./ -type f -name "*.fastq.gz" | while read F; do basename $F | rev | cut -c 22- | rev; done | sort | uniq)
    do echo "Merging R1"
    cat "$i"_L00*_R1_001.fastq.gz > "$i"_ME_L001_R1_001.fastq.gz
    echo "Merging R2"
    cat "$i"_L00*_R2_001.fastq.gz > "$i"_ME_L001_R2_001.fastq.gz
done;
```

### change names - get rid of `001`

```
for filename in *fastq.gz; do                  
    [ -f "$filename" ] || continue
    mv "$filename" "${filename//_001/}"
done
```


### change names - get rid of `L001` and `L002`

```
for filename in *fastq.gz; do                  
    [ -f "$filename" ] || continue
    mv "$filename" "${filename//L002_/}"
done

for filename in *fastq.gz; do                  
    [ -f "$filename" ] || continue
    mv "$filename" "${filename//L001_/}"
done

```


## mapping and ht-seq

```
source ~./bash_profile
conda activate mapping

sbatch ./ReadCount.job \
/mnt/lustre/macmaneslab/macmanes/physiology/genome/Peer2.0.1.fasta \
/mnt/lustre/macmaneslab/macmanes/physiology/genome/Peromyscus_eremicus__Peer2.0.1.fasta_v3.functional.gff3 \
/mnt/lustre/macmaneslab/macmanes/physiology/raw_reads \
.fastq.gz
```


```
source ~.bash_profile
conda activate mapping

sbatch ./ReadCount.job \
/mnt/lustre/macmaneslab/macmanes/physiology/genome/Peer2.0.1.fasta \
/mnt/lustre/macmaneslab/macmanes/physiology/genome/Peromyscus_eremicus__Peer2.0.1.fasta_v3.functional.gff3 \
/mnt/lustre/macmaneslab/macmanes/physiology/raw_reads/second_run/pilot \
.fastq.gz
```
