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

report sequence database stats #16

Closed alexmasselot closed 9 years ago

alexmasselot commented 9 years ago

sequence source, number of entries if possible fast, number of residues

alexmasselot commented 9 years ago

for the sequence count db.sequences.aggregate([{$group:{_id:"$source", nbEntries:{$sum : 1}}}])

alexmasselot commented 9 years ago

db.sequences.group({key:{source:1}, initial:{nbEntries:0, nbResidues:0}, reduce:function(cur, result){result.nbEntries++; result.nbResidues+= cur.sequence.length}})

trinidadmartin commented 9 years ago

I tested into mongo and I got this:

[ { "source" : null, "nbEntries" : 2, "nbResidues" : 694 } ]

So, without the source we obtain same results:

[ { "nbEntries" : 2, "nbResidues" : 694 } ]

Could we just remove the source???

And for the reduce:function...do you have an example about how to translate into BSONDocument??

alexmasselot commented 9 years ago

http://localhost:9000/sequence/stats