Skip to content

Commit

Permalink
os.path.splitext is a tuple, not a single extension (#36)
Browse files Browse the repository at this point in the history
fix bug with file splitting
  • Loading branch information
ilan-gold authored Nov 19, 2019
1 parent 8160283 commit 89136a0
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
3 changes: 2 additions & 1 deletion context/on_startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def write_igv_configuration():
),
"url": file_url
}
if '.bam' == os.path.splitext(file_url):
(base, ext) = os.path.splitext(file_url)
if '.bam' == ext:
# Assume that there is only one auxiliary file for bam igv and it's
# the .bai file.
track['type'] = 'alignment'
Expand Down
48 changes: 48 additions & 0 deletions input_fixtures/good_bam/input.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"node_info": {
"2146307a-7958-4fad-bd1f-ce2546eef5a9": {
"file_url": "/fake_path/fake.bam",
"auxiliary_file_list": [
"/fake_path/fake.bam.bai"
],
"node_solr_info": {
"organism_Characteristics_generic_s": "Human",
"data_set_uuid": "6f218b65-42d3-4c69-a34b-9f8de0644d6a",
"django_ct": "data_set_manager.node",
"is_annotation": false,
"REFINERY_DOWNLOAD_URL_s": "https://fake-bucket.s3.amazonaws.com/fake.bam",
"id": "data_set_manager.node.255002",
"django_id": "255002",
"sample_Characteristics_generic_s": "A402EV1 + A402EV2 + A402SMARCB11 + A402SMARCB12 + G402EV1 + G402EV2 + G402SMARCB11 + G402SMARCB12",
"analysis_uuid": "5bad41e2-55c3-48e5-b45b-6264d576a948",
"assay_uuid": "0e4ed305-6b21-450f-a0e5-42febff21fbb",
"REFINERY_FILETYPE_1390_699_s": "Binary compressed SAM",
"REFINERY_DATAFILE_s": "fake.bam",
"REFINERY_SUBANALYSIS_1390_699_s": "0",
"type": "Derived Data File",
"REFINERY_TYPE_1390_699_s": "Derived Data File",
"organism_Characteristics_1390_699_s": "Human",
"filetype_Characteristics_generic_s": "Binary compressed SAM",
"study_uuid": "1f93a154-7aac-4863-b144-dbb601199fe7",
"subanalysis": 0,
"uuid": "2146307a-7958-4fad-bd1f-ce2546eef5a9",
"REFINERY_NAME_1390_699_s": "Fake",
"REFINERY_WORKFLOW_OUTPUT_1390_699_s": "pseudobam_output",
"name": "Fake",
"workflow_output": "pseudobam_output",
"REFINERY_ANALYSIS_UUID_1390_699_s": "Fake - Human - 2019/11/15 09:46:34 - Ilangold",
"file_uuid": "21e2e0e8-4405-47f8-a588-0d4a09fbe508",
"sample_Characteristics_1390_699_s": "A402EV1 + A402EV2 + A402SMARCB11 + A402SMARCB12 + G402EV1 + G402EV2 + G402SMARCB11 + G402SMARCB12"
}
}
},
"parameters": [
{
"name": "Genome Build",
"description": "Refernce genome to use",
"value_type": "GENOME_BUILD",
"default_value": "hg19",
"value": "hg19"
}
]
}
7 changes: 7 additions & 0 deletions test.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ def test_input_data_url(self):
path='/options.json'
)

def test_input_data_url_index_included(self):
self.assert_expected_response(
'good_bam',
'.bai',
path='/options.json'
)

# Bad configurations:

def test_missing_assembly(self):
Expand Down

0 comments on commit 89136a0

Please sign in to comment.