goatools.anno.genetogo_reader module

Read an NCBI gene2go GO Association File and store the data in a Python object.

Annotations available from NCBI:

ftp://ftp.ncbi.nih.gov/gene/DATA/gene2go.gz

class goatools.anno.genetogo_reader.Gene2GoReader(filename=None, **kws)[source]

Bases: AnnoReaderBase

Reads a Gene Annotation File (GAF). Returns a Python object.

exp_kws = {'godag', 'namespaces', 'taxid', 'taxids'}
get_ns2assc(taxid=None, **kws)[source]

Return given associations into 3 (BP, MF, CC) dicts, id2gos

get_ns2ntsanno(taxid=None)[source]

Return all associations in three (one for BP MF CC) dicts, id2gos

get_associations(taxid=None)[source]

Return annotations

get_id2gos_nss(**kws)[source]

Return all associations in a dict, id2gos, regardless of namespace

get_name()[source]

Get name using taxid

get_taxid()[source]

Return taxid, if one was provided. Other wise return True representing all taxids

has_ns()[source]

Return True if namespace field, NS exists on annotation namedtuples

prt_counts(prt=sys.stdout)[source]

Print the number of taxids stored.

get_taxid2asscs(taxids=None, **kws)[source]

Read Gene Association File (GAF). Return data.

static fill_taxid2asscs(taxid2asscs_usr, taxid2asscs_ret)[source]

Fill user taxid2asscs for backward compatibility.

static get_id2gos_all(taxid2asscs_a2b)[source]

Get associations for all stored species taxid2asscs[taxid][ID2GOs|GO2IDs].