Click here to Skip to main content
Click here to Skip to main content

AzharDNA New Bioinformatics Program (DNA Translation)

, 4 Mar 2014
Rate this:
Please Sign up or sign in to vote.
Basic tool for the translation of DNA

Introduction

In molecular biology and genetics, translation is the third stage of protein biosynthesis (part of the overall process of gene expression). In translation, messenger RNA (mRNA) produced by transcription is decoded by the ribosome to produce a specific amino acid chain, or polypeptide, that will later fold into an active protein. In Bacteria, translation occurs in the cell's cytoplasm, where the large and small subunits of the ribosome are located, and bind to the mRNA. In Eukaryotes, translation occurs across the membrane of the endoplasmic reticulum in a process called vectorial synthesis. The ribosome facilitates decoding by inducing the binding of tRNAs with complementary anticodon sequences to that of the mRNA. The tRNAs carry specific amino acids that are chained together into a polypeptide as the mRNA passes through and is "read" by the ribosome in a fashion reminiscent to that of a stock ticker and ticker tape.

Background

Every amino acid is encoded by triple nucleotide code like M(Methionine) is encoded by (atg)triple code and there are 64 combinations encoded for 21 amino acids.

Translation Method

This method is responsible for cutting the DNA into number of triple code every triple code is consisted of three nucleotides then the code will ask the database about the amino acid that is encoded by this specific triple code and we must know there are many triples code for one amino acid but there just one amino acid for every triple code the method will require both the sequence and the database connection and it will return series of amino acids.

public static string Translate(string seq, SqlConnection DnaPro)
{
    string Translation = "";
    using (SqlConnection cn = new SqlConnection(DnaPro.ConnectionString))
    {
        cn.Open();

        for (int x = 0; x < seq.Length / 3; x++)
        {
            int g = x * 3;
            string h = seq.Substring(g, 3);
            string cm = "select aminoacid from dnapro where dna='" + h + "'";
            SqlCommand cmd = new SqlCommand(cm, cn);
            Translation += cmd.ExecuteScalar();
        }

        return (string)Translation;
    }
}

Sequence Frames and the Probabilities of Translation

What if the first nucleotide in sequence was not the first nucleotide in translation and also what the two first nucleotides will not integrate into the translation process, this will leave you with three probabilities for the sequence which will be translated, and over all this what if the translation process will began from the opposite direction this will leave with three other probabilities (frames) and this mean that there are six frames (probabilities) for the main sequence which will enter the process of translation.

//One DIRECTION
 string frame1 = Translation.Translate(seq, DNAPro.Connection);
 string frame2 = Translation.Translate(seq.Substring(1), DNAPro.Connection);
 string frame3 = Translation.Translate(seq.Substring(2), DNAPro.Connection);
 //Opposite DIRECTION
 string Revseq = Main_Operations.Reversion(seq);
 string frame4 = Translation.Translate(Revseq, DNAPro.Connection);
 string frame5 = Translation.Translate(Revseq.Substring(1), DNAPro.Connection);
 string frame6 = Translation.Translate(Revseq.Substring(2), DNAPro.Connection);

Drawing the Result on Form

First define where every frame will be painted on the picture box or its position:

Translation.Frame1_Pos = 100;
Translation.Frame2_Pos = 110;
Translation.Frame3_Pos = 120;
Translation.Frame4_Pos = 155;
Translation.Frame5_Pos = 165;
Translation.Frame6_Pos = 175;

Then we will calculate the sequence which will be in this image depending on that every image has to contain 50 nucleotides.

double images = Main_Operations.How_Many_Images(seq); 

In the loop:

for (int image_No = 0; image_No < images; image_No++)
{
    //creating Bitmap image with specific dimensions 
    Image image = new Bitmap(500, 200);
    Graphics pic = Graphics.FromImage(image);
    //painting the reverse sequence
    string RevSeq = Main_Operations.Reversion(seq);
    Main_Operations.draw_Seq_On_Image(seq, image_No, pic, 85);
    Main_Operations.draw_Seq_On_Image(Revseq, image_No, pic, 145);
    Main_Operations.draw_SeqCount_On_Image(seq, Revseq, image_No, pic);
    //painting frames
    Translation.Draw_Trans_Result_Image(seq, Revseq, image_No, pic, 
                frame1, frame2, frame3, frame4, frame5, frame6, 70);
    //Processes
    //to paint the images at specific positions on form
    Draw_Box_With_This_Image(image_No, image);
}

public void Draw_Box_With_This_Image(int im, Image image)
{
    PictureBox p = new PictureBox();
    p.Location = new Point(0, im * 200);
    p.Image = image;
    p.Size = image.Size;
    Controls.Add(p);
}

Here is the method that will paint the frames on the image:

