ReinV / SCOPE

Search and Chemical Ontology Plotting Environment
Other
1 stars 2 forks source link

visualize_multiplot.py generates identical plots for different queries #17

Closed magnuspalmblad closed 4 years ago

magnuspalmblad commented 4 years ago

In my browser, all queries look identical in the plot. They all look like the first query. I have tried this with a new output name, 2 and 3 queries, and both visualize_multiplot.py scripts (there is still one in 'other_visualization_scripts', but this crashes).

The tables are different and correct. If I remove the first query table, the script correctly visualizes the distribution in the second.

Can you replicate this behavior?

ReinV commented 4 years ago

No I can't replicate this behavior. I used this script to make a plot of all neoplasm queries and I can switch between all the different plots.

Could you open console in browser (ctrl+shift+i for me in chrome) and check what is printed when switching between the queries? It should print different dataframes (arrays) for the queries.

magnuspalmblad commented 4 years ago

Yes, there seems to be an "Uncaught ReferenceError: key is not defined" error reported there:

eval @ VM319:27
execute @ bokeh-2.0.2.min.js:351
(anonymous) @ bokeh-2.0.2.min.js:237
emit @ bokeh-2.0.2.min.js:176
emit @ bokeh-2.0.2.min.js:176
_setv @ bokeh-2.0.2.min.js:175
setv @ bokeh-2.0.2.min.js:175
set @ bokeh-2.0.2.min.js:175
change_input @ bokeh-widgets-2.0.2.min.js:90
(anonymous) @ bokeh-widgets-2.0.2.min.js:90
VM320:24 {0.0: Array(3574), 0.0_tfidf: Array(3574), 0.25: Float64Array(3574), 0.25_tfidf: Float64Array(3574), 0.5: Float64Array(3574), …}
VM320:27 Uncaught ReferenceError: key is not defined
    at d.eval (eval at get func (bokeh-2.0.2.min.js:351), <anonymous>:27:18)
    at i.execute (bokeh-2.0.2.min.js:351)
    at d.<anonymous> (bokeh-2.0.2.min.js:237)
    at c.emit (bokeh-2.0.2.min.js:176)
    at c.emit (bokeh-2.0.2.min.js:176)
    at d._setv (bokeh-2.0.2.min.js:175)
    at d.setv (bokeh-2.0.2.min.js:175)
    at d.set [as value] (bokeh-2.0.2.min.js:175)
    at a.change_input (bokeh-widgets-2.0.2.min.js:90)
    at HTMLSelectElement.<anonymous> (bokeh-widgets-2.0.2.min.js:90)
eval @ VM320:27
execute @ bokeh-2.0.2.min.js:351
(anonymous) @ bokeh-2.0.2.min.js:237
emit @ bokeh-2.0.2.min.js:176
emit @ bokeh-2.0.2.min.js:176
_setv @ bokeh-2.0.2.min.js:175
setv @ bokeh-2.0.2.min.js:175
set @ bokeh-2.0.2.min.js:175
change_input @ bokeh-widgets-2.0.2.min.js:90
(anonymous) @ bokeh-widgets-2.0.2.min.js:90
VM321:24 {0.0: Array(7018), 0.0_tfidf: Array(7018), 0.25: Float64Array(7018), 0.25_tfidf: Float64Array(7018), 0.5: Float64Array(7018), …}
VM321:27 Uncaught ReferenceError: key is not defined
    at d.eval (eval at get func (bokeh-2.0.2.min.js:351), <anonymous>:27:18)
    at i.execute (bokeh-2.0.2.min.js:351)
    at d.<anonymous> (bokeh-2.0.2.min.js:237)
    at c.emit (bokeh-2.0.2.min.js:176)
    at c.emit (bokeh-2.0.2.min.js:176)
    at d._setv (bokeh-2.0.2.min.js:175)
    at d.setv (bokeh-2.0.2.min.js:175)
    at d.set [as value] (bokeh-2.0.2.min.js:175)
    at a.change_input (bokeh-widgets-2.0.2.min.js:90)
    at HTMLSelectElement.<anonymous> (bokeh-widgets-2.0.2.min.js:90)
