Skip to content

Commit

Permalink
Merge pull request #1132 from VirtualFlyBrain/feature/1114
Browse files Browse the repository at this point in the history
Improve Layout and Links on Circuit Browser
  • Loading branch information
Robbie1977 authored Jun 21, 2021
2 parents eefb5c8 + 15f7cfc commit 4b2f1fb
Show file tree
Hide file tree
Showing 10 changed files with 233 additions and 183 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
var locationCypherQuery = ( instances, hops, weight ) => ({
var locationCypherQuery = ( instances, paths, weight ) => ({
"statements": [
{
"statement" : "WITH [" + instances + "] AS neurons"
Expand All @@ -7,20 +7,19 @@ var locationCypherQuery = ( instances, hops, weight ) => ({
+ " CALL gds.beta.shortestPath.yens.stream({"
+ " nodeQuery: 'MATCH (n:Neuron) RETURN id(n) AS id',"
+ " relationshipQuery: 'MATCH (a:Neuron:has_neuron_connectivity)-[r:synapsed_to]->(b:Neuron) WHERE exists(r.weight) AND r.weight[0] >= "
+ weight.toString() + " RETURN id(a) AS source, id(b) AS target, type(r) as type, 5000-r.weight[0] as weight_p',"
+ weight?.toString() + " RETURN id(a) AS source, id(b) AS target, type(r) as type, 5000-r.weight[0] as weight_p',"
+ " sourceNode: id(source),"
+ " targetNode: id(target),"
+ " k: " + hops.toString() + ","
+ " k: " + paths?.toString() + ","
+ " relationshipWeightProperty: 'weight_p',"
+ " relationshipTypes: ['*'],"
+ " path: true"
+ "})"
+ " YIELD index, sourceNode, targetNode, nodeIds, path"
+ " WITH * ORDER BY index DESC"
+ " OPTIONAL MATCH fp=(source)-[r:synapsed_to*..]->(target) WHERE ALL(n in nodes(fp) WHERE id(n) IN nodeIds)"
+ " UNWIND r as sr WITH *, collect(id(sr)) as ids, toString(id(sr))+':'+toString(index) as relY OPTIONAL MATCH cp=(source)-[r:synapsed_to*..]-(target)"
+ " WHERE ALL(n in nodes(cp) WHERE id(n) IN nodeIds) UNWIND ids as id"
+ " RETURN distinct a as root, collect(distinct fp) as pp, collect(distinct cp) as p, collect(distinct id) as fr, sourceNode as source, targetNode as target, max(length(fp)) as maxHops, collect(distinct relY) as relationshipY ",
+ " UNWIND relationships(path) as sr"
+ " OPTIONAL MATCH cp=(x)-[:synapsed_to]-(y) WHERE x=apoc.rel.startNode(sr) AND y=apoc.rel.endNode(sr) OPTIONAL MATCH fp=(x)-[r:synapsed_to]->(y)"
+ " RETURN distinct a as root, collect(distinct fp) as pp, collect(distinct cp) as p, collect(distinct id(r)) as fr, sourceNode as source, targetNode as target, max(length(path)) as maxHops, collect(distinct toString(id(r))+':'+toString(index)) as relationshipY ",
"resultDataContents": ["row", "graph"]
}
]
Expand All @@ -41,14 +40,16 @@ var configuration = {
"tooltip" : "label"
}
},
// Minimum amount of hops allowed
minHops : 1,
// Maximum amount of hops allowed
maxHops : 6,
// Minimum amount of paths allowed
minPaths : 1,
// Maximum amount of paths allowed
maxPaths : 6,
// Minimum amount of neurons allowed
minNeurons : 2,
// Maximum amount of neurons allowed
maxNeurons : 2
maxNeurons : 2,
// Curvature of lines, 0 is a straight line
linkCurvature : 0
}

var styling = {
Expand Down Expand Up @@ -110,7 +111,7 @@ var styling = {
}

var restPostConfig = {
url: "https://pdb.virtualflybrain.org/db/neo4j/tx/commit",
url: "https://pdb-dev.virtualflybrain.org/db/neo4j/tx/commit",
contentType: "application/json"
};

Expand Down
10 changes: 0 additions & 10 deletions components/configuration/VFBOverview/quickHelp.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,6 @@
"height": "575",
"width": "900",
"steps": [{
"title": "Welcome to Virtual Fly Brain",
"image" : "https://VirtualFlyBrain.org/data/VFB/screencaps/VFB_3D_400x400.jpg",
"instructions": [{
"icon" : "fa fa-question-circle-o",
"label" : "Hi, we are currently running a VFB User Survey, once you have used the site please consider completing this survey to help us improve it by clicking User Survey in the Help menu above."
},{
"icon" : "fa fa-fast-forward",
"label" : "Just click NEXT below for handy tips on using VFB or SKIP INTRO to close this and jump right into VFB."
}]
},{
"title": "Welcome to Virtual Fly Brain",
"image" : "geppetto/build/VFBqHelpMain.jpg",
"instructions": [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -632,14 +632,6 @@ var toolbarMenu = {
position: "bottom-start",
list: [
{
label: "User Survey",
icon: "",
trailerIcon: "fa fa-external-link",
action: {
handlerAction: "openNewTab",
parameters: ["https://www.surveymonkey.co.uk/r/5HDZZRR"]
}
},{
label: "F.A.Q.",
icon: "",
trailerIcon: "fa fa-external-link",
Expand Down
22 changes: 11 additions & 11 deletions components/interface/VFBCircuitBrowser/Controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,11 @@ const searchConfiguration = require('./../../configuration/VFBMain/searchConfigu
const datasourceConfiguration = require('./../../configuration/VFBMain/searchConfiguration').datasourceConfiguration;

/**
* Create custom marks for Hops slider.
* Only show the label for the minimum and maximum hop, hide the rest
* Create custom marks for Paths slider.
* Only show the label for the minimum and maximum paths, hide the rest
*/
const customMarks = () => {
let marks = new Array(configuration.maxHops);
let marks = new Array(configuration.maxPaths);
for ( var i = 0; i < marks.length; i++ ) {
if ( i == 0 || i == marks.length - 1 ) {
marks[i] = { value : i + 1, label : (i + 1).toString() };
Expand Down Expand Up @@ -203,7 +203,7 @@ class Controls extends Component {
key : 1
};
this.weight = this.props.weight;
this.hops = this.props.hops;
this.paths = this.props.paths;
this.addNeuron = this.addNeuron.bind(this);
this.reverseNeurons = this.reverseNeurons.bind(this);
this.neuronTextfieldModified = this.neuronTextfieldModified.bind(this);
Expand Down Expand Up @@ -330,7 +330,7 @@ class Controls extends Component {
clearTimeout(this.typingTimeout);
}
// Create a setTimeout interval, to avoid performing searches on every stroke
setTimeout(this.typingTimeout, 500, event.target);
setTimeout(this.typingTimeout, 10, event.target);
}

/**
Expand All @@ -355,10 +355,10 @@ class Controls extends Component {
}

/**
* Hops slider has been dragged, value has changed
* Paths slider has been dragged, value has changed
*/
sliderChange (event, value ) {
this.hops = value;
this.paths = value;
}

weightChange (event ) {
Expand Down Expand Up @@ -528,13 +528,13 @@ class Controls extends Component {
<Grid item sm={9}>
<Slider
aria-labelledby="discrete-slider-always"
defaultValue={this.hops}
defaultValue={this.paths}
onChangeCommitted={this.sliderChange}
step={1}
marks={customMarks()}
valueLabelDisplay="auto"
min={configuration.minHops}
max={configuration.maxHops}
min={configuration.minPaths}
max={configuration.maxPaths}
/>
</Grid>
</Grid>
Expand Down Expand Up @@ -580,7 +580,7 @@ function mapStateToProps (state) {
}

function mapDispatchToProps (dispatch) {
return { vfbCircuitBrowser: (type, path) => dispatch ( { type : type, data : { instance : path } }), }
return { vfbCircuitBrowser: (type, neurons) => dispatch ( { type : type, data : { instance : neurons } }), }
}

export default connect(mapStateToProps, mapDispatchToProps, null, { forwardRef : true } )(withStyles(styles)(Controls));
Loading

0 comments on commit 4b2f1fb

Please sign in to comment.