예제 #1
0
    private void DrawPeptide(Graphics g, ArrayList RectArray)
    {
        Font Numberfont = new Font("Arial", 8, FontStyle.Regular);

        g.DrawString("Observed Peptides", Numberfont, Brushes.Black, new Point(MARGIN, AXISY + 15));
        //string strSQL = string.Format("select a.pp_relationship_seq,a.location,b.peptide_cop_id,b.sequence_length from pp_relation_tbl a, peptide_tbl b where b.peptide_cop_id= a.peptide_cop_id and a.location <> -1 and a.protein_cop_id='{0}'  order by a.location", ProteinID);
        //DBInterface.ConnectDB();
        //System.Data.Common.DbDataReader result = DBInterface.QuerySQL(strSQL);
        //int i = 0;
        //if (result != null)
        //{
        int j = 0;

        for (j = 0; j < RectArray.Count; j++)
        {
            PeptidesImageInfo.PepRectInfo rect = (PeptidesImageInfo.PepRectInfo)RectArray[j];

            //int location = result.GetInt32(1);
            //string pepid = result.GetString (2);
            //int length = result.GetInt32 (3);

            RectangleF pepRect = new RectangleF(rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top);
            g.DrawRectangle(new Pen(Brushes.Brown, 2), pepRect.X, pepRect.Y, pepRect.Width, pepRect.Height);
            //if (rect.bUnique)
            //    g.FillRectangle(Brushes.Green, pepRect);
            //else
            g.FillRectangle(Brushes.Yellow, pepRect);

            //g.DrawString(pepid, Numberfont, Brushes.Red, pepRect.Right+1 ,pepRect.Top-4 );
            //i += 1;
        }

        // }
    }
예제 #2
0
    private void QueryPeptides(string ProteinID)
    {
        string  PepIDURL = "<a href='PeptideInfo.aspx?QType=Peptide+ID&QValue={0}'>{1}</a>";
        string  strSQL   = string.Format("select a.peptide_sequence, a.peptide_sequence,b.prevaa,b.nextaa,a.Molecular_weight,b.location,a.Enzyme_Specificity from peptide_tbl a, pp_relation_tbl b where a.peptide_sequence = b.peptide_sequence and b.location<> -1 and b.protein_id='{0}' order by b.location", DBInterface.SQLValidString(ProteinID));
        DataSet result   = DBInterface.QuerySQL2(strSQL);

        if (result != null)
        {
            for (int j = 0; j < result.Tables[0].Rows.Count; j++)
            {
                TableRow  trCaption = new TableRow();
                TableCell tcPepID   = new TableCell();
                string    PeptideID = result.Tables[0].Rows[j].ItemArray[0].ToString();
                tcPepID.Text            = string.Format(PepIDURL, PeptideID, PeptideID);
                tcPepID.HorizontalAlign = HorizontalAlign.Left;
                trCaption.Cells.Add(tcPepID);
                TableCell tcPreAA = new TableCell();
                tcPreAA.Text            = result.Tables[0].Rows[j].ItemArray[2].ToString();
                tcPreAA.HorizontalAlign = HorizontalAlign.Center;
                trCaption.Cells.Add(tcPreAA);
                //TableCell tcSequence = new TableCell();
                //tcSequence.Text = result.Tables[0].Rows[j].ItemArray[1].ToString();
                //tcSequence.HorizontalAlign = HorizontalAlign.Left;
                //trCaption.Cells.Add(tcSequence);
                TableCell tcNextAA = new TableCell();
                tcNextAA.Text            = result.Tables[0].Rows[j].ItemArray[3].ToString();
                tcNextAA.HorizontalAlign = HorizontalAlign.Center;
                trCaption.Cells.Add(tcNextAA);
                TableCell tcMW = new TableCell();
                tcMW.Text            = result.Tables[0].Rows[j].ItemArray[4].ToString();
                tcMW.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcMW);
                TableCell tcFully = new TableCell();
                tcFully.Text            = result.Tables[0].Rows[j].ItemArray[5].ToString();
                tcFully.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcFully);
                TableCell tcEnzyme = new TableCell();
                tcEnzyme.Text            = result.Tables[0].Rows[j].ItemArray[6].ToString();
                tcEnzyme.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcEnzyme);
                tbPeptides.Rows.Add(trCaption);
            }

            lbDistinct_Peptides.Text = result.Tables[0].Rows.Count.ToString();
            imgPeptides.ImageUrl     = String.Format("ProSeqImage.aspx?PID={0}&L={1}&NO={2:F0}", ProteinID, lbSequence_Length.Text, result.Tables[0].Rows.Count);
            lbPeptideNumber.Text     = string.Format("Totals: {0:F0}", result.Tables[0].Rows.Count);
            try
            {
                PeptidesImageInfo PIF = new PeptidesImageInfo(ProteinID, int.Parse(lbSequence_Length.Text), result.Tables[0].Rows.Count);
                int       totalHeight = 0;
                ArrayList RectArray   = PIF.ComputeTheValues(ref totalHeight);
                int       j           = 0;
                for (j = 0; j < result.Tables[0].Rows.Count; j++)
                {
                    PeptidesImageInfo.PepRectInfo rect = (PeptidesImageInfo.PepRectInfo)RectArray[j];
                    RectangleHotSpot recthot           = new RectangleHotSpot();
                    recthot.Left          = rect.left;
                    recthot.Right         = rect.right;
                    recthot.Top           = rect.top;
                    recthot.Bottom        = rect.bottom;
                    recthot.NavigateUrl   = string.Format("PeptideInfo.aspx?QType=Peptide+ID&QValue={0}", rect.PepID);
                    recthot.AlternateText = string.Format("{0}-{1}, {2}", rect.Location, rect.Location + rect.Length, rect.Sequence);
                    imgPeptides.HotSpots.Add(recthot);
                }
            }
            catch (Exception ex)
            {
            }
        }
    }