You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The util module has a YAML representer for collections.OrderedDict that is utilized in the __init__.py to display the YAML metadata header in a convenient way when writing to disk.
This should be addressed in graph_algo by now, but I'm adding this to be sure.
The text was updated successfully, but these errors were encountered:
…e board, version bump to v0.7.8. In this commit, tested on Cdiff_R3.fa (in test/data), the graph subcommand produces a valid metadata header, and writes the outputs to stdout and to the .kdbg file, and correctly asserts/validates the relationship between unique k-mers, unique nullomers, and the number of theoretically possible k-mers.
def represent_yaml_from_collections_dot_OrderedDict(dumper, data):
"""
Thanks to Blender and EquipDev on StackOverflow for this handy method to pass to yaml.add_representer
https://stackoverflow.com/a/16782282
I use this throughout the metadata representation in the bgzf specification to print out the representer, it's just awesome.
I really like this answer. Finally got around to liking it this year, in Jan 2022 after using it for like a few years.
:param dumper: The OrderedDict_Representer, this faciliatates key sorting, consistent ordering of hasmap values, and can retain order during print for optimal metadata block structure.
:type dumper:
:param data:
:type data: dict
"""
import yaml
from collections import OrderedDict
def represent_ordereddict(dumper, data):
value = []
for item_key, item_value in data.items():
node_key = dumper.represent_data(item_key)
node_value = dumper.represent_data(item_value)
value.append((node_key, node_value))
return yaml.nodes.MappingNode(u'tag:yaml.org,2002:map', value)
yaml.add_representer(OrderedDict, represent_ordereddict)
The
util
module has a YAML representer forcollections.OrderedDict
that is utilized in the__init__.py
to display the YAML metadata header in a convenient way when writing to disk.This should be addressed in
graph_algo
by now, but I'm adding this to be sure.The text was updated successfully, but these errors were encountered: