def add_info(opts): global database # check arguments if opts.file is None: die("Please provide an input file with the -f option") elif not os.path.exists(opts.file): die("Cannot find file '%s'" % opts.file) data = parse_flatfile(opts.file) for c, d in enumerate(data): meta = get_metadata(d['Accession No']) data[c] = dict(d.items() + meta.items()) #print data[c] database.append(data[c]) # save updated version of DB to pickle cp.dump(database, open("%s/%s" % (db_loc, database_name), 'wb'))
def add_info(opts): global database # check arguments if opts.file is None: die("Please provide an input file with the -f option") elif not os.path.exists(opts.file): die("Cannot find file '%s'" % opts.file) data = parse_flatfile(opts.file) for c, d in enumerate(data): meta = get_metadata(d["Accession No"]) data[c] = dict(d.items() + meta.items()) # print data[c] database.append(data[c]) # save updated version of DB to pickle cp.dump(database, open("%s/%s" % (db_loc, database_name), "wb"))
def test_metadata(): acc = 'AJ511268' exp = { 'Molecule Type': 'genomic DNA', 'Topology': 'linear', 'Organism': 'Pseudomonas aeruginosa', 'Taxonomy': 'Bacteria; Proteobacteria; Gammaproteobacteria; Pseudomonadales; Pseudomonadaceae; Pseudomonas', 'Taxon ID': '287', 'Strain': '', 'Description': 'Pseudomonas aeruginosa partial type 1 integron In182', 'Keywords': 'aac(3)-Ic gene; aminoglycoside acetyltransferase; blaVIM-2 gene; cmlA7 gene; CMLA7 protein; DNA integrase; integron; intI1 gene; qacEdelta1 gene; QacEdelta1 multidrug exporter; VIM-2 metallo-beta-lactamase', 'Reference Location': 'Antimicrob. Agents Chemother. 47(5):1746-1748(2003).', 'PubMed ID': '12709352', 'Notes': '', 'URL': 'http://www.ebi.ac.uk/ena/data/view/AJ511268', 'Sequence': '', 'First Release': '2003-04-24', 'Last Updated': '2005-04-15' } got = ena_metadata.get_metadata(acc) assert got == exp
def initiate_test_sequence(opt): data = get_metadata(opt.query) print data