Skip to content

Commit

Permalink
update R to 3.5.1 and update full-outer-join to accept multiple table…
Browse files Browse the repository at this point in the history
… 2's
  • Loading branch information
stevekm committed Aug 31, 2021
1 parent 712b694 commit 3f1af3e
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 9 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -177,8 +177,8 @@ singularity-pull-cmoutils:
. "$(ENVSH)" singularity && \
singularity pull --force --name "$(CMOUTILS_SIF)" docker://$(CMOUTILS_DOCKERTAG)

R_DOCKERTAG:=mskcc/helix_filters_01:R-3.6.1
R_SIF:=mskcc_helix_filters_01:R-3.6.1.sif
R_DOCKERTAG:=mskcc/helix_filters_01:R-3.5.1
R_SIF:=mskcc_helix_filters_01:R-3.5.1.sif
singularity-pull-r:
. "$(ENVSH)" singularity && \
singularity pull --force --name "$(R_SIF)" docker://$(R_DOCKERTAG)
Expand All @@ -199,7 +199,7 @@ singularity-pull-vep:
fi
# rsync -vrthP "$(VEP_SIF_LOCAL)" "$(VEP_SIF)"

singularity-pull-all: singularity-pull singularity-pull-dev singularity-pull-facets-suite singularity-pull-facets singularity-pull-fillout singularity-pull-igv-reports singularity-pull-cmoutils singularity-pull-msi singularity-pull-vep
singularity-pull-all: singularity-pull singularity-pull-dev singularity-pull-facets-suite singularity-pull-facets singularity-pull-fillout singularity-pull-igv-reports singularity-pull-cmoutils singularity-pull-msi singularity-pull-vep singularity-pull-r

# change the Docker tag for all the CWL files from the old pattern to the new pattern
OLD_TAG:=
Expand Down
4 changes: 3 additions & 1 deletion cwl/full-outer-join.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ inputs:
inputBinding:
position: 1
table2:
type: ['null', File]
type:
- 'null'
- File[]
inputBinding:
position: 2
prefix: '--t2'
Expand Down
6 changes: 3 additions & 3 deletions cwl/portal-workflow.cwl
Original file line number Diff line number Diff line change
Expand Up @@ -149,11 +149,11 @@ inputs:
type:
- "null"
- File
extra_cna_file:
extra_cna_files:
doc: "An extra CNA data file to be merged in with the portal CNA data"
type:
- "null"
- File
- File[]

steps:
# meta_clinical_sample.txt (cbio_clinical_sample_meta_filename; meta_clinical_sample_file)
Expand Down Expand Up @@ -366,7 +366,7 @@ steps:
run: full-outer-join.cwl
in:
table1: clean_cna_headers/output_file
table2: extra_cna_file
table2: extra_cna_files
join_key:
valueFrom: ${ return "Hugo_Symbol" }
output_filename:
Expand Down
64 changes: 63 additions & 1 deletion tests/test_full-outer-join_cwl.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,68 @@
class TestMergeTables(PlutoTestCase):
cwl_file = CWLFile('full-outer-join.cwl')

def test_merge_three_tables(self):
"""
Test case for merging with three or more tables
"""
lines1 = [
['Hugo_Symbol', 'Sample1', 'Sample2'],
["TAP1", "0", "0"],
["ERRFI1", "0", "0"],
["STK19", "", "0"],
]

lines2 = [
['Hugo_Symbol', 'Sample3', 'Sample4'],
["ERRFI1", "0", "0"],
["STK19", "-2", "0"],
["STK11", "0", ""],
]

lines3 = [
['Hugo_Symbol', 'Sample5', 'Sample6'],
["ERRFI1", "-1", ""],
["STK19", "-1", "-2"],
["STK11", "", "-1"],
]

cna_file1 = self.write_table(self.tmpdir, filename = "cna1.txt", lines = lines1)
cna_file2 = self.write_table(self.tmpdir, filename = "cna2.txt", lines = lines2)
cna_file3 = self.write_table(self.tmpdir, filename = "cna3.txt", lines = lines3)
output_file = os.path.join(self.tmpdir, "output.tsv")

self.input = {
'table1': { "class": "File", "path": cna_file1 },
'table2': [{ "class": "File", "path": cna_file2 }, { "class": "File", "path": cna_file3 }, ],
'join_key': 'Hugo_Symbol',
'output_filename': 'output.tsv'
}

output_json, output_dir = self.run_cwl()

expected_output = {
'output_file': {
'location': 'file://' + os.path.join(output_dir,'output.tsv'),
'basename': 'output.tsv',
'class': 'File',
'checksum': 'sha1$9be315be7f1f256d80c1d4e6f9cd31f82381e2c4',
'size': 147,
'path': os.path.join(output_dir,'output.tsv')
}
}
self.assertDictEqual(output_json, expected_output)

output_file = expected_output['output_file']['path']
lines = self.read_table(output_file)
expected_lines = [
['Hugo_Symbol', 'Sample1', 'Sample2', 'Sample3', 'Sample4', 'Sample5', 'Sample6'],
['ERRFI1', '0', '0', '0', '0', '-1', 'NA'],
['STK19', 'NA', '0', '-2', '0', '-1', '-2'],
['TAP1', '0', '0', 'NA', 'NA', 'NA', 'NA'],
['STK11', 'NA', 'NA', '0', 'NA', 'NA', '-1']
]
self.assertEqual(lines, expected_lines)

def test_merge_two_tables(self):
lines1 = [
['Hugo_Symbol', 'Sample1', 'Sample2'],
Expand All @@ -33,7 +95,7 @@ def test_merge_two_tables(self):
cna_file2 = self.write_table(self.tmpdir, filename = "cna2.txt", lines = lines2)
self.input = {
'table1': { "class": "File", "path": cna_file1 },
'table2': { "class": "File", "path": cna_file2 },
'table2': [{ "class": "File", "path": cna_file2 }],
'join_key': 'Hugo_Symbol',
'output_filename': 'output.tsv'
}
Expand Down
2 changes: 1 addition & 1 deletion tests/test_portal-workflow_cwl.py
Original file line number Diff line number Diff line change
Expand Up @@ -933,7 +933,7 @@ def test_with_facets_txt_and_facets_mafs(self):
"class": "File"
},
],
"extra_cna_file": {"class": "File", "path": cna_file1}
"extra_cna_files": [{"class": "File", "path": cna_file1}]
}

with TemporaryDirectory() as tmpdir:
Expand Down

0 comments on commit 3f1af3e

Please sign in to comment.