phylogeography / SpreaD3

Spatial Phylogenetic Reconstruction of Evolutionary Dynamics 3
GNU Lesser General Public License v3.0
13 stars 7 forks source link

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

Open Muzaffar1234 opened 5 years ago

Muzaffar1234 commented 5 years ago

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 commented 5 years ago

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

ghost commented 5 years ago

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

GuyBaele commented 5 years ago

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 commented 5 years ago

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

ghost commented 5 years ago

@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 commented 5 years ago

@Muzaffar1234 E-mail me your data file?

ghost commented 5 years ago

@Muzaffar1234 mine is okay.

ghost commented 5 years ago

If you safari is okay, just use it.

Muzaffar1234 commented 5 years ago

@GuyBaele share your email pls

Muzaffar1234 commented 5 years ago

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

ghost commented 5 years ago

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

ghost commented 5 years ago

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

terrycojones commented 5 years ago

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 commented 5 years ago

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 commented 4 years ago

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

wangboioz commented 3 years ago

@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 commented 3 years ago

@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 commented 3 years ago

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 commented 1 year ago

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!