Skip to content

Conversation

@sundarvenkata-EBI
Copy link
Contributor

No description provided.

{
"$group": {
"_id": None,
"topChrStartPick": {"$first": "$$ROOT"}
Copy link
Contributor

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}]?

Copy link
Contributor Author

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....

Copy link
Contributor

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"
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants