Esempio n. 1
0
    private void ListHistoryVersion()
    {
        string VersionIDURL = "<a href='WikiHistory.aspx?PageName={0}&VID={1}'>{1}</a>";
        string strSQL       = string.Format("select pagehistoryid,modifydate,modifiedby from wiki_pagehistory where pagename='{0}' order by modifydate desc", m_PageName);;
        //DBInterface.ConnectDB();
        IDataReader result = DBInterface.QuerySQL(strSQL);
        int         i      = 0;

        if (result != null)
        {
            while (result.Read())
            {
                TableRow trCaption = new TableRow();

                TableCell tcVersion = new TableCell();
                tcVersion.Text            = string.Format(VersionIDURL, m_PageName, result.GetValue(0).ToString());
                tcVersion.HorizontalAlign = HorizontalAlign.Left;
                trCaption.Cells.Add(tcVersion);

                TableCell tcVersionTime = new TableCell();
                tcVersionTime.Text            = result.GetDateTime(1).ToString("MM/dd/yy H:mm:ss zzz");
                tcVersionTime.HorizontalAlign = HorizontalAlign.Left;
                trCaption.Cells.Add(tcVersionTime);


                TableCell tcEditor = new TableCell();
                tcEditor.Text            = result.GetString(2);
                tcEditor.HorizontalAlign = HorizontalAlign.Left;
                trCaption.Cells.Add(tcEditor);

                if (i == 0 && m_VersionID == "")
                {
                    m_VersionID         = result.GetValue(0).ToString();
                    trCaption.BackColor = System.Drawing.Color.LightBlue;
                }
                else if (m_VersionID == result.GetValue(0).ToString())
                {
                    trCaption.BackColor = System.Drawing.Color.LightBlue;
                }
                tbVersionList.Rows.Add(trCaption);
                i += 1;
            }
            result.Close();
        }
        DBInterface.CloseDB();
    }
Esempio n. 2
0
    private void LoadVersionContent()
    {
        string strSQL = string.Format("select pagecontent from wiki_pagehistory where pagehistoryid='{0}' ", m_VersionID);;
        //DBInterface.ConnectDB();
        IDataReader result = DBInterface.QuerySQL(strSQL);

        if (result != null)
        {
            while (result.Read())
            {
                WikiTextFormatter wf = new WikiTextFormatter();
                litContent.Text = wf.FormatPageForDisplay(result.GetString(0));
            }
            result.Close();
        }
        DBInterface.CloseDB();
    }
Esempio n. 3
0
    private void GetPeptideFamily(string PeptideSeq)
    {
        string PepIDURL = "<a href='PeptideInfo.aspx?QType=Peptide+ID&QValue={0}'>{1}</a>";
        string strSQL   = string.Format("select p.peptide_cop_id,p.peptide_sequence,p.molecular_weight, t.score from peptide_tbl p,TABLE(blastp_match('{0}',cursor(select peptide_cop_id, peptide_sequence from peptide_tbl))) t where p.peptide_cop_id = t.T_SEQ_ID", PeptideSeq);
        //DBInterface.ConnectDB();
        IDataReader result = DBInterface.QuerySQL(strSQL);
        int         i      = 0;

        if (result != null)
        {
            while (result.Read())
            {
                TableRow  trCaption = new TableRow();
                TableCell tcPepID   = new TableCell();

                tcPepID.Text            = string.Format(PepIDURL, result.GetString(0), result.GetString(0));
                tcPepID.HorizontalAlign = HorizontalAlign.Left;
                trCaption.Cells.Add(tcPepID);

                TableCell tcSequence = new TableCell();
                tcSequence.Text            = result.GetString(1);
                tcSequence.HorizontalAlign = HorizontalAlign.Left;
                trCaption.Cells.Add(tcSequence);

                TableCell tcMW = new TableCell();
                tcMW.Text            = result.GetDouble(2).ToString();
                tcMW.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcMW);

                TableCell tcScore = new TableCell();
                tcScore.Text            = result.GetValue(3).ToString();
                tcScore.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcScore);

                tbPeptides.Rows.Add(trCaption);
                i += 1;
            }
            result.Close();
        }

        DBInterface.CloseDB();
    }
