コード例 #1
0
        public void BuildTexture()           //, ParseDNA parseDNA) {
        //this.DNA_Model = parseDNA;

        {
            Debug.Log("inside build texture");
            string[] val      = DNA_Model.data[key];
            string   sequence = val[1];

            var texture = new Texture2D(textureX, textureY, TextureFormat.BGRA32, true);

            GetComponent <Renderer>().material.mainTexture = texture;

            texture.SetPixel(textureX, textureY, Color.black);             // mark the end of this texture.

            Debug.Log("sequence: " + sequence);

            for (int i = 0; i < sequence.Length; i++)
            {
                Nuc n = Nucleotide.CharToNuc(sequence[i]);
                texture.SetPixel(i % textureX, i / textureX, Nucleotide.defaultColor[n]);
            }

            texture.filterMode = FilterMode.Point;
            texture.Apply();
        }
コード例 #2
0
        public void BuildCDSTexture(List <string> cds)
        {
            Debug.Log("inside build CDS texture");
            string sequence1 = cds[0];
            string sequence2 = cds[1];

            var texture = new Texture2D(textureX, textureY, TextureFormat.BGRA32, true);

            GetComponent <Renderer>().material.mainTexture = texture;

            //@todo: get new textureX, textureY values from alignment.
            texture.SetPixel(textureX, textureY, Color.black);             // mark the end of this texture.

            Debug.Log("sequence2: " + sequence2);
            if (sequence1.Length != sequence2.Length)
            {
                throw new Exception("two sequences from alignment are not the same length.");
            }

            for (int i = 0; i < sequence1.Length; i++)
            {
                Nuc n1 = Nucleotide.CharToNuc(sequence1[i]);
                Nuc n2 = Nucleotide.CharToNuc(sequence2[i]);

                if (n1 == n2)
                {
                    texture.SetPixel(i % textureX, i / textureX, Nucleotide.litColor[n1]);
                }
                else
                {
                    texture.SetPixel(i % textureX, i / textureX, Nucleotide.dimColor[n1]);
                }
            }

            texture.filterMode = FilterMode.Point;
            texture.Apply();
        }