def loadMEME_ID(subset): care = PlantCARE('./databases/plantcare.db') place = Place('./databases/place.db') jaspar = JasparDB('./databases/jaspar.db') meme_ids = [] print subset if 'plantcare' in subset.keys() and subset['plantcare'] != None: meme_ids.extend(care.getMotifSeq(subset['plantcare'])) if 'place' in subset.keys() and subset['place'] != None: tmp_seq = place.getMotifSeq(subset['place']) #for those contain U would change by iupac2meme to T #causing KeyError tmp_seq = [seq.replace("U", "T") for seq in tmp_seq] meme_ids.extend(tmp_seq) if 'jaspar' in subset.keys() and subset['jaspar'] != None: meme_ids.extend(jaspar.getBASE_ID(subset['jaspar'])) if 'denovo' in subset.keys() and subset['denovo'] != None: meme_ids.extend(united.getMEME_ID(subset['denovo'])) return list(set(meme_ids))
else: jaspar = JasparDB(jaspar_path) meme_motifs = jaspar2meme('./databases/jaspar_pfm/') meme_slv.update(split_meme(meme_motifs)) united.importDB('Jaspar', jaspar_path) if options.plantcare: if not os.path.exists(plantcare_path): plantcare = PlantCARE(plantcare_path) plantcare.importMotifs('./databases/plantcare.txt') else: plantcare = PlantCARE(plantcare_path) meme_motifs = iupac2meme(plantcare.getMotifSeq()) meme_slv.update(split_meme(meme_motifs)) united.importDB('PlantCARE', plantcare_path) if options.place: if not os.path.exists(place_path): place = Place(place_path) place.importTable('./databases/place.tab') else: place = Place(place_path) meme_motifs = iupac2meme(place.getMotifSeq()) meme_slv.update(split_meme(meme_motifs)) united.importDB('PLACE', place_path) if options.denovo_path: meme_motifs = open(options.denovo_path).read() meme_slv.update(split_meme(meme_motifs)) united.importDenovo(options.denovo_path, 'MEME')