Skip to content

Commit

Permalink
Fix ordering by position
Browse files Browse the repository at this point in the history
Position was no longer being sorted by correcty, due to casting its type
to a string.

As noted by @arahuja in issue #407

This does not fix the issue, though; that requires a more complex sort
by contig (in the works).
  • Loading branch information
ihodes committed Jan 23, 2015
1 parent a5d1eeb commit 4756176
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions cycledash/genotypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,9 +431,13 @@ def _annotate_query_with_types(query, vcf_spec):
"""Adds a columnType field to each filter and sortBy in query."""
operations = query.get('sortBy', []) + query.get('filters', [])
for operation in operations:
info = _find_column(vcf_spec, operation['columnName'])
name = operation['columnName']
info = _find_column(vcf_spec, name)
if not info:
operation['columnType'] = 'string'
if name == 'position':
operation['columnType'] = 'integer'
else:
operation['columnType'] = 'string'
continue
column_type = info.get('info', {}).get('type', 'string').lower()
operation['columnType'] = column_type
Expand Down

0 comments on commit 4756176

Please sign in to comment.