forked from intermine/bluegenes-protein-visualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add table for coloring by secondary structure and add static styling …
…to style.less
- Loading branch information
1 parent
da2ebcd
commit bcaae0f
Showing
3 changed files
with
69 additions
and
68 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,62 +1,60 @@ | ||
import { Component } from 'react'; | ||
const uniform_color_table = [ | ||
['#FFFFFF', 'hydrogen (H)'], | ||
['#000000', 'carbon (C)'], | ||
['#2233FF', 'nitrogen (N)'], | ||
['#FF2200', 'oxygen (O)'], | ||
['#1FF01F', 'fluorine (F), chlorine (Cl)'], | ||
['#992200', 'bromine (Br)'], | ||
['#6600BB', 'iodine (I)'], | ||
['#00FFFF', 'noble gases (He, Ne, Ar, Xe, Kr)'], | ||
['#FF9900', 'phosphorus (P)'], | ||
['#FFE522', 'sulfur (S)'], | ||
['#FFAA77', 'boron (B), most transition metals'], | ||
['#7700FF', 'alkali metals (Li, Na, K, Rb, Cs, Fr)'], | ||
['#007700', 'alkaline earth metals (Be, Mg, Ca, Sr, Ba, Ra)'], | ||
['#999999', 'titanium (Ti)'], | ||
['#DD7700', 'iron (Fe)'], | ||
['#DD77FF', 'other elements'] | ||
]; | ||
|
||
class ColorTable extends Component { | ||
constructor(props) { | ||
super(props); | ||
const secondary_color_table = [ | ||
['#FF0080', 'α helix'], | ||
['#A00080', `3${'\u2081\u2080'} helix`], | ||
['#600080', 'π helix'], | ||
['#FFC800', 'β strand'], | ||
['#6080FF', '(β) turn'], | ||
['#FFFFFF', 'other'], | ||
['#AE00FE', 'DNA'], | ||
['#FD0162', 'RNA'], | ||
['#A6A6FA', 'Carbohydrate'], | ||
['#808080', 'other'] | ||
]; | ||
|
||
this.state = { | ||
color_table: [ | ||
['#FFFFFF', 'hydrogen (H)'], | ||
['#000000', 'carbon (C)'], | ||
['#2233FF', 'nitrogen (N)'], | ||
['#FF2200', 'oxygen (O)'], | ||
['#1FF01F', 'fluorine (F), chlorine (Cl)'], | ||
['#992200', 'bromine (Br)'], | ||
['#6600BB', 'iodine (I)'], | ||
['#00FFFF', 'noble gases (He, Ne, Ar, Xe, Kr)'], | ||
['#FF9900', 'phosphorus (P)'], | ||
['#FFE522', 'sulfur (S)'], | ||
['#FFAA77', 'boron (B), most transition metals'], | ||
['#7700FF', 'alkali metals (Li, Na, K, Rb, Cs, Fr)'], | ||
['#007700', 'alkaline earth metals (Be, Mg, Ca, Sr, Ba, Ra)'], | ||
['#999999', 'titanium (Ti)'], | ||
['#DD7700', 'iron (Fe)'], | ||
['#DD77FF', 'other elements'] | ||
] | ||
}; | ||
this.setColor = this.setColor.bind(this); | ||
} | ||
setColor(colorValue) { | ||
let background = { | ||
height: '10px', | ||
width: '10px', | ||
margin: '0px 0px 0px 0px', | ||
background: colorValue, | ||
border: 'thin solid grey' | ||
}; | ||
return background; | ||
} | ||
render() { | ||
return ( | ||
<div> | ||
<table> | ||
<tbody> | ||
{this.state.color_table.map(element => { | ||
return ( | ||
<tr> | ||
<td> | ||
<div style={this.setColor(element[0])}></div> | ||
</td> | ||
const ColorTable = ({ colorMode }) => { | ||
const color_table = | ||
colorMode == 'uniform' ? uniform_color_table : secondary_color_table; | ||
return ( | ||
<div className="color-table"> | ||
<table> | ||
<tbody> | ||
{color_table.map(element => { | ||
return ( | ||
<tr className="color-table-row"> | ||
<td> | ||
<div | ||
className="color-table-box" | ||
style={{ background: element[0] }} | ||
></div> | ||
</td> | ||
|
||
<td>{element[1]}</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
</div> | ||
); | ||
} | ||
<td>{element[1]}</td> | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
</div> | ||
); | ||
} | ||
|
||
export default ColorTable; |
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