ff355a86fe75110d111d545207cb97c0e2c4c49d wong Mon Oct 10 16:09:57 2011 -0700 cleaned up some cv validator stuff diff --git python/lib/ucscgenomics/cv.py python/lib/ucscgenomics/cv.py index 00352a7..c0c3716 100644 --- python/lib/ucscgenomics/cv.py +++ python/lib/ucscgenomics/cv.py @@ -150,32 +150,34 @@ if necessary == None: necessary = set() if optional == None: optional = set() baseNecessary = {'term', 'tag', 'type'} if self['type'] != 'Antibody': baseNecessary.add('description') baseOptional = {'deprecated'} self.checkMandatory(ra, necessary | baseNecessary) self.checkExtraneous(ra, necessary | baseNecessary | optional | baseOptional) - if self['type'] != 'Cell Line': # cv, you disgust me with your inconsistencies - if len(ra.filter(lambda s: s['term'] == self['type'] and s['type'] == 'typeOfTerm', lambda s: s)) == 0: + temptype = self['type'] + if self['type'] == 'Cell Line': # cv, you disgust me with your inconsistencies + temptype = 'cellType' + if len(ra.filter(lambda s: s['term'] == temptype and s['type'] == 'typeOfTerm', lambda s: s)) == 0: ra.handler(InvalidTypeError(self, self['type'])) self.checkDuplicates(ra) def checkDuplicates(self, ra): """ensure that all keys are present and not blank in the stanza""" for key in self.iterkeys(): if '__$$' in key: newkey = key.split('__$$', 1)[0] ra.handler(DuplicateKeyError(self, newkey)) def checkMandatory(self, ra, keys): """ensure that all keys are present and not blank in the stanza""" for key in keys: