@@ -176,6 +176,7 @@ vsec "Your output directory is ${outputDirectory}"
export od=${outputDirectory}
export matureSamMerge="${od}/matureSamMerge"
export wptIdx="${od}/whippetIndex"
export fqd="${od}/whippetFASTQ";
# validate threadCount
ssec "proceeding with ${threadCount} threads"
...
...
@@ -216,13 +217,20 @@ main() {
makeWhippetIndex || die "unable to prepare whippet index"
fi
# generate whippet index
if["$nm"-lt"4"]
then
echo"Preparing to analyse cytoplasmic alignments"
generateSequence || die "unable to prepare whippet index"
fi
die "no further instructions provided"
}
####################################
# generate on the fly whippet index using mature bams
# merge cytoplasmic bams and prepare to make whippet index
function prepareForWhippetIndex(){
nsec "preparing cytoplasmic alignments for whippet indexing"
...
...
@@ -242,7 +250,7 @@ function prepareForWhippetIndex() {
ssec "Output for already exists and was last modified at ${mergedFileModDate} --- Returning"
export returnWhippet="1"
fi
[${returnWhippet}=="1"]&&return 0
["${returnWhippet}"-eq"1"]&&return 0
# tell bash to die if an undefined variable is used
set-u
...
...
@@ -286,7 +294,7 @@ function prepareForWhippetIndex() {
cd${splitMerged}|| die "1"
samtools rmdup -S${myBam} - >${myBam%.bam}.unique.bam || die "2"
rm${myBam} 2>/dev/null || die "could not remove ${myBam}"
rm${myBam%.}.bai 2>/dev/null || die "could not remove ${myBam%.}.bai"
rm${splitMerged}/${myBam%.*}.bai 2>/dev/null #|| die "could not remove ${myBam%.*}.bai"
};export-f removeBamDup
# call the function for each bam
...
...
@@ -324,9 +332,11 @@ function makeWhippetIndex() {
# make an output directory for whippet
mkdir-p${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"
cd${wptIdx}|| die "cannot access whippet index directory"
rm-rf${wptIdx}/*# clear the index
ssec "launching whippet"
julia ${whippetPath}/whippet-index.jl --fasta"${myFasta}"--bam"${matureSamMerge}/unique.sorted.merged.bam"--gtf"${myAnnotation}"--bam-min-reads 3 --index"${od}/whippetIndex/index_"|| die "canot make whippet index"
ssec "succesfully build whippet index"
}
####################################
...
...
@@ -337,7 +347,7 @@ function generateSequence() {
nsec "generating sequences for each cytoplasmic alignment"