Ejemplo n.º 1
0
        /// <summary>
        /// 데이터베이스에서 userBricks 데이터 가져와서 뿌려주기
        /// </summary>
        private void lv_From_DB()
        {
            try
            {
                lv_All.Items.Clear();

                ListViewItem item;
                string       str_qu = "select part_name, part_desc, part_type from userbricks";

                OleDbDataReader oddr = connector.select_Data(str_qu);

                lv_All.Groups.Add("User", "User");

                while (oddr.Read())
                {
                    item = new ListViewItem(oddr.GetString(0));
                    item.SubItems.Add(oddr.GetString(1));
                    item.SubItems.Add(oddr.GetString(2));
                    item.Group = lv_All.Groups["User"];

                    lv_All.Items.Add(item);
                }

                oddr.Close();
            }
            catch (System.Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 관리해야 하는 데이터 DB에서 가져오기
        /// </summary>
        public void list_from_DB()
        {
            try
            {
                lv_All.Items.Clear();

                ListViewItem item;

                string str_qu = "select part_name, part_short_desc, part_type from part where part_short_name is not null";

                OleDbDataReader oddr = connector.select_Data(str_qu);

                lv_All.Groups.Add("Registered Brick", "Registered Brick");

                while (oddr.Read())
                {
                    item = new ListViewItem(oddr.GetString(0));
                    item.SubItems.Add(oddr.GetString(1));
                    item.SubItems.Add(oddr.GetString(2));
                    item.Group = lv_All.Groups["Registered Brick"];

                    lv_All.Items.Add(item);
                }

                str_qu = "select part_name, part_desc, part_type from userbricks";
                oddr   = connector.select_Data(str_qu);

                lv_All.Groups.Add("User's Brick", "User's Brick");

                while (oddr.Read())
                {
                    item = new ListViewItem(oddr.GetString(0));
                    item.SubItems.Add(oddr.GetString(1));
                    item.SubItems.Add(oddr.GetString(2));
                    item.Group = lv_All.Groups["User's Brick"];

                    lv_All.Items.Add(item);
                }

                oddr.Close();
            }
            catch (System.Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 3
0
        //////////////////////////////////////////////////////////////////////////
        // 클로닝툴을 누르면 백본을 선택할 수 있다.
        // 백본을 선택해서 셀렉트 버튼을 누르게 되면
        // 백본의 서열을 이용해서 패널에 그림을 그리게 되고
        // 그림은 제한효소의 위치를 포함한다.
        // 그리고 제한효소들을 리스트박스에서 선택하면 그림에서 제한효소가 부각되며
        // 제한효소를 하나씩 선택하고 OK버튼을 누르면
        // 폼은 꺼지며 메인에서 둥근형태로 표현하게 된다.
        //////////////////////////////////////////////////////////////////////////


        /// <summary>
        /// Plasmid_Backbone을 가져와서 리스트에 뿌려주기
        /// </summary>
        private void list_from_DB()
        {
            try
            {
                string str_qu = "select part_name, part_short_desc from part where part_type = 'plasmid_backbone' and part_short_name is not null;";

                OleDbDataReader oddr = connector.select_Data(str_qu);

                ListViewItem item;

                lv_All.Groups.Add("Registered Brick", "Registered Brick");

                while (oddr.Read())
                {
                    item = new ListViewItem(oddr.GetString(0));
                    item.SubItems.Add(oddr.GetString(1));
                    item.Group = lv_All.Groups["Registered Brick"];

                    lv_All.Items.Add(item);
                }

                str_qu = "select part_name, part_desc from userbricks where part_type = 'plasmid_backbone'";

                oddr = connector.select_Data(str_qu);

                lv_All.Groups.Add("User's Brick", "User's Brick");

                while (oddr.Read())
                {
                    item = new ListViewItem(oddr.GetString(0));
                    item.SubItems.Add(oddr.GetString(1));
                    item.Group = lv_All.Groups["User's Brick"];

                    lv_All.Items.Add(item);
                }
                oddr.Close();
            }
            catch (System.Exception ex)
            {
                Debug.WriteLine(ex.Message);
                MessageBox.Show("Error");
            }
        }
Ejemplo n.º 4
0
        private void combo_from_db()
        {
            comboBox1.Items.Clear();

            string str_select_qu = "select distinct(part_type) from part";

            OleDbDataReader oddr = connector.select_Data(str_select_qu);

            while (oddr.Read())
            {
                comboBox1.Items.Add(oddr.GetString(0));
            }

            oddr.Close();
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 해당 타입의 브릭들 리스트뷰에 보여주기
        /// </summary>
        public void select_to_listview()
        {
            ListViewItem item;

            string str_q = "select part_name, part_short_desc, part_type from part where part_type = '" + str_FormType + "' and part_short_name is not null;";

            OleDbDataReader oddr = connector.select_Data(str_q);

            lv_Type.Groups.Add("Registered Brick", "Registered Brick");

            while (oddr.Read())
            {
                item = new ListViewItem(oddr.GetString(0));
                item.SubItems.Add(oddr.GetString(1));
                item.SubItems.Add(oddr.GetString(2));
                item.Group = lv_Type.Groups["Registered Brick"];

                lv_Type.Items.Add(item);
            }

            str_q = "select part_name, part_desc, part_type from userbricks where part_type = '" + str_FormType + "'";

            oddr = connector.select_Data(str_q);

            lv_Type.Groups.Add("User's Brick", "User's Brick");

            while (oddr.Read())
            {
                item = new ListViewItem(oddr.GetString(0));
                item.SubItems.Add(oddr.GetString(1));
                item.SubItems.Add(oddr.GetString(2));
                item.Group = lv_Type.Groups["User's Brick"];

                lv_Type.Items.Add(item);
            }

            oddr.Close();
        }
        /// <summary>
        /// 리스트뷰에 Other에 해당하는 브릭을 뿌려준다.
        /// </summary>
        private void listview_from_DB()
        {
            ListViewItem item;

            string str_q = "select part_name, part_short_desc, part_type from part where part_short_name is not null and (part_type = '' or part_type = 'Basic' or part_type = 'Cell' or part_type = 'Composite' or part_type = 'Conjugation' or part_type = 'Device' or part_type = 'Intermediate' or part_type = 'Other' or part_type = 'Project' or part_type = 'Project' or part_type = 'RNA' or part_type = 'T7' or part_type = 'Tag' or part_type = 'Temporary')";

            OleDbDataReader oddr = connector.select_Data(str_q);

            lv_Type.Groups.Add("Registered Brick", "Registered Brick");

            while (oddr.Read())
            {
                item = new ListViewItem(oddr.GetString(0));
                item.SubItems.Add(oddr.GetString(1));
                item.SubItems.Add(oddr.GetString(2));
                item.Group = lv_Type.Groups["Registered Brick"];

                lv_Type.Items.Add(item);
            }

            str_q = "select part_name, part_desc, part_type from userbricks where part_type = '' or part_type = 'Basic' or part_type = 'Cell' or part_type = 'Composite' or part_type = 'Conjugation' or part_type = 'Device' or part_type = 'Intermediate' or part_type = 'Other' or part_type = 'Project' or part_type = 'Project' or part_type = 'RNA' or part_type = 'T7' or part_type = 'Tag' or part_type = 'Temporary'";

            oddr = connector.select_Data(str_q);

            lv_Type.Groups.Add("User's Brick", "User's Brick");

            while (oddr.Read())
            {
                item = new ListViewItem(oddr.GetString(0));
                item.SubItems.Add(oddr.GetString(1));
                item.SubItems.Add(oddr.GetString(2));
                item.Group = lv_Type.Groups["User's Brick"];

                lv_Type.Items.Add(item);
            }

            oddr.Close();
        }
Ejemplo n.º 7
0
        // 기본 데이터 베이스 작성하기
        private void BackgroundWorker2_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                downfile.Refresh();

                try
                {
                    this.Invoke(new MethodInvoker(delegate()
                    {
                        progressBar1.Style = ProgressBarStyle.Marquee;
                    }));
                }
                catch (Exception ex)
                {
                    Debug.WriteLine(ex.Message);
                }

                if (downfile.Exists)
                {
                    string          str_q = "select part_id from part;";
                    OleDbDataReader oddr  = connector.select_Data(str_q);

                    List <string> strl_Part_id = new List <string>();

                    while (oddr.Read())
                    {
                        strl_Part_id.Add(oddr.GetInt32(0).ToString());
                    }

                    FileStream   fs = new FileStream(Path.Combine(Directory.GetCurrentDirectory(), downfile.Name), FileMode.Open, FileAccess.Read);
                    StreamReader sr = new StreamReader(fs, Encoding.Default);

                    string   line;
                    String[] str_Brickname;

                    System.Text.RegularExpressions.Regex rx = new System.Text.RegularExpressions.Regex("\"" + @"[\w\W]*" + "\"");

                    while ((line = sr.ReadLine()) != null)
                    {
                        if (line.StartsWith(">"))
                        {
                            str_Brickname = null;
                            str_Brickname = line.Split(' ');

                            // 만약 데이터베이스에 있다면 건너기

                            if (strl_Part_id.Contains(str_Brickname[2]))
                            {
                                // nothing;
                            } // end if
                            else
                            {
                                // 없다면 추가하기

                                string str_qu_insert_brick = "insert into part (part_id,part_name,part_short_desc,part_type) values (@ID, @NAME, @SDESC, @TYPE);";

                                OleDbCommand conm = new OleDbCommand(str_qu_insert_brick);

                                conm.Parameters.AddWithValue("@ID", str_Brickname[2]);
                                conm.Parameters.AddWithValue("@NAME", str_Brickname[0].Replace(">", ""));
                                conm.Parameters.AddWithValue("@SD", rx.Match(line).ToString().Replace("\"", ""));
                                conm.Parameters.AddWithValue("@TYPE", str_Brickname[3]);

                                connector.update_Data(conm);
                            } // end else
                        }     // end if
                    }         // end while
                }
            }
            catch (System.Exception ex)
            {
                Debug.WriteLine(ex.Message);
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// 클로닝 시퀀스 하는거염
        /// </summary>
        /// <param name="bb_name"></param>
        /// <param name="bb_seq"></param>
        /// <param name="rs1"></param>
        /// <param name="i_rs1"></param>
        /// <param name="rs2"></param>
        /// <param name="i_rs2"></param>
        public void processing_Seq(string bb_name, string bb_seq, string rs1, int i_rs1, string rs2, int i_rs2, bool isReg)
        {
            // 먼저 브릭리스트 앞에 해당되는 pre, suf 붙여주기
            // 그런 다음에 bb seq를 가공하고 seq의 정보를 보고

            // 먼저 위치계산을 먼저 해서 브릭이 앞에 갈지 뒤에 갈지를 결정

            // 하지만 rs가 오는 순서는 prefix인지 suffix인지는 결정되어 있으니

            string str_brick_prefix;
            string str_brick_suffix;

            string str_plasmid_seq;

            if (rs1 == "Ecor1")
            {
                if (this.newBD.sl_subpart_list[0].part_seq.StartsWith("atg"))
                {
                    str_brick_prefix = "cgcggccgcttctaga";
                }
                else
                {
                    str_brick_prefix = "cgcggccgcttctagag";
                }
            }
            else
            {
                if (this.newBD.sl_subpart_list[0].part_seq.StartsWith("atg"))
                {
                    str_brick_prefix = "ag";
                }
                else
                {
                    str_brick_prefix = "a";
                }
            }

            if (rs2 == "Pst1")
            {
                str_brick_suffix = "tactagtagcggccgc";
            }
            else
            {
                str_brick_suffix = "ta";
            }

            // 제한효소가 뒤집어 있으면 서열 뒤집기
            // 아니면 그대로
            // 그리고 나서 prefix 넣고 브릭 넣고 서픽스 넣고 제한효소 넣고 시퀀스 넣고 제한효소 넣고 끝.

            // 백본 시퀀스 서브시퀀스 가져오기
            // rs1 이 더 큼
            // rs2 는 앞 쪽임

            str_plasmid_seq = bb_seq.Substring(i_rs2 + 5, Math.Abs(i_rs1 + 1 - (i_rs2 + 5)));

            // 현재 백본 시퀀스 처리

            if (i_rs2 > i_rs1)
            {
                string str_plasmid_seq_d = "";
                foreach (char c in str_plasmid_seq.ToCharArray())
                {
                    switch (c)
                    {
                        case 'a':
                            str_plasmid_seq_d += 't';
                            break;
                        case 't':
                            str_plasmid_seq_d += 'a';
                            break;
                        case 'c':
                            str_plasmid_seq_d += 'g';
                            break;
                        case 'g':
                            str_plasmid_seq_d += 'c';
                            break;
                    }
                }
                str_plasmid_seq = str_plasmid_seq_d;
            }

            // 클로닝 리스트 작성
            // 1. Prefix
            // 2. 브릭리스트
            // 3. Suffix
            // 4. 제한효소
            // 5. 백본 시퀀스
            // 6. 제한효소

            int i = 0;

            Brick_sub_data _bsd = new Brick_sub_data();
            _bsd.part_name = "Prefix";
            _bsd.part_type = "Prefix";
            _bsd.part_seq = str_brick_prefix;
            this.newBD.sl_cloning_list.Add(0, _bsd);

            for (i = 1; i < this.newBD.sl_subpart_list.Count + 1; i++)
            {
                this.newBD.sl_cloning_list.Add(i, newBD.sl_subpart_list[i - 1]);
            }

            _bsd = new Brick_sub_data();
            _bsd.part_name = "Suffix";
            _bsd.part_type = "Suffix";
            _bsd.part_seq = str_brick_suffix;
            this.newBD.sl_cloning_list.Add(i, _bsd);

            _bsd = new Brick_sub_data();
            _bsd.part_name = rs2;
            _bsd.part_type = rs2;
            _bsd.part_seq = this.get_SR_seq(rs1);
            this.newBD.sl_cloning_list.Add(i + 1, _bsd);

            _bsd = new Brick_sub_data();
            //_bsd.part_name = bb_name;

            connector = new DBconnector();

            if (isReg) // 등록된 브릭이면
            {
                string str_q = "select * from part where part_name = '" + bb_name + "'";

                OleDbDataReader oddr = connector.select_Data(str_q);

                while (oddr.Read())
                {
                    _bsd.part_id = oddr.GetInt32(0);
                    _bsd.part_name = oddr.GetString(1);
                    _bsd.part_desc = oddr.GetString(3);
                    _bsd.part_type = oddr.GetString(4);
                    _bsd.part_status = oddr.GetString(5);

                    _bsd.part_result = oddr.GetString(6);

                    _bsd.part_entered = oddr.GetString(10);

                    _bsd.part_author = oddr.GetString(11);
                    _bsd.best_qulity = oddr.GetString(12);
                }

                str_q = "select p.part_name from part as p, specified_subparts as sp where sp.part_id = " + _bsd.part_id + " and sp.subpart_id = p.part_id";

                oddr = connector.select_Data(str_q);

                while (oddr.Read())
                {
                    _bsd.subparts.Add(oddr.GetString(0));
                    lb_Subparts.Items.Add(oddr.GetString(0));
                }
            }
            else
            {
                string str_q = "select * from userbricks where part_name = '" + bb_name + "'";

                OleDbDataReader oddr = connector.select_Data(str_q);

                while (oddr.Read())
                {
                    _bsd.part_name = oddr.GetString(0);
                    _bsd.part_desc = oddr.GetString(2);
                    _bsd.part_type = oddr.GetString(1);
                    _bsd.part_seq = oddr.GetString(3);
                }
            }

            _bsd.part_seq = str_plasmid_seq;
            this.newBD.sl_cloning_list.Add(i + 2, _bsd);

            _bsd = new Brick_sub_data();
            _bsd.part_name = rs1;
            _bsd.part_name = rs1;
            _bsd.part_seq = this.get_SR_seq(rs2);
            this.newBD.sl_cloning_list.Add(i + 3, _bsd);
        }
Ejemplo n.º 9
0
        public void data_load()
        {
            StringBuilder sbLoad = new StringBuilder();
            Stream sr_Stream;

            connector = new DBconnector();

            OpenFileDialog openFD = new OpenFileDialog();
            openFD.Filter = "project files (*brp)|*.brp";

            if (openFD.ShowDialog() == DialogResult.OK)
            {
                if ((sr_Stream = openFD.OpenFile()) != null)
                {
                    this.newBD = new Brick_data();

                    TextReader tr = new StreamReader(sr_Stream);
                    string _str;

                    int i = 0;
                    int j = 0;
                    while ((_str = tr.ReadLine()) != null)
                    {

                        if (_str.Length == 0)
                        {
                            continue;
                        }

                        if (i == 0)
                        {
                            this.newBD.str_brick_name = _str;
                        }
                        else if (i == 1)
                        {
                            this.newBD.str_brick_type = _str;
                        }
                        else if (i == 2)
                        {
                            this.newBD.str_brick_desc = _str;
                        }
                        else
                        {
                            // 여기서 브릭 네임으로 가져와서 정보를 서브 데이터로 저장해야함

                            Brick_sub_data bsd = new Brick_sub_data();
                            string[] split_str = _str.Split(' ');

                            if (split_str[0] == "Scar" || split_str[0] == "Spe1+Xba1")
                            {
                                // 여긴 스칼임
                                bsd.part_name = "Scar";
                                bsd.part_type = "Scar";
                                bsd.part_seq = "";

                                this.newBD.sl_subpart_list.Add(j, bsd);

                            }
                            else if (split_str[1] == "-1")
                            {
                                // 유저브릭임.
                                string str_q = "select * from userbricks where part_name = '" + split_str[0] + "'";

                                OleDbDataReader oddr = connector.select_Data(str_q);

                                while (oddr.Read())
                                {
                                    bsd.part_name = oddr.GetString(0);
                                    bsd.part_type = oddr.GetString(1);
                                    bsd.part_desc = oddr.GetString(2);
                                    bsd.part_seq = oddr.GetString(3);

                                    if (split_str.Count() > 2)
                                    {
                                        bsd.part_icon = int.Parse(split_str[2]);
                                    }
                                }

                                this.newBD.sl_subpart_list.Add(j, bsd);
                            }
                            else
                            {
                                string str_q = "select * from part where part_name = '" + split_str[0] + "'";

                                OleDbDataReader oddr = connector.select_Data(str_q);

                                while (oddr.Read())
                                {
                                    bsd.part_id = oddr.GetInt32(0);
                                    bsd.part_name = oddr.GetString(1);
                                    bsd.part_desc = oddr.GetString(3);
                                    bsd.part_type = oddr.GetString(4);
                                    bsd.part_status = oddr.GetString(5);
                                    bsd.part_result = oddr.GetString(6);
                                    bsd.part_entered = oddr.GetString(10);
                                    bsd.part_author = oddr.GetString(11);
                                    bsd.best_qulity = oddr.GetString(12);
                                }

                                str_q = "select sequences.seq_data from sequences, part where part.part_name = '" + split_str[0] + "' and part.part_id = sequences.part_id";

                                oddr = connector.select_Data(str_q);

                                while (oddr.Read())
                                {
                                    bsd.part_seq = oddr.GetString(0);
                                }

                                str_q = "select p.part_name from part as p, specified_subparts as sp where sp.part_id = " + bsd.part_id + " and sp.subpart_id = p.part_id";

                                oddr = connector.select_Data(str_q);

                                while (oddr.Read())
                                {
                                    bsd.subparts.Add(oddr.GetString(0));
                                }

                                if (split_str.Count() > 2)
                                {
                                    bsd.part_icon = int.Parse(split_str[2]);
                                }

                                this.newBD.sl_subpart_list.Add(j, bsd);
                            }

                            j++;
                        }
                        i++;
                    }

                }
            }

            connector = null;
            this.change_FromName();
        }