Skip to content

Commit

Permalink
update igv session generating (#1585)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikkonie committed Jan 23, 2023
1 parent 6030573 commit bc6ece1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ Changed
- **Samplesheets**
- Upgrade critical Vue app dependencies (#1527, #1571)
- Remove redundant node UUIDs from render tables (#708)
- Improve IGV session file XML generating (#1585)

Fixed
-----
Expand Down
21 changes: 2 additions & 19 deletions samplesheets/studyapps/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,8 @@ def get_igv_session_url(source, app_name, merge=False):
file_url = reverse(
'{}:igv'.format(app_name), kwargs={'genericmaterial': source.sodar_uuid}
)
return '{}/load?{}merge={}&file={}{}.xml'.format(
return '{}/load?merge={}&file={}{}.xml'.format(
IGV_URL_BASE,
'genome=b37&' if not merge else '',
str(merge).lower(),
file_prefix,
file_url,
Expand Down Expand Up @@ -121,18 +120,14 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'version': '8',
},
)

# Resources
xml_resources = ET.SubElement(xml_session, 'Resources')

# VCF resource
for vcf_name, vcf_url in vcf_urls.items():
ET.SubElement(xml_resources, 'Resource', attrib={'path': vcf_url})

# BAM resources
for bam_name, bam_url in bam_urls.items():
ET.SubElement(xml_resources, 'Resource', attrib={'path': bam_url})

# VCF panel (under Session)
for vcf_name, vcf_url in vcf_urls.items():
xml_vcf_panel = ET.SubElement(
Expand Down Expand Up @@ -165,7 +160,6 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'windowFunction': 'count',
},
)

# BAM panels
for bam_name, bam_url in bam_urls.items():
# Generating unique panel name with hashlib
Expand All @@ -179,7 +173,6 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'width': '1129',
},
)

xml_bam_panel_track_coverage = ET.SubElement(
xml_bam_panel,
'Track',
Expand All @@ -198,7 +191,6 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'visible': 'true',
},
)

# xml_bam_panel_track_datarange
ET.SubElement(
xml_bam_panel_track_coverage,
Expand All @@ -212,7 +204,6 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'type': 'LINEAR',
},
)

xml_bam_panel_track = ET.SubElement(
xml_bam_panel,
'Track',
Expand All @@ -229,7 +220,6 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'visible': 'true',
},
)

# xml_bam_panel_track_renderoptions
ET.SubElement(
xml_bam_panel_track,
Expand All @@ -247,13 +237,11 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'sortByTag': '',
},
)

xml_feature_panel = ET.SubElement(
xml_session,
'Panel',
attrib={'height': '40', 'name': 'FeaturePanel', 'width': '1129'},
)

# xml_feature_panel_track
ET.SubElement(
xml_feature_panel,
Expand All @@ -271,7 +259,6 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'visible': 'true',
},
)

xml_feature_panel_track2 = ET.SubElement(
xml_feature_panel,
'Track',
Expand All @@ -284,15 +271,14 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'displayMode': 'COLLAPSED',
'featureVisibilityWindow': '-1',
'fontSize': '10',
'id': 'b37_genes',
'id': 'genes',
'name': 'Gene',
'renderer': 'BASIC_FEATURE',
'sortable': 'false',
'visible': 'true',
'windowFunction': 'count',
},
)

# xml_feature_panel_track2_datarange
ET.SubElement(
xml_feature_panel_track2,
Expand All @@ -306,7 +292,6 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'type': 'LINEAR',
},
)

# xml_panel_layout
ET.SubElement(
xml_session,
Expand All @@ -316,12 +301,10 @@ def get_igv_xml(bam_urls, vcf_urls, vcf_title, request):
'0.6595744680851063,0.9273049645390071'
},
)

xml_hidden_attrs = ET.SubElement(xml_session, 'HiddenAttributes')
ET.SubElement(xml_hidden_attrs, 'Attribute', attrib={'name': 'DATA FILE'})
ET.SubElement(xml_hidden_attrs, 'Attribute', attrib={'name': 'DATA TYPE'})
ET.SubElement(xml_hidden_attrs, 'Attribute', attrib={'name': 'NAME'})

xml_str = ET.tostring(
xml_session,
encoding='utf-8',
Expand Down

0 comments on commit bc6ece1

Please sign in to comment.