goatools.grouper.wrxlsx 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.wrxlsx.WrXlsxSortedGos(sortname, sortobj, ver_list=None)[source]

Bases: object

Writes grouped and sorted user GO IDs into an xlsx file.

kw_keys_xlsx = {'hdrs', 'title'}
wr_xlsx_gos(fout_xlsx, **kws_usr)[source]

Write an Excel spreadsheet with user GO ids, grouped under broader GO terms.

wr_xlsx_nts(fout_xlsx, desc2nts, **kws_usr)[source]

Print grouped and sorted GO IDs.

wr_txt_gos(fout_txt, **kws_usr)[source]

Write an Excel spreadsheet with user GO ids, grouped under broader GO terms.

wr_txt_nts(fout_txt, desc2nts, prtfmt=None)[source]

Write grouped and sorted GO IDs to GOs.

prt_txt_desc2nts(prt, desc2nts, prtfmt)[source]

Print grouped and sorted GO IDs.

get_prtfmt(key='fmta')[source]

Return print format for Grouper, which includes hdr1usr01 and num_usrgos.

get_col_hdr(key='hdra')[source]

Return a column header string for the grouped GO IDs output.

Columns prepended by Grouper:

hd ‘*’ if this GO term is a group header; ‘**’ if header and user GO nUsrGOs number of user GO IDs grouped under this header GO term

The replacement of ‘# NS’ is safe because get_prt_hdr always generates exactly one ‘# NS’ token in that position (mirroring the ‘# {NS}’ in get_prt_fmt). Width of replacement: ‘nUsrGOs ‘ (9) chars, matching the data format’s ‘{num_usrgos:>4} uGOs’ = 9 chars (4 + 5). The ‘hd’ header for the leading {hdr1usr01:2} field is prepended separately before the GO_ID column.