Currently, the MongoDB schema for variants is file oriented. The actual mongo document looks like this:
{
"_id" : "22_1234_A_T",
"files" : [
{"sid" : "1000g", "fid" : "f1", "samp": {"def" : "0|0", "0|1" : [254, 623] } , "attrs":{ } ... },
{"sid" : "1000g", "fid" : "f2", "samp": {"def" : "0|0", "0|1" : [54, 78 ] } , "attrs":{ } ... }
]
}
This can be a constraint when the samples of a study are provided separately, and want to query all samples from different files. Files should be merged in a single element in the array and look like this:
{
"_id" : "22_1234_A_T",
"studies" : [
{ "sid" : "1000g", "gt": {"0|1" : [54, 78, 254, 623] }, ... }
]
}
Because can happen that in different files, the default genotype is not the same, this default genotype must be the same for the whole study. This won't compromise the size of the collection, because the default value use to be the same in the 99% of the documents. The only consideration to keep in mind is to decide which is this default genotype. It depends on the polyploid of the specie and if the variants are or not in phase. The first approach will require this information from the user. In the future, this default genotype should be inferred by studying the files.
In this scenario, the "attrs" field, witch contains the vcf "info column" will disappear. This is a very unused fields, and they tend to be parsed into stats (#61) or into annot.
For times that this field need to be obtained, a Tabix access must be implemented.