load_in_dict_dict

yoda_powers.toolbox.load_in_dict_dict(filename, sep='\t')[source]

Check file exist and return a dict with load rows first column is the key and value are other column. File can be a gzip file with ‘.gz’ extension.

Parameters
  • filename (str) – a path to existent file

  • sep (str, default) – the string separator. Default=” “

Returns

a python dict of file

Return type

dict

Raises
  • FileNotFoundError – If file filename does not exist or not valid file

  • IndexError – If missing data

Example

>>> dico = load_in_dict_dict(filename)
>>> dico
{
"indiv1",{"headerCol2":"toto","headerCol3":"tata"},
"indiv2",{"headerCol2":"tutu","headerCol3":"titi"},
"indiv3",{"headerCol2":"tete","headerCol3":"tyty"},
}