eval @ VM321:27
execute @ bokeh-2.0.2.min.js:351
(anonymous) @ bokeh-2.0.2.min.js:237
emit @ bokeh-2.0.2.min.js:176
emit @ bokeh-2.0.2.min.js:176
_setv @ bokeh-2.0.2.min.js:175
setv @ bokeh-2.0.2.min.js:175
set @ bokeh-2.0.2.min.js:175
change_input @ bokeh-widgets-2.0.2.min.js:90
(anonymous) @ bokeh-widgets-2.0.2.min.js:90
magnuspalmblad commented 4 years ago

(The above is the error twice, I captured the errors when clicking on one query and then on another.)

ReinV commented 4 years ago

Just to be sure, VM321:27 you can click on here, you should see some javascript code appear, is this the line "for (key in new_data)" ?

ReinV commented 4 years ago

Does the same problem occur in a different browser?

magnuspalmblad commented 4 years ago

Yes, this is line 27:

26          // replace current data
**27          for (key in new_data) {**
28                source_data[key] = [];
29                for (i=0;i<new_data[key].length;i++) {
30                    source_data[key].push(new_data[key][i]);
magnuspalmblad commented 4 years ago

Edge exhibits the same behavior, but gives a different error message:

[object Object]: {0.0: Array, 0.0_tfidf: Array, 0.25: Array, 0.25_tfidf: Array, 0.5: Array...}

0: Variable undefined in strict mode
bokeh-2.0.2.min.js (175,643)
magnuspalmblad commented 4 years ago

IE does not show anything (white page).

ReinV commented 4 years ago

Could you go to the visualize_multiplot.py script, and replace line 356 - 362:

            // replace current data
            for (key in new_data) {
                source_data[key] = [];
                for (i=0;i<new_data[key].length;i++) {
                    source_data[key].push(new_data[key][i]);
                }
            }

with:

           // replace current data 
            for (column in new_data) {  
                source_data[column] = []; 
                for (i=0;i<new_data[column].length;i++) {
                    source_data[column].push(new_data[column][i]);
                }
            }

And check again please? (sorry for these edits, I'm messing up github code posting )

magnuspalmblad commented 4 years ago

It still does not work. Here is the new error message, complaining 'column' is now undefined:

VM56:24 {0.0: Array(3574), 0.0_tfidf: Array(3574), 0.25: Float64Array(3574), 0.25_tfidf: Float64Array(3574), 0.5: Float64Array(3574), …}
VM56:27 Uncaught ReferenceError: column is not defined
    at d.eval (eval at get func (bokeh-2.0.2.min.js:351), <anonymous>:27:18)
    at i.execute (bokeh-2.0.2.min.js:351)
    at d.<anonymous> (bokeh-2.0.2.min.js:237)
    at c.emit (bokeh-2.0.2.min.js:176)
    at c.emit (bokeh-2.0.2.min.js:176)
    at d._setv (bokeh-2.0.2.min.js:175)
    at d.setv (bokeh-2.0.2.min.js:175)
    at d.set [as value] (bokeh-2.0.2.min.js:175)
    at a.change_input (bokeh-widgets-2.0.2.min.js:90)
    at HTMLSelectElement.<anonymous> (bokeh-widgets-2.0.2.min.js:90)
eval @ VM56:27
execute @ bokeh-2.0.2.min.js:351
(anonymous) @ bokeh-2.0.2.min.js:237
emit @ bokeh-2.0.2.min.js:176
emit @ bokeh-2.0.2.min.js:176
_setv @ bokeh-2.0.2.min.js:175
setv @ bokeh-2.0.2.min.js:175
set @ bokeh-2.0.2.min.js:175
change_input @ bokeh-widgets-2.0.2.min.js:90
(anonymous) @ bokeh-widgets-2.0.2.min.js:90
ReinV commented 4 years ago

What about:

           // replace current data 
            for (var column in new_data) {  
magnuspalmblad commented 4 years ago

Yes, this works!!!

ReinV commented 4 years ago

For some reason the previous notation (not declaring var ...) is allowed on my pc but not on your pc (maybe it has something to do with "strict mode"?). Anyways, I will change it on our github as well.