load_in_dict

yoda_powers.toolbox.load_in_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

Example

>>> dico = load_in_dict(filename)
>>> dico
{
"col1",["col2","col3"],
"indiv1",["valeurcol2","valeurcol3"],
"indiv2",["valeurcol2","valeurcol3"]
}