User:Lindenb/Notebook/UMR915/20100929
From OpenWetWare
Generating individuals for biomonogo
from the file I wrote yesterday:
cat jeter.ped | grep r | sort | sort | sed 's/Br//' |\ awk -F ' ' '{printf("i={_id:\"Brs%s.%s\",name:\"%s\",sex:%s,familyId:{$ref:\"families\",$id:\"Br%s\"},labels:[],dead:false,fatherId:",$1,$2,$2,$5,$1); if($3=="0") {printf("null");} else { printf("{$ref:\"individuals\",$id:\"Brs%s.%s\"}",$1,$3);} printf(",motherId:"); if($4=="0") {printf("null");} else { printf("{$ref:\"individuals\",$id:\"Brs%s.%s\"}",$1,$4);} printf("}; db.individuals.save(i);\n"); }'
generating mongo scripts from mysql
updated my stylesheet: http://code.google.com/p/lindenb/source/browse/trunk/src/xsl/sql2json.xsl to support Mongodb
xsltproc --stringparam mongo bams ~/src/lindenb/src/xsl/sql2json.xsl ~/jeter.xml record={_id:1,"filename":"/GENOTYPAGE/data/xxxx.bam","sample_id":1,"description":"Fastq","meta":"{}","creation":"2010-06-30 17:25:24","modified":"2010-06-30 17:25:24"}; db.bams.save(record);
Updated table vcfinputs
function castindi(id) { switch(id) { case 3: case 4: case 27: case 45: case 57: return "XXXXX1.6"; case 5: case 6: case 28: case 46: case 58: return "XXXXX2.3"; case 7: case 8: case 29: case 47: case 59: return "XXXXX3.11"; case 9: case 10: case 30: case 48: case 60: return "XXXXX4.12"; case 11: case 12: case 31: case 49: case 61: return "XXXXX5.12"; case 13: case 14: case 32: case 50: case 62: return "XXXXX6.30"; case 15: case 16: case 33: case 51: case 63: return "XXXXX7.3"; case 17: case 18: case 34: case 52: case 64: return "XXXXX8.11"; case 19: case 20: case 35: case 53: case 65: return "XXXXX9.11"; case 21: case 22: case 36: case 54: case 66:return "XXXXX10.10"; } return null; } var c= db.vcfinputs.find(); while(c.hasNext()) { var rec= c.next(); var indi= castindi(rec.sqlid); if(indi==null) continue; delete rec.individuals; rec.individualIds=[indi]; db.vcfinputs.save(rec); }