Skip to content
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

Unable to open data file in firefox, chrome, and internet browser #32

Open
Muzaffar1234 opened this issue Aug 6, 2019 · 19 comments
Open

Comments

@Muzaffar1234
Copy link

Muzaffar1234 commented Aug 6, 2019

Data file created using the SPREAD software can not be opened in any firefox, chrome, and internet browser in window 10 system.
The opening file is blank.
Same file is fine when opened in safari (mac browser).

@GuyBaele
Copy link
Member

GuyBaele commented Aug 6, 2019

Firefox should be fine, except for the most recent version. Up to version 67 should work without problems.

@ghost
Copy link

ghost commented Aug 6, 2019

@GuyBaele , is there any better methods for showing the results for phylogeographic analysis using beast?

@GuyBaele
Copy link
Member

GuyBaele commented Aug 6, 2019

We mainly use SpreaD3 at the moment; other approaches may require more custom scripting/programming, but hopefully there will be more options (like Nextstrain) in the future. We have discussed many different visualisation options in a very recent review: https://www.frontiersin.org/articles/10.3389/fpubh.2019.00208/full

@Muzaffar1234
Copy link
Author

@GuyBaele I tried Firefox 58.0.2 version but still the same problem.

@ghost
Copy link

ghost commented Aug 6, 2019

@GuyBaele, thank you, Spread3 using the map in D2 format, which is not good as google earth (my personal opinion), Nextstrain is difficult for coding, and hope we can see more powerful software to visualisation.

@GuyBaele
Copy link
Member

GuyBaele commented Aug 6, 2019

@Muzaffar1234 E-mail me your data file?

@ghost
Copy link

ghost commented Aug 6, 2019

@Muzaffar1234 mine is okay.

@ghost
Copy link

ghost commented Aug 6, 2019

If you safari is okay, just use it.

@Muzaffar1234
Copy link
Author

@GuyBaele share your email pls

@Muzaffar1234
Copy link
Author

@LIXINGGUANG i dont have safari, My friend checked this on Safari, it was working fine

@ghost
Copy link

ghost commented Aug 6, 2019

@GuyBaele very interesting paper, is there more deep materials for phylogeography analysis, thanks.

@ghost
Copy link

ghost commented Aug 6, 2019

@Muzaffar1234, I suggest you use Mac for phylogeograpyic analysis, many softwares and webs are very nice for Mac.

@terrycojones
Copy link

I just ran into this. In case people don't know, this is due to a CORS violation causing the browser to refuse to load the data.json file because it is not requested via http. The firefox console shows the error
Screenshot from 2019-10-10 18-00-50

An easy fix for this would be to just print the static data into the main.js file instead of having it as a separate file. That's a small pain for the developers but would instantly fix the problem. You could just use m4 to do the include or put a JavaScript marker comment into main.js that gets replaced/expanded with the JSON data on export from the GUI.

@terrycojones
Copy link

I just wrote this quick and (very!) dirty shell script to work around the problem. Please see the notes below before you use it.

#!/bin/bash

set -Eeuo pipefail

(
    head -n 149 < main.js
    echo -n 'json = '
    cat data.json
    echo ';'
    tail -n +156 main.js | awk 'NR != 107'
) > main-new.js

sed -e 's/main\.js/main-new.js/' < index.html > index-new.html

You'll need to save it to a file (call it convert-spread3.sh) and then make it executable.

It will produce two new files, index-new.html and main-new.js. Open the former with your browser.

NOTE: this is extremely brittle. If the spread3 developers change what they write into main.js (which they certainly will do!), this code will cease to produce output that works. I've just written it so a colleague can work with spread3 and post it here in case it helps you. It also illustrates how the overall problem could be fixed, along the lines that I posted above.

If you don't see a map loaded in your browser, open the console and have a look for JavaScript errors. Then post them here & maybe I'll be able to help.

The person I wrote this for tells me he is using version 0.9.7.1 of spread3. The above script is, I expect, highly unlikely to work on any other version.

@terrycojones
Copy link

I put the above converter hack into a repo with a README, etc. https://github.com/VirologyCharite/convert-spread3

@wangboioz
Copy link

@terrycojones Thanks for your useful code, which help me to reconstruct the example figure, but, my data can't be converted well like the next figure, could you help me, thank you so much!
image

@wangboioz
Copy link

@GuyBaele After I generate the index file (and convert it to index.new with the provided script), the lines representing the migration path are "fixed". What I mean is that they are present from time 0 to the end of the considered time period.
additionally, the "lines layer" is not present in the toggle layer visibility menu.
Thank you for any help you could provide me

@babarlelephant
Copy link

babarlelephant commented Sep 20, 2021

Hi, otherwise, copy the the data.json into the src/renderer/D3 folder, then run python3 -m http.server from the command line into that folder,
and load localhost:8000 into your browser.

A few years ago chrome had a --disable-web-security option for disabling CORS restriction, but it doesn't work anymore.

@MordorianGuy
Copy link

Hi, otherwise, copy the the data.json into the src/renderer/D3 folder, then run python3 -m http.server from the command line into that folder, and load localhost:8000 into your browser.

A few years ago chrome had a --disable-web-security option for disabling CORS restriction, but it doesn't work anymore.

I used the "simple-server" utility to look at SpreaD3 results but your solution allows to use only built-in tools, thanks!

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

No branches or pull requests

6 participants