-
Notifications
You must be signed in to change notification settings - Fork 67
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
Easier Way to Use Custom LD? #204
Comments
Thanks for your question.
First, the fancy answer to your question: if you're comfortable running the infrastructure, then the code to calculate custom LD is open source and you can run a compatible API locally:
https://github.com/statgen/LDServer/ <https://github.com/statgen/LDServer/>
And you can experiment with API query syntax for that LD server here: https://portaldev.sph.umich.edu/playground <https://portaldev.sph.umich.edu/playground>
If you only want to use precalculated LD from a file: it is possible to load from pre-calculated LD, but it's kind of unwieldy. The main issue is that pre-calculated LD files can be extremely large to store and query; you can try to reduce the size by only including LD relative to a preset list of lead variants.... but for phewas-scale data, you might have a lot of lead variants (=bigger files).
The newest version of Locuszoom.js includes some features designed to help read such LD files (it's what we use for LocalZoom & my.locuszoom.org <http://my.locuszoom.org/>). But PheWeb uses an older version of Locuszoom (see a rough draft of what PheWeb code would need to change <#185> to work with LocusZoom.js 0.14.0, which added the "use LD from local file" helper code). There's no strong technical reason why PheWeb isn't updated for LZ.js 14, except that the original developer of PheWeb moved on and the task got lost in the shuffle.
Some LZ.js demos show how you would modify the plot creation code to specify LD from a local file. We use tabix to make the queries (slightly) more manageable, but custom LD can still be a very big file. PLINK can be kind of slow calculating that much LD the first time, but the demo shows expected file format so you can substitute other tools of your choosing.
https://statgen.github.io/locuszoom/examples/ext/tabix_tracks.html <https://statgen.github.io/locuszoom/examples/ext/tabix_tracks.html>
https://github.com/statgen/locuszoom/blob/develop/examples/ext/tabix_tracks.html#L203-L207 <https://github.com/statgen/locuszoom/blob/develop/examples/ext/tabix_tracks.html#L203-L207>
Anyway, I hope this helps! We always wanted to have more LD options, but in a reusable internet tool, there aren't a lot of good LD panels that people are allowed to share publicly. Every now and then I ask, in hopes that something has changed. :)
…-Andy Boughton
***@***.***
Applications Programmer/Analyst, Lead
Center for Statistical Genetics
University of Michigan
On Jan 2, 2023, at 5:15 AM, ttbek ***@***.***> wrote:
If I'm reading the code correctly, in order to use my own LD I would need to actually change the source passed to locuszoom.js, find the calls used while populating in locuszoom.js, and then set up our own restful API server to give the json response?
Does the following match the call format used in locuszoom.js? That is, does it use the region call like that?
https://portaldev.sph.umich.edu/ld/genome_builds/GRCh37/references/1000G/populations/AFR/regions?correlation=r&chrom=X&start=67544032&stop=67544350 <https://portaldev.sph.umich.edu/ld/genome_builds/GRCh37/references/1000G/populations/AFR/regions?correlation=r&chrom=X&start=67544032&stop=67544350>
Is there an easier way to load from a local precalculated LD file?
Maybe customize the locuszoom.js (means loading the changed version from our server instead of the currently set source) by changing their populate function?
I'm a bit unsure what the best approach would be here. Preferably we would also still be able to load the 1000 genomes LD values but we want to also display some custom ones.
—
Reply to this email directly, view it on GitHub <#204>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAWR6EITXS36NOXSXPOLRYTWQKTEXANCNFSM6AAAAAATOV6XMA>.
You are receiving this because you are subscribed to this thread.
|
Sorry for taking so long to get back to this. I'm attempting to setup the server and I'm getting some output from the Raremetal one, but the ld server is just giving: "The connection was reset" Output is looking like this:
So the only think coming from the LD container is that it is running the startup commands. I'm not seeing anything problematic in the gunicorn or Redis logs (I think at least). Do we expect the startup commands to take a long time? That is, am I just being too impatient and I'll probably get different output when it is ready, or is there probably a problem? |
Is gunicorn supposed to be running on 8000? The .env I have says 4546 and docker is mapping 4546, but the gunicorn log has this:
My .env file:
|
Ah... the example docker override file wasn't putting the port even though they showed modifying the command, so changing from this:
to this:
Allows me to reach the endpoints http://localhost:8084/correlations (8084 is the locally mapped ssh forwarded port, it is localhost:4546 on the server side) and http://localhost:8084/genome_builds with the expected results. However, something like http://localhost:8084/genome_builds/GRCh37/references/1000G/populations/AFR/regions?correlation=r&chrom=20&start=60343&stop=65000 gives me "Internal Server Error" and looking in the gunicorn log on the server shows:
The Redis log shows:
I did take a shot at fixing that warning earlier and currently if I:
Well, it looks fixed there. Maybe this parameter needs to be done inside the container? I thought it was a kernel parameter and would be outside though. It was originally 128 as the message suggests, but it has been changed to 512 and Redis has been restarted several times since then. I don't think that would be the issue, but it's all the Redis log is complaining about. |
Turns out the container may be more restricted than the kernel value, but it can be set in the dockerfile, so I added: sysctls: net.core.somaxconn: 512 To the section for the alpine Redis image. It fixes that last warning in the Redis log... but no dice on the error in the gunicorn log, still get it. |
Ah, ok, ok,
For some reason I read this as changing the left side, to redis, that is the text 'CACHE_REDIS_HOSTNAME' to the text 'redis'. I know, makes no sense. Fixed now. So I guess the next step is that I need to move my Pheweb over to the production server and... point it to this new LD server somehow. Regarding available LD Panels, true indeed. Unfortunately we aren't putting out a new data set with this. The population in our Pheweb is Arab and not well represented in 1KG, so even though it is small we wanted to also show the LD from the 108 Qatari genomes published here: https://genome.cshlp.org/content/26/2/151.full.html They're publicly available on the Sequence Read Archive, just need to use the toolkit to download them due to the size. |
If I'm reading the code correctly, in order to use my own LD I would need to actually change the source passed to locuszoom.js, find the calls used while populating in locuszoom.js, and then set up our own restful API server to give the json response?
Does the following match the call format used in locuszoom.js? That is, does it use the region call like that?
https://portaldev.sph.umich.edu/ld/genome_builds/GRCh37/references/1000G/populations/AFR/regions?correlation=r&chrom=X&start=67544032&stop=67544350
Is there an easier way to load from a local precalculated LD file?
Maybe customize the locuszoom.js (means loading the changed version from our server instead of the currently set source) by changing their populate function?
I'm a bit unsure what the best approach would be here. Preferably we would also still be able to load the 1000 genomes LD values but we want to also display some custom ones.
The text was updated successfully, but these errors were encountered: