Skip to content

Commit

Permalink
Merge pull request #14 from ICGC-TCGA-PanCancer/no-var-spool-cwl
Browse files Browse the repository at this point in the history
Remove hardcoded output path /var/spool/cwl
  • Loading branch information
junjun-zhang authored Mar 16, 2019
2 parents 61d3894 + c8a37f5 commit dcc5c0c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 16 deletions.
4 changes: 4 additions & 0 deletions delly_docker/Dockstore.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ inputs:
inputBinding:
position: 3
prefix: --tumor-bam
secondaryFiles:
- .bai
normal-bam:
type: File
inputBinding:
position: 2
prefix: --normal-bam
secondaryFiles:
- .bai
reference-gz:
type: File
inputBinding:
Expand Down
27 changes: 15 additions & 12 deletions delly_docker/scripts/run_seqware_workflow.pl
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@


my @files;
my ($run_id, $normal_bam, $tumor_bam, $reference_gz, $reference_gc);
my ($output_dir, $run_id, $normal_bam, $tumor_bam, $reference_gz, $reference_gc);
my $cwd = cwd();

# workflow version
my $wfversion = "2.0.0";

GetOptions (
"output-dir=s" => \$output_dir,
"run-id=s" => \$run_id,
"normal-bam=s" => \$normal_bam,
"tumor-bam=s" => \$tumor_bam,
Expand All @@ -59,6 +60,8 @@
# TODO: need to add all the new params, then symlink the ref files to the right place
or die("Error in command line arguments\n");

$ENV{'HOME'} = $output_dir;

# check our assumptions
run("env");
run("whoami");
Expand All @@ -70,15 +73,15 @@
# SYMLINK REF FILES
run("mkdir -p /datastore/normal/");
run("mkdir -p /datastore/tumor/");
run("ln -s $normal_bam /datastore/normal/normal.bam");
run("samtools index /datastore/normal/normal.bam");
run("ln -s $tumor_bam /datastore/tumor/tumor.bam");
run("samtools index /datastore/tumor/tumor.bam");
run("ln -sf $normal_bam /datastore/normal/normal.bam");
run("ln -sf $normal_bam.bai /datastore/normal/normal.bam.bai");
run("ln -sf $tumor_bam /datastore/tumor/tumor.bam");
run("ln -sf $tumor_bam.bai /datastore/tumor/tumor.bam.bai");
run("mkdir -p /datastore/data/");
#run("ln -s $reference_gz /datastore/data/genome.fa.gz");
#run("ln -sf $reference_gz /datastore/data/genome.fa.gz");
#run("gunzip /datastore/data/genome.fa.gz");
system("gunzip -c $reference_gz > /datastore/data/hg19_1_22XYMT.fa");
run("ln -s $reference_gc /datastore/data/hg19_1_22XYMT.gc");
run("ln -sf $reference_gc /datastore/data/hg19_1_22XYMT.gc");

# MAKE CONFIG
# the default config is the workflow_local.ini and has most configs ready to go
Expand Down Expand Up @@ -107,10 +110,10 @@

# NOW RUN WORKFLOW
# workaround for docker permissions
run("gosu root mkdir -p /var/spool/cwl/.seqware");
run("gosu root chown -R seqware /var/spool/cwl/");
run("gosu root cp /home/seqware/.seqware/settings /var/spool/cwl/.seqware");
run("gosu root chmod a+wrx /var/spool/cwl/.seqware/settings");
run("gosu root mkdir -p $output_dir/.seqware");
run("gosu root chown -R seqware $output_dir");
run("gosu root cp /home/seqware/.seqware/settings $output_dir/.seqware");
run("gosu root chmod a+wrx $output_dir/.seqware/settings");
run("perl -pi -e 's/wrench.res/seqwaremaven/g' /home/seqware/bin/seqware");
my $error = system("seqware bundle launch --dir /home/seqware/DELLY/target/Workflow_Bundle_DELLY_".$wfversion."_SeqWare_1.1.1 --engine whitestar --ini /datastore/workflow.ini --no-metadata");

Expand All @@ -119,7 +122,7 @@
chomp $path;

# MOVE THESE TO THE RIGHT PLACE
system("gosu root mv /datastore/$path/*.vcf.gz /datastore/$path/*.bedpe.txt /datastore/$path/delly_results/*.sv.cov.tar.gz /datastore/$path/delly_results/*.sv.cov.plots.tar.gz /datastore/$path/*.sv.log.tar.gz /datastore/$path/*.json $cwd");
system("gosu root mv /datastore/$path/*.vcf.gz /datastore/$path/*.bedpe.txt /datastore/$path/delly_results/*.sv.cov.tar.gz /datastore/$path/delly_results/*.sv.cov.plots.tar.gz /datastore/$path/*.sv.log.tar.gz /datastore/$path/*.json $output_dir");

# RETURN RESULT
exit($error);
Expand Down
16 changes: 12 additions & 4 deletions delly_docker/scripts/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,16 @@ set -o pipefail
set -x

gosu root chmod a+wrx /tmp
gosu root chmod a+wrx /var/spool/cwl
env
gosu seqware bash -c "$*"
#allow cwltool to pick up the results created by seqware
gosu root chmod -R a+wrx /var/spool/cwl

# newer version of cwltool no longer mounts hardcoded '/var/spool/cwl'
# as $HOME (used for output in the container). Need to pass current
# user's $HOME as output-dir. The other choice is $PWD, which is set
# using '--workdir' in 'docker run' command by cwltool. Currently version
# of cwltool set $PWD same as $HOME
OUTPUT_DIR=$HOME
# allow cwltool to pick up the results created by seqware
gosu root chmod -R a+wrx $OUTPUT_DIR

cd $OUTPUT_DIR
gosu seqware bash -c "$* --output-dir $OUTPUT_DIR"

0 comments on commit dcc5c0c

Please sign in to comment.