def _get_ntgpadvals(self, flds, goid, nspc, add_ns): """Convert fields from string to preferred format for GPAD ver 2.1 and 2.0.""" is_set = False qualifiers = self._get_qualifier(flds[2]) assert flds[3][:3] == 'GO:', 'UNRECOGNIZED GO({GO})'.format(GO=flds[3]) db_reference = self._rd_fld_vals("DB_Reference", flds[4], is_set, 1) assert flds[5][:4] == 'ECO:', 'UNRECOGNIZED ECO({ECO})'.format(ECO=flds[3]) with_from = self._rd_fld_vals("With_From", flds[6], is_set) taxons = self._get_taxon(flds[7]) assert flds[8].isdigit(), 'UNRECOGNIZED DATE({D})'.format(D=flds[8]) assert flds[9], '"Assigned By" VALUE WAS NOT FOUND' props = self._get_properties(flds[11]) self._chk_qty_eq_1(flds, [0, 1, 3, 5, 8, 9]) # Additional Formatting self._chk_qualifier(qualifiers) # Create list of values eco = flds[5] goid = flds[3] gpadvals = [ flds[0], # 0 DB flds[1], # 1 DB_ID qualifiers, # 3 Qualifier goid, # 4 GO_ID db_reference, # 5 DB_Reference eco, # 6 ECO ECO2GRP[eco], with_from, # 7 With_From taxons, # 12 Taxon get_date_yyyymmdd(flds[8]), # 13 Date flds[9], # 14 Assigned_By get_extensions(flds[10]), # 12 Extension props] # 12 Annotation_Properties if add_ns: gpadvals.append(nspc) return gpadvals
def get_gafvals(self, flds, nspc): """Convert fields from string to preferred format for GAF ver 2.1 and 2.0.""" flds[3] = self._get_qualifier(flds[3]) # 3 Qualifier flds[5] = self._get_set(flds[5]) # 5 DB_Reference flds[7] = self._get_set(flds[7]) # 7 With_From flds[8] = nspc # 8 GAF Aspect field converted to BP, MF, or CC flds[9] = self._get_set(flds[9]) # 9 DB_Name flds[10] = self._get_set(flds[10]) # 10 DB_Synonym flds[12] = self._do_taxons(flds[12]) # 12 Taxon flds[13] = get_date_yyyymmdd(flds[13]) # 13 Date 20190406 # Version 2.x has these additional fields not found in v1.0 if self.is_long: flds[15] = get_extensions(flds[15]) # Extensions (or Annotation_Extension) flds[16] = self._get_set(flds[16].rstrip()) else: flds[14] = self._get_set(flds[14].rstrip()) return flds
def _get_ntgpadvals(self, flds, goid, nspc, add_ns): """Convert fields from string to preferred format for GPAD ver 2.1 and 2.0.""" is_set = False qualifiers = self._get_qualifier(flds[2]) assert flds[3][:3] == 'GO:', 'UNRECOGNIZED GO({GO})'.format(GO=flds[3]) db_reference = self._rd_fld_vals("DB_Reference", flds[4], is_set, 1) assert flds[5][:4] == 'ECO:', 'UNRECOGNIZED ECO({ECO})'.format( ECO=flds[3]) with_from = self._rd_fld_vals("With_From", flds[6], is_set) taxons = self._get_taxon(flds[7]) assert flds[8].isdigit(), 'UNRECOGNIZED DATE({D})'.format(D=flds[8]) assert flds[9], '"Assigned By" VALUE WAS NOT FOUND' props = self._get_properties(flds[11]) self._chk_qty_eq_1(flds, [0, 1, 3, 5, 8, 9]) # Additional Formatting if qualifiers: self._chk_qualifier(qualifiers) # Create list of values eco = flds[5] goid = flds[3] gpadvals = [ flds[0], # 0 DB flds[1], # 1 DB_ID qualifiers, # 3 Qualifier goid, # 4 GO_ID db_reference, # 5 DB_Reference eco, # 6 ECO ECO2GRP[eco], with_from, # 7 With_From taxons, # 12 Taxon get_date_yyyymmdd(flds[8]), # 13 Date flds[9], # 14 Assigned_By get_extensions(flds[10]), # 12 Extension props ] # 12 Annotation_Properties if add_ns: gpadvals.append(nspc) return gpadvals