예제 #1
0
        public bool LoadSettings(string FileLocation)
        {
            XmlSerializer mySerializer = null;
            FileStream    myFileStream = null;
            bool          fileExisits  = false;

            try
            {
                mySerializer = new XmlSerializer(typeof(SearchingParameters));
                FileInfo fi = new FileInfo(FileLocation);
                if (fi.Exists)
                {
                    myFileStream = fi.OpenRead();
                    SearchingParameters mySetting = (SearchingParameters)mySerializer.Deserialize(myFileStream);
                    this._bOnlyTop1             = mySetting.OnlyTop1;
                    this._DefaultPossibility    = mySetting.ConfidenceLevel;
                    this._DistinctPeptide       = mySetting.DistinctPeptide;
                    this._LibraryModule         = mySetting.LibraryModule;
                    this._PeptideTolerance      = mySetting.Peptidetolerance;
                    this._PTMShift              = mySetting.PTMShift;
                    this._ScoreCriteria         = mySetting.ScoreCriteria;
                    this._SlideSize             = mySetting.SlideSize;
                    this._UseNoiseLibrary       = mySetting.UseNoiseLibrary;
                    this._UseStatisticalMode    = mySetting.UseStatisticalMode;
                    this._PeptideToleranceHR    = mySetting.PeptideToleranceHR;
                    this._IsotopePeaks          = mySetting.IsotopePeaks;
                    this._HighResolution        = mySetting.HighResolution;
                    this._UniquePeptide         = mySetting.UniquePeptide;
                    this._bUsePTMModule         = mySetting.UsePTMModule;
                    this._PTMType               = mySetting.PTMType;
                    this._bCustomizedLibraryFDR = mySetting.CustomizedLibraryFDR;
                    this._LibraryFDR            = mySetting.LibraryFDR;
                    this.SettingChanged         = false;
                    fileExisits = true;
                }
            }
            catch (Exception ex)
            { }
            finally
            {
                if (myFileStream != null)
                {
                    myFileStream.Close();
                }
            }
            return(fileExisits);
        }
예제 #2
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";
        }
    }
예제 #3
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>.";
                }
            }
        }
    }
예제 #4
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));
    }
예제 #5
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;
    }