die(){printf"$(date +%F)\t$(date +%T)\t[scriptDied] characterise-ExoDUs.sh died because it $*\n";exit 1;};export-f die
...
...
@@ -35,12 +35,12 @@ vsec() { if [ "${VERBOSE}" == "TRUE" ]; then printf "$(date +%F)\t$(date +%T)\t\
####################################
# housekeeping
# initialize variables prior to parsing arguements
nsec "ClaiRO initiated"
# test that all the requisite packages are avialable in path
# define a function that returns status 1 if a package isn't available
function checkAvailable {
builtin type-P"$1" &> /dev/null
...
...
@@ -59,7 +59,10 @@ export nbamCount=0
export cbamCount=0
export MODE="die"
####################################
# process the input arguments
ARGS=""
while[$# -gt 0 ]
do
...
...
@@ -72,7 +75,7 @@ do
case$optionsin
a)# annotation
[-d${OPTARG}]&&export input="${OPTARG}"&&inputFiles=`ls-d${OPTARG}/*.*`|| die "cannot fetch input files"# get a list of files in the primary input
[-d${OPTARG}]&&export input="${OPTARG}"&&inputFiles=`ls-d${OPTARG}/*.*`|| die "cannot access files in annotation directory"# get a list of files in the primary input
gunzipCount=$(echo$inputFiles | grep-c-e".gz");if[${gunzipCount}-gt"0"];then ssec "unzipping ${gunzipCount} files in ${1}";for i in${1}/*;do gunzip${i}|| die "cannot unzip ${i} " & done;wait;fi# unzip any .gz files if they are present
fastaCount=$(echo$inputFiles | tr" ""\n" | grep-v".fai" | grep-c-e".fasta"-e".fa"-e"fna");[${fastaCount}-eq"1"]|| die "did not identify a single input fasta in ${1}"# check that a fasta of some sort is present
[-d${OPTARG}]&&export nbamDir="${OPTARG}"&&nbamList=`ls-d${OPTARG}/*.*`|| die "cannot fetch input files"# get a list of files in the primary input
n)# nascent RNA alignments
[-d${OPTARG}]&&export nbamDir="${OPTARG}"&&nbamList=`ls-d${OPTARG}/*.*`|| die "cannot find any binary alignments in nascent bam directory"# get a list of files in the primary input
nbamCount=$(echo$nbamList | grep-c-e".bam")
[${nbamCount}-gt"0"]|| die "no binary alignments found in ${nbamDir}"
;;
c)# cytoplasmic RNA alignments
[-d${OPTARG}]&&export cbamDir="${OPTARG}"&&cbamList=`ls-d${OPTARG}/*.*`|| die "cannot fetch input files"# get a list of files in the primary input
[-d${OPTARG}]&&export cbamDir="${OPTARG}"&&cbamList=`ls-d${OPTARG}/*.*`|| die "ccannot find any binary alignments in mature bam directory"# get a list of files in the primary input
cbamCount=$(echo$cbamList | grep-c-e".bam")
[${cbamCount}-gt"0"]|| die "no binary alignments found in ${cbamDir}"
;;
...
...
@@ -135,7 +138,9 @@ do
done
### validate the input arguments
####################################
# validate the input arguments
# validate the annotation
[-f${myAnnotation}]&&[-f${myFasta}]|| die "user supplied invalid annotation"
julia ${whippetPath}/whippet-index.jl --fasta${myReferenceSequence}--bam${matureSamMerge}/unique.sorted.merged.bam --gtf${myAnnotation}--bam-min-reads 3 || die "canot make whippet index"
# generate OTF fastq for each cytoplasmic alignment;
ssec "fasta is ${myFasta}"
ssec "bam is "${matureSamMerge}/unique.sorted.merged.bam""
ssec "annotation is ${myAnnotation}"
# ask whippet to make an index while recognizing splice junctions from our bam
wptIdx="/g/data/lf10/as7425/SRscan/index-whippet";mkdir${wptIdx} 2>/dev/null;cd${wptIdx}|| die "cannot access whippet index directory";rm-rf${wptIdx}/*
julia ${whippetPath}/whippet-index.jl --fasta"${myFasta}"--bam"${matureSamMerge}/unique.sorted.merged.bam"--gtf"${myAnnotation}"--bam-min-reads 3 --index${wptIdx}|| die "canot make whippet index"
exit 0
####################################
# generate OTF fastq for each cytoplasmic alignment