Skip to content

Instantly share code, notes, and snippets.

@kozo2
Created February 18, 2014 01:14
Show Gist options
  • Save kozo2/9062681 to your computer and use it in GitHub Desktop.
Save kozo2/9062681 to your computer and use it in GitHub Desktop.
iron-maiden
from pymongo.collection import Collection
client = MongoClient()
db = client['keggscape']
targets = db['all_target_ids_all']
ecoli_targets = targets.find({"Species" : "Escherichia coli"})
convtable = db['conv-eco-uniprot']
eco = db['eco']
for target in ecoli_targets:
conv = convtable.find_one({ "uniprot_id" : "up:" + target['UniProt ID'] })
if (conv != None):
targets.update({"_id" : target["_id"]}, {"$set" : {"kegg_id" : conv["kegg_id"]}})
#import pdb; pdb.set_trace()
#target.insert({'kegg_id' : conv['kegg_id']})
#print target['ID'], target['UniProt ID'], conv["kegg_id"]
import pdb; pdb.set_trace()
eco.insert(ecoli_targets)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment