-
Notifications
You must be signed in to change notification settings - Fork 24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
EVA-1063 - Populate a default locus range (for use in Variant Browser) for a given species #155
base: master
Are you sure you want to change the base?
EVA-1063 - Populate a default locus range (for use in Variant Browser) for a given species #155
Conversation
{ | ||
"$group": { | ||
"_id": None, | ||
"topChrStartPick": {"$first": "$$ROOT"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are the 2 last stages making something different than ..., {"$sort": {"num_entries": -1}}, {"$limit:1}]
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not sure if $limit guarantees ordering or it retrieves just one entry at random so I opted for $first. But looks like limit() does honor the order. so I will change this....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep, also a great optimization will be done:
When a $sort precedes a $limit and there are no intervening stages that modify the number of documents, the optimizer can coalesce the $limit into the $sort. This allows the $sort operation to only maintain the top n results as it progresses, where n is the specified limit, and ensures that MongoDB only needs to store n items in memory. This optimization still applies when allowDiskUse is true and the n items exceed the aggregation memory limit.
from pymongo import MongoClient | ||
from __init__ import * | ||
|
||
DEFAULT_LOCUS_RANGE_COLLECTION_NAME = "defaultLocusRange" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good idea. I assume you plan to make this available through some new webservice to un-hardcode it from the website?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. I intend to add a separate end point /default-locus-range similar to /annotation for a given species.
import configparser | ||
import urllib.parse | ||
|
||
from pymongo import MongoClient |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a requirements.txt and readme for installing the dependencies?
No description provided.