-
Notifications
You must be signed in to change notification settings - Fork 67
/
splitfq.sh
executable file
·56 lines (45 loc) · 1.17 KB
/
splitfq.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# LMU Munich. AG Enard
# splitting fastq files to filter using multiple processors.
# Authors: Swati Parekh, Christoph Ziegenhain, Beate Vieth & Ines Hellmann
# Contact: [email protected] or [email protected]
function splitfq() {
fqfile=$1
pexc=$2
nthreads=$3
nreads=$4
t=$5
project=$6
n=`expr $nreads / $nthreads`
n=`expr $n + 1`
nl=`expr $n \* 4`
pref=`basename $fqfile`
d=`dirname $fqfile`
split --lines=$nl --filter=''$pexc' -p '$nthreads' > $FILE.gz' $fqfile $t$pref$project
ls $t$pref$project* | sed "s|$t$pref$project||" > $t/$project.listPrefix.txt
exit 1
}
function splitfqgz() {
fqfile=$1
pexc=$2
nthreads=$3
nreads=$4
t=$5
project=$6
n=`expr $nreads / $nthreads`
n=`expr $n + 1`
nl=`expr $n \* 4`
pref=`basename $fqfile .gz`
d=`dirname $fqfile`
$pexc -dc -p $nthreads $d/$pref.gz | split --lines=$nl --filter=''$pexc' -p '$nthreads' > $FILE.gz' - $t$pref$project
ls $t$pref$project* | sed "s|$t$pref$project||" | sed 's/.gz//' > $t/$project.listPrefix.txt
exit 1
}
i=$1
pigzexc=$2
num_threads=$3
tmpMerge=$4
fun=$5
project=$6
nreads=$7
$fun "$i" "$pigzexc" "$num_threads" "$nreads" "$tmpMerge" "$project"