-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathconcat.fastq.R2.sh
42 lines (32 loc) · 1.76 KB
/
concat.fastq.R2.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
###########################################
# (c) Alexandra Jansen van Rensburg
# last modified 12/07/2019 05:49
###########################################
## Concatenates fastq reads from a list of file names
## R1 and R2 are processed separately
#PBS -N G3.OS.concat.R2 ##job name
#PBS -l nodes=1:ppn=1 #nr of nodes and processors per node
#PBS -l mem=16gb #RAM
#PBS -l walltime=10:00:00 ##wall time.
#PBS -j oe #concatenates error and output files (with prefix job1)
#PBS -t 1-33
#run job in working directory
cd $PBS_O_WORKDIR
#Define variables
#create files with sample names listed for the 33 samples
#ls ../01a_museum2_cutadapt_reads/*R1*gz > samplenames.museum2.R1
#ls ../01a_museum2_cutadapt_reads/*R2*gz > samplenames.museum2.R2
#ls ../01a_museum_cutadapt_reads/*R1*gz >> samplenames.museum1.R1
#ls ../01a_museum_cutadapt_reads/*R2*gz >> samplenames.museum1.R2
#remove all the extra sample names from the last two files. Make sure the sample names are in the same order in all files.
#remove path before sample names
#NAMEMUS1R1=$(sed "${PBS_ARRAYID}q;d" samplenames.museum1.R1)
NAMEMUS1R2=$(sed "${PBS_ARRAYID}q;d" samplenames.museum1.R2)
#NAMEMUS2R1=$(sed "${PBS_ARRAYID}q;d" samplenames.museum2.R1)
NAMEMUS2R2=$(sed "${PBS_ARRAYID}q;d" samplenames.museum2.R2)
##Concat R2 fastq files
echo "[concatenating] ${NAMEMUS1R2} and ${NAMEMUS2R2}"
printf "\n"
echo "time cat /newhome/aj18951/G3_Hesperia_comma/01a_museum_cutadapt_reads/${NAMEMUS1R2} /newhome/aj18951/G3_Hesperia_comma/01a_museum2_cutadapt_reads/${NAMEMUS2R2} > ${NAMEMUS2R2}.concat.fastq.gz" >> concat.mus.R2.log
time cat /newhome/aj18951/G3_Hesperia_comma/01a_museum_cutadapt_reads/${NAMEMUS1R2} /newhome/aj18951/G3_Hesperia_comma/01a_museum2_cutadapt_reads/${NAMEMUS2R2} > ${NAMEMUS2R2}.concat.fastq.gz