Esempio n. 1
0
 def __init__(self, filename=None, hdr_only=False, prt=sys.stdout):
     self.filename = filename
     self.evobj = EvidenceCodes()
     # Initialize associations and header information
     self.hdr = None
     self.associations = self.read_gaf(filename, hdr_only,
                                       prt) if filename is not None else []
Esempio n. 2
0
def test_evcode_picker():
    """Test that expected 3 letter codes are chosen when given: inc, exc for codes and groups"""
    obj = EvidenceCodes()
    # pylint: disable=superfluous-parens
    act = obj.get_evcodes()
    print('ALL POSITIVE CODES: {C}'.format(C=' '.join(sorted(act))))
    assert 'ND' not in act and len(act) > 15, act
    #
    act = obj.get_evcodes({'Experimental'})
    assert act == set(['EXP', 'IDA', 'IPI', 'IMP', 'IGI', 'IEP']), act
    #
    act = obj.get_evcodes({'Experimental'}, {'IEP'})
    assert act == set(['EXP', 'IDA', 'IPI', 'IMP', 'IGI']), act
    #
    act = obj.get_evcodes({'Experimental', 'Similarity'}, {'IEP', 'IMR'})
    exp = {
        'EXP', 'IDA', 'IPI', 'IMP', 'IGI', 'ISS', 'ISO', 'ISA', 'ISM', 'IGC',
        'IBA', 'IBD', 'IKR', 'IRD'
    }
    assert act == exp, act
    #
    act = obj.get_evcodes(None, {'IEA'})
    exp = set(obj.code2nt)
    exp.difference_update({'IEA', 'ND'})
    assert act == exp, act.symmetric_difference(exp)
    #
    obj.prt_details()
    obj.prt_summary_code()
    print("**TEST PASSED")
Esempio n. 3
0
 def __init__(self, filename=None, hdr_only=False, prt=sys.stdout, **kws):
     # kws: allow_missing_symbol
     self.kws = {k:v for k, v in kws.items() if k in self.exp_kwdct}
     self.filename = filename
     self.evobj = EvidenceCodes()
     # Initialize associations and header information
     self.hdr = None
     self.associations = self.read_gaf(filename, hdr_only, prt) if filename is not None else []
Esempio n. 4
0
 def __init__(self, filename=None, **kws):
     # kws: allow_missing_symbol
     self.filename = filename
     self.evobj = EvidenceCodes()
     # Read anotation file, store namedtuples:
     #     Gene2GoReader(filename=None, taxids=None):
     #     GafReader(filename=None, hdr_only=False, prt=sys.stdout, allow_missing_symbol=False):
     #     GpadReader(filename=None, hdr_only=False):
     self.hdr = None
     self.datobj = None
     self.associations = self._init_associations(filename, **kws)
Esempio n. 5
0
 def _prt_evidence_codes(args):
     if not {'--ev_help', '--ev_help_short'}.isdisjoint(args):
         print('\nEVIDENCE CODE HELP: --ev_exc --ev_inc')
         print('Use any of these group names, ')
         print(
             'like Experimental or Similarity or Experimental,Similarity,')
         print(
             'or evidence codes, like IEA or ISS,ISO,ISA in --ev_exc or --ev_inc:'
         )
         obj = EvidenceCodes()
         if '--ev_help' in args:
             print('')
             obj.prt_details()
         if '--ev_help_short' in args:
             print('')
             obj.prt_summary_code()
         sys.exit(0)
Esempio n. 6
0
 def __init__(self, name, filename=None, **kws):
     # kws: allow_missing_symbol
     self.name = name  # name is one of valid_formats
     self.filename = filename
     self.godag = kws.get('godag')
     self.namespaces = kws.get('namespaces')
     self.evobj = EvidenceCodes()
     # Read anotation file, store namedtuples:
     #     Gene2GoReader(filename=None, taxids=None):
     #     GafReader(filename=None, hdr_only=False, prt=sys.stdout, allow_missing_symbol=False):
     #     GpadReader(filename=None, hdr_only=False):
     self.hdr = None
     self.datobj = None
     # pylint: disable=no-member
     self.associations = self._init_associations(filename, **kws)
     # assert self.associations, 'NO ANNOTATIONS FOUND: {ANNO}'.format(ANNO=filename)
     assert self.namespaces is None or isinstance(self.namespaces, set)
def test_ev():
    """Return GO associations from a GAF file. Download if necessary."""
    evs = _get_evidencecodes('gene2go')
    obj = EvidenceCodes()
    missing = evs.difference(obj.code2nt)
    assert not missing, 'MISSING({EV})'.format(EV=missing)
Esempio n. 8
0
 def __init__(self, filename=None, log=sys.stdout):
     self.filename = filename
     self.log = log
     self.evobj = EvidenceCodes()
     self.associations = self.read_gaf(
         filename) if filename is not None else []