forked from RTXteam/RTX-KG2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RTXteam#316 tui combo mapping converter
- Loading branch information
Showing
1 changed file
with
31 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
__author__ = 'Erica Wood' | ||
__copyright__ = 'Oregon State University' | ||
__credits__ = ['Stephen Ramsey', 'Erica Wood'] | ||
__license__ = 'MIT' | ||
__version__ = '0.1.0' | ||
__maintainer__ = '' | ||
__email__ = '' | ||
__status__ = 'Prototype' | ||
|
||
import json | ||
|
||
if __name__ == '__main__': | ||
combos = dict() | ||
with open('tui_combo_mappings.tsv') as combo_file: | ||
line_count = 0 | ||
for line in combo_file: | ||
line_count += 1 | ||
if line_count == 1: | ||
continue | ||
line = line.split('\t') | ||
mapping = line[2] | ||
tuis = list() | ||
item_count = 0 | ||
for item in line: | ||
if item_count > 2 and item_count % 2 == 1 and len(item) > 0: | ||
tuis.append(item) | ||
item_count += 1 | ||
tuis = str(tuple(tuis)) | ||
if len(mapping) > 0: | ||
combos[tuis] = mapping | ||
print(json.dumps(combos, indent=4, sort_keys=True)) |