Skip to content
Open
Show file tree
Hide file tree
Changes from 7 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
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ CWL files and workflows to accompany the [helix_filters_01](https://github.com/m

# Installation & Setup

Clone this repo with

```
git clone --recursive https://github.com/mskcc/pluto-cwl.git
cd pluto-cwl
```

Install dependencies for the repo with the command:

```
Expand Down
86 changes: 86 additions & 0 deletions cwl/conpair-pileup.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0

class: CommandLineTool
baseCommand:
- python
- /usr/bin/conpair/scripts/run_gatk_pileup_for_sample.py

id: conpair-pileup

requirements:
InlineJavascriptRequirement: {}
ResourceRequirement:
ramMin: 16000
coresMin: 1
DockerRequirement:
dockerPull: mskcc/roslin-variant-conpair:0.3.3

doc: |
None

inputs:

ref:
type: File
inputBinding:
prefix: --reference
secondaryFiles:
- .amb
- .ann
- .bwt
- .pac
- .sa
- .fai
- ^.dict
java_xmx:
type:
- 'null'
- type: array
items: string
doc: set up java -Xmx parameter
inputBinding:
prefix: --xmx_java

java_temp:
type: ['null', string]
doc: temporary directory to set -Djava.io.tmpdir
inputBinding:
prefix: --temp_dir_java

gatk:
type:
- [File, string, "null"]
inputBinding:
prefix: --gatk

markers_bed:
type:
- [File, string]
inputBinding:
prefix: --markers

bam:
type:
- [File, string]
inputBinding:
prefix: --bam
secondaryFiles:
- ^.bai

outfile:
type:
- string
inputBinding:
prefix: --outfile

outputs:
out_file:
type: File
outputBinding:
glob: |
${
if (inputs.outfile)
return inputs.outfile;
return null;
}
143 changes: 143 additions & 0 deletions cwl/fingerprint.cwl
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#!/usr/bin/env cwl-runner
cwlVersion: v1.0
class: Workflow
doc: "
Workflow to run generate fingerprint search on entire dmp normals and optionally on project normals
"

requirements:
MultipleInputFeatureRequirement: {}
ScatterFeatureRequirement: {}
StepInputExpressionRequirement: {}
InlineJavascriptRequirement: {}
SubworkflowFeatureRequirement: {}

Comment thread
stevekm marked this conversation as resolved.
hints:
cwltool:LoadListingRequirement:
loadListing: no_listing

inputs:
dmp_dir:
type: Directory
default:
class: Directory
path: /work/ci/dmp_finderprint_matching/dummy_pileup
conpair_markers_bed: # conpair_markers_txt
type: File
conpair_markers_txt: # conpair_markers_txt
type: File
tumor_bam: # GATK .pileup or likelihoods .pickle
type: File
secondaryFiles: ["^.bai"]
additional_normal_bams:
type: File[]
secondaryFiles: ["^.bai"]
default: [{class: File, path: /work/ci/dmp_finderprint_matching/dummy_bam/dummy.bam}]
ref_fasta:
type: File
secondaryFiles:
- .amb
- .ann
- .bwt
- .pac
- .sa
- .fai
- ^.dict


outputs:
output_file:
type: File
outputSource: run_conpair_concordance/output_file

steps:
run-pileup-tumor:
run: conpair-pileup.cwl
in:
bam: tumor_bam
ref: ref_fasta
gatk:
valueFrom: ${ return '/usr/bin/gatk.jar'; }
markers_bed: conpair_markers_bed
java_xmx:
valueFrom: ${ return ["24g"]; }

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a default setting?
this is a memory requirement so the CWL will also need a memory requirement

outfile:
valueFrom: ${ return inputs.bam.basename.replace(".bam", ".pileup"); }
out: [out_file]
######
run-pileup-additional_normals:
run: conpair-pileup.cwl
scatter: bam
in:
bam: additional_normal_bams
ref: ref_fasta
gatk:
valueFrom: ${ return '/usr/bin/gatk.jar'; }
markers_bed: conpair_markers_bed
java_xmx:
valueFrom: ${ return ["24g"]; }
outfile:
valueFrom: ${ return inputs.bam.basename.replace(".bam", ".pileup"); }
out: [out_file]

put-in-dir:
run: put_in_dir.cwl
in:
output_directory_name:
valueFrom: ${ return "additional_normals"; }
files: run-pileup-additional_normals/out_file
out: [ directory ]
#######
run_conpair_concordance:
in:
dmp_dir: dmp_dir
markers: conpair_markers_txt
tumor_file: run-pileup-tumor/out_file
additional_normal_pickles: put-in-dir/directory

out: [output_file]

run:
class: CommandLineTool
baseCommand: ['bash', 'run.sh']
requirements:
DockerRequirement:
dockerPull: mskcc/conpair:1.0.1
InitialWorkDirRequirement:
listing:
# NOTE: might need dos2unix for some that give errors ERROR: Your MAF uses CR line breaks, which we can't support. Please use LF or CRLF.
# NOTE: might also need sanity check that maf has >1 line
Comment thread
stevekm marked this conversation as resolved.
Outdated
- entryname: run.sh
entry: |-
set -eu
path="${ return inputs.dmp_dir.path; }"
find "\$path"/ -type f > normal_dmp_pickles_file_list.txt

path="${ return inputs.additional_normal_pickles.path; }"
find "\$path"/ -type f >> normal_dmp_pickles_file_list.txt

tumor_pickle="${ return inputs.tumor_file.path; }"
markers="${ return inputs.markers.path; }"
run.py \\
concordance \\
\$tumor_pickle \\
--normals-list normal_dmp_pickles_file_list.txt \\
--markers \$markers \\
--threads 10 \\
Comment thread
stevekm marked this conversation as resolved.
Outdated
--output-file "${ return inputs.tumor_file.nameroot + '.concordance.tsv' }"
inputs:
dmp_dir: Directory
additional_normal_pickles: Directory
markers: File
tumor_file: File

outputs:
output_file:
type: File
outputBinding:
glob: ${ return inputs.tumor_file.nameroot + '.concordance.tsv' }



$namespaces:
Comment thread
stevekm marked this conversation as resolved.
Outdated
cwltool: "http://commonwl.org/cwltool#"
2 changes: 1 addition & 1 deletion pluto
Submodule pluto updated 1 files
+26 −0 tools.py
74 changes: 74 additions & 0 deletions tests/test_fingerprint_cwl.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
unit tests for the fingerprint.cwl
"""
import os
import sys
import unittest
# import json
# from tempfile import TemporaryDirectory

THIS_DIR = os.path.dirname(os.path.realpath(__file__))
PARENT_DIR = os.path.dirname(THIS_DIR)
sys.path.insert(0, PARENT_DIR)
from pluto.tools import PlutoTestCase, CWLFile
from pluto.serializer import OFile
sys.path.pop(0)


class TestFingerprint(PlutoTestCase):
cwl_file = CWLFile('fingerprint.cwl')


def test_fingerprint_1(self):
"""
"""

self.preserve = True

self.input = {
"conpair_markers_txt": {
"path": "/juno/work/ci/concordance-workflow/markers/IMPACT468/FP_tiling_genotypes_for_Conpair.txt",
"class": "File"
},
"conpair_markers_bed": {
"path": "/juno/work/ci/concordance-workflow/markers/IMPACT468/FP_tiling_genotypes_for_Conpair.bed",
"class": "File"
},
"ref_fasta": {
"path": "/juno/work/ci/resources/genomes/GRCh37/fasta/b37.fasta",
"class": "File"
},
"runparams": {
"tmp_dir": "/scratch",
"gatk_jar_path": "/usr/bin/gatk.jar"
},
"tumor_bam": {
"path": "/work/ci/dmp_finderprint_matching/dummy_bam/dummy.bam",
"class": "File"
},
"dmp_dir": {
"class": "Directory",
"path": "/work/ci/dmp_finderprint_matching/dummy_pickle"
}
}



##"/work/ci/dmp/likelihoods"

output_json, output_dir = self.run_cwl()

expected_output = {
'output_file': OFile(name = 'dummy.concordance.tsv', hash = "sha1$6b1a5ef498be9c15c842033ba7b5cc970397b5f5", size = 487, dir = output_dir)
}


self.assertCWLDictEqual(expected_output, output_json)




if __name__ == "__main__":
unittest.main()