goatools.anno.init.reader_gaf module

Read a GO Annotation File (GAF) and store the data in a Python object.

Annotations available from the Gene Ontology Consortium:

http://current.geneontology.org/annotations/

class goatools.anno.init.reader_gaf.InitAssc(fin_gaf)[source]

Bases: object

Read annotation file and store a list of namedtuples.

init_associations(hdr_only, prt, namespaces, allow_missing_symbol)[source]

Read GAF file. Store annotation data in a list of namedtuples.

class goatools.anno.init.reader_gaf.GafData(ver, allow_missing_symbol=False)[source]

Bases: object

Extracts GAF fields from a GAF line.

spec_req1 = [0, 1, 2, 4, 6, 8, 11, 13, 14]
aspect2ns = {'C': 'CC', 'F': 'MF', 'P': 'BP'}
gafhdr = ['DB', 'DB_ID', 'DB_Symbol', 'Qualifier', 'GO_ID', 'DB_Reference', 'Evidence_Code', 'With_From', 'NS', 'DB_Name', 'DB_Synonym', 'DB_Type', 'Taxon', 'Date', 'Assigned_By']
gafhdr2 = ['Extension', 'Gene_Product_Form_ID']
gafhdr_ext = ['DB', 'DB_ID', 'DB_Symbol', 'Qualifier', 'GO_ID', 'DB_Reference', 'Evidence_Code', 'With_From', 'NS', 'DB_Name', 'DB_Synonym', 'DB_Type', 'Taxon', 'Date', 'Assigned_By', 'Extension', 'Gene_Product_Form_ID']
gaf_req_str = ['REQ', 'REQ', 'REQ', '', 'REQ', 'REQ', 'REQ', '', 'REQ', '', '', 'REQ', 'REQ', 'REQ', 'REQ', '', '']
gaf_req_str_2_2 = ['REQ', 'REQ', 'REQ', 'REQ', 'REQ', 'REQ', 'REQ', '', 'REQ', '', '', 'REQ', 'REQ', 'REQ', 'REQ', '', '']
gaf_required_columns = {'1.0': ['REQ', 'REQ', 'REQ', '', 'REQ', 'REQ', 'REQ', '', 'REQ', '', '', 'REQ', 'REQ', 'REQ', 'REQ'], '2.0': ['REQ', 'REQ', 'REQ', '', 'REQ', 'REQ', 'REQ', '', 'REQ', '', '', 'REQ', 'REQ', 'REQ', 'REQ', '', ''], '2.1': ['REQ', 'REQ', 'REQ', '', 'REQ', 'REQ', 'REQ', '', 'REQ', '', '', 'REQ', 'REQ', 'REQ', 'REQ', '', ''], '2.2': ['REQ', 'REQ', 'REQ', 'REQ', 'REQ', 'REQ', 'REQ', '', 'REQ', '', '', 'REQ', 'REQ', 'REQ', 'REQ', '', '']}
gaf_columns = {'1.0': ['DB', 'DB_ID', 'DB_Symbol', 'Qualifier', 'GO_ID', 'DB_Reference', 'Evidence_Code', 'With_From', 'NS', 'DB_Name', 'DB_Synonym', 'DB_Type', 'Taxon', 'Date', 'Assigned_By'], '2.0': ['DB', 'DB_ID', 'DB_Symbol', 'Qualifier', 'GO_ID', 'DB_Reference', 'Evidence_Code', 'With_From', 'NS', 'DB_Name', 'DB_Synonym', 'DB_Type', 'Taxon', 'Date', 'Assigned_By', 'Extension', 'Gene_Product_Form_ID'], '2.1': ['DB', 'DB_ID', 'DB_Symbol', 'Qualifier', 'GO_ID', 'DB_Reference', 'Evidence_Code', 'With_From', 'NS', 'DB_Name', 'DB_Synonym', 'DB_Type', 'Taxon', 'Date', 'Assigned_By', 'Extension', 'Gene_Product_Form_ID'], '2.2': ['DB', 'DB_ID', 'DB_Symbol', 'Qualifier', 'GO_ID', 'DB_Reference', 'Evidence_Code', 'With_From', 'NS', 'DB_Name', 'DB_Synonym', 'DB_Type', 'Taxon', 'Date', 'Assigned_By', 'Extension', 'Gene_Product_Form_ID']}
static get_dfltdict()[source]

Return default values for GAF data in a namedtuple

chk(annotations, fout_err)[source]

Check annotations.

get_ntobj()[source]

Get namedtuple object specific to version

get_gafvals(flds, nspc)[source]

Convert fields from string to preferred format for GAF ver 2.1 and 2.0.

prt_line_detail(prt, line)[source]

Print line header and values in a readable format.

prt_error_summary(fout_err)[source]

Print a summary about the GAF file that was read.

class goatools.anno.init.reader_gaf.GafHdr(version=LATEST_GAF_VERSION)[source]

Bases: object

Used to build a GAF header.

cmpline = re.compile('^!(\\w[\\w\\s-]+:.*)$')
get_hdr()[source]

Return GAF header data as a string paragragh.

chkaddhdr(line)[source]

If this line contains desired header info, save it.

validate()[source]

Since 2.2, the header must also contain ‘generated-by’ and ‘date-generated’ lines

Returns:

True if header passes validation

Return type:

[bool]