wrapper_ehdn_outlier.sh 2.6 KB
Newer Older
1 2 3 4
#! /bin/sh

### ASDP PIPELINE ###
## Version: 0.0.1
5 6
## Licence: AGPLv3
## Author: anne-sophie.denomme-pichon@u-bourgogne.fr
7 8
## Description: script to generate automatically a manifest and multisampleprofile in a tsv format, then do outlier analyses for a single patient

9 10
# Source the configuration file
. "$(dirname "$0")/config.sh"
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30

# Log file path option
if [ -z "$LOGFILE" ]
then
    LOGFILE=ehdn_outlier.$(date +"%F_%H-%M-%S").log
fi

# Logging
exec 1>> "$LOGFILE" 2>&1
echo "$(date +"%F_%H-%M-%S"): START"

# Check if case is specified
if [ -z "$CASE" ]
then
    echo "Dijen is not specified"
    echo "$(date +"%F_%H-%M-%S"): END"
    exit 1
fi

# Generate manifest for one patient with all samples (to write lines in the file)
31
cd "$OUTPUTDIR"
32 33 34
for dijen in dijen*
do
    # Check if str_profile.json exists
35
    if [ -f "$OUTPUTDIR/$dijen/ehdn/$dijen.str_profile.json" ]
36 37 38
    then
        if [ "x$dijen" = "x$CASE" ]
        then
39
        echo -e "$dijen\tcase\t$OUTPUTDIR/$dijen/ehdn/$dijen.str_profile.json"
40
        else
41
        echo -e "$dijen\tcontrol\t$OUTPUTDIR/$dijen/ehdn/$dijen.str_profile.json"
42 43
        fi
    fi
44
done > "$OUTPUTDIR/$CASE/ehdn/$CASE.manifest.tsv"
45 46 47 48 49 50 51 52 53 54 55 56 57

ehdn_outlier_exitcode=$?

echo "ehdn_outlier exit code : $ehdn_outlier_exitcode"
if [ $ehdn_outlier_exitcode != 0 ]
then
    echo "$(date +"%F_%H-%M-%S"): END"
    exit 1
fi

# Generate multisampleprofile for one patient with all samples
"$EHDN" merge \
    --reference "$REFERENCE" \
58
    --manifest "$OUTPUTDIR/$CASE/ehdn/$CASE.manifest.tsv" \
59 60 61 62 63 64 65 66 67 68 69 70 71
    --output-prefix "$CASE/ehdn/$CASE"

ehdn_outlier_exitcode=$?

echo "ehdn_outlier exit code : $ehdn_outlier_exitcode"
if [ $ehdn_outlier_exitcode != 0 ]
then
    echo "$(date +"%F_%H-%M-%S"): END"
    exit 1
fi

# Run locus-based comparison analysis
"$EHDN_OUTLIER" locus \
72 73 74
    --manifest "$OUTPUTDIR/$CASE/ehdn/$CASE.manifest.tsv" \
    --multisample-profile "$OUTPUTDIR/$CASE/ehdn/$CASE.multisample_profile.json" \
    --output "$OUTPUTDIR/$CASE/ehdn/$CASE.outlier_locus.tsv"
75 76 77 78 79 80 81 82 83 84 85 86 87

ehdn_outlier_exitcode=$?

echo "ehdn_outlier exit code : $ehdn_outlier_exitcode"
if [ $ehdn_outlier_exitcode != 0 ]
then
    echo "$(date +"%F_%H-%M-%S"): END"
    exit 1
fi


# Run motif_based comparison analysis
"$EHDN_OUTLIER" motif \
88 89 90
    --manifest "$OUTPUTDIR/$CASE/ehdn/$CASE.manifest.tsv" \
    --multisample-profile "$OUTPUTDIR/$CASE/ehdn/$CASE.multisample_profile.json" \
    --output "$OUTPUTDIR/$CASE/ehdn/$CASE.outlier_motif.tsv"
91 92 93 94 95 96 97 98 99 100 101 102 103 104

ehdn_outlier_exitcode=$?

echo "ehdn_outlier exit code : $ehdn_outlier_exitcode"
if [ $ehdn_outlier_exitcode != 0 ]
then
    echo "$(date +"%F_%H-%M-%S"): END"
    exit 1
fi

echo "$(date +"%F_%H-%M-%S"): END"