Skip to content

Commit 731c6c0

Browse files
Create og2.sh
1 parent ff66b77 commit 731c6c0

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed

og2.sh

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#!/bin/bash
2+
3+
cd /cromwell_root
4+
tmpDir=`mkdir -p "/cromwell_root/tmp.43725cb9" && echo "/cromwell_root/tmp.43725cb9"`
5+
chmod 777 "$tmpDir"
6+
export _JAVA_OPTIONS=-Djava.io.tmpdir="$tmpDir"
7+
export TMPDIR="$tmpDir"
8+
export HOME="$HOME"
9+
(
10+
cd /cromwell_root
11+
12+
)
13+
(
14+
cd /cromwell_root
15+
16+
17+
# Set the exit code of a pipeline to that of the rightmost command
18+
# to exit with a non-zero status, or zero if all commands of the pipeline exit
19+
set -o pipefail
20+
# cause a bash script to exit immediately when a command fails
21+
set -e
22+
# cause the bash shell to treat unset variables as an error and exit immediately
23+
set -u
24+
# echo each line of the script to stdout so we can see what is happening
25+
set -o xtrace
26+
#to turn off echo do 'set +o xtrace'
27+
28+
echo "Running pre-alignment"
29+
30+
samtools view -T /cromwell_root/topmed_workflow_testing/topmed_variant_caller/reference_files/hg38/hs38DH.fa -uh -F 0x900 /cromwell_root/topmed_workflow_testing/topmed_aligner/input_files/NWD176325.0005.recab.cram \
31+
| bam-ext-mem-sort-manager squeeze --in -.ubam --keepDups --rmTags AS:i,BD:Z,BI:Z,XS:i,MC:Z,MD:Z,NM:i,MQ:i --out -.ubam \
32+
| samtools sort -l 1 -@ 1 -n -T pre_output_base.samtools_sort_tmp - \
33+
| samtools fixmate - - \
34+
| bam-ext-mem-sort-manager bam2fastq --in -.bam --outBase pre_output_base --maxRecordLimitPerFq 20000000 --sortByReadNameOnTheFly --readname --gzip
35+
) > '/cromwell_root/stdout' 2> '/cromwell_root/stderr'
36+
echo $? > /cromwell_root/rc.tmp
37+
(
38+
# add a .file in every empty directory to facilitate directory delocalization on the cloud
39+
cd /cromwell_root
40+
find . -type d -empty -print | xargs -I % touch %/.file
41+
)
42+
(
43+
cd /cromwell_root
44+
sync
45+
# make the directory which will keep the matching files
46+
mkdir /cromwell_root/glob-7cc51463fe16c850aa9228b0db87877e
47+
48+
# create the glob control file that will allow for the globbing to succeed even if there is 0 match
49+
echo "This file is used by Cromwell to allow for globs that would not match any file.
50+
By its presence it works around the limitation of some backends that do not allow empty globs.
51+
Regardless of the outcome of the glob, this file will not be part of the final list of globbed files." > /cromwell_root/glob-7cc51463fe16c850aa9228b0db87877e/cromwell_glob_control_file
52+
53+
# symlink all the files into the glob directory
54+
( ln -L pre_output_base.* /cromwell_root/glob-7cc51463fe16c850aa9228b0db87877e 2> /dev/null ) || ( ln pre_output_base.* /cromwell_root/glob-7cc51463fe16c850aa9228b0db87877e )
55+
56+
# list all the files (except the control file) that match the glob into a file called glob-[md5 of glob].list
57+
ls -1 /cromwell_root/glob-7cc51463fe16c850aa9228b0db87877e | grep -v cromwell_glob_control_file > /cromwell_root/glob-7cc51463fe16c850aa9228b0db87877e.list
58+
59+
60+
)
61+
mv /cromwell_root/rc.tmp /cromwell_root/rc

0 commit comments

Comments
 (0)