forked from fl-yu/CUT-RUNTools-2.0
-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_bulkModule.sh
executable file
·90 lines (77 loc) · 3.29 KB
/
run_bulkModule.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
80
81
82
83
84
85
86
87
88
89
#!/bin/bash
# Copyright (C) 2020 Fulong Yu
#
# CUT&RUNTools 2.0 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
#
# CUT&RUNTools 2.0 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# A copy of the GNU General Public License has been distributed along with CUT&RUNTools and is found in LICENSE.md.
configrue_file=$1 # $scriptdir/bulk-config.json
sample_name=$2 # $scriptdir/bulk-config.json
experiment_name=$sample_name
# SCRIPT=`readlink -f $0`
SCRIPT=`echo "$(cd "$(dirname "$0")" && pwd -P)/$(basename "$0")"`
SCRIPTPATH=`dirname $SCRIPT`
scriptdir=$SCRIPTPATH/src/bulk
# convert configuration JSON files to bash variables
eval "$(jq -r '.software_config | to_entries | .[] | .key + "=\"" + .value + "\""' < $configrue_file)"
eval "$(jq -r '.input_output | to_entries | .[] | .key + "=\"" + .value + "\""' < $configrue_file)"
eval "$(jq -r '.motif_finding | to_entries | .[] | .key + "=\"" + .value + "\""' < $configrue_file)"
chrom_size_file=$SCRIPTPATH/assemblies/chrom."$organism_build"/"$organism_build".chrom.sizes
blacklist=$SCRIPTPATH/blacklist/"$organism_build".blacklist.bed
blacklist2=$SCRIPTPATH/blacklist/"$organism_build"_TA_repeat.bed
workdir=$workdir/$experiment_name
# check the parameters
if [ "$spike_in" == "none" ]
then
if [ "$spike_in_norm" == "TRUE" ]
then
>&2 echo [ERROR] Check the parameters of spike_in and spike_in_norm
exit
fi
fi
if [ "$organism_build" != "hg38" ] && [ "$organism_build" != "hg19" ] && [ "$organism_build" != "mm10" ] && [ "$organism_build" != "mm9" ]
then
echo "organism_build should be one of hg38, hg19, mm10 or mm9"
exit 1
fi
if [ "$organism_build" == "hg38" ] || [ "$organism_build" == "hg19" ]
then
macs2_genome=hs
else
macs2_genome=mm
fi
if [ "$organism_build" == "hg38" ]
then
eGenomeSize=2913022398
elif [ "$organism_build" == "hg19" ]
then
eGenomeSize=2864785220
elif [ "$organism_build" == "mm10" ]
then
eGenomeSize=2652783500
else
eGenomeSize=2620345972
fi
# also check T and F for spike_in_norm.....
echo "==================================== Bulk data analysis pipeline will run =============================================================="
>&2 echo -e "## Input FASTQ folder: $fastq_directory"
sleep 0.1
>&2 echo -e "## Sample name: $sample_name"
sleep 0.1
>&2 echo -e "## Workdir folder: $workdir"
sleep 0.1
>&2 echo -e "## Experiment name: $experiment_name"
sleep 0.1
>&2 echo -e "## Experiment type: $experiment_type"
sleep 0.1
>&2 echo -e "## Reference genome: $organism_build"
sleep 0.1
>&2 echo -e "## Spike-in genome: $spike_in"
sleep 0.1
>&2 echo -e "## Spike-in normalization: $spike_in_norm"
sleep 0.1
>&2 echo -e "## Fragment 120 filtration: $frag_120"
sleep 0.1
echo -e "================================================================================================================================="
. $scriptdir/bulk-pipeline.sh