Esempio n. 1
0
        public static PeptideFileAnalysisFrame ShowFileAnalysisForm <T>(PeptideFileAnalysis peptideFileAnalysis) where T : PeptideFileAnalysisForm
        {
            var analysisForm = PeptideAnalysisFrame.ShowPeptideAnalysis(peptideFileAnalysis.PeptideAnalysis);

            if (null == analysisForm)
            {
                return(null);
            }
            return(ActivatePeptideDataForm <T>(analysisForm.PeptideAnalysisSummary, peptideFileAnalysis));
        }
Esempio n. 2
0
 private void ShowPeptideAnalysis(Peptide peptide)
 {
     using (var session = Workspace.OpenSession())
     {
         var dbPeptide         = session.Load <DbPeptide>(peptide.Id);
         var dbPeptideAnalysis = (DbPeptideAnalysis)session
                                 .CreateCriteria(typeof(DbPeptideAnalysis))
                                 .Add(Restrictions.Eq("Peptide", dbPeptide))
                                 .UniqueResult();
         if (dbPeptideAnalysis == null)
         {
             var psmTimesByDataFileId = dbPeptide.PsmTimesByDataFileId(session);
             if (psmTimesByDataFileId.Count == 0)
             {
                 MessageBox.Show(
                     "This peptide cannot be analyzed because it has no search results.",
                     Program.AppName);
                 return;
             }
             if (MessageBox.Show("This peptide has not yet been analyzed.  Do you want to analyze it now?", Program.AppName, MessageBoxButtons.OKCancel) == DialogResult.Cancel)
             {
                 return;
             }
             session.BeginTransaction();
             session.Save(dbPeptideAnalysis = Peptide.CreateDbPeptideAnalysis(session, dbPeptide));
             foreach (var grouping in psmTimesByDataFileId)
             {
                 MsDataFile msDataFile;
                 if (!Workspace.MsDataFiles.TryGetValue(grouping.Key, out msDataFile))
                 {
                     continue;
                 }
                 session.Save(PeptideFileAnalysis.CreatePeptideFileAnalysis(
                                  session, msDataFile, dbPeptideAnalysis, psmTimesByDataFileId));
                 dbPeptideAnalysis.FileAnalysisCount++;
             }
             session.Update(dbPeptideAnalysis);
             session.Transaction.Commit();
         }
         var peptideAnalysis = TopographForm.Instance.LoadPeptideAnalysis(dbPeptideAnalysis.GetId());
         if (peptideAnalysis == null)
         {
             return;
         }
         PeptideAnalysisFrame.ShowPeptideAnalysis(peptideAnalysis);
     }
 }
Esempio n. 3
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex < 0)
            {
                return;
            }
            var row = dataGridView1.Rows[e.RowIndex];

            if (e.ColumnIndex == colPeptide.Index)
            {
                var peptideSequence = row.Cells[e.ColumnIndex].Value as string;
                if (string.IsNullOrEmpty(peptideSequence))
                {
                    return;
                }
                using (var session = Workspace.OpenSession())
                {
                    var peptideAnalysisIds =
                        session.CreateQuery(
                            "SELECT pa.Id FROM DbPeptideAnalysis pa WHERE pa.Peptide.Sequence = :sequence")
                        .SetParameter("sequence", Peptide.TrimSequence(peptideSequence))
                        .List();
                    if (peptideAnalysisIds.Count >= 0)
                    {
                        PeptideAnalysisFrame.ShowPeptideAnalysis(
                            TurnoverForm.Instance.LoadPeptideAnalysis((long)peptideAnalysisIds[0]));
                    }
                }
                return;
            }
            if (e.ColumnIndex == colProteinKey.Index)
            {
                var halfLifeForm = new HalfLifeForm(Workspace)
                {
                    Peptide     = Peptide.TrimSequence(Convert.ToString(row.Cells[colPeptide.Index].Value) ?? ""),
                    ProteinName = Convert.ToString(row.Cells[colProteinName.Index].Value),
                    MinScore    = double.Parse(tbxMinScore.Text),
                };
                halfLifeForm.Show(DockPanel, DockState);
            }
        }