Skip to content

Commit

Permalink
use module only when available
Browse files Browse the repository at this point in the history
  • Loading branch information
arangrhie committed Mar 24, 2020
1 parent 8a8cb1e commit 99a7ad8
Show file tree
Hide file tree
Showing 8 changed files with 59 additions and 19 deletions.
12 changes: 7 additions & 5 deletions eval/spectra-cn.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ if [ -s $name ]; then
fi


## Comment this line if R is properly installed ##
echo "Load R"
module load R #
#################################################
echo
has_module=$(check_module)
if [[ $has_module -gt 0 ]]; then
echo "No modules available.."
else
module load R
fi


asm1=`echo $asm1_fa | sed 's/.fasta$//g' | sed 's/.fa$//g' | sed 's/.fasta.gz$//g' | sed 's/.fa.gz$//g'`

Expand Down
13 changes: 10 additions & 3 deletions trio/block_n_stats.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,16 @@ else
g_size=$4
fi

module load bedtools
module load samtools
module load R
source $MERQURY/util/util.sh

has_module=$(check_module)
if [[ $has_module -gt 0 ]]; then
echo "No modules available.."
else
module load bedtools
module load samtools
module load R
fi

for asm in $asm1 $asm2
do
Expand Down
7 changes: 6 additions & 1 deletion trio/hap_blob.sh
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,12 @@ done
echo "
Plot hap-mer blob plots"

module load R
has_module=$(check_module)
if [[ $has_module -gt 0 ]]; then
echo "No modules available.."
else
module load R
fi

echo "
Rscript $MERQURY/plot/plot_blob.R -f $count -o $out.hapmers.blob"
Expand Down
12 changes: 8 additions & 4 deletions trio/hapmers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,14 @@ meryl histogram shrd.inherited.meryl | awk -v kmer="shared" '{print kmer"\t"$1"\
echo

echo "# Plot $hist"
## Comment this line if R is properly installed ##
echo "Load R" #
module load R #
##################################################
source $MERQURY/util/util.sh

has_module=$(check_module)
if [[ $has_module -gt 0 ]]; then
echo "No modules available.."
else
module load R
fi
echo

Rscript $MERQURY/plot/plot_spectra_cn.R -f $hist -o ${hist/.hist/} -l cutoffs.txt
Expand Down
9 changes: 7 additions & 2 deletions trio/phase_block.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ hap1=`link $2`
hap2=`link $3`
out=$4

module load bedtools
module load samtools
has_module=$(check_module)
if [[ $has_module -gt 0 ]]; then
echo "No modules available.."
else
module load bedtools
module load samtools
fi

k=`meryl print $hap1 | head -n 2 | tail -n 1 | awk '{print length($1)}'`
echo "Detected k-mer size: $k"
Expand Down
11 changes: 8 additions & 3 deletions trio/spectra-hap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@ k=`meryl print $read | head -n 2 | tail -n 1 | awk '{print length($1)}'`
echo "Detected k-mer size $k"

## Remove this line if R is properly installed ##
echo "Load R"
module load R #
#################################################
source $MERQURY/util/util.sh

has_module=$(check_module)
if [[ $has_module -gt 0 ]]; then
echo "No modules available.."
else
module load R
fi

read=${read/.meryl/} # all read counts
read_hap1=${read_hap1/.meryl/} # pat specific mers with read counts
Expand Down
9 changes: 8 additions & 1 deletion trio/switch_error.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,14 @@ echo "Count $hap1 and $hap2 hap-mers per block to $count"
echo -e "Block\tRange\t$hap1\t$hap2\tSize" > $count
awk -v hap1=$hap1 -v hap2=$hap2 '{ swi=$(NF-1); phase=$NF; {if ($4==hap1) { hap1_cnt=phase; hap2_cnt=swi; } else if ($4==hap2) { hap1_cnt=swi; hap2_cnt=phase; }} {print $4"\t"$1"_"$2"_"$3"\t"hap1_cnt"\t"hap2_cnt"\t"($3-$2)}}' $out.phased_block.bed >> $count

module load R
source $MERQURY/util/util.sh

has_module=$(check_module)
if [[ $has_module -gt 0 ]]; then
echo "No modules available.."
else
module load R
fi

echo "
Rscript $MERQURY/plot/plot_blob.R -f $count -o $out.phased_block.blob"
Expand Down
5 changes: 5 additions & 0 deletions util/util.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,8 @@ function link()
echo $db_name
}

function check_module()
{
module -v 1> /dev/null 2> /dev/null
echo $?
}

0 comments on commit 99a7ad8

Please sign in to comment.