Ejemplo n.º 1
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (currentThread != null)
     {
         if (currentThread.IsAlive)
         {
             currentThread.Abort();
         }
     }
     if (currRawFile != null)
     {
         currRawFile.ClearCachedScans();
         currRawFile.Dispose();
     }
     if (currFDM != null)
     {
         currFDM.Dispose();
         currFDM = null;
     }
     if (conn != null)
     {
         conn.Close();
         conn.Dispose();
     }
     //this.Close();
 }
Ejemplo n.º 2
0
 private void GroupFeatures()
 {
     if (currIndex < allRawFileNames.Count)
     {
         var currRawFileString = allRawFileNames[currIndex];
         currRawFile = new ThermoRawFile(currRawFileString);
         currRawFile.Open();
         var path = outputTextBox.Text + "\\" + currRawFile.Name + "_ExtractedFeatures.gcfeat";
         conn = new SQLiteConnection(@"Data Source=" + path);
         conn.Open();
         rawFileListBox.ClearSelected();
         rawFileListBox.SelectedIndex = currIndex;
         if (!SQLiteIOMethods.IsGroupingDone(conn))
         {
             currFDM           = new FeatureDetectionMethods(currRawFile);
             statusLabel.Text  = "Grouping Features from " + currRawFile.Name + "...";
             currFDM.Finished += grouping_Finished;
             //currentThread = new Thread(() => currFDM.GroupFeatures(conn));
             //currentThread.Start();
         }
         else
         {
             currIndex++;
             double percent = ((double)currIndex) / ((double)allRawFileNames.Count) * 100;
             statusBar.Value = (int)percent;
             GroupFeatures();
         }
     }
     else
     {
         currRawFile.ClearCachedScans();
         currRawFile.Dispose();
         if (conn != null)
         {
             conn.Close();
             conn.Dispose();
         }
         conn = null;
         if (currFDM != null)
         {
             currFDM.Dispose();
             currFDM = null;
         }
         GC.Collect();
         rawFileListBox.ClearSelected();
         foreach (Control control in this.Controls)
         {
             control.Enabled = true;
         }
         statusBar.Value  = 100;
         statusLabel.Text = "Done!";
     }
 }
Ejemplo n.º 3
0
 private void deconvolution_Finished(object sender, EventArgs e)
 {
     if (InvokeRequired)
     {
         Invoke(new Action <object, EventArgs>(deconvolution_Finished), sender, e);
         return;
     }
     statusBar.Value = (int)0;
     currRawFile.ClearCachedScans();
     currRawFile.Dispose();
     conn.Close();
     conn.Dispose();
     conn              = null;
     currFDM.Finished -= deconvolution_Finished;
     currFDM.Progress -= deconvolution_Progress;
     currFDM.Dispose();
     currFDM = null;
     GC.Collect();
     currIndex++;
     extractFeatures();
 }
Ejemplo n.º 4
0
        private void grouping_Finished(object sender, EventArgs e)
        {
            if (InvokeRequired)
            {
                Invoke(new Action <object, EventArgs>(grouping_Finished), sender, e);
                return;
            }
            statusBar.Value = (int)0;
            currRawFile.ClearCachedScans();
            currRawFile.Dispose();
            conn.Close();
            conn.Dispose();
            conn              = null;
            currFDM.Finished -= grouping_Finished;
            currFDM.Dispose();
            currFDM = null;
            GC.Collect();
            double percent = ((double)currIndex) / ((double)allRawFileNames.Count) * 100;

            statusBar.Value = (int)percent;
            currIndex++;
            GroupFeatures();
        }
Ejemplo n.º 5
0
        private void extractFeatures()
        {
            if (currIndex < allRawFileNames.Count)
            {
                var currRawFileString = allRawFileNames[currIndex];
                currRawFile = new ThermoRawFile(currRawFileString);
                currRawFile.Open();
                var path = outputTextBox.Text + "\\" + currRawFile.Name + "_ExtractedFeatures.gcfeat";
                conn = new SQLiteConnection(@"Data Source=" + path);
                conn.Open();
                rawFileListBox.ClearSelected();
                rawFileListBox.SelectedIndex = currIndex;
                this.Text = currIndex + "\\" + allRawFileNames.Count + " Deconvolved...";
                if (!SQLiteIOMethods.IsExtractionDone(conn))
                {
                    currFDM           = new FeatureDetectionMethods(currRawFile);
                    statusLabel.Text  = "Adding Features from " + currRawFile.Name + " to Database...";
                    currFDM.Progress += deconvolution_Progress;
                    currFDM.Finished += deconvolution_Finished;
                    currentThread     = new Thread(() => currFDM.StepwiseSetupFinalGroups(currRawFile, conn));
                    currentThread.Start();
                }
                else
                {
                    conn.Close();
                    conn.Dispose();
                    currRawFile.Dispose();
                    currIndex++;
                    extractFeatures();
                }
            }
            else
            {
                currIndex = 0;
                //statusBar.Value = 0;
                //statusLabel.Text = "Starting Feature Grouping...";
                //GroupFeatures();

                currRawFile.ClearCachedScans();
                currRawFile.Dispose();
                if (conn != null)
                {
                    conn.Close();
                    conn.Dispose();
                }
                conn = null;
                if (currFDM != null)
                {
                    currFDM.Dispose();
                    currFDM = null;
                }
                GC.Collect();
                rawFileListBox.ClearSelected();
                foreach (Control control in this.Controls)
                {
                    control.Enabled = true;
                }
                statusBar.Value  = 100;
                statusLabel.Text = "Done!";
                this.Text        = "Deconvolution Engine";
            }
        }