mgkit.workflow.dict_utils module¶
Dictionary Utilities¶
This scripts include a series of commands to help with dictionary files, where the first columns is a key and all columns after are values. Most of the command expect the structure of a dictionary file like this:
key1,value1,value2,.. key2,value3,value4,..
So all columns after the first are supposed to be part of a list. The internal representation is a dictionary with keys and values as lists (or sets).
Split¶
The split command can be used in those cases where the value is just one column and the values must be separated. For example, if you use edit-gff view to extract the uid and map_KO in a GFF from MGKit, you’ll have:
uid1 K00001,K00002 uid2 K00004,K01002
By passing the value separator, they can be split into the form accepted by other commands. The same can be accomplished by using tr in linux to substitute commas with tabs.
A trickier and more compelling use is for the FC attribute. They are in the form:
uid1 AK uid2 FU
These categories are single letter and they can split by using the –no-separator option.
Reverse Dictionary¶
Used to reverse a dictionary Key/Values. Values are used as keys in the new dictionary and the original keys become the values.
Changes¶
New in version 0.5.7.