Created
February 9, 2023 14:10
-
-
Save canimus/1b23464a40d900361410fde5e6e71c69 to your computer and use it in GitHub Desktop.
Revisions
-
canimus created this gist
Feb 9, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ series = [] d = {} for row in raw: try: if len(row) == 0: continue if row.startswith("!sample_table_end"): for k in arr: if k in d: d[k] = [d[k]] series.append(d) d = {} continue if row.startswith("#") or row.startswith("ID_REF") or ("sample_table_begin" in row): continue if row.startswith("^") or row.startswith("!"): x = row.split(" ") a,b = x[0].strip(), " ".join(x[1:]).strip() if a in arr: if a not in d: d[a] = [] else: d[a] = d[a] + [b[2:]] else: d[a] = [b[2:]] else: a,b = row.split("\t") d[a.strip()] = [b.strip()] except Exception as e: print(row, e) break