diff --git a/Dockerfile b/Dockerfile index f674fcd..09ee856 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,13 +1,12 @@ FROM ubuntu -RUN apt-get update && apt-get install -y wget build-essential git-core cmake zlib1g-dev libncurses-dev python python-dev python-pip +RUN apt-get update && apt-get install -y wget build-essential git-core cmake zlib1g-dev libncurses-dev python python-dev python-pip samtools RUN pip install pysam WORKDIR /opt RUN wget https://github.com/genome/somatic-sniper/archive/v1.0.5.0.tar.gz && tar xvzf v1.0.5.0.tar.gz && rm v1.0.5.0.tar.gz RUN cd /opt/somatic-sniper-1.0.5.0 && mkdir build && cd build && cmake ../ && make deps && make -j && make install -RUN cp /opt/somatic-sniper-1.0.5.0/build/vendor/samtools/samtools /usr/bin/ COPY SomaticSniper.py /opt/ -RUN chmod +x /opt/SomaticSniper.py \ No newline at end of file +RUN chmod +x /opt/SomaticSniper.py diff --git a/Dockstore.json b/Dockstore.json new file mode 100644 index 0000000..5d1c5fa --- /dev/null +++ b/Dockstore.json @@ -0,0 +1,18 @@ +{ + "reference": { + "path": "http://hgwdev.cse.ucsc.edu/~jeltje/public_data/genome.fa.gz", + "class": "File" + }, + "normalbam": { + "path":"https://dcc.icgc.org/api/v1/download?fn=/PCAWG/reference_data/data_for_testing/HCC1143_ds/HCC1143_BL.bam", + "class": "File" + }, + "mutations": { + "path": "/tmp/out.vcf", + "class": "File" + }, + "tumorbam": { + "path":"https://dcc.icgc.org/api/v1/download?fn=/PCAWG/reference_data/data_for_testing/HCC1143_ds/HCC1143.bam", + "class": "File" + } +} diff --git a/SomaticSniper.py b/SomaticSniper.py old mode 100644 new mode 100755 index 8de3453..da4068f --- a/SomaticSniper.py +++ b/SomaticSniper.py @@ -45,6 +45,15 @@ def sniper_argparser(): group.add_argument('--sniper-exe', dest='sniper_exe', default='bam-somaticsniper', help='SomaticSniper Exec Name') return parser +def gunzip(infile, outfile): + cmd = ' '.join(['zcat', infile]) + with open(outfile, 'w') as outF: + p = subprocess.Popen(cmd, shell=True, stdout=outF, stderr=subprocess.PIPE) + stdout,stderr = p.communicate() + if len(stderr): + print "unzip command failed:", stderr + raise Exception("unzip failed") + def tcga_header_arguments(): return set(('reference_id', 'center', 'tumor_uuid', 'tumor_barcode', 'tumor_accession', 'tumor_platform', @@ -87,7 +96,13 @@ def create_sniper_cmdline(namespace_dict, reference, tumor_bam, normal_bam, temp def create_workspace(workdir, reference, tumor_bam, normal_bam): - new_ref = symlink_workspace_file(workdir, reference, "ref_genome.fasta") + if reference.endswith('.gz'): + new_ref = os.path.join(args.workdir, "ref_genome.fasta") + gunzip(args.f, new_ref) + args.f = new_ref + else: + new_ref = symlink_workspace_file(workdir, reference, "ref_genome.fasta") + if not os.path.exists(reference + ".fai"): print "Indexing", new_ref subprocess.check_call( ["/usr/bin/samtools", "faidx", new_ref] ) diff --git a/somatic_sniper.cwl b/somatic_sniper.cwl new file mode 100644 index 0000000..e0c78ef --- /dev/null +++ b/somatic_sniper.cwl @@ -0,0 +1,128 @@ +#!/usr/bin/env cwl-runner +# +# Author: Jeltje van Baren jeltje.van.baren@gmail.com + +cwlVersion: v1.0 +class: CommandLineTool +baseCommand: [ /opt/SomaticSniper.py, -F, vcf, --workdir, ./ ] + +doc: "Runs somatic sniper snp caller on input bam files" + +hints: + DockerRequirement: + dockerPull: quay.io/opengenomics/somatic-sniper + +#requirements: +# - class: InlineJavascriptRequirement + +inputs: + + reference: + type: File + doc: | + reference sequence in the FASTA format + inputBinding: + position: 3 + prefix: -f + + tumor_name: + type: string? + doc: | + tumor sample id (for VCF header) [TUMOR] + inputBinding: + position: 3 + prefix: -t + + normal_name: + type: string? + doc: | + normal sample id (for VCF header) [NORMAL] + inputBinding: + position: 3 + prefix: -n + + minmapqual: + type: int? + doc: | + filtering reads with mapping quality less than [0] + inputBinding: + position: 3 + prefix: -q + + snvqual: + type: int? + doc: | + filtering somatic snv output with somatic quality less than [15] + inputBinding: + position: 3 + prefix: -Q + + noLOH: + type: boolean? + doc: | + do not report LOH variants as determined by genotypes + inputBinding: + position: 3 + prefix: -L + + noGainOfRef: + type: boolean? + doc: | + do not report Gain of Reference variants as determined by genotypes + inputBinding: + position: 3 + prefix: -G + + noSomaticPriors: + type: boolean? + doc: | + disable priors in the somatic calculation. Increases sensitivity for solid tumors + inputBinding: + position: 3 + prefix: -p + + doPriors: + type: boolean? + doc: | + Use prior probabilities accounting for the somatic mutation rate + inputBinding: + position: 3 + prefix: -J + + priorProb: + type: float? + doc: | + prior probability of a somatic mutation (implies -J) [0.010000] + inputBinding: + position: 3 + prefix: -s + + tumorbam: + type: File + doc: | + tumor bamfile + inputBinding: + position: 1 + + normalbam: + type: File + doc: | + normal bamfile + inputBinding: + position: 2 + + output_name: + type: string + default: mutations.vcf + doc: | + Name of output file + inputBinding: + position: 5 + +outputs: + + mutations: + type: File? + outputBinding: + glob: $(inputs.output_name) + diff --git a/somatic_sniper.cwl.yaml b/somatic_sniper.cwl.yaml deleted file mode 100644 index 07f9a36..0000000 --- a/somatic_sniper.cwl.yaml +++ /dev/null @@ -1,77 +0,0 @@ -class: CommandLineTool -label: SomaticSniper -cwlVersion: v1.0 -baseCommand: [ python, /opt/SomaticSniper.py, -F, vcf, --workdir, ./ ] -requirements: - - class: "DockerRequirement" - dockerImageId: "opengenomics/somatic-sniper:1.0.5.0" -inputs: - reference: - type: File - inputBinding: - prefix: -f - tumor_name: - type: string - default: "TUMOR" - inputBinding: - prefix: -t - normal_name: - type: string - default: "NORMAL" - inputBinding: - prefix: -n - mapq: - type: int - inputBinding: - prefix: -q - default: 0 - somaticq: - type: int - inputBinding: - prefix: -Q - default: 40 - loh: - type: boolean - default: false - inputBinding: - prefix: -L - gor: - type: boolean - default: false - inputBinding: - prefix: -G - dis_priors: - type: boolean - default: false - inputBinding: - prefix: -p - use_priorp: - type: boolean - default: false - inputBinding: - prefix: -J - prior_p: - type: float - default: 0.01 - inputBinding: - prefix: -s - tumor: - type: File - inputBinding: - position: 1 - normal: - type: File - inputBinding: - position: 2 - output_name: - type: string - default: "mutations.vcf" - inputBinding: - position: 3 - -outputs: - mutations: - type: File - outputBinding: - glob: mutations.vcf -