示例#1
0
    void LoadSearchingCondition(string TaskID)
    {
        string scLocation = WebConfigurationManager.ConnectionStrings["UploadPath"].ConnectionString + TaskID + "\\searchcondition.xml";

        this.con1.Text = scLocation;
        FileInfo fi = new FileInfo(scLocation);

        if (fi.Exists)
        {
            this.con3.Text = "enter";
            SearchingParameters mySP = new SearchingParameters(scLocation);
            if (mySP.HighResolution)
            {
                this.lbPeptideTolerance.Text = string.Format("{0}ppm consider {1} isotope peaks", mySP.PeptideToleranceHR, mySP.IsotopePeaks);
            }
            else
            {
                this.lbPeptideTolerance.Text = mySP.Peptidetolerance.ToString() + " Th (Da/e)";
            }
            this.lbSlideSize.Text = mySP.SlideSize.ToString();
            if (mySP.UseNoiseLibrary)
            {
                this.lbIsUsingNoiseDecoy.Text = "True";
            }
            else
            {
                this.lbIsUsingNoiseDecoy.Text = "False";
            }
            if (mySP.BonusDetaMz)
            {
                this.lbBonusms.Text = "True";
            }
            else
            {
                this.lbBonusms.Text = "False";
            }
            if (mySP.UseStatisticalMode)
            {
                this.lbThreshold.Text = string.Format("{0}%", mySP.ConfidenceLevel * 100);
            }
            else
            {
                this.lbThreshold.Text = mySP.ScoreCriteria;
            }
            this.lbPeptideNumber.Text = mySP.DistinctPeptide.ToString();
        }
        else
        {
            this.con3.Text = "fail";
        }
    }
示例#2
0
    int UpdateSearchConditionFile(string TaskID, float newPossibility)
    {
        string   scLocation = WebConfigurationManager.ConnectionStrings["UploadPath"].ConnectionString + TaskID + "\\searchcondition.xml";
        FileInfo fi         = new FileInfo(scLocation);

        if (fi.Exists)
        {
            SearchingParameters mySP = new SearchingParameters(scLocation);
            mySP.ConfidenceLevel = newPossibility / 100;
            mySP.SaveSettings(scLocation);
            return(mySP.DistinctPeptide);
        }
        return(1);
    }
示例#3
0
    void UpdateSearchingCondition(string TaskID, float confidence, int distinctPeptides, int UniquePeptides)
    {
        string   scLocation = WebConfigurationManager.ConnectionStrings["UploadPath"].ConnectionString + TaskID + "\\searchcondition.xml";
        FileInfo fi         = new FileInfo(scLocation);

        if (fi.Exists)
        {
            SearchingParameters mySP = new SearchingParameters(scLocation);
            mySP.ConfidenceLevel = confidence;
            mySP.DistinctPeptide = distinctPeptides;
            mySP.UniquePeptide   = UniquePeptides;
            mySP.SaveSettings();
        }
        COPaWS.COPaWS copaws = new COPaWS.COPaWS();
        if (copaws.ChangeCreteria(TaskID, this.lbmzML.Text.Replace("<br/>", "\r\n")))
        {
            Response.Redirect(string.Format("Report.aspx?TaskID={0}", TaskID));
        }
    }
示例#4
0
        public List<string> GetXmlsAfterSearch(string searchName, SearchingParameters searchingParameters, bool searchNone,
            bool searchAfter, bool searchBefore, bool searchBetween, DateTime dateFrom, DateTime dateTo)
        {
            List<string> xmlNames = new List<string>();

            foreach (XmlFile item in _xmlFilesList.Values)
            {
                if (searchName != "")
                {
                    if (item.Name == null || !item.Name.Contains(searchName))
                    {
                        continue;
                    }
                }

                if (searchingParameters.SearchingTagsIDs.Count > 0)
                {
                    bool containsAllTags = true;
                    foreach (int tagId in searchingParameters.SearchingTagsIDs)
                    {
                        bool fileContainsTag;

                        fileContainsTag = XmlManager.Instance.HasTagRelation(item.Id, tagId);

                        if (!fileContainsTag)
                        {
                            containsAllTags = false;
                            break;
                        }
                    }

                    if (!containsAllTags)
                    {
                        continue;
                    }
                }
                if (!searchNone)
                {
                    if (searchAfter && item.TimeStamp < dateFrom)
                    {
                        continue;
                    }
                    if (searchBefore && item.TimeStamp > dateFrom)
                    {
                        continue;
                    }
                    if (searchBetween)
                    {
                        if (item.TimeStamp < dateFrom || item.TimeStamp > dateTo)
                        {
                            continue;
                        }
                    }
                }
                bool fullfillAllParameters = true;
                foreach (ParameterSearchValue param in searchingParameters.Parameters)
                {
                    if (!item.CompareToParameterSearchValue(param))
                    {
                        fullfillAllParameters = false;
                        continue;
                    }
                }
                if (!fullfillAllParameters)
                {
                    continue;
                }
                xmlNames.Add(item.Name);
            }
            return xmlNames;
        }
示例#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>.";
                }
            }
        }
    }