Skip to content
Open
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
23 changes: 23 additions & 0 deletions Dockstore.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"reference": {
"path": "http://hgwdev.cse.ucsc.edu/~jeltje/public_data/genome.fa.gz",
"class": "File"
},
"mode": "wgs",
"normal": {
"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/muse.vcf",
"class": "File"
},
"known": {
"path": "ftp://ftp.ncbi.nlm.nih.gov/snp/organisms/human_9606_b149_GRCh37p13/VCF/common_all_20161121.vcf.gz",
"class": "File"
},
"tumor": {
"path":"https://dcc.icgc.org/api/v1/download?fn=/PCAWG/reference_data/data_for_testing/HCC1143_ds/HCC1143.bam",
"class": "File"
}
}
67 changes: 67 additions & 0 deletions muse.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
#!/usr/bin/env cwl-runner
#
# Author: Jeltje van Baren jeltje.van.baren@gmail.com

cwlVersion: v1.0
class: CommandLineTool
baseCommand: [/opt/bin/muse.py, -O, muse.vcf, -w, ./, --muse, MuSEv1.0rc]

doc: "Runs MuSEv1.0rc SNP caller on split chromosomes (MuSE call) then creates final calls in VCF format (MuSE sump)"

hints:
DockerRequirement:
dockerPull: quay.io/opengenomics/muse

#requirements:
# - class: InlineJavascriptRequirement

inputs:
tumor:
type: File
doc: |
tumor bam file
inputBinding:
prefix: --tumor-bam
secondaryFiles:
- .bai
normal:
type: File
doc: |
normal bam file
inputBinding:
prefix: --normal-bam
secondaryFiles:
- .bai
reference:
type: File
doc: |
Reference sequence file, can be gzipped.
inputBinding:
prefix: -f
known:
type: File
doc: |
dbSNP vcf file (will be bgzip compressed and tabix indexed). Can be gzipped.
inputBinding:
prefix: -D
mode:
type: {"type": "enum", "name": "Mode", "symbols": ["wgs", "wxs"]}
doc: |
Input is whole genome or exome {wgs,wxs}
inputBinding:
prefix: --mode
ncpus:
type: int?
doc: |
number of cpus (8)
inputBinding:
position: 2
prefix: --cpus

outputs:
mutations:
type: File
outputBinding:
glob: muse.vcf


37 changes: 0 additions & 37 deletions muse.cwl.yaml

This file was deleted.

23 changes: 20 additions & 3 deletions muse.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,15 @@ def which(cmd):
if len(res) == 0: return None
return res

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 fai_chunk(path, blocksize):
seq_map = {}
with open( path ) as handle:
Expand Down Expand Up @@ -77,8 +86,13 @@ def run_muse(args):
args.muse = which(args.muse)

workdir = os.path.abspath(tempfile.mkdtemp(dir=args.workdir, prefix="muse_work_"))
if args.f.endswith('.gz'):
new_ref = os.path.join(workdir, "ref_genome.fasta")
gunzip(args.f, new_ref)
subprocess.check_call( ["/usr/bin/samtools", "faidx", new_ref] )
args.f = new_ref

if not os.path.exists(args.f + ".fai"):
elif not os.path.exists(args.f + ".fai"):
new_ref = os.path.join(workdir, "ref_genome.fasta")
os.symlink(os.path.abspath(args.f),new_ref)
subprocess.check_call( ["/usr/bin/samtools", "faidx", new_ref] )
Expand Down Expand Up @@ -132,11 +146,14 @@ def run_muse(args):
first = False
if not args.no_clean:
os.unlink(out)

dbsnp_file = None
if args.D:
new_dbsnp = os.path.join(workdir, "db_snp.vcf")
os.symlink(args.D,new_dbsnp)
if args.D.endswith('.gz'):
print "unzipping SNP file..."
gunzip(args.D, new_dbsnp)
else:
os.symlink(args.D,new_dbsnp)
subprocess.check_call( ["/usr/bin/bgzip", new_dbsnp] )
subprocess.check_call( ["/usr/bin/tabix", "-p", "vcf", new_dbsnp + ".gz" ])
dbsnp_file = new_dbsnp + ".gz"
Expand Down