Skip to content

Commit

Permalink
Merge pull request #2 from moka-guys/v1.1.0
Browse files Browse the repository at this point in the history
dual reporting changes (#2)
  • Loading branch information
rebeccahaines1 authored Sep 11, 2023
2 parents b4d1f2b + ceab2f3 commit ff3cbd5
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 35 deletions.
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# dnanexus_ED_cnv_analysis_v1.0.0
# dnanexus_ED_cnv_analysis_v1.1.0
Performs CNV calling using ExomeDepth.

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.
Expand All @@ -8,8 +8,7 @@ This app runs the CNV calling stage.

# How the app works?

A Docker image containing Exome depth is downloaded from 001 - In this release [#1220d31](https://github.com/moka-guys/seglh-cnv/tree/1220d31e2eed1d4488eb461e70615a0fad8b5eb1) is used.

A Docker image containing Exome depth is downloaded from 001 - The image is taken from https://github.com/moka-guys/seglh-cnv/releases/tag/v2.0.0
The app takes in a readcount file generated by https://github.com/moka-guys/dnanexus\_ED\_readcount_analysis, the docker image will pick the most appropriate reference samples and run exomedepth for a given sample.


Expand All @@ -18,9 +17,9 @@ For further details on the usage of the docker image please refer to https://git
# Input
- DNAnexus project name where the BAM and the indexes are stored (BAMs/BAIs MUST be present in the /output folder)
- Readcount file generated using https://github.com/moka-guys/dnanexus\_ED\_readcount_analysis
- QC file containing QC parameters (Optional) - generated using https://github.com/moka-guys/dnanexus\_ED\_readcount_analysis
- List of comma seperated pan numbers (Pan4127,Pan4129,Pan4130,Pan4049)
- Test specific BED file
Note: Transitional probability is set to 0.01, the default value is 0.001 (too many false positives during testing).
See CLI command below for an example of inputs.

# Output
Expand All @@ -35,13 +34,12 @@ See CLI command below for an example of inputs.
The app can be run from the dx CLI. The example below shows the code used to run test samples through this app:

```bash
dx run project-G0pKxX80pgqFk9Vy8p6vQbKv:applet-G7B5Zxj0pgq9Q8JfP0jpY3y4 -iproject_name=003_220103_exomeDepth_calling_test -ireadcount_file=project-G6jb1k807Xjj1J984K6kfP13:file-G6kg5q80gvvz37qZ4ZPbvZ8Q -ibamfile_pannumbers=Pan4127,Pan4129,Pan4130,Pan4049 -isubpanel_bed=project-ByfFPz00jy1fk6PjpZ95F27J:file-G6kZpqQ0jy1q1Zk94G3qbVyV -iQC_file=project-G6jb1k807Xjj1J984K6kfP13:file-G66X1Z80p6PG52GFK4zfpY7y

dx run project-G0pKxX80pgqFk9Vy8p6vQbKv:applet-G7B5Zxj0pgq9Q8JfP0jpY3y4 -iproject_name=003_220103_exomeDepth_calling_test -ireadcount_file=project-G6jb1k807Xjj1J984K6kfP13:file-G6kg5q80gvvz37qZ4ZPbvZ8Q -ibamfile_pannumbers=Pan4127,Pan4129,Pan4130,Pan4049 -isubpanel_bed=project-ByfFPz00jy1fk6PjpZ95F27J:file-G6kZpqQ0jy1q1Zk94G3qbVyV
```
# Debugging

For debugging issues with the `docker` image it can be helpful to `ssh` into a 'held for debugging' job in DNA nexus and run the `docker` image in interactive mode:

```bash
docker run -v /home/dnanexus:/home/dnanexus/ --rm -it --entrypoint /bin/bash seglh/exomedepth:1220d31
docker run -v /home/dnanexus:/home/dnanexus/ --rm -it --entrypoint /bin/bash seglh/exomedepth:87fa493
```
16 changes: 4 additions & 12 deletions dxapp.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "ED_cnv_calling_v1.0.0",
"title": "ED_cnv_calling_v1.0.0",
"summary": "v1.0.0 - Performs CNV calling using ExomeDepth",
"name": "ED_cnv_calling_v1.1.0",
"title": "ED_cnv_calling_v1.1.0",
"summary": "v1.1.0 - Performs CNV calling using ExomeDepth",
"dxapi": "1.0.0",
"inputSpec": [
{
Expand All @@ -18,14 +18,6 @@
"patterns": ["*.RData"],
"optional": false
},
{
"name": "QC_file",
"label": "QC_file",
"help": "QC metrics specific for each panel",
"class": "file",
"patterns": ["*.RData"],
"optional": true
},
{
"name": "bamfile_pannumbers",
"label": "bamfile_pannumbers",
Expand All @@ -45,7 +37,7 @@
{
"name": "exomedepth_output",
"label": "exomedepth output",
"help": "PDF output from ExomeDepth.",
"help": "outputs from ExomeDepth.",
"class": "array:file"
}
],
Expand Down
39 changes: 23 additions & 16 deletions src/code.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
# exomedepth_cnv_analysis_v1.0.0
# exomedepth_cnv_analysis_v1.1.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 @@ -16,7 +16,7 @@ readcount_file_name=$(dx describe --name "$readcount_file")
subpanel_bed_prefix=$(echo "$subpanel_bed_name" | sed -r 's/^[^0-9]*(Pan[0-9]+).*/\1/')

# Location of the ExomeDepth docker file
docker_file=project-ByfFPz00jy1fk6PjpZ95F27J:file-G6kfZYQ0jy1vZ0BF33KZpQjJ
docker_file=project-ByfFPz00jy1fk6PjpZ95F27J:file-GYzKz400jy1yx101F34p8qj2

#read the DNA Nexus api key as a variable
API_KEY=$(dx cat project-FQqXfYQ0Z0gqx7XG9Z2b4K43:mokaguys_nexus_auth_key)
Expand Down Expand Up @@ -81,7 +81,7 @@ cd ..
mark-section "setting up Exomedepth docker image"
# download the docker file from 001_Tools...
dx download $docker_file --auth "${API_KEY}"
docker load -i '/home/dnanexus/seglh_exomedepth_1220d31.tgz'
docker load -i '/home/dnanexus/seglh_exomedepth_87fa493.tgz'

mark-section "Run CNV analysis using docker image"

Expand All @@ -95,26 +95,33 @@ do
samplename=$(basename "$bam" _R1_001.bam)
echo "samplename:" "$samplename"
echo "bam:" "$bam"
echo "subpanel:" "$subpanel_bed_name"

# Handle optional argument relating to QC file
if [ -z "$QC_file" ]; then
echo "Optional QC file not provided by user"
bam_and_QC_command="$bam":"$samplename"
else
QC_file_path="/home/dnanexus/in/QC_file/*.RData"
bam_and_QC_command="$bam:$samplename $QC_file_path"
echo "subpanel:" "$subpanel_bed_name"
echo "trans_prob:" "$trans_prob"

# Check which QC file to you
#Extract panel type from samplename
#split samplename on '_'
panelname="$(echo $samplename | cut -d'_' -f6)"
echo $panelname
if [[ "$panelname" == *VCP1* ]]; then
QC_file="vcp1_qc.RData";
elif [[ "$panelname" == *VCP2* ]]; then
QC_file="vcp2_qc.RData";
elif [[ "$panelname" == *VCP3* ]]; then
QC_file="vcp3_qc.RData";
fi

#test
echo "RDATA = " "$readcount_file_name"
#for each bam run exomedepth - the string in the format v1.0.0 will be concatenated to the ouput as the app version
docker run -v /home/dnanexus:/home/dnanexus/ \
--rm seglh/exomedepth:1220d31 \
--rm seglh/exomedepth:87fa493 \
exomeDepth.R \
'v1.0.0' \
'v1.1.0' \
/home/dnanexus/out/exomedepth_output/exomedepth_output/"$samplename"_output.pdf \
/home/dnanexus/in/subpanel_bed/"$subpanel_bed_name":"$subpanel_bed_prefix" \
/home/dnanexus/in/readcount_file/"$readcount_file_name" \
"$bam_and_QC_command"
/home/dnanexus/in/readcount_file/"$readcount_file_name" "$bam":"$samplename":0.01 $QC_file

done

# Upload results
Expand Down

0 comments on commit ff3cbd5

Please sign in to comment.