-
Notifications
You must be signed in to change notification settings - Fork 0
/
MergeFq
executable file
·30 lines (30 loc) · 987 Bytes
/
MergeFq
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
#########################################################################
# File Name: work.sh
# Author: jdw
# mail: [email protected]
# Created Time: Wed 24 Jan 2018 01:12:41 PM CST
#########################################################################
#!/bin/bash
if [ $# -lt 3 ]
then
echo "Usage: $0 [Sample list] [Faste Indir] [Merged Fasetq Outdir] "
exit 1
fi
basepath=$(cd `dirname $0`;pwd)
usearch=$basepath/usearch10
SampleList=$1
indir=$2
outdir=$3
# Merge paired reads
# Add sample name to read label (-relabel option)
# Pool samples together in raw.fq (Linux cat command)
mkdir -p $outdir
log=$outdir/log
mkdir -p $log
rm -rf $outdir/all.merged.fq
for Sample in `cat ${SampleList} |grep -v '^#sample'| cut -f 1`
do
$usearch -fastq_mergepairs $indir/${Sample}*_R1.fq -fastqout $outdir/$Sample.merged.fq -relabel $Sample. 1>$log/$Sample.merge.log 2>&1
cat $outdir/$Sample.merged.fq >> $outdir/all.merged.fq
rm -rf $outdir/$Sample.merged.fq
done