Esempio n. 1
0
    public void setSequence(string sequence)
    {
        foreach (char c in sequence)
        {
            Nucleotide.Type t = Nucleotide.Type.Unknown;
            switch (c)
            {
            case 'A':
                t = Nucleotide.Type.A;
                break;

            case 'T':
                t = Nucleotide.Type.T;
                break;

            case 'C':
                t = Nucleotide.Type.C;
                break;

            case 'G':
                t = Nucleotide.Type.G;
                break;

            case '-':
                t = Nucleotide.Type.Unknown;
                break;
            }
            appendFilledSlot(t);
            // Debug.Log(c);
        }
    }
Esempio n. 2
0
    public void setType(Nucleotide.Type t)
    {
        switch (t)
        {
        case Nucleotide.Type.A:
            setColor(new Color(255, 0, 0));
            setText("A");
            break;

        case Nucleotide.Type.T:
            setColor(new Color(255, 255, 0));
            setText("T");
            break;

        case Nucleotide.Type.C:
            setColor(new Color(0, 255, 0));
            setText("C");
            break;

        case Nucleotide.Type.G:
            setColor(new Color(0, 0, 255));
            setText("G");
            break;
        }
    }
Esempio n. 3
0
 public void setType(Nucleotide.Type t1, Nucleotide.Type t2)
 {
     nucleotide1.setType(t1);
     nucleotide2.setType(t2);
     if (t1 == Nucleotide.Type.A || t1 == Nucleotide.Type.T)
     {//A T只有两条氢键,要使最中间一条不显示{
         //Debug.Log("A/T has two bond");
         HydrogenBond1.SetActive(true);
         HydrogenBond2.SetActive(false);
         HydrogenBond3.SetActive(true);
     }
     else if (t1 == Nucleotide.Type.C || t1 == Nucleotide.Type.G)
     {
         HydrogenBond1.SetActive(true);
         HydrogenBond2.SetActive(true);
         HydrogenBond3.SetActive(true);
     }
     if (NucleotideDirector.getInstance().getPairType(t1) != t2 && t1 != Nucleotide.Type.Empty && t2 != Nucleotide.Type.Empty)
     {
         nucleotide1.gameObject.GetComponent <Renderer>().material.color = Color.red;
         nucleotide2.gameObject.GetComponent <Renderer>().material.color = Color.red;
         HydrogenBond1.SetActive(false);
         HydrogenBond2.SetActive(false);
         HydrogenBond3.SetActive(false);
     }
     if (t1 == Nucleotide.Type.Empty || t2 == Nucleotide.Type.Empty)
     {
         HydrogenBond1.SetActive(false);
         HydrogenBond2.SetActive(false);
         HydrogenBond3.SetActive(false);
     }
 }
Esempio n. 4
0
 public void setType(Nucleotide.Type t)
 {
     if (!this.attach)
     {
         this.attach = (Instantiate(nucleotidePrefab, this.transform.position, this.transform.rotation) as GameObject).GetComponent <Nucleotide>();
     }
     this.attach.attach();
     this.attach.setType(t);
 }
Esempio n. 5
0
 private bool appendFilledSlot(Nucleotide.Type t)
 {
     if (slots == null)
     {
         slots = new Hashtable();
     }
     if (!slots.Contains(0))
     {
         addSlot(0);
     }
     if (t != Nucleotide.Type.Unknown)
     {
         (slots[maxIdx] as slot).setType(t);
     }
     attach(slots[maxIdx] as slot);
     return(true);
 }
Esempio n. 6
0
    public char Type2Char(Nucleotide.Type t)
    {
        switch (t)
        {
        case Nucleotide.Type.A:
            return('A');

        case Nucleotide.Type.T:
            return('T');

        case Nucleotide.Type.C:
            return('C');

        case Nucleotide.Type.G:
            return('G');

        default:
            return('-');
        }
    }
Esempio n. 7
0
    public Nucleotide.Type getPairType(Nucleotide.Type t)
    {
        switch (t)
        {
        case Nucleotide.Type.A:
            return(Nucleotide.Type.T);

        case Nucleotide.Type.T:
            return(Nucleotide.Type.A);

        case Nucleotide.Type.C:
            return(Nucleotide.Type.G);

        case Nucleotide.Type.G:
            return(Nucleotide.Type.C);

        default:
            return(Nucleotide.Type.Empty);
        }
    }