User:Lindenb/Notebook/UMR915/20100924

From OpenWetWare

Jump to: navigation, search

20100923        Top        20100927       


C API for mongo ?

  git clone "http://github.com/mongodb/mongo-c-driver.git"

moving sql data to biomongo

   mysql -u root -D umr915 -N -e |\
  'select concat("snp={sqlid:",id,",build:\"hg18\",chrom:\"",chrom,"\",position:",position,",ref:\"",ref,"\",alt:\"",alt,"\",creation:\"",creation,"\",projects:[\"Bru\"]};db.variations.save(snp);") from variation'
  snp={sqlid:1,build:"hg18",chrXXXX:"chr11",position:6855238,ref:"G",alt:"A",creation:"2010-06-22 17:23:04",projects:["Br"]};db.variations.save(snp);
  snp={sqlid:2,build:"hg18",chrXXXX:"chr11",position:6869819,ref:"A",alt:"G",creation:"2010-06-22 17:23:04",projects:["Br"]};db.variations.save(snp);
  snp={sqlid:3,build:"hg18",chrXXXX:"chr11",position:6899051,ref:"C",alt:"A",creation:"2010-06-22 17:23:04",projects:["Br"]};db.variations.save(snp);
  snp={sqlid:4,build:"hg18",chrXXXX:"chr11",position:6899270,ref:"C",alt:"T",creation:"2010-06-22 17:23:04",projects:["Br"]};db.variations.save(snp);
  snp={sqlid:5,build:"hg18",chrXXXX:"chr11",position:6899301,ref:"G",alt:"C",creation:"2010-06-22 17:23:04",projects:["Br"]};db.variations.save(snp);
  snp={sqlid:6,build:"hg18",chrXXXX:"chr11",position:6910433,ref:"A",alt:"G",creation:"2010-06-22 17:23:04",projects:["Br"]};db.variations.save(snp);
  snp={sqlid:7,build:"hg18",chrXXXX:"chr11",position:6933563,ref:"A",alt:"T",creation:"2010-06-22 17:23:04",projects:["Br"]};db.variations.save(snp);
  snp={sqlid:8,build:"hg18",chrXXXX:"chr11",position:7016535,ref:"A",alt:"C",creation:"2010-06-22 17:23:04",projects:["Br"]};db.variations.save(snp);
  snp={sqlid:9,build:"hg18",chrXXXX:"chr11",position:7016556,ref:"G",alt:"A",creation:"2010-06-22 17:23:04",projects:["Br"]};db.variations.save(snp);
  snp={sqlid:10,build:"hg18",chrXXXX:"chr11",position:7027606,ref:"G",alt:"A",creation:"2010-06-22 17:23:04",projects:["Br"]};db.variations.save(snp);

insert:

 /usr/local/package/mongodb-linux-x86_64-1.6.2/bin/mongo umr915 ~/jeter.js
 
 /usr/local/package/mongodb-linux-x86_64-1.6.2/bin/mongo umr915 
 
 >db.variations.find().limit(5)
 { "_id" : ObjectId("4c9c74f3fd4b0fa24f495f0c"), "sqlid" : 1, "build" : "hg18", "chrom" : "chrXXXX", "position" : 6855238, "ref" : "G", "alt" : "A", "creation" : "2010-06-22 17:23:04", "projects" : [ "Br" ] }
 { "_id" : ObjectId("4c9c74f3fd4b0fa24f495f0d"), "sqlid" : 2, "build" : "hg18", "chrom" : "chrXXXX", "position" : 6869819, "ref" : "A", "alt" : "G", "creation" : "2010-06-22 17:23:04", "projects" : [ "Br" ] }
 { "_id" : ObjectId("4c9c74f3fd4b0fa24f495f0e"), "sqlid" : 3, "build" : "hg18", "chrom" : "chrXXXX", "position" : 6899051, "ref" : "C", "alt" : "A", "creation" : "2010-06-22 17:23:04", "projects" : [ "Br" ] }
 { "_id" : ObjectId("4c9c74f3fd4b0fa24f495f0f"), "sqlid" : 4, "build" : "hg18", "chrom" : "chrXXXX", "position" : 6899270, "ref" : "C", "alt" : "T", "creation" : "2010-06-22 17:23:04", "projects" : [ "Br" ] }
 { "_id" : ObjectId("4c9c74f3fd4b0fa24f495f10"), "sqlid" : 5, "build" : "hg18", "chrom" : "chrXXXX", "position" : 6899301, "ref" : "G", "alt" : "C", "creation" : "2010-06-22 17:23:04", "projects" : [ "Br" ] }

create indexes

   db.variations.ensureIndex({build:1,chrom:1,position:1})
   db.variations.ensureIndex({projects:1})
Personal tools