Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make MELT scripts independent of the execution path. #665

Merged
merged 4 commits into from
Apr 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 9 additions & 13 deletions dockerfiles/melt/run_MELT_2.0.5.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ set -euo pipefail
##### Usage statement
usage(){
cat <<EOF
usage: runMELT.sh bam ref cov read_len mean_is MELT_DIR RUN_DIR REF_VER
usage: runMELT.sh bam ref cov read_len mean_is MELT_DIR REF_VER
Runs MELT for mobile element detection. Requires paired-end deep (>10X) WGS data mapped with BWA.
Positional arguments (all required):
bam Full path to mapped bam file (bam.bai assumed accompanying the BAM)
Expand All @@ -28,15 +28,14 @@ cat <<EOF
read_len Mean read length of library
mean_is Mean insert size of library
MELT_DIR Full path to MELT install directory
RUN_DIR Full path to directory for MELT output
REF_VER Reference version (19|38)
EOF
}

##### Args parsing and validation
if [[ "$#" -eq 0 ]]; then
usage && exit 0;
elif [[ "$#" -lt 8 ]]; then
elif [[ "$#" -lt 7 ]]; then
echo "At least one of the required parameters is not properly set by the given command:"
temp_args="$@" && echo "$0 ${temp_args}" && exit 1;
fi
Expand All @@ -51,11 +50,10 @@ cov=$3
read_len=$4
mean_is=$5
MELT_DIR=$6
RUN_DIR=$7
REF_VER=$8
REF_VER=$7

##### Check for required input (unset or empty)
if [ -z "${bam}" ] || [ -z "${ref}" ] || [ -z "${cov}" ] || [ -z "${read_len}" ] || [ -z "${mean_is}" ] || [ -z "${MELT_DIR}" ] || [ -z "${RUN_DIR}" ] || [ -z "${REF_VER}" ]; then
if [ -z "${bam}" ] || [ -z "${ref}" ] || [ -z "${cov}" ] || [ -z "${read_len}" ] || [ -z "${mean_is}" ] || [ -z "${MELT_DIR}" ] || [ -z "${REF_VER}" ]; then
echo "At least one of the required parameters is not properly set by the given command:"
temp_args="$@" && echo "$0 ${temp_args}" && exit 1; # non-zero exit because it indicates user errror
fi
Expand All @@ -76,20 +74,18 @@ read_len=$( echo "${read_len}" | cut -f1 -d\. )
mean_is=$( echo "${mean_is}" | cut -f1 -d\. )

##### remove trailing slash just to make sure
RUN_DIR="${RUN_DIR%/}"
MELT_DIR="${MELT_DIR%/}"

##### Create transposons reference list
if [[ "$REF_VER" == "38" ]]; then
ls "${MELT_DIR}"/me_refs/Hg38/*zip | sed 's/\*//g' > "${RUN_DIR}/transposon_reference.list"
ls "${MELT_DIR}"/me_refs/Hg38/*zip | sed 's/\*//g' > "transposon_reference.list"
GENE_BED_FILE="${MELT_DIR}/add_bed_files/Hg38/Hg38.genes.bed"
elif [[ "$REF_VER" == "19" ]]; then
ls "${MELT_DIR}"/me_refs/1KGP_Hg19/*zip | sed 's/\*//g' > "${RUN_DIR}/transposon_reference.list"
ls "${MELT_DIR}"/me_refs/1KGP_Hg19/*zip | sed 's/\*//g' > "transposon_reference.list"
GENE_BED_FILE="${MELT_DIR}/add_bed_files/1KGP_Hg19/hg19.genes.bed"
fi

##### Create output directory if it doesn't exist. then run MELT Single
mkdir -p "${RUN_DIR}" && cd "${RUN_DIR}"
##### Run MELT Single
java -Xmx"${JVM_MAX_MEM}" \
-jar "${MELT_DIR}/MELT.jar" \
Single \
Expand All @@ -99,6 +95,6 @@ java -Xmx"${JVM_MAX_MEM}" \
-r "${read_len}" \
-e "${mean_is}" \
-d "${MIN_CHR_LENGTH}" \
-t "${RUN_DIR}/transposon_reference.list" \
-t "transposon_reference.list" \
-n "${GENE_BED_FILE}" \
-w "${RUN_DIR}"
-w "."
2 changes: 1 addition & 1 deletion inputs/values/dockers.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"genomes_in_the_cloud_docker": "us.gcr.io/broad-gotc-prod/genomes-in-the-cloud:2.3.2-1510681135",
"linux_docker": "marketplace.gcr.io/google/ubuntu1804",
"manta_docker": "us.gcr.io/broad-dsde-methods/gatk-sv/manta:2023-09-14-v0.28.3-beta-3f22f94d",
"melt_docker": "us.gcr.io/talkowski-sv-gnomad/melt:3159ce1",
"melt_docker": "us.gcr.io/talkowski-sv-gnomad/melt:a85c92f",
"scramble_docker": "us.gcr.io/broad-dsde-methods/markw/scramble:mw-scramble-99af4c50",
"samtools_cloud_docker": "us.gcr.io/broad-dsde-methods/gatk-sv/samtools-cloud:2024-01-24-v0.28.4-beta-9debd6d7",
"sv_base_docker": "us.gcr.io/broad-dsde-methods/gatk-sv/sv-base:2024-01-24-v0.28.4-beta-9debd6d7",
Expand Down
2 changes: 1 addition & 1 deletion inputs/values/dockers_azure.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"genomes_in_the_cloud_docker": "vahid.azurecr.io/genomes-in-the-cloud:2.3.2-1510681135",
"linux_docker": "vahid.azurecr.io/google/ubuntu1804",
"manta_docker": "vahid.azurecr.io/gatk-sv/manta:2023-09-14-v0.28.3-beta-3f22f94d",
"melt_docker": "vahid.azurecr.io/melt:3159ce1",
"melt_docker": "vahid.azurecr.io/melt:a85c92f",
"scramble_docker": "vahid.azurecr.io/scramble:mw-scramble-99af4c50",
"samtools_cloud_docker": "vahid.azurecr.io/gatk-sv/samtools-cloud:2024-01-24-v0.28.4-beta-9debd6d7",
"sv_base_docker": "vahid.azurecr.io/gatk-sv/sv-base:2024-01-24-v0.28.4-beta-9debd6d7",
Expand Down
19 changes: 0 additions & 19 deletions wdl/MELT.wdl
Original file line number Diff line number Diff line change
Expand Up @@ -511,24 +511,6 @@ task RunMELT {
# these locations should be stable
MELT_DIR="/MELT"

# `cromwell_root` and `cromwell-executions` are the **default**
# root directory for cromwell deployments on GCP and Azure respectively.
# The last option, i.e., $PWD, is the fall back option if the
# default root directory of the cromwell instance was changed,
# however, it is not a reliable option as it fails on GCP.
# It does not seem Cromwell sets a runtime environment variable
# exposing the configured value of the root directory,
# which could have provided a portable solution for this.
# The following solution works with the Cromwell deployments
# we are currently using on GCP and Azure.
if [ -d "/cromwell_root" ]; then
CROMWELL_ROOT="/cromwell_root"
elif [ -d "/cromwell-executions" ]; then
CROMWELL_ROOT="/cromwell-executions"
else
CROMWELL_ROOT="$PWD"
fi

# these locations may vary based on MELT version number, so find them:
MELT_ROOT=$(find "$MELT_DIR" -name "MELT.jar" | xargs -n1 dirname)
MELT_SCRIPT=$(ls "$MELT_DIR/run_MELT"*.sh)
Expand All @@ -541,7 +523,6 @@ task RunMELT {
~{read_length} \
~{insert_size} \
"$MELT_ROOT" \
"$CROMWELL_ROOT" \
~{reference_version}

cat "~{melt_standard_vcf_header}" \
Expand Down
Loading