public static void Draw_Trans_Result_Image(string seq, string Revseq, 
   int image_No, System.Drawing.Graphics pic, string frame1, 
   string frame2, string frame3, string frame4, string frame5, 
   string frame6, int level)
{
    //painting Of the sequence of DNA Nu which are exists in this image.
    string subframe1 = "";
    string subframe2 = "";
    string subframe3 = "";
    string subframe4 = "";
    string subframe5 = "";
    string subframe6 = "";
    double MyNumber = Main_Operations.How_Many_Images(seq)-1;
    if (image_No < MyNumber )
    {
        subframe1 = frame1.Substring(image_No * 16 + image_No / 2, 16);
        subframe2 = frame2.Substring(image_No * 16 + image_No / 2, 16);
        subframe3 = frame3.Substring(image_No * 16 + image_No / 2, 16);
        subframe4 = frame4.Substring(image_No * 16 + image_No / 2, 16);
        subframe5 = frame5.Substring(image_No * 16 + image_No / 2, 16);
        subframe6 = frame6.Substring(image_No * 16 + image_No / 2, 16);
    }
    else
    {
        subframe1 = frame1.Substring(frame1.Length - frame1.Length % 16 + image_No / 2);
        subframe2 = frame2.Substring(frame2.Length - frame2.Length % 16 + image_No / 2);
        subframe3 = frame3.Substring(frame3.Length - frame3.Length % 16 + image_No / 2);
        subframe4 = frame4.Substring(frame4.Length - frame4.Length % 16 + image_No / 2);
        subframe5 = frame5.Substring(frame5.Length - frame5.Length % 16 + image_No / 2);
        subframe6 = frame6.Substring(frame6.Length - frame6.Length % 16 + image_No / 2);
    }

    for (int t = 0; t < seq.Length; t++)
    {
        if (t == 2 || (t - 2) % 3 == 0)
        {
            if (subframe1.Length > (t - 2) / 3)
                pic.DrawString(subframe1[(t - 2) / 3].ToString(), 
                  new Font("italic", 8, FontStyle.Bold), 
                  Brushes.DarkOrange, new PointF(t * 8 + 15, Frame1_Pos));
            if (subframe2.Length > (t - 2) / 3)
                pic.DrawString(subframe2[(t - 2) / 3].ToString(), 
                  new Font("italic", 8, FontStyle.Bold), 
                  Brushes.Purple, new PointF(t * 8 + 8 + 15, Frame2_Pos));
            if (subframe3.Length > (t - 2) / 3)
                pic.DrawString(subframe3[(t - 2) / 3].ToString(), 
                  new Font("italic", 8, FontStyle.Bold), 
                  Brushes.Blue, new PointF(t * 8 + 15 + 15, Frame3_Pos));
            if (subframe4.Length > (t - 2) / 3)
                pic.DrawString(subframe4[(t - 2) / 3].ToString(), 
                  new Font("italic", 8, FontStyle.Bold), 
                  Brushes.Red, new PointF(t * 8 + 15, Frame4_Pos));
            if (subframe5.Length > (t - 2) / 3)
                pic.DrawString(subframe5[(t - 2) / 3].ToString(), 
                  new Font("italic", 8, FontStyle.Bold), 
                  Brushes.Green, new PointF(t * 8 + 8 + 15, Frame5_Pos));
            if (subframe6.Length > (t - 2) / 3)
                pic.DrawString(subframe6[(t - 2) / 3].ToString(), 
                  new Font("italic", 8, FontStyle.Bold), 
                  Brushes.Brown, new PointF(t * 8 + 15 + 15, Frame6_Pos));
        }
    }
}

Note

I know that it's annoying when I used PictureBox to display the translation result and really I wanted to paint the result on a RichTextBox, and it will be very helpful if anyone can help me with this method. And I am very sorry that my code is not professional enough but what I can do is better than what I can't.

History

This code is related to the AzharDNA new bioinformatics program (basic tool for DNA translation).

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Al-Samman Mahmoud
Software Developer Agriculture Genetic Engineering Research Institute
Egypt Egypt
I have adored bioinformatics since my second year in college and then I specialized in this field in my final year in biotechnology department, I have learned both C# and Perl Languages to build open soft-wares contain specialized tools in this particular science.
I'm trying to enhance my knowledge in this beautiful field by both reading and writing articles , also I hope to gain both master and doctoral degree in it.
If you have any scholarship, source , opportunity , project or idea which can help me to reach my goal don't hesitate to contact me on :
E-Mail:samman_mahmoud@yahoo.com
Facebook:Samman Mahmoud
Tel: +20118904500
Follow on   Twitter

Comments and Discussions

 
QuestionAwesome PinmemberAngel Emmanuel Calvas5-Mar-14 8:39 
GeneralNot professional coding, but interesting topic PinmemberJohn Brett5-Mar-14 1:08 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140827.1 | Last Updated 4 Mar 2014
Article Copyright 2014 by Al-Samman Mahmoud
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid