Skip to content

Commit

Permalink
Merge pull request #5 from moka-guys/v1.2.0
Browse files Browse the repository at this point in the history
changes for v1.2.0 (#5)
  • Loading branch information
Aled Jones authored Oct 2, 2023
2 parents da10610 + 10c7966 commit d980b10
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 19 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# dnanexus_ED_readcount_analysis_v1.1.0
# dnanexus_ED_readcount_analysis_v1.2.0
Exome depth is run in two stages. Firstly, read counts are calculated, before CNVs are called using the read counts. Read counts are calculated over the entire genome whereas the CNV calling can be performed using a subpanel.

dnanexus_ED_readcount_analysis_v1.1.0 calculates readcounts for samples using panel of normals and intrabatch samples as reference.
dnanexus_ED_readcount_analysis_v1.2.0 calculates readcounts for samples using panel of normals and intrabatch samples as reference.

# What does the app do?
This app runs the read count calculation stage.
Expand Down
25 changes: 17 additions & 8 deletions dxapp.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
{
"name": "ED_readcount_analysis_v1.1.0",
"title": "ED_readcount_analysis_v1.1.0",
"summary": "v1.1.0 - Step 1 of CNV calling using ExomeDepth",
"name": "ED_readcount_analysis_v1.2.0",
"title": "ED_readcount_analysis_v1.2.0",
"summary": "v1.2.0 - Step 1 of CNV calling using ExomeDepth",
"properties": {
"github release": "v1.2.0"
},
"dxapi": "1.0.0",
"inputSpec": [
{
Expand Down Expand Up @@ -55,10 +58,16 @@
],
"outputSpec": [
{
"name": "exomedepth_output",
"label": "exomedepth output",
"help": "PDF output from ExomeDepth.",
"class": "array:file"
"name": "csv",
"label": "exomedepth CSV file",
"help": "CSV file containing CNVs",
"class": "file"
},
{
"name": "RData",
"label": "exomedepth RData file",
"help": "Readcount file",
"class": "file"
}
],
"runSpec": {
Expand Down Expand Up @@ -90,4 +99,4 @@
}
}
}
}
}
29 changes: 20 additions & 9 deletions src/code.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# exomedepth_cnv_analysis_v1.1.0
# exomedepth_cnv_analysis_v1.2.0

# The following line causes bash to exit at any point if there is any error
# and to output each line as it is executed -- useful for debugging
Expand All @@ -10,10 +10,16 @@ set -e -x -o pipefail
run=${project_name##*_}

#read the DNA Nexus api key as a variable
API_KEY=$(dx cat project-FQqXfYQ0Z0gqx7XG9Z2b4K43:mokaguys_nexus_auth_key)
API_KEY_wquotes=$(echo $DX_SECURITY_CONTEXT | jq '.auth_token')
API_KEY=$(echo "$API_KEY_wquotes" | sed 's/"//g')
echo "$API_KEY"

output_RData_dir="/home/dnanexus/out/RData/exomedepth_output/${bedfile_prefix}"
output_RData_file="${output_RData_dir}/${bedfile_prefix}_readCount.RData"
output_CSV_dir="/home/dnanexus/out/csv/exomedepth_output/${bedfile_prefix}/"

# make output dir and folder to hold downloaded files
mkdir -p /home/dnanexus/out/exomedepth_output/exomedepth_output/$bedfile_prefix/ /home/dnanexus/to_test
mkdir -p /home/dnanexus/to_test $output_CSV_dir $output_RData_dir

mark-section "Downloading inputs"
# download all inputs
Expand All @@ -39,7 +45,7 @@ echo "reference_genome="$reference_fasta
echo "panel="$bamfile_pannumbers
echo "bedfile_prefix="$bedfile_prefix
echo "normals_RData="$normals_RData
output_RData_file="/home/dnanexus/out/exomedepth_output/exomedepth_output/${bedfile_prefix}/${bedfile_prefix}_readCount.RData"


mark-section "Download all relevant BAMs"
# make and cd to test dir
Expand Down Expand Up @@ -73,10 +79,12 @@ cd /home/dnanexus

mark-section "setting up Exomedepth docker image"
# Location of the ExomeDepth docker file
docker_file=project-ByfFPz00jy1fk6PjpZ95F27J:file-GYzKz400jy1yx101F34p8qj2
docker_file_id=project-ByfFPz00jy1fk6PjpZ95F27J:file-GYzKz400jy1yx101F34p8qj2
# download the docker file from 001_Tools...
dx download $docker_file --auth "${API_KEY}"
docker load -i '/home/dnanexus/seglh_exomedepth_87fa493.tgz'
dx download $docker_file_id --auth "${API_KEY}"
docker_file=$(dx describe ${docker_file_id} --name)
DOCKERIMAGENAME=`tar xfO ${docker_file} manifest.json | sed -E 's/.*"RepoTags":\["?([^"]*)"?.*/\1/'`
docker load < /home/dnanexus/"${docker_file}"
#docker pull seglh/exomedepth:1111b6c
mark-section "Calculate read depths using docker image"
# docker run - mount the home directory as a share
Expand All @@ -90,7 +98,10 @@ mark-section "Calculate read depths using docker image"
# The log (PanXXXXexomedepth_readCount.csv) written to same location as the $output_RData_file

# Run ReadCount script in docker container
docker run -v /home/dnanexus:/home/dnanexus seglh/exomedepth:87fa493 readCount.R $output_RData_file $reference_fasta $bedfile_path ${bam_list[@]} $normals_RData_path
docker run -v /home/dnanexus:/home/dnanexus ${DOCKERIMAGENAME} readCount.R $output_RData_file $reference_fasta $bedfile_path ${bam_list[@]} $normals_RData_path

# Move outputs into output folders to delocalise into dnanexus project
mv $output_RData_dir/*.csv $output_CSV_dir

# Upload results
dx-upload-all-outputs
dx-upload-all-outputs

0 comments on commit d980b10

Please sign in to comment.