def parse(self, line): line = chomp(line) self.line = line fields = line.split('\t') try: self.domainid = fields[0] self.pdbid = fields[1] self.chainidField = fields[2] self.scopfamily = fields[3] self.scopid = fields[4] self.scopinfoField = fields[5] self.chainids = [] self.chainrange = {} for chainid in self.chainidField.split(','): chainfields = chainid.split(':') if len(chainfields) == 1: if chainfields[0] == '-': chainfields = ['', ''] else: chainfields = ['', chainfields[0]] self.chainids.append(chainfields[0]) self.chainrange[chainfields[0]] = chainfields[1] except: return self.isinit = True
def Load(self, filename): infh = file(filename) for line in infh: if line[0] == '#': fields = chomp(line).split('\t') self.cutoff = float(fields[1]) self.specificity = float(fields[2]) self.sensitivity = float(fields[3]) else: self.falseNegatives.append(ScoresEntry(line))
def Parse(self, line): fields = chomp(line).split('#', 1) data = fields[0].strip() if len(fields) > 1: self.comments = fields[1].strip() fields = data.split('\t') self.label = fields[0] self.values = map(float, fields[1:]) subfields = self.label.split('_') self.pdbid = '_'.join(subfields[1:-1]) self.index = int(subfields[-1])
def Parse(self, line): fields = chomp(line).split('\t') name = fields[1] value = fields[2] if name not in self.SPECIAL_PARAMETERS: return None name, func = self.SPECIAL_PARAMETERS[name] self.name = name self.value = func(value) return self
def parse(self, line): line = chomp(line) self.line = line fields = line.split('\t') self.pdbid = fields[0].lower() self.chainid = '' self.comment = fields[-1] match = COMMENT_RE.search(self.comment) if match: self.chainid = match.group('chainid') if self.chainid: self.chainid = self.chainid.lower()
def Parse(self, line): self.line = line fields = chomp(line).split('\t') self.label = fields[0] subfields = fields[0].split('_') self.pdbid = '_'.join(subfields[1:-1]) self.index = int(subfields[-1]) self.score = float(fields[1]) self.x = float(fields[2]) self.y = float(fields[3]) self.z = float(fields[4]) self.description = '\t'.join(fields[5:])
def advance(snake, direction, food): """ Takes a list of positions (snake) and returns a snake advanced in the direction given of type Direction. Snake "grows" if it eats food snake must be a list """ return \ apply( lambda x: chain( [x], chomp(iter(snake)) if not x == food else iter(snake)), tuple( map( add, snake[0], direction.value)))
def Parse(self, line): self.line = line fields = chomp(line).split('\t') self.name = fields[0] subfields = self.name.split('-') self.property = '-'.join(subfields[:-1]) self.volume = int(subfields[-1]) self.pvalue = float(fields[1]) self.minval = float(fields[2]) self.binsize = float(fields[3]) self.scores = map(float, fields[4:4 + self.NUM_BINS]) extendedFields = fields[4 + self.NUM_BINS:] if extendedFields and extendedFields[0] == '#': for idx, value in enumerate(extendedFields[1:]): if not idx < len(self.EXTENDED_FIELDNAMES): warning('Too many extended fields') break name, func = self.EXTENDED_FIELDNAMES[idx] setattr(self, name, func(value))