def populate(self, box, schema_name): for child in box.get_children(): box.remove(child) functions.Functions(self.main, self.conn, box, schema_name, self.schema_store) sequences.Sequences(self.main, self.conn, box, schema_name) tables.Tables(self.main, self.conn, box, schema_name, self.schema_store) views.Views(self.main, self.conn, box, schema_name, self.schema_store)
def load(in_name, models): fname = None seq = None constraint = "" both_strands = False cands = [] count = -1 tries = [0,0] if( not in_name is None ): fi = open( in_name ) else: fi = sys.stdin for line in fi: line = line.strip() if( line.startswith( "##seq = " ) ): seq = line.split( "=" )[1].strip() elif( line.startswith( "##seq_file = " ) ): fname = line.split( "=" )[1].strip() elif( line.startswith( "##constraint = " ) ): constraint = line.split( "=" )[1].strip() elif( line.startswith( "##both_strands = " ) ): both_strands = (line.split( "=" )[1].strip() == 'YES') elif( line.startswith( "##sequences = " ) ): count = int(line.split( "=" )[1].strip()) elif( line.startswith( "##tests_all = " ) ): tries[0] = int(line.split( "=" )[1].strip()) elif( line.startswith( "##tests_pairs = " ) ): tries[1] = int(line.split( "=" )[1].strip()) elif( line.startswith( "#" ) or (line == "") ): continue else: cands.append( candidates.CandidateParser.parse( line, models ) ) seqs = sequences.Sequences(fname=fname, seq=seq, both_strands=both_strands) if( not in_name is None ): fi.close() return( seqs, cands, constraint, count, tries )
help="Minimum bpp to accept a candidate.") #parser.add_option( "--min-evalue", action="store", dest="min_evalue", default=None, type="float", help="Minimum -log(e-value) to accept candidate." ) parser.add_option("--constraint", action="store", dest="constraint", default=None, type="string", help="File containing secondary structure constraints.") (options, args) = parser.parse_args() # # Read the input sequences from wherever they came # seqs = sequences.Sequences(fname=((len(args) > 0) and args[0] or None), both_strands=options.both_strands) # # Configure and initialize the search class # # set the default values for 'win_len' and 'win_step' config.win_len = options.win_len if (options.win_step is None): config.win_step = int(config.win_len / 2) else: config.win_step = options.win_step # Read the secondary structure constraints if they exist if (not options.constraint is None):
with open(filename, 'r') as f: lines = f.readlines() x = 0 while x < len(lines): name = lines[x].strip('\n').lstrip('>') x += 1 emissions = lines[x].strip('\n').lstrip(' ') x += 1 hiddens = lines[x].strip('\n').lstrip('# ') x += 2 data[name] = dict(X=emissions, Z=hiddens) return data; def __str__(self): return str(self.sequences) def __len__(self): return len(self.sequences) def get(self): return self.sequences def get_by_key(self, key): return self.sequences[key] if __name__ == "__main__": import sequences SEQUENCEFILE = '../sequences-project2.txt' sequences = sequences.Sequences(SEQUENCEFILE) print sequences