goatools.grouper.grprobj module

Given user GO ids and parent terms, group user GO ids under one parent term.

Given a group of GO ids with one or more higher-level grouping terms, group each user GO id under the most descriptive parent GO term.

Each GO id may have more than one parent. One of the parent(s) is chosen to best represent the user GO id’s function. The choice of parent is made by regarding how close the parent GO id is to the bottom of its hierarchy.

The estimation of how close a GO term is to “the bottom” of its GO hierarchy is estimated using the number of total Go term descendent counts below that term.

class goatools.grouper.grprobj.Grouper(grpname, goids, hdrobj, gosubdag, **kws)[source]

Bases: object

Groups the user GO ids under other GO IDs acting as headers for the GO groups.

fmtsum = '{GO_DESC} GOs({GOs:6,} in {SECs:2} sections, {UNGRP:>3} {undesc}) {ACTION} {FILE}\n'
get_usrgos_w_parents(hdrgos, usrgos_all=None)[source]

Get usrgos w/parents in hdrgos, even if usrgos did not get grouped under hdrgos.

get_sections_2d()[source]

Get 2-D list of sections and hdrgos sets actually used in grouping.

get_usrgos_g_section(section=None)[source]

Get usrgos in a requested section.

get_section2usrnts()[source]

Get dict section2usrnts.

get_section2items(itemkey)[source]

Collect all items into a single set per section.

get_hdrgos_g_usrgos(usrgos)[source]

Return hdrgos which contain the usrgos.

get_section_hdrgos_nts(sortby=None)[source]

Get a flat list of sections and hdrgos actually used in grouping.

get_sections_2d_nts(sortby=None)[source]

Get high GO IDs that are actually used to group current set of GO IDs.

get_hdrgos()[source]

Return high GO IDs that are actually used to group current set of GO IDs.

get_usrgos_g_hdrgos(hdrgos)[source]

Return usrgos under provided hdrgos.

get_hdrgos_unplaced()[source]

Get hdrgos which are not headers in sections.

get_hdrgos_u0()[source]

Return header GO IDs which ARE NOT user GO IDs.

get_hdrgos_u1()[source]

Return header GO IDs which ARE user GO IDs.

get_hdrgo2usrgos(hdrgos)[source]

Return a subset of hdrgo2usrgos.

get_usrgo2hdrgo()[source]

Return a dict with all user GO IDs as keys and their respective header GOs as values.

get_go2sectiontxt()[source]

Return a dict with actual header and user GO IDs as keys and their sections as values.

get_usrgo2sections()[source]

Return a dict with all user GO IDs as keys and their sections as values.

get_fout_base(goid, name=None, pre='gogrp')[source]

Get filename for a group of GO IDs under a single header GO ID.

prt_summary(prt=sys.stdout)[source]

Print summary of grouping/sorting run.