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

Latest version from development for review #1334

Merged
merged 35 commits into from
May 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
6b82ef1
Merge pull request #1136 from VirtualFlyBrain/feature/1114
Robbie1977 May 28, 2021
62e66af
reverting to paths
Robbie1977 May 28, 2021
f8b2df1
Merge branch 'pipeline2' into pipeline2-sync-1e8d
Robbie1977 Jun 22, 2021
1967e39
Merge pull request #1149 from VirtualFlyBrain/pipeline2-sync-1e8d
Robbie1977 Jun 22, 2021
0d42f48
Merge pull request #1156 from VirtualFlyBrain/pipeline2-sync-5c32
Robbie1977 Jul 6, 2021
6413e11
Merge pull request #1189 from VirtualFlyBrain/pipeline2-sync-da98
Robbie1977 Oct 14, 2021
4eaedeb
Merge pull request #1201 from VirtualFlyBrain/pipeline2-sync-6c33
Robbie1977 Oct 14, 2021
f6d21be
Merge pull request #1246 from VirtualFlyBrain/pipeline2-sync-244a
Robbie1977 Nov 8, 2021
89bc79f
Merge pull request #1256 from VirtualFlyBrain/pipeline2-sync-6ec1
Robbie1977 Nov 22, 2021
54b20b6
Merge pull request #1272 from VirtualFlyBrain/development
Robbie1977 Jan 10, 2022
6b66eab
updates for new menu layout
Robbie1977 Mar 11, 2022
0b0d749
Merge pull request #1297 from VirtualFlyBrain/feature/1295
ddelpiano Mar 14, 2022
399c0f5
Merge pull request #1317 from VirtualFlyBrain/development-sync-0806
Robbie1977 Mar 14, 2022
9cfc9d1
Merge pull request #1321 from VirtualFlyBrain/pipeline2-sync-0806
Robbie1977 Mar 14, 2022
85d9dbc
adding manual run
Robbie1977 Mar 22, 2022
d6ecc95
#1322 Label and id in squared brackets in the node float over/tooltip
jrmartin Mar 25, 2022
aa08f1a
defaulting to symbol vs label if available
Robbie1977 Mar 28, 2022
f9d6ce8
updating cluster report to latest Individual + related_individuals fr…
Robbie1977 Mar 31, 2022
747bd08
update from https://github.com/VirtualFlyBrain/VFB_json_schema/runs/5…
Robbie1977 Mar 31, 2022
3398265
naming pub query for comparison
Robbie1977 Apr 1, 2022
e58b325
updating xmi from https://github.com/VirtualFlyBrain/VFB_json_schema/…
Robbie1977 Apr 1, 2022
f2cdd8d
removing any channels
Robbie1977 Apr 1, 2022
7ecdadd
Revert "updating xmi from https://github.com/VirtualFlyBrain/VFB_json…
Robbie1977 Apr 1, 2022
8762085
updating pub query with name
Robbie1977 Apr 1, 2022
99c68ea
update to match https://github.com/VirtualFlyBrain/VFB_json_schema/ru…
Robbie1977 Apr 1, 2022
55f253e
Merge pull request #1324 from VirtualFlyBrain/pipeline2
Robbie1977 Apr 4, 2022
ba81f80
Merge pull request #1323 from VirtualFlyBrain/feature/1322
ddelpiano Apr 4, 2022
f48c430
#1326 - Text increase for circuit browser
jrmartin Apr 7, 2022
6869b81
#1326 Fix font sizes in circuit browser nodes
jrmartin Apr 8, 2022
c3b945a
#1326 Leave font size of nodes to be 8px by default
jrmartin Apr 8, 2022
fe539aa
#1326 Minor fix for text
jrmartin Apr 8, 2022
d99cf1b
latest queries from https://github.com/VirtualFlyBrain/VFB_json_schem…
Robbie1977 Apr 9, 2022
337c974
Merge pull request #1328 from VirtualFlyBrain/pipeline2
Robbie1977 Apr 9, 2022
d7d464f
#1326 - Circuit browser text, break lines by space. Add space before
jrmartin Apr 22, 2022
a5c0594
Merge pull request #1327 from VirtualFlyBrain/feature/1326
ddelpiano Apr 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ on:
push:
branches: '**'
tags: 'v*'
workflow_run:
workflows: [Build]
types: [completed]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var locationCypherQuery = ( instances, paths, weight ) => ({
+ " WITH * ORDER BY index DESC"
+ " UNWIND relationships(path) as sr"
+ " OPTIONAL MATCH cp=(x:Neuron:has_neuron_connectivity)-[:synapsed_to]-(y:Neuron:has_neuron_connectivity) WHERE x=apoc.rel.startNode(sr) AND y=apoc.rel.endNode(sr) OPTIONAL MATCH fp=(x)-[r:synapsed_to]->(y) WHERE r.weight[0] >= " + weight?.toString()
+ " OPTIONAL MATCH (x)-[xio:INSTANCEOF]->(xpc:Class) OPTIONAL MATCH (y)-[yio:INSTANCEOF]->(ypc:Class) WITH *,'\"'+ x.short_form+'\":{\"'+xpc.short_form+'\":\"' + xpc.label + '\"},\"'+ y.short_form+'\":{\"'+ypc.short_form+'\":\"' + ypc.label + '\"}' as Class"
+ " OPTIONAL MATCH (x)-[xio:INSTANCEOF]->(xpc:Class) OPTIONAL MATCH (y)-[yio:INSTANCEOF]->(ypc:Class) WITH *,'\"'+ x.short_form+'\":{\"'+xpc.short_form+'\":\"' + coalesce(xpc.symbol[0], xpc.label) + '\"},\"'+ y.short_form+'\":{\"'+ypc.short_form+'\":\"' + coalesce(ypc.symbol[0], ypc.label) + '\"}' as Class"
+ " 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, "
+ " apoc.convert.fromJsonMap('{' + apoc.text.join(collect(Class),',') + '}') as class ",
"resultDataContents": ["row", "graph"]
Expand Down Expand Up @@ -71,8 +71,19 @@ var styling = {
defaultLinkHoverColor : "#11bffe",
// Color apply to target and source nodes when hovering over a link or a node.
defaultNeighborNodesHoverColor : "orange",
// Font used for text in nodes
defaultNodeFont : "8px sans-serif",
defaultNodeFont : "sans-serif",
// Font size in pixels used for text in nodes
nodeTitleFontSize : 8,
// Percentage of node for title area to take in node, as decimal. Default 45%
nodeTitleHeight : .45,
// Pixel font size for description text of node
nodeDescriptionFontSize : 8,
// percentage of node description area to take in node, as decimal. Default 45%
nodeDescriptionHeight : .45,
// percentage of node color bar area to take in node, as decimal. Default 10%
nodeColorAreaHeight : .1,
// Max amount of lines to display for title and description
linesText : 3,
// Color of font in node's text
defaultNodeFontColor : "black",
// Node border color
Expand Down
2 changes: 1 addition & 1 deletion components/configuration/VFBMain/searchConfiguration.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ var datasourceConfiguration = {
"start": "0",
"pf":"true",
"fq": [
"short_form:VFB* OR short_form:FB* OR facets_annotation:DataSet OR facets_annotation:pub"
"(short_form:VFB* OR short_form:FB* OR facets_annotation:DataSet OR facets_annotation:pub) AND NOT short_form:VFBc_*"
],
"rows": "100",
"wt": "json",
Expand Down
111 changes: 69 additions & 42 deletions components/interface/VFBCircuitBrowser/VFBCircuitBrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,8 +268,6 @@ class VFBCircuitBrowser extends Component {
let width = context.measureText(text).width;
while (width > maxWidth) {
baseSize--;
context.font = `${baseSize}px sans-serif`
width = context.measureText(text).width;
}

return baseSize;
Expand All @@ -278,31 +276,47 @@ class VFBCircuitBrowser extends Component {
/**
* Breaks Description texts into lines to fit within a certain width value.
*/
wrapText (context, text, x, y, maxWidth, maxHeight) {
let words = text.split(' ');
let lines = [];
let line = '';

let maxTextLength = text.length < 20 ? text.length / 2 : text.length / 3;

words.forEach( word => {
let testLine = line + word + ' ';
if ( line.length >= maxTextLength ) {
lines.push(line);
line = word + ' ';
wrapText (context, text, x, y, fontSize, maxWidth, maxHeight) {
let lines = new Array();
let width = 0, i, j;
let result, tempLine;

while ( text.length ) {
for ( i = text.length; context.measureText(text.substr(0,i)).width > maxWidth; i-- ) {}

result = text.substr(0,i);
tempLine = result.substr(0, result.length);

// Break line by spaces if avaiable
if ( tempLine.indexOf(" ") >= 0 && ( text.charAt(i + 1) != ' ' && text.charAt(i + 1) != "" ) ) {
tempLine = tempLine.split(" ")[0];
lines.push( tempLine );
text = text.substr( tempLine.length + 1, text.length );
} else {
line = testLine;
lines.push( tempLine );
text = text.substr( tempLine.length, text.length );
}
});

lines.push(line);
}

const lineHeight = this.getFontSize(context, maxWidth, lines[0], maxTextLength);

lines.forEach( line => {
context.fillText(line, x, y);
y += lineHeight;
});
// Only one line, center it
if ( lines.length == 1 ) {
y = y + ( maxHeight / 2 ) - fontSize / 2;
}
// Tow lines, center them
if ( lines.length == 2 ) {
y = y + (fontSize * ((stylingConfiguration.linesText / 2) - 1));
}

// Multiple lines
for ( let i = 0; i < lines.length ; i++ ) {
if ( i === stylingConfiguration.linesText - 1 ) {
context.fillText( lines.length > i + 1 ? lines[i] + "..." : lines[i], x, y );
break;
} else {
context.fillText( lines[i], x, y );
}
y += fontSize + ( fontSize / lines.length );
}
}

// Calculate link middle point
Expand All @@ -316,22 +330,23 @@ class VFBCircuitBrowser extends Component {
nodeRendering (node, ctx, globalScale) {
const cardWidth = NODE_WIDTH;
const cardHeight = NODE_HEIGHT;
const classnameHeight = cardHeight * .45;
const idHeight = cardHeight * .45;
const nodeTitleHeight = cardHeight * stylingConfiguration.nodeTitleHeight;
const nodeDescriptionHeight = cardHeight * stylingConfiguration.nodeDescriptionHeight;
const colorBarHeight = cardHeight * stylingConfiguration.nodeColorAreaHeight;
let borderThickness = this.highlightNodes.has(node) ? NODE_BORDER_THICKNESS : 1;

// Node border color
ctx.fillStyle = self.hoverNode == node ? stylingConfiguration.defaultNodeHoverBoderColor : (this.highlightNodes.has(node) ? stylingConfiguration.defaultNeighborNodesHoverColor : stylingConfiguration.defaultNodeBorderColor) ;
ctx.fillStyle = self.hoverNode == node || node?.id === self.hoverNode?.id ? stylingConfiguration.defaultNodeHoverBoderColor : (this.highlightNodes.has(node) ? stylingConfiguration.defaultNeighborNodesHoverColor : stylingConfiguration.defaultNodeBorderColor) ;
// Create Border
ctx.fillRect(node.x - cardWidth / 2 - (borderThickness), node.y - cardHeight / 2 - (borderThickness), cardWidth , cardHeight );
ctx.fillRect(node.x - (cardWidth / 2) - borderThickness, node.y - (cardHeight / 2) + borderThickness, cardWidth + (borderThickness * 2), cardHeight + (borderThickness * 2));

// Assign color to Description Area background in Node
ctx.fillStyle = stylingConfiguration.defaultNodeDescriptionBackgroundColor;
// Create Description Area in Node
ctx.fillRect(node.x - cardWidth / 2,node.y - cardHeight / 2, cardWidth - (borderThickness * 2 ), cardHeight - (borderThickness * 2 ));
ctx.fillRect(node.x - cardWidth / 2,node.y - nodeDescriptionHeight, cardWidth, cardHeight);

ctx.fillStyle = stylingConfiguration.defaultNodeTitleBackgroundColor;
ctx.fillRect(node.x - cardWidth / 2,node.y - cardHeight / 2, cardWidth - (borderThickness * 2 ), cardHeight / 2 );
ctx.fillRect(node.x - cardWidth / 2,node.y - nodeTitleHeight, cardWidth, nodeTitleHeight );

const lastIndex = node.nodeColorLabels.length;
node.nodeColorLabels.forEach( (color, index) => {
Expand All @@ -340,28 +355,39 @@ class VFBCircuitBrowser extends Component {
const x = (node.x - cardWidth / 2) + (index * (cardWidth / lastIndex));
const y = node.y;
// Create Title Bar in Node
ctx.fillRect(x,y, (cardWidth / lastIndex) - ( index == lastIndex - 1 ? borderThickness * 2 : 0 ) , cardHeight / 10);
ctx.fillRect(x,y, (cardWidth / lastIndex), colorBarHeight);
})

// Assign font to text in Node
ctx.font = stylingConfiguration.defaultNodeFont;
ctx.font = `${stylingConfiguration.nodeTitleFontSize}px ${stylingConfiguration.defaultNodeFont}`;
// Assign color to text in Node
ctx.fillStyle = stylingConfiguration.defaultNodeFontColor;
// Text in font to be centered
ctx.textAlign = "center";
ctx.textBaseline = 'middle';

/*
* Add Description text to Nodes
* Parameters:
* node.name = text to display
* node.x = x coordinate of text
* node.y - (cardHeight / 2) + 10 = y coordinate, adds 15 pixels for padding from upper element
* cardWidth * .8 = The maximum width the text can take
* nodeTitleHeight = The maximum height the text can take
*/
this.wrapText(ctx, node.classLabel, node.x, node.y - (cardHeight / 2) + 10, stylingConfiguration.nodeTitleFontSize, cardWidth * .8 , nodeTitleHeight);

// Create Title in Node
this.wrapText(ctx, node.classLabel, node.x, node.y - (cardHeight / 2) + 10, cardWidth * .8 , classnameHeight);

ctx.font = stylingConfiguration.defaultNodeFont;
ctx.font = `${stylingConfiguration.nodeDescriptionFontSize}px ${stylingConfiguration.defaultNodeFont}`;
/*
* Add Description text to Nodes
* Parameters:
* node.name = text to display
* node.x = x coordinate of text
* node.y + 20 = y coordinate, adds 20 pixels for padding from upper element
* node.y + 15 = y coordinate, adds 15 pixels for padding from upper element
* cardWidth * .8 = The maximum width the text can take
* cardHeight = The maximum height the text can take
*/
this.wrapText(ctx, node.name, node.x, node.y + 20, cardWidth * .8 , classnameHeight);
this.wrapText(ctx, node.name, node.x, node.y + 15, stylingConfiguration.nodeDescriptionFontSize, cardWidth * .8 , nodeDescriptionHeight);
}

render () {
Expand Down Expand Up @@ -408,7 +434,7 @@ class VFBCircuitBrowser extends Component {
data={this.state.graph}
// Create the Graph as 2 Dimensional
d2={true}
nodeLabel={node => node.title}
nodeLabel={node => node.name + " [" + node.title + "]"}
// Relationship label, placed in Link
linkLabel={link => link.label}
// Width of links, log(weight)
Expand Down Expand Up @@ -478,8 +504,9 @@ class VFBCircuitBrowser extends Component {
ctx.fillText(label, 0, 0);
ctx.restore();
}}
nodeRelSize={20}
nodeRelSize={50}
nodeSize={30}
enableNodeDrag={true}
// Assign background color to Canvas
backgroundColor = {stylingConfiguration.canvasColor}
// Assign color to Links connecting Nodes
Expand Down Expand Up @@ -562,8 +589,8 @@ class VFBCircuitBrowser extends Component {
self.highlightNodes.add(link.source);
self.highlightNodes.add(link.target);
}
}
}
}}
linkHoverPrecision={10}
/>
)
}
Expand Down
Loading