Esempio n. 4
0
    private void LoadNewPages()
    {
        string PageNameURL = "<a href='COPaWikiDefault.aspx?PageName={0}'>{0}</a>";
        //string strSQL = "select * from (select a.pagename,a.lastmodified,a.modifiedby from wiki_pages a where ((a.pagename like '%%') order by lastmodified desc) where rownum<10";
        string strSQL = "select * from (select a.pagename, a.lastmodified, a.modifiedby from wiki_pages a where not regexp_like(a.pagename, '^([A-Z0-9]{6}(-[0-9]+)?|[0-9]+|[A-Z]+)$') order by a.lastmodified desc) where rownum < 10";

        if (DBInterface.DbType == "MySql")
        {
            strSQL = "select a.pagename,a.lastmodified,a.modifiedby from wiki_pages a where  not ((a.pagename like 'CoPro%' or a.pagename like 'CoPep%'  ) and length(a.pagename)=13)   order by lastmodified desc limit 10";
        }
        //DBInterface.ConnectDB();
        IDataReader result = DBInterface.QuerySQL(strSQL);
        int         i      = 0;

        if (result != null)
        {
            while (result.Read())
            {
                TableRow trCaption = new TableRow();

                TableCell tcPagename = new TableCell();
                tcPagename.Text            = string.Format(PageNameURL, result.GetString(0));
                tcPagename.HorizontalAlign = HorizontalAlign.Left;
                trCaption.Cells.Add(tcPagename);



                TableCell tcLastModifiedTime = new TableCell();
                tcLastModifiedTime.Text            = result.GetDateTime(1).ToLongDateString();
                tcLastModifiedTime.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcLastModifiedTime);

                TableCell tcEditor = new TableCell();
                tcEditor.Text            = result.GetString(2);
                tcEditor.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcEditor);


                tbNewPages.Rows.Add(trCaption);
                i += 1;
            }
            result.Close();
        }

        string ProteinIDURL = "<a href='ProteinInfo.aspx?QType=Protein+ID&QValue={0}'>{1}</a>";

        strSQL = "select * from (select a.pagename,b.protein_name,a.lastmodified,a.modifiedby from wiki_pages a, protein_tbl b where trim(b.protein_cop_id) = trim(a.pagename)  order by lastmodified desc) where rownum<10";
        if (DBInterface.DbType == "MySql")
        {
            strSQL = "select a.pagename,b.protein_name,a.lastmodified,a.modifiedby from wiki_pages a, protein_tbl b where  a.pagename like 'IPI%' and trim(b.protein_cop_id) = trim(a.pagename)  order by lastmodified desc limit 10";
        }

        //DBInterface.ConnectDB();
        result = DBInterface.QuerySQL(strSQL);

        if (result != null)
        {
            while (result.Read())
            {
                TableRow trCaption = new TableRow();

                TableCell tcPagename = new TableCell();
                tcPagename.Text            = string.Format(ProteinIDURL, result.GetString(0), result.GetString(0));
                tcPagename.HorizontalAlign = HorizontalAlign.Left;
                trCaption.Cells.Add(tcPagename);

                TableCell tcLastModifiedTime = new TableCell();
                tcLastModifiedTime.Text            = result.GetDateTime(2).ToLongDateString();
                tcLastModifiedTime.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcLastModifiedTime);

                TableCell tcEditor = new TableCell();
                tcEditor.Text            = result.GetString(3);
                tcEditor.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcEditor);


                tbProteinPages.Rows.Add(trCaption);
            }
            result.Close();
        }

        string PeptideIDURL = "<a href='PeptideInfo.aspx?QType=Peptide+ID&QValue={0}'>{1}</a>";

        strSQL = "select * from (select a.pagename,b.peptide_sequence,a.lastmodified,a.modifiedby from wiki_pages a, peptide_tbl b where  trim(b.peptide_sequence) = trim(a.pagename)  order by lastmodified desc) where rownum<10";
        if (DBInterface.DbType == "MySql")
        {
            strSQL = "select a.pagename,b.peptide_sequence,a.lastmodified,a.modifiedby from wiki_pages a, peptide_tbl b where  a.pagename like 'CoPep%' and trim(b.peptide_cop_id) = trim(a.pagename) order by lastmodified desc limit 10";
        }

        result = DBInterface.QuerySQL(strSQL);

        if (result != null)
        {
            while (result.Read())
            {
                TableRow trCaption = new TableRow();

                TableCell tcPagename = new TableCell();
                tcPagename.Text            = string.Format(PeptideIDURL, result.GetString(0), result.GetString(0));
                tcPagename.HorizontalAlign = HorizontalAlign.Left;
                trCaption.Cells.Add(tcPagename);

                TableCell tcLastModifiedTime = new TableCell();
                tcLastModifiedTime.Text            = result.GetDateTime(2).ToLongDateString();
                tcLastModifiedTime.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcLastModifiedTime);

                TableCell tcEditor = new TableCell();
                tcEditor.Text            = result.GetString(3);
                tcEditor.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcEditor);


                tbPeptidePages.Rows.Add(trCaption);
            }
            result.Close();
        }


        string SpectrumURL = "<a href='SpectrumInfo.aspx?QValue={0}' Target='_blank'>{0}</a>";

        strSQL = "select a.pagename,b.instrumentation,a.lastmodified,a.modifiedby from wiki_pages a, spectrum_tbl b where to_char(b.spectrum_seq) = a.pagename and rownum < 10 order by lastmodified desc";
        if (DBInterface.DbType == "MySql")
        {
            strSQL = "select a.pagename,b.instrumentation,a.lastmodified,a.modifiedby from wiki_pages a, spectrum_tbl b where to_char(b.spectrum_seq) = a.pagename order by lastmodified desc limit 10";
        }

        result = DBInterface.QuerySQL(strSQL);

        if (result != null)
        {
            while (result.Read())
            {
                TableRow trCaption = new TableRow();

                TableCell tcPagename = new TableCell();
                tcPagename.Text            = string.Format(SpectrumURL, result.GetString(0));
                tcPagename.HorizontalAlign = HorizontalAlign.Left;
                trCaption.Cells.Add(tcPagename);

                TableCell tcLastModifiedTime = new TableCell();
                tcLastModifiedTime.Text            = result.GetDateTime(2).ToLongDateString();
                tcLastModifiedTime.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcLastModifiedTime);

                TableCell tcEditor = new TableCell();
                tcEditor.Text            = result.GetString(3);
                tcEditor.HorizontalAlign = HorizontalAlign.Right;
                trCaption.Cells.Add(tcEditor);


                tbSpectrumPages.Rows.Add(trCaption);
            }

            result.Close();
        }

        DBInterface.CloseDB();
    }
Esempio n. 5
0
    protected void btUpload_Click(object sender, EventArgs e)
    {
        //if (this.tbUserID.Text == "")
        //{
        //    this.lbEmailMessage1.Text = "Required field.";
        //    return;
        //}
        //else
        //    this.lbEmailMessage1.Text = "*";

        if (!this.RegularExpressionValidator2.IsValid || !this.RegularExpressionValidator1.IsValid)
        {
            return;
            //validation group for mzMl or raw file
        }

        if (!cbUseURL.Checked && !this.InputFile1.HasFile)
        {
            return;
        }
        if (cbUseURL.Checked && this.tbURL.Text == "")
        {
            this.lbMessage.Text = "You need to upload a local file or provide the URL of a file in the web.";
            return;
        }

        string FileName       = "";
        string SingleFileName = "";

        if (cbUseURL.Checked)
        {
            FileName       = this.tbURL.Text;
            SingleFileName = FileName.Substring(FileName.LastIndexOf("/") + 1);
        }
        else
        {
            FileName       = this.InputFile1.FileName;
            SingleFileName = FileName;
        }



        string strSQL        = "insert into search_task (task_user,upload_filename,search_model,report_filename) values ('{0}','{1}','{2}','{3}')";
        string strReportName = SingleFileName.Substring(0, SingleFileName.LastIndexOf(".")) + ".txt";

        strSQL = string.Format(strSQL, DBInterface.SQLValidString(this.tbUserID.Text), DBInterface.SQLValidString(FileName), this.ddlModels.Text, DBInterface.SQLValidString(strReportName));
        //DBInterface.ConnectDB();
        string taskID = "";

        if (DBInterface.UpdateSQL(strSQL) > 0)
        {
            strSQL = "select task_seq from search_task where task_user='******' and  upload_filename = '{1}' order by task_seq desc";
            strSQL = string.Format(strSQL, DBInterface.SQLValidString(this.tbUserID.Text), DBInterface.SQLValidString(FileName));
            IDataReader result = DBInterface.QuerySQL(strSQL);
            if (result != null)
            {
                result.Read();
                taskID = result.GetValue(0).ToString();
            }
            DBInterface.CloseDB();
            string UploadPath = WebConfigurationManager.ConnectionStrings["UploadPath"].ConnectionString + taskID + "\\";

            DirectoryInfo newpath = new DirectoryInfo(UploadPath);
            if (!newpath.Exists)
            {
                newpath.Create();
            }
            if (!cbUseURL.Checked)
            {
                string TargeFile = UploadPath + FileName;
                this.InputFile1.MoveTo(TargeFile, Brettle.Web.NeatUpload.MoveToOptions.Overwrite);
            }
            //***save the searching conditions in files***
            SearchingParameters mySP = new SearchingParameters();
            if (cbUseDefault.Checked)
            {
                mySP.ConfidenceLevel      = 0.95F;
                mySP.DistinctPeptide      = 1;
                mySP.LibraryModule        = this.ddlModels.Text;
                mySP.OnlyTop1             = true;
                mySP.Peptidetolerance     = 2;
                mySP.PTMShift             = 0;
                mySP.SlideSize            = 1;
                mySP.ScoreCriteria        = "|0;-1";
                mySP.UseNoiseLibrary      = true;
                mySP.UseStatisticalMode   = true;
                mySP.HighResolution       = false;
                mySP.PeptideToleranceHR   = 20;
                mySP.IsotopePeaks         = 2;
                mySP.BonusDetaMz          = false;
                mySP.CustomizedLibraryFDR = false;
                mySP.UniquePeptide        = 0;
                mySP.UsePTMModule         = false;
            }
            else
            {
                try
                {
                    mySP.ConfidenceLevel = float.Parse(this.ddl_Threshold.Text.Substring(0, this.ddl_Threshold.Text.Length - 1)) / 100;
                    if (mySP.ConfidenceLevel >= 1 || mySP.ConfidenceLevel <= 0)
                    {
                        lbMessage.Text = "The peptide confidence should be set in the range 0%-100%.";
                        return;
                    }
                }
                catch
                {
                    lbMessage.Text = "The peptide confidence setting is out of range.";
                    return;
                }
                mySP.DistinctPeptide  = int.Parse(this.ddl_DistinctPepties.Text);      // sc.DistinctPeptide;
                mySP.UniquePeptide    = int.Parse(this.ddl_UniquePeptides.Text);
                mySP.LibraryModule    = this.ddlModels.Text;                           // GetModuleName(sc.searchModule);
                mySP.OnlyTop1         = true;                                          // sc.bOnlyTop1;
                mySP.Peptidetolerance = float.Parse(this.ddl_PrecursorTolerance.Text); //sc.fPrecursorWindow;
                mySP.PTMShift         = float.Parse(this.ddl_PTMshift.Text);           // sc.fPTMShift;
                string Criterias = "|0;-1";
                //foreach (SearchingThreadPair stp in sc.NormalSearchCondition)
                //{
                //    Criterias += string.Format("|{0};{1}", stp.MatchScore, stp.DetaDecoyScore);
                //}
                mySP.ScoreCriteria        = Criterias;
                mySP.SlideSize            = int.Parse(this.ddl_SlideSize.Text); // sc.iSlideSize;
                mySP.UseNoiseLibrary      = this.cbUseNDP.Checked;              // sc.bUseNoiseLibrary;
                mySP.UseStatisticalMode   = true;                               // sc.bStatisticSearching;
                mySP.HighResolution       = this.cbHighResolution.Checked;
                mySP.PeptideToleranceHR   = float.Parse(this.ddlHRPrecursorTolerance.Text);
                mySP.IsotopePeaks         = int.Parse(this.ddlIsotopePeaks.Text);
                mySP.BonusDetaMz          = this.cbBonusMS.Checked;
                mySP.CustomizedLibraryFDR = false;
                mySP.UsePTMModule         = false;
            }
            string sclocation = UploadPath + "searchcondition.xml";
            mySP.SaveSettings(sclocation);
            //*****************************************
            strSQL = "update search_task set task_status=1 where task_seq=" + taskID;
            if (DBInterface.UpdateSQL(strSQL) > 0)
            {
                if (cbUseURL.Checked)
                {
                    informationShow.Text = @"<div id='helpNote' class='collapse'>";
                    informationBtn.Text  = @"<button type='button' class='close button collapsed' data-toggle='collapse' data-target='#helpNote'>&times;</button>";
                    lbMessage.Text       = "You URL resource has been submitted. The task ID is <a href=\"SearchReport.aspx?QType=" + this.tbUserID.Text + "&QValue=" + taskID + "\" style=\"font-size: large; color: #FF0000\" >" + taskID + "</a>.";
                    //this.cbUseURL.Checked = false;
                }
                else
                {
                    lbMessage.Text = "You mzML file has been successfully uploaded. The  task ID is <a href=\"SearchReport.aspx?QType=" + this.tbUserID.Text + "&QValue=" + taskID + "\" style=\"font-size: large; color: #FF0000\" >" + taskID + "</a>.";
                }
            }
        }
    }