aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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;
+ }
+ );
+ }
+ );
+ });
+ }
}