mgkit.mappings.eggnog module

Module containing classes and functions to deal with eggNOG data

Todo

  • unify download of data from web
class mgkit.mappings.eggnog.Kegg2NogMapper(fname=None, gen_ko_to_cat=True)

Bases: mgkit.kegg.KeggMapperBase

Usage

to add a ko_id to the mapper use: * map_ko_to_eggnog(ko_id) which calls:

  • get_uniprot_from_ko
  • get_eggnog_from_uniprot

return None if there was no problem or a dictionary with the exception thrown

to make mappings ko_id -> eggnog-categories: * get_cat_mapping_from_file (file are in the current directory) * gen_ko_to_cat

Todo

  • add method to load kos from file
  • optimise querying (like Kegg2CazyMapper)
columns_string = 'database(eggnog)'
gen_ko_to_cat()
get_cat_ko_dict()
get_cat_mapping(f_handle)
get_cat_mapping_from_file(files=('COG.funccat.txt', 'NOG.funccat.txt', 'KOG.funccat.txt'))

Duplicate functionality of load_func_cat

Categories are single letter and their descriptioons are in EGGNOG_CAT, while the broader categories EGGNOG_CAT_MAP

get_ko_cat(ko_id)
get_ko_cat_dict()
get_ko_map()
load_data(fname)
map_ko_to_eggnog(ko_id, contact)
map_kos_eggnog(kos, contact)
query_string = 'database:(type:ko {0}) AND database:(type:eggnog)'
save_data(fname)
class mgkit.mappings.eggnog.NOGInfo

Bases: object

New in version 0.1.14.

Mappings from Uniprot to eggNOG

..note:

load_description is optional
get_gene_funccat(gene_id)

Returns the functional category (one letter, EGGNOG_CAT keys) for the requested eggNOG gene ID

get_gene_nog(gene_id)

Returns the COG/NOG ID of the requested eggNOG gene ID

get_nog_funccat(nog_id)

Returns the functional category (one letter, EGGNOG_CAT keys) for the requested eggNOG COG/NOG ID

get_nog_gencat(nog_id)

Returns the functional category (EGGNOG_CAT_NAMES keys) for the requested eggNOG COG/NOG ID

get_nogs_funccat(nog_ids)

Returns the functional categories for a list of COG/NOG IDs. Uses NOGInfo.get_nog_funccat()

load_description(file_handle)

Loads data from NOG.description.txt.gz

file_handle can either an open file or a path

load_funccat(file_handle)

Loads data from NOG.funccat.txt.gz

file_handle can either an open file or a path

load_members(file_handle)

Loads data from NOG.members.txt.gz

file_handle can either an open file or a path

mgkit.mappings.eggnog.download_data(contact, kegg_data='kegg.pickle', eggnog_data='eggnog.pickle', base_url='http://eggnog.embl.de/version_3.0/data/downloads/')
mgkit.mappings.eggnog.get_general_eggnog_cat(category)

New in version 0.1.14.

Returns the functional category (EGGNOG_CAT_NAMES keys) for the requested single letter functional category (EGGNOG_CAT keys)

mgkit.mappings.eggnog.print_ko_to_cat(data_file='eggnog.pickle', descr=False)