diff options
-rw-r--r-- | SNPInfo.sc | 30 |
1 files changed, 30 insertions, 0 deletions
@@ -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; + } + ); + } + ); + }); + } } |