Locuszoom.js: "Failed to Fetch"

87 views
Skip to first unread message

kyle campbell

unread,
Jun 11, 2021, 4:14:03 PM6/11/21
to locuszoom
Hey there. I'm using Locuszoom.js to create a custom plot, but one of my data sources includes a static association file hosted on local. Here's how I'm specifying my data sources:

      var apiBase = "https://portaldev.sph.umich.edu/api/v1/";
      var assocFile = "http://localhost:8000/csvjson.json";
      data_sources = new LocusZoom.DataSources()
          .add("assoc", ["AssociationLZ", {url: assocFile, params: {analysis: true, id_field: "variant"}}])
          .add("credset", ["CredibleSetLZ", { params: { fields: { log_pvalue: 'assoc:log_pvalue' }, threshold: 0.95, significance_threshold: 7.301 } }])
          .add("ld", ["LDServer", { url: "https://portaldev.sph.umich.edu/ld/", params: { source: '1000G', build: 'GRCh37', population: 'ALL' } }])
          .add("gene", ["GeneLZ", {url: apiBase + "annotation/genes/", params: { build: 'GRCh37' }}])
          .add("recomb", ["RecombLZ", {url: apiBase + "annotation/recomb/results/", params: { build: 'GRCh37' }}])
          .add("constraint", ["GeneConstraintLZ", { url: "https://gnomad.broadinstitute.org/api/", params: { build: 'GRCh37' } }]);

and an excerpt of the assocFile format is given below:

{
"data: [
  {
    "chromosome": 4,
    "position": 173008175,
    "log_pvalue": 0.187638213,
    "variant": "4:173008175_C\\/G",
    "ref_allele": "C",
    "Alt": "G",
    "rsID": "rs115276194",
    "beta": 1.03918,
    "se": 0.0844913,
    "analysis": null
  },
.
.
.
]
}

The full code is given at the following Pastebin. It's just a modified version of the credible_sets.html from the LocusZoom GitHub repo (https://github.com/statgen/locuszoom/blob/develop/examples/credible_sets.html):

This yields the error "Failed to fetch" where the regional association plot should show up.
How can I avoid this error?

Thank you for your time!
Kyle Campbell

Andy Boughton

unread,
Jun 11, 2021, 5:44:00 PM6/11/21
to locu...@googlegroups.com
Thanks for the question. There are a few possible reasons this could occur: the first place I would start is by asking if there are messages on the JavaScript console in your browser that explain which request failed to fetch, or why.

For example, if you're very new to JS, a common gotcha is to load the HTML file from your hard drive (rather than with a dev server), in which case you could run into security issues that prevent loading your csvjson.json file. (this is a security feature and not something we can override for you. But since your URL contains "localhost", that's probably not the problem for your case)

Another option: I notice that your data format has a slightly unusual variant specifier format; in theory the error could be fetching the LD instead of the association file. The console can clear up where to start looking.
4:173008175_C\\/G


I'm not sure how ambitious your efforts are. But if your goal is to create fast plots for one specific study, you might also find our my.locuszoom.org service helpful (generates private plots from an uploaded summary stats file without writing code). (if you want to keep files off a remote server, LocalZoom does the same for local tabixed files, without you needing to transform summary stats into a hard-coded JSON file first).

-Andy Boughton
abo...@umich.edu

Senior Applications Programmer/Analyst
Center for Statistical Genetics
University of Michigan

--
You received this message because you are subscribed to the Google Groups "locuszoom" group.
To unsubscribe from this group and stop receiving emails from it, send an email to locuszoom+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/locuszoom/576f3012-fb9d-42ec-9d14-8cf11b7aa31cn%40googlegroups.com.

kyle campbell

unread,
Jun 11, 2021, 6:12:45 PM6/11/21
to locuszoom
Aha, it was two things. There was an extra backslash in the variant specifier due to a typo I had, and I was running the file directly from my hard drive rather than the dev server (I am new to JS, oops!).

Works great now, thank you!

Kyle Campbell

Computational Biologist
Center for Heart Lung Innovation
University of British Columbia

Tim Bigdeli

unread,
Aug 28, 2023, 1:00:53 PM8/28/23
to locuszoom
Hi - is there any explanation for this behavior when using LocalZoom and files that previously worked with no issue? Any recent updates/changes? Thanks. t

Andy Boughton

unread,
Aug 28, 2023, 1:43:45 PM8/28/23
to locu...@googlegroups.com
Thanks for the inquiry.

Two thoughts, speaking as the author of LocalZoom:

  1. There have been no updates recently AFAIK. I moved on from the team about a year ago, and I'm not aware of anyone else shipping new versions.
  2. Our demonstrations use live data from the UM web server (genes, LD, recombination...). UM is currently seeing a major internet service outage, which might make datasets temporarily fail to render today even if they worked last week. (necessary parts of the plot are unavailable) ITS has no current estimate of when service will be restored.

If what you're seeing is a problem with similar files, but not the same one: it really depends on the data! GWAS data is wildly un-standardized, and even though I made an effort to support common GWAS programs, it's totally possible that existing tools changed since we wrote the original parser. (eg a software update makes a new file format that isn't handled perfectly) 

When I worked on LocalZoom, we really relied on user feedback to help identify problems and make the most generic tool possible!

-Andy Boughton
abo...@umich.edu

Applications Programmer/Analyst, Lead

Center for Statistical Genetics
University of Michigan

Tim Bigdeli

unread,
Aug 28, 2023, 2:07:54 PM8/28/23
to locuszoom
Thanks, Andy!

I really appreciate your immediate and informative reply!
  1. UM is currently seeing a major internet service outage, which might make datasets temporarily fail to render today even if they worked last week. (necessary parts of the plot are unavailable) ITS has no current estimate of when service will be restored.
This seems like the most likely cause, as I've recently been identical  files without issues.

I will try to exercise some patience, and perhaps take up a new hobby, while waiting for these unfortunate circumstances to pass.

Fingers crossed... t

Junhao Wen

unread,
Aug 30, 2023, 8:24:01 AM8/30/23
to locuszoom
Hi team, 

The same problem happened here. I am using LocalZoom with the data that worked one month ago, but now it gave me error "Failed to fetch". 

Hope the internet service outage will be solved soon.

Thanks for this wonderful tool

Best

Andy Boughton

unread,
Aug 30, 2023, 11:33:08 AM8/30/23
to locu...@googlegroups.com
Greetings all. We have received notice that our servers and sites are restored. Apologies for the interruption: this incident was unplanned and happened at a level outside our control. 

As far as we are currently aware, the outage affected internet connectivity at the entire university, but not the specific data or functionality of the underlying servers. Please let us know if you see any issues.

This alert should cover my.LocusZoom.org, LocalZoom, and any custom usages of LocusZoom.js that use our underlying portaldev.sph.umich.edu API services.

-Andy Boughton
abo...@umich.edu

Applications Programmer/Analyst, Lead
Center for Statistical Genetics
University of Michigan
Reply all
Reply to author
Forward
0 new messages