aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Runge <dave@sleepmap.de>2015-03-30 01:28:00 +0200
committerDavid Runge <dave@sleepmap.de>2015-03-30 01:28:00 +0200
commitc1d26bc361d52f1ae7be0a7da8a205b04bd665ff (patch)
tree575f7f4821c28171f424fb9a276e2ce8cd6a1266
parente172c23373454ddd78ba4217402b66dcd01f2245 (diff)
downloadthesoundofpeople-c1d26bc361d52f1ae7be0a7da8a205b04bd665ff.tar.gz
thesoundofpeople-c1d26bc361d52f1ae7be0a7da8a205b04bd665ff.tar.bz2
thesoundofpeople-c1d26bc361d52f1ae7be0a7da8a205b04bd665ff.tar.xz
thesoundofpeople-c1d26bc361d52f1ae7be0a7da8a205b04bd665ff.zip
SNPInfo.sc: Adding getColorFromBase function to retrieve a color Hex string derived from the base/ the combination of bases.
-rw-r--r--SNPInfo.sc30
1 files changed, 30 insertions, 0 deletions
diff --git a/SNPInfo.sc b/SNPInfo.sc
index 26fc24a..a037e4a 100644
--- a/SNPInfo.sc
+++ b/SNPInfo.sc
@@ -15,6 +15,10 @@ SNPInfo{//helper class for calculations and constants used in the other classes
const <g = #[0,0,1,0];
const <t = #[0,0,0,1];
const <e = #[0,0,0,0];
+ const <colorA = "#80ff00";
+ const <colorC = "#ff0000";
+ const <colorG = "#8000ff";
+ const <colorT = "#00ffff";
classvar <workingSCompany = #[1];//the companies working with this software (so far)
*calcPosition{//normalize all positions on chromosomes to the longest (the first) by chromosomesFactor of chromosomesFactor
@@ -146,4 +150,30 @@ SNPInfo{//helper class for calculations and constants used in the other classes
^false;
});
}
+
+ //returns a hex color value for a base/ base pair
+ *getColorFromBase{
+ arg base;
+ if(this.isBase(base.asSymbol),{
+ switch(base.asSymbol,
+ \A, {^colorA},
+ \C, {^colorC},
+ \G, {^colorG},
+ \T, {^colorT}
+ );
+ },{
+ switch(base.asSymbol,
+ \AA, {^colorA},
+ \CC, {^colorC},
+ \GG, {^colorG},
+ \TT, {^colorT},
+ {
+ if((base.asString.size==2 && this.isBase(base.asString[0]) && this.isBase(base.asString[1])),{
+ ^Color.fromHexString(this.getColorFromBase(base.asString[0])).blend(Color.fromHexString(this.getColorFromBase(base.asString[1]))).hexString;
+ }
+ );
+ }
+ );
+ });
+ }
}