-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbw_and_bb_to_plain.sh
46 lines (38 loc) · 1.08 KB
/
bw_and_bb_to_plain.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
#!/bin/bash
# Paths to the conversion tools
BWTW_TOOL="../Packages/bigWigToWig"
BBTB_TOOL="../Packages/bigBedToBed"
parentDir="/data/user/${USER}/T2T/RawData"
# Find all subdirectories in the parent directory
for dataDir in ${parentDir}/*/; do
# Remove trailing slash for consistency in file naming
dataDir=${dataDir%/}
# Convert BigWig files to Wig
for file in ${dataDir}/*.bw; do
jobScript="${dataDir}/convert_${file##*/}.sh"
cat > ${jobScript} << EOF
#!/bin/bash
#SBATCH --job-name=convertBW2Wig
#SBATCH --output=convertBW2Wig_%j.out
#SBATCH --time=01:00:00
#SBATCH --mem=4G
#SBATCH --cpus-per-task=1
${BWTW_TOOL} "$file" "${file%.bw}.wig"
EOF
sbatch ${jobScript}
done
# Convert BigBed files to Bed
for file in ${dataDir}/*.bb; do
jobScript="${dataDir}/convert_${file##*/}.sh"
cat > ${jobScript} << EOF
#!/bin/bash
#SBATCH --job-name=convertBB2Bed
#SBATCH --output=convertBB2Bed_%j.out
#SBATCH --time=01:00:00
#SBATCH --mem=4G
#SBATCH --cpus-per-task=1
${BBTB_TOOL} "$file" "${file%.bb}.bed"
EOF
sbatch ${jobScript}
done
done