471059f48d7e0d93419bebfb79c379dde343fcb1 mmaddren Tue Apr 10 12:11:08 2012 -0700 removed CRLF from encode and fixed a small error in cv.py diff --git python/lib/ucscgenomics/cv.py python/lib/ucscgenomics/cv.py index 7709a32..0fc7b9f 100644 --- python/lib/ucscgenomics/cv.py +++ python/lib/ucscgenomics/cv.py @@ -57,31 +57,31 @@ '''wrapper function for raising exception''' raise exception def readStanza(self, stanza, key=None): '''overriden method from RaFile which makes specialized stanzas based on type''' entry = CvStanza() key, val = entry.readStanza(stanza) return key, val, entry def validate(self): '''base validation method which calls all stanzas' validate''' for stanza in self.itervalues(): stanza.validate(self) - print self.missingTypes + #print self.missingTypes def getTypeOfTermStanza(self, type): types = self.filter(lambda s: s['term'] == type and s['type'] == 'typeOfTerm', lambda s: s) if len(types) != 1: return None return types[0] class CvStanza(ra.RaStanza): '''base class for a single stanza in the cv, which adds validation''' def __init__(self): ra.RaStanza.__init__(self) def readStanza(self, stanza): ''' @@ -129,33 +129,30 @@ else: self[raKey] = raVal def validate(self, cvfile): type = self['type'] if self['type'] == 'Cell Line': # :( if 'organism' in self and self['organism'] == 'human': type = 'cellType' elif 'organism' in self and self['organism'] == 'mouse': type = 'mouseCellType' else: cvfile.handler(OrganismError(self)) typeStanza = cvfile.getTypeOfTermStanza(type) if typeStanza == None: - #print cvfile.filter2(lambda s: s['type'] == 'typeOfTerm').keys() - #print '>%s<' % cvfile['mouseCellType ']['term'] - #print '>%s<' % cvfile['mouseCellType ']['type'] cvfile.handler(InvalidTypeError(self, self['type'] + '(%s)' % type)) return required = list() if 'requiredVars' in typeStanza: required = extractList(typeStanza['requiredVars']) optional = list() if 'optionalVars' in typeStanza: optional = extractList(typeStanza['optionalVars']) self.checkMandatory(cvfile, required) required.extend(optional) self.checkExtraneous(cvfile, required) self.checkDuplicates(cvfile) for key in self.iterkeys():