Skip to content

Commit

Permalink
Merge pull request #879 from nextstrain/measurements-command
Browse files Browse the repository at this point in the history
Measurements command
  • Loading branch information
joverlee521 authored Jun 13, 2022
2 parents f68c448 + 8fbdc82 commit 95d9d11
Show file tree
Hide file tree
Showing 26 changed files with 1,460 additions and 4 deletions.
3 changes: 2 additions & 1 deletion augur/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@
"export",
"validate",
"version",
"import"
"import",
"measurements",
]

COMMANDS = [importlib.import_module('augur.' + c) for c in command_strings]
Expand Down
2 changes: 1 addition & 1 deletion augur/data/schema-auspice-config-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
"minItems": 1,
"items": {
"type": "string",
"enum": ["tree", "map", "frequencies", "entropy"]
"enum": ["tree", "map", "frequencies", "entropy", "measurements"]
}
},
"vaccine_choices": {
Expand Down
2 changes: 1 addition & 1 deletion augur/data/schema-export-v2.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"type": "array",
"items": {
"type": "string",
"enum": ["tree", "map", "frequencies", "entropy"]
"enum": ["tree", "map", "frequencies", "entropy", "measurements"]
},
"uniqueItems": true,
"minItems": 1
Expand Down
107 changes: 107 additions & 0 deletions augur/data/schema-measurements-collection-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"$schema": "http://json-schema.org/draft-06/schema#",
"$id": "https://nextstrain.org/schemas/dataset/measurements/collection/config",
"title": "Collection config file to be supplied to `augur measurements export`",
"type": "object",
"additionalProperties": false,
"required": [],
"properties": {
"key": {
"description": "The short name of the collection that is only used internally within Auspice. Each collection is expected to have a unique key.",
"type": "string"
},
"title": {
"description": "The title to display in the collections dropdown and panel title. Optional -- if not provided, then `key` will be used",
"type": "string"
},
"fields": {
"description": "Custom field order and display titles. Order of the fields determines the order they are shown in the measurement hover display. Optional -- if not provided, then the key of the field will be displayed in alphabetical order.",
"type": "array",
"minItems": 1,
"items": {
"description": "A single field of the measurements",
"type": "object",
"additionalProperties": false,
"required": ["key"],
"properties": {
"key": {
"description": "The property name of the field within the measurement object",
"type": "string"
},
"title": {
"description": "The display title for the field. Optional -- if not provided, then `key` will be used",
"type": "string"
}
}
}
},
"groupings": {
"description": "The available group by fields for measurements. Order of the group by fields determines the order they are shown in the group by dropdown.",
"type": "array",
"minItems": 1,
"items": {
"description": "A single group by field for measurements",
"type": "object",
"additionalProperties": false,
"required": ["key"],
"properties": {
"key": {
"description": "The property name of the group by field within the measurement object",
"type": "string"
},
"order": {
"description": "A custom order of group by values to customize the display order of the subplots when using group by field",
"type": "array",
"minItems": 1,
"items": {
"description": "A single value of the group by field present in measurements",
"type": ["string", "number", "boolean"]
}
}
}
}
},
"filters": {
"description": "The available filter options for measurements. Order of the filter options determines the order they are shown in the filter dropdown. Optional -- if not provided, then all fields will be available as filters.",
"type": "array",
"minItems": 1,
"items": {
"description": "The property name of the filter field within the measurement object",
"type": "string"
}
},
"x_axis_label": {
"description": "The short label to display for the x-axis that describes the `value` of the measurements in a collection",
"type": "string"
},
"threshold": {
"description": "A numeric measurement threshold to be displayed as a single grey line shared across subplots. Optional -- if not provided, no threshold will be displayed",
"type": "number"
},
"display_defaults": {
"description": "Default display options of the collection",
"type": "object",
"additionalProperties": false,
"minProperty": 1,
"properties": {
"group_by": {
"description": "Default group by field name that must be included as a group by option in the groupings array. Optional -- if not provided, first group by option will be used",
"type": "string"
},
"measurements_display": {
"description": "Dictates how the measurements are displayed, either as the raw data points or as the means of values grouped by the tree color-by attribute",
"type": "string",
"enum": ["raw", "mean"]
},
"show_overall_mean": {
"description": "Should the overall mean per group be displayed by default?",
"type": "boolean"
},
"show_threshold": {
"description": "Should the threshold line be displayed by default? Ignored if no threshold has been provided for collection",
"type": "boolean"
}
}
}
}
}
2 changes: 1 addition & 1 deletion augur/export_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -842,7 +842,7 @@ def register_arguments_v2(subparsers):
config.add_argument('--description', metavar="description.md", help="Markdown file with description of build and/or acknowledgements to be displayed by Auspice")
config.add_argument('--geo-resolutions', metavar="trait", nargs='+', help="Geographic traits to be displayed on map")
config.add_argument('--color-by-metadata', metavar="trait", nargs='+', help="Metadata columns to include as coloring options")
config.add_argument('--panels', metavar="panels", nargs='+', choices=['tree', 'map', 'entropy', 'frequencies'], help="Restrict panel display in auspice. Options are %(choices)s. Ignore this option to display all available panels.")
config.add_argument('--panels', metavar="panels", nargs='+', choices=['tree', 'map', 'entropy', 'frequencies', 'measurements'], help="Restrict panel display in auspice. Options are %(choices)s. Ignore this option to display all available panels.")

optional_inputs = v2.add_argument_group(
title="OPTIONAL INPUT FILES"
Expand Down
Loading

0 comments on commit 95d9d11

Please sign in to comment.