Mercurial > repos > petr-novak > re_utils
annotate paired_fastq_filtering_wrapper.sh @ 33:f1738f8649b0 draft
planemo upload commit 39094a128ea3dd2c39f4997c6de739c33c07e5f3-dirty
author | petr-novak |
---|---|
date | Fri, 04 Aug 2023 08:09:40 +0000 |
parents | 628b235d76c7 |
children |
rev | line source |
---|---|
0 | 1 #!/bin/bash |
2 set -euo pipefail | |
3 IFS=$'\n\t' | |
4 | |
5 # run filtering | |
6 WD="`dirname $0`" | |
7 ORIDIR=$PWD | |
8 cd $WD | |
9 WD=$PWD # absolute path to this script | |
10 cd $ORIDIR | |
11 SAMPLING="" | |
12 TRIM_END="" | |
13 TRIM_START="" | |
14 PERCENT_ABOVE="95" | |
15 CUTADAPT="" | |
16 RENAME="" | |
17 FILTER_SEQ="" | |
18 while getopts "a:b:o:n:c:p:e:s:N:C:G:F:R" OPTION | |
19 do | |
20 case $OPTION in | |
21 a) | |
22 FASTAA=$OPTARG;; | |
23 b) | |
24 FASTAB=$OPTARG;; | |
25 o) | |
26 PAIRED_OUTPUT=$OPTARG;; | |
27 n) | |
28 SAMPLING=( -n ${OPTARG} );; | |
29 c) | |
30 CUT_OFF=$OPTARG;; | |
31 p) | |
32 PERCENT_ABOVE=$OPTARG;; | |
33 e) | |
34 TRIM_END=( -e ${OPTARG} );; | |
35 s) | |
36 TRIM_START=( -s ${OPTARG} );; | |
37 N) | |
38 MAX_N=${OPTARG};; | |
39 C) | |
40 CUTADAPT=(-C " "${OPTARG}" " );; | |
41 G) | |
42 PNG_OUTPUT=${OPTARG};; | |
43 R) | |
44 RENAME="-R";; | |
45 F) | |
46 FILTER_SEQ=( -F ${OPTARG} );; | |
47 | |
48 esac | |
49 done | |
50 fasta_tmp_fileX=$(mktemp) | |
51 fasta_tmp_fileY=$(mktemp) | |
52 | |
53 if [ -z "$CUTADAPT" ] # test if$CUTADAPT is empty | |
54 then | |
32
628b235d76c7
planemo upload commit 39094a128ea3dd2c39f4997c6de739c33c07e5f3-dirty
petr-novak
parents:
0
diff
changeset
|
55 Rscript ${WD}/paired_fastq_filtering.R -a $FASTAA -b $FASTAB -x $fasta_tmp_fileX -y $fasta_tmp_fileY ${SAMPLING[@]} -c $CUT_OFF -G $PNG_OUTPUT\ |
0 | 56 -p $PERCENT_ABOVE ${TRIM_START[@]} ${TRIM_END[@]} -N $MAX_N $RENAME ${FILTER_SEQ[@]} |
57 else | |
32
628b235d76c7
planemo upload commit 39094a128ea3dd2c39f4997c6de739c33c07e5f3-dirty
petr-novak
parents:
0
diff
changeset
|
58 Rscript ${WD}/paired_fastq_filtering.R -a $FASTAA -b $FASTAB -x $fasta_tmp_fileX -y $fasta_tmp_fileY ${SAMPLING[@]} -c $CUT_OFF -G $PNG_OUTPUT\ |
0 | 59 -p $PERCENT_ABOVE ${TRIM_START[@]} ${TRIM_END[@]} -N $MAX_N "${CUTADAPT[@]}" $RENAME ${FILTER_SEQ[@]} |
60 fi | |
61 | |
32
628b235d76c7
planemo upload commit 39094a128ea3dd2c39f4997c6de739c33c07e5f3-dirty
petr-novak
parents:
0
diff
changeset
|
62 python ${WD}/fasta_interlacer.py -a $fasta_tmp_fileX -b $fasta_tmp_fileY -p $PAIRED_OUTPUT -x fasta_tmp_single |
0 | 63 |
64 | |
65 rm $fasta_tmp_fileX | |
66 rm $fasta_tmp_fileY |