-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from glycojones/add_database
Added database API
- Loading branch information
Showing
17 changed files
with
938 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
92 changes: 92 additions & 0 deletions
92
webserver/src/components/DatabaseComponents/BFactorVsRSCC.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
import { useEffect, useState, lazy } from 'react'; | ||
|
||
const Plot = lazy(() => import('react-plotly.js')); | ||
|
||
function calculate_points(data) { | ||
let glycans = data.data.glycans | ||
|
||
let x_axis = [] | ||
let y_axis = [] | ||
let text = [] | ||
|
||
for (const key in glycans) { | ||
let glycan_type = glycans[key] | ||
for (let i = 0; i < glycan_type.length; i++) { | ||
let sugars = glycan_type[i].Sugars | ||
for (let j = 0; j < sugars.length; j++) { | ||
x_axis.push(sugars[j].BFactor) | ||
y_axis.push(sugars[j].RSCC) | ||
text.push(sugars[j]["Sugar ID"]) | ||
} | ||
} | ||
} | ||
|
||
|
||
return [x_axis, y_axis, text] | ||
} | ||
|
||
export default function BFactorVsRSCC(props) { | ||
|
||
const [trace, setTrace] = useState({}) | ||
|
||
useEffect(() => { | ||
const [x_axis, y_axis, text] = calculate_points(props) | ||
|
||
setTrace({ | ||
x: x_axis, | ||
y: y_axis, | ||
text: text, | ||
hoverinfo: "text", | ||
mode: 'markers', | ||
type: 'scatter', | ||
marker: { | ||
size: 8, | ||
color: 'green', | ||
symbol: ['o'] | ||
}, | ||
}) | ||
}, []) | ||
|
||
|
||
return ( | ||
<div className='flex flex-col mx-auto'> | ||
<span className='text-xl'>BFactor vs RSCC</span> | ||
<Plot | ||
data={[ | ||
trace | ||
]} | ||
layout={{ | ||
width: 500, height: 400, title: "", | ||
plot_bgcolor: "#D6D9E5", | ||
paper_bgcolor: "#D6D9E5", | ||
margin: { | ||
l: 50, | ||
r: 50, | ||
b: 50, | ||
t: 10, | ||
pad: 4 | ||
}, | ||
yaxis: { | ||
title: { | ||
text: "RSCC" | ||
}, | ||
fixedrange: true, | ||
range: [0, 1], | ||
showgrid: true | ||
}, | ||
xaxis: { | ||
title: { | ||
text: "B Factor" | ||
}, | ||
fixedrange: true, | ||
range: [0, 100], | ||
showgrid: true | ||
}, | ||
}} | ||
/> | ||
</div> | ||
) | ||
|
||
|
||
|
||
} |
98 changes: 98 additions & 0 deletions
98
webserver/src/components/DatabaseComponents/CremerPopleGraph.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { useEffect, useState, lazy } from 'react'; | ||
|
||
const Plot = lazy(() => import('react-plotly.js')); | ||
|
||
function calculate_points(data) { | ||
let glycans = data.data.glycans | ||
|
||
let x_axis = [] | ||
let y_axis = [] | ||
let text = [] | ||
|
||
for (const key in glycans) { | ||
let glycan_type = glycans[key] | ||
for (let i = 0; i < glycan_type.length; i++) { | ||
let sugars = glycan_type[i].Sugars | ||
for (let j = 0; j < sugars.length; j++) { | ||
|
||
x_axis.push(sugars[j].Phi) | ||
y_axis.push(sugars[j].Theta) | ||
text.push(sugars[j]["Sugar ID"]) | ||
} | ||
} | ||
} | ||
|
||
|
||
return [x_axis, y_axis, text] | ||
} | ||
|
||
export default function CremerPopleGraph(props) { | ||
|
||
const [trace, setTrace] = useState({}) | ||
|
||
useEffect(() => { | ||
const [x_axis, y_axis, text] = calculate_points(props) | ||
|
||
setTrace({ | ||
x: x_axis, | ||
y: y_axis, | ||
text: text, | ||
hoverinfo: "text", | ||
mode: 'markers', | ||
type: 'scatter', | ||
marker: { | ||
size: 8, | ||
color: 'green', | ||
symbol: ['o'] | ||
}, | ||
}) | ||
|
||
}, []) | ||
|
||
|
||
return ( | ||
<div className='flex flex-col mx-auto'> | ||
<span className='text-xl'>Conformational landscape for pyranoses</span> | ||
|
||
<Plot | ||
data={[ | ||
trace | ||
]} | ||
layout={{ | ||
width: 500, height: 400, title: "", | ||
plot_bgcolor: "#D6D9E5", | ||
paper_bgcolor: "#D6D9E5", | ||
margin: { | ||
l: 50, | ||
r: 50, | ||
b: 50, | ||
t: 10, | ||
pad: 4 | ||
}, | ||
|
||
yaxis: { | ||
title: { | ||
text: "Theta / °" | ||
}, | ||
fixedrange: true, | ||
range: [180, 0], | ||
showgrid: true | ||
}, | ||
xaxis: { | ||
title: { | ||
text: "Phi / °" | ||
}, | ||
fixedrange: true, | ||
range: [360, 0], | ||
showgrid: true | ||
}, | ||
}} | ||
/> | ||
|
||
</div> | ||
|
||
) | ||
|
||
|
||
|
||
} |
Oops, something went wrong.