def open_fasta_file(self): name = tkFileDialog.askopenfilename() if name: try: self.f = Fasta(name) self.loaded_file = os.path.split(name)[-1] self.mlb.delete(0, self.mlb.size() - 1) self.status.set("Loaded %s - %s" % (self.loaded_file, self.f)) self.scanmenu.entryconfig(0, state=NORMAL) except: tkMessageBox.showerror("Error opening file", "Error opening %s.\nIs it a valid FASTA file?" % os.path.split(name)[-1])
"PWM-file supplied, left halfsite: %s, right halfsite: %s\n" % (len(pwm_left), len(pwm_right))) if not options.cutoff: s_max = max_score(pwm_left) + max_score(pwm_right) s_min = min_score(pwm_left) + min_score(pwm_right) sys.stderr.write( "No cutoffs specified, using %s as a cutoff (%s of maxscore)\n" % (SCORE_FRACTION * (s_max - s_min) + s_min, SCORE_FRACTION)) cutoffs = [ SCORE_FRACTION * (s_max - s_min) + s_min for i in range(max_spacer - min_spacer + 1) ] bed = options.bed f = Fasta(inputfile) for (id, seq) in f.items(): result = scan(seq.upper(), pwm_left, pwm_right, min_spacer, max_spacer, cutoffs, nreport) for (score, pos, spacer, strand) in result: if bed: first = id.split(" ")[0] (chr, loc) = first.split(":") if loc: (start, end) = map(int, loc.split("-")) print "%s\t%s\t%s\t%s" % (chr, start + pos, start + pos + len(pwm_left) + spacer + len(pwm_right), score) else: print "%s\t%s\t%s\t%s" % (id, pos, pos + len(pwm_left) +