Exemplo n.º 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            key  = new Key();
            help = new Help();
            abr  = new Abstract(curSEQ);
            dropDown.SelectedIndex = 0;

            // keep track of controls used for sequence viewing
            List <Control> seqView = new List <Control>();

            seqView.Add(titleBox);
            seqView.Add(subTitleTop);
            seqView.Add(subTitleBot);
            seqView.Add(end3prime);
            seqView.Add(end5prime);
            seqView.Add(keyButton);
            seqView.Add(featureListBox);
            seqView.Add(pan_down);
            seqView.Add(pan_up);
            seqView.Add(zoom_in);
            seqView.Add(zoom_out);
            seqView.Add(navLabel);
            seqView.Add(navInput);
            seqView.Add(navButton);
            seqView.Add(posStart);
            seqView.Add(posEnd);
            seqView.Add(prv_src);
            seqView.Add(prv_rna);
            seqView.Add(abstractButton);

            viewer = new SeqView(seqView);
            viewer.Off();

            // keep track of controls used for search list viewing
            List <Control> listView = new List <Control>();

            listView.Add(searchResultsTable);
            view_list = new ListView(listView);
            view_list.Off();
        }
Exemplo n.º 2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            key = new Key();
            help = new Help();
            abr = new Abstract(curSEQ);
            dropDown.SelectedIndex = 0;

            // keep track of controls used for sequence viewing
            List<Control> seqView = new List<Control>();
            seqView.Add(titleBox);
            seqView.Add(subTitleTop);
            seqView.Add(subTitleBot);
            seqView.Add(end3prime);
            seqView.Add(end5prime);
            seqView.Add(keyButton);
            seqView.Add(featureListBox);
            seqView.Add(pan_down);
            seqView.Add(pan_up);
            seqView.Add(zoom_in);
            seqView.Add(zoom_out);
            seqView.Add(navLabel);
            seqView.Add(navInput);
            seqView.Add(navButton);
            seqView.Add(posStart);
            seqView.Add(posEnd);
            seqView.Add(prv_src);
            seqView.Add(prv_rna);
            seqView.Add(abstractButton);

            viewer = new SeqView(seqView);
            viewer.Off();

            // keep track of controls used for search list viewing
            List<Control> listView = new List<Control>();
            listView.Add(searchResultsTable);
            view_list = new ListView(listView);
            view_list.Off();
        }
Exemplo n.º 3
0
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            this.SetStyle(ControlStyles.DoubleBuffer, true);
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.UserPaint, true);

            if (isSeqView && curSEQ.getSEQ() != null)
            {
                //clear
                e.Graphics.Clear(this.BackColor);

                // determine window size
                Size size = this.ClientSize;
                size.Height -= (menuHeight + 30);
                size.Width  -= menuWidth;

                // line of bases
                int unitsize = size.Height / graphheight;
                if (unitsize < 5)
                {
                    graphheight = size.Height / 5;
                    unitsize    = 5;
                }

                // position units
                posStart.Text = graphstart.ToString();
                posEnd.Text   = (graphstart + graphheight).ToString();

                if (unitsize < 15)
                {
                    for (int i = 0; i < graphheight && i + graphstart <= curSEQ.getSEQ().Length; i++)
                    {
                        char       ntbase    = curSEQ.getSEQ()[graphstart + i - 1];
                        SolidBrush pencolor  = new SolidBrush(SeqView.getColor(ntbase));
                        Rectangle  rectangle = new Rectangle(
                            size.Width * 2 / 5 - unitsize / 2, menuHeight + i * unitsize, unitsize, unitsize);
                        e.Graphics.FillEllipse(pencolor, rectangle);
                    }
                }
                else if (unitsize < 75)
                {
                    Font drawFont = new Font("Arial", unitsize, GraphicsUnit.Pixel);
                    for (int i = 0; i < graphheight && i + graphstart <= curSEQ.getSEQ().Length; i++)
                    {
                        char       ntbase    = curSEQ.getSEQ()[graphstart + i - 1];
                        SolidBrush drawBrush = new SolidBrush(SeqView.getColor(ntbase));
                        float      x         = size.Width * 2 / 5 - unitsize / 2;
                        float      y         = menuHeight + i * (unitsize);

                        StringFormat drawFormat = new StringFormat();
                        e.Graphics.DrawString(ntbase.ToString(), drawFont, drawBrush, x, y, drawFormat);

                        //drawBrush.Dispose();
                    }
                    //graphics.Dispose();
                    //drawFont.Dispose();
                }
                else
                {
                    for (int i = 0; i < graphheight && i + graphstart <= curSEQ.getSEQ().Length; i++)
                    {
                        char  ntbase   = curSEQ.getSEQ()[graphstart + i - 1];
                        Image newImage = SeqView.ResizeImage(SeqView.getImg(ntbase), unitsize, unitsize * 3 / 5);
                        Point ulCorner = new Point(size.Width * 2 / 5 - unitsize / 2, menuHeight + i * (unitsize));
                        e.Graphics.DrawImage(newImage, ulCorner);
                    }
                }

                List <Sequence.feature> featurelist = curSEQ.getVisibleFeatures(graphstart, graphstart + graphheight - 1);
                featurelist = featurelist.OrderBy(feat => feat.start).ToList();

                int done = 0;
                foreach (TextBox box in funcBox.ToList())
                {
                    if (!stopBoxDraw)
                    {
                        box.Hide();
                    }
                }
                if (!stopBoxDraw)
                {
                    foreach (Sequence.feature feat in featurelist)
                    {
                        int     boxheight = size.Height / featurelist.Count();
                        int     boxwidth  = size.Width / 4;
                        TextBox txt;
                        if (funcBox.Count() >= done)
                        {
                            txt             = new TextBox();
                            txt.Multiline   = true;
                            txt.WordWrap    = true;
                            txt.AutoSize    = false;
                            txt.ScrollBars  = ScrollBars.Vertical;
                            txt.MouseEnter += new System.EventHandler(this.flicker_Off);
                            txt.MouseLeave += new System.EventHandler(this.flicker_On);
                        }
                        else
                        {
                            txt = funcBox[done];
                        }
                        txt.Text  = feat.name + "\r\n";
                        txt.Text += "-> Position: " + feat.start + "-" + feat.end + "\r\n";
                        txt.Text += feat.notes;
                        txt.Size  = new Size(boxwidth, (int)(boxheight * 0.8));
                        int featbox_x = size.Width - boxwidth;
                        int featbox_y = menuHeight + 15 + done * boxheight;
                        txt.Location = new Point(featbox_x, featbox_y);
                        if (funcBox.Count() >= done)
                        {
                            funcBox.Add(txt);
                            Controls.Add(txt);
                        }
                        else
                        {
                            txt.Show();
                        }

                        Pen myPen      = new Pen(SeqView.randColor(done));
                        int startWidth = size.Width * 3 / 5;
                        int linetop    = (feat.start < graphstart) ? 0 : feat.start - graphstart;
                        int linebot    = (feat.end >= graphstart + graphheight) ? graphheight : feat.end - graphstart + 1;
                        int x          = startWidth + done * 8;
                        int y1         = menuHeight + linetop * unitsize;
                        int y2         = menuHeight + linebot * unitsize;
                        e.Graphics.DrawLine(myPen, x, y1, x, y2);
                        e.Graphics.DrawLine(myPen, x, (y1 + y2) / 2, featbox_x, featbox_y + txt.Size.Height / 2);
                        myPen.Dispose();

                        done++;
                    }
                }
            }
        }