vitalit-sib / msviz-backend

A mass spectrometry visualization platform, developed by the PAF & Vital-IT, Swiss Institute of Bioinformatics.
Other
8 stars 5 forks source link

mongodb query to retrieve the list of protein in a searchId #17

Closed alexmasselot closed 9 years ago

alexmasselot commented 9 years ago

aggregate. the exact syntaxt will change soon

alexmasselot commented 9 years ago

there are a lot of thing not available yet, so the query is approximative. No searchId and no sequenceSource at the protinInfo level

But the idea is a pipeline like: db.psm.aggregate([ {$match:{spSource:'20141212_Fusco_7188B'}}, //that should be searchId {$project:{'proteinList.AC':1, spSource:1, _id:0}}, //that should have proteinRef {$unwind:'$proteinList'}, {$group:{_id:'$spSource', accessionCodes:{$addToSet: "$proteinList.AC"}}} ])

rmylonas commented 9 years ago

The adapted mongo command is:

db.psm.aggregate([
{$match:{searchId:'M_100'}}, 
{$project:{'proteinList.proteinRef.AC':1, searchId:1, _id:0}}, 
{$unwind:'$proteinList'},
{$group:{_id:'$searchId', accessionCodes:{$addToSet: "$proteinList.proteinRef.AC"}}}
])