-
Notifications
You must be signed in to change notification settings - Fork 5
/
running_kbvelocity.sh
79 lines (74 loc) · 2.16 KB
/
running_kbvelocity.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#!/bin/bash
# Purpose: To run kb-wrapper for RNA velocity on multiple scRNA-seq paired end fastq files stored in the same folder.
# Default values of arguments
INDEXPATH="/home/snabel/refs/genomes/GRCh38/kb_genome/velocity+erccrep_index/"
INDEXFILE="$INDEXPATH/GRCh38_index.idx"
T2G="$INDEXPATH/GRCh38_t2g.txt"
CDNAFILE="$INDEXPATH/GRCh38_cdna_t2c.txt"
INTRONFILE="$INDEXPATH/GRCh38_intron_t2c.txt"
BARCODEFILE="/home/snabel/scrna/1col_barcode_384.tab"
# Loop through arguments and process them
for arg in "$@"
do
case $arg in
-f|--fastqpath)
FASTQPATH="$2"
shift # Remove argument name from processing
shift # Remove argument value from processing
;;
-i|--idexfile)
INDEXFILE="$2"
shift
shift
;;
-g|--t2g)
T2G="$2"
shift
shift
;;
-b|--barcodefile)
BARCODEFILE="$2"
shift
shift
;;
-c1|--cdnafile)
CDNAFILE="$2"
shift
shift
;;
-c2|--intronfile)
INTRONFILE="$2"
shift
shift
;;
esac
done
echo "Running kb-wrapper for scRNA-seq with velocity, with the following settings:"
echo "# Fastq directory: $FASTQPATH"
echo "# Index path: $INDEXFILE"
if [ -z "$FASTQPATH" ];
then
echo "Oops, nothing happened! This function needs the location of the .fastq files as input! Use -f or --fastqpath to specify the location of fastqs."
else
for filename in ${FASTQPATH}*R1.fastq.gz;
do
id="${filename##*/}";
id="${id/_R1.fastq.gz/}";
output_name="${id}_output/";
r1="$filename";
r2="${filename/_R1.fastq.gz/}_R2.fastq.gz";
# check if the ouput files for this plate are present.
if [ ! -e "${output_name}counts_unfiltered/unspliced.mtx" ];
then
echo "Running for: ${id}";
nice -n 10 kb count -i ${INDEXFILE} \
-g ${T2G} -x 0,8,16:0,0,8:1,0,0 -w ${BARCODEFILE} \
--overwrite --verbose --lamanno -t 40 \
-o ${output_name} -c1 ${CDNAFILE} -c2 ${INTRONFILE} \
${r1} ${r2} >> log.out 2>&1;
echo "Done. Check ${output_name}";
else
echo "Checked ${output_name}. Done.";
fi;
done
fi