File tree Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Expand file tree Collapse file tree 2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change 11[metadata]
22name = pango_aliasor
3- version = 0.1.2
3+ version = 0.1.3
44description = Pango lineage aliasing and dealiasing
55long_description = file: README.md
66long_description_content_type = text/markdown
77url = https://github.com/corneliusroemer/pango_aliasor
88author = Cornelius Roemer
9910- license = MIT
11- license_file = LICENSE
1210classifiers =
1311 License :: OSI Approved :: MIT License
1412 Programming Language :: Python :: 3
Original file line number Diff line number Diff line change 11#%%
22class Aliasor :
33 def __init__ (self , alias_file = None ):
4- import pandas as pd
4+ import json
55
66 if alias_file is None :
7- # import importlib.resources
7+ import importlib .resources
88
9- aliases = pd .read_json ("https://raw.githubusercontent.com/cov-lineages/pango-designation/master/pango_designation/alias_key.json" )
10- # with importlib.resources.open_text("pango_designation", "alias_key.json") as file:
11- # aliases = pd.read_json(file)
9+ with importlib .resources .open_text ("pango_designation" , "alias_key.json" ) as file :
10+ file = json .load (file )
1211
1312 else :
14- aliases = pd . read_json (alias_file )
13+ file = json . load (alias_file )
1514
1615 self .alias_dict = {}
17- for column in aliases . columns :
18- if column . startswith ( 'X' ) :
16+ for column in file . keys () :
17+ if type ( file [ column ]) is list or file [ column ] == "" :
1918 self .alias_dict [column ] = column
2019 else :
21- self .alias_dict [column ] = aliases [column ][0 ]
22-
23- self .alias_dict ['A' ] = 'A'
24- self .alias_dict ['B' ] = 'B'
20+ self .alias_dict [column ] = file [column ]
2521
2622 self .realias_dict = {v : k for k , v in self .alias_dict .items ()}
2723
You can’t perform that action at this time.
0 commit comments