示例#1
0
 public MwtCalc(ref MwtWinDll.MolecularWeightCalculator objMwtWin, string sequence)
 {
     mMwtWin     = objMwtWin;
     bPeakHolder = null;
     yPeakHolder = null;
     TestAccessFunctions(sequence);
 }
示例#2
0
 private void button4_Click(object sender, EventArgs e)
 {
     try
     {
         string present_formula = name_modification(textBox_formula.Text);
         MwtWinDll.MolecularWeightCalculator objMwtWin = new MwtWinDll.MolecularWeightCalculator();
         try
         {
             textBox_mass.Text = objMwtWin.ComputeMass(Convert_formula(present_formula)).ToString();
         }
         catch { MessageBox.Show("Unable to read formula and calculate mass!"); }
         double exact_mass          = Convert.ToDouble(textBox_mass.Text);
         double estimated_diffusion = 140 * Math.Log(383 / exact_mass);
         textBox_difusion.Text = estimated_diffusion.ToString("0.00", CultureInfo.InvariantCulture);
     }
     catch
     {
     }
 }
示例#3
0
 public MwtCalc()
 {
     mMwtWin = new MwtWinDll.MolecularWeightCalculator();
 }
示例#4
0
        private void button_ApplyElement_Click(object sender, EventArgs e)
        {
            bool pokracuj = true;
            bool jetu     = false;

            foreach (Items Item in ItemColection)
            {
                if (Item.name == textBox_name.Text)
                {
                    jetu = true;
                }
            }
            if (jetu)
            {
                if (MessageBox.Show("Do you want to continue?", "Name already exist.",
                                    MessageBoxButtons.YesNo, MessageBoxIcon.Question)
                    == DialogResult.No)
                {
                    pokracuj = false;
                }
            }
            if (pokracuj)
            {
                if (jetu)
                {
                    Items removed_item = new Items();
                    foreach (Items Item in ItemColection)
                    {
                        if (Item.name == textBox_name.Text)
                        {
                            removed_item = Item;
                        }
                    }
                    ItemColection.Remove(removed_item);
                    listBox1.Items.Remove(removed_item);
                }
                Items new_item = new Items();
                new_item.name          = textBox_name.Text;
                new_item.formula       = name_modification(textBox_formula.Text);
                new_item.s_name        = name_modification(textBox_shortname.Text);
                new_item.concentration = Convertor(textBox_concentration.Text);
                new_item.mobility      = item_mobility;
                MwtWinDll.MolecularWeightCalculator objMwtWin = new MwtWinDll.MolecularWeightCalculator();
                try
                {
                    new_item.mass = objMwtWin.ComputeMass(Convert_formula(new_item.formula));
                }
                catch { MessageBox.Show("Unable to read formula and calculate mass!"); }
                new_item.diffusion = Convertor(textBox_difusion.Text);
                if (radioButton_cation.Checked)
                {
                    new_item.cation = true;
                }
                else
                {
                    new_item.cation    = false;
                    new_item.mobility  = new Constant(0.0, true);
                    new_item.diffusion = 0.0;
                }
                ItemColection.Add(new_item);
                this.listBox1.Items.Add(new_item);
            }
        }
示例#5
0
        static void Main(string[] args)
        {
            MwtWinDll.MolecularWeightCalculator objMwtWin;

            // Instantiate the Molecular Weight Calculator
            objMwtWin = new MwtWinDll.MolecularWeightCalculator();

            string sTestFormula;
            double dMass;

            // Set the element mode (average, monoisotopic, or integer)
            objMwtWin.SetElementMode(MwtWinDll.MWElementAndMassRoutines.emElementModeConstants.emAverageMass);

            // Can simply compute the mass of a formula using ComputeMass
            sTestFormula = "C6H6";
            dMass        = objMwtWin.ComputeMass(sTestFormula);

            Console.WriteLine("Mass of " + sTestFormula + " is " + dMass.ToString());
            Console.WriteLine();

            // If we want to do more complex operations, need to fill mMwtWin.Compound with valid info
            // Then, can read out values from it
            objMwtWin.Compound.SetFormula("Cl2PhH4OH");

            if (objMwtWin.Compound.ErrorDescription.Length > 0)
            {
                Console.WriteLine("Error: " + objMwtWin.Compound.ErrorDescription);
            }
            else
            {
                Console.WriteLine("Formula:           " + objMwtWin.Compound.FormulaCapitalized);
                Console.WriteLine("Expand Abbrev:     " + objMwtWin.Compound.ExpandAbbreviations());
                Console.WriteLine("Empirical Formula: " + objMwtWin.Compound.ConvertToEmpirical());
                // Console.WriteLine("FormulaRTF: " + objMwtWin.Compound.FormulaRTF);
                Console.WriteLine();
                Console.WriteLine("Mass:              " + objMwtWin.Compound.Mass);
                Console.WriteLine("Mass with StDev:   " + objMwtWin.Compound.MassAndStdDevString);
                Console.WriteLine();

                objMwtWin.Compound.SetFormula("Cl2PhH4OH");
                Console.WriteLine("Formula:            " + objMwtWin.Compound.FormulaCapitalized);
                Console.WriteLine("CautionDescription: " + objMwtWin.Compound.CautionDescription);
                Console.WriteLine();

                sTestFormula = "^13c2c4h6fe";

                objMwtWin.Compound.SetFormula(sTestFormula);
                Console.WriteLine(sTestFormula + " auto-capitalizes to " + objMwtWin.Compound.FormulaCapitalized);
                Console.WriteLine("Mass: " + objMwtWin.Compound.Mass);
            }

            Console.WriteLine();
            Console.WriteLine();

            clsFragSpecTest objFragTest = new clsFragSpecTest(ref objMwtWin);

            objFragTest.TestAccessFunctions();

            Console.WriteLine("Press any key to continue");
            Console.ReadKey(true);
        }
示例#6
0
 public clsFragSpecTest(ref MwtWinDll.MolecularWeightCalculator objMwtWin)
 {
     mMwtWin = objMwtWin;
 }
示例#7
0
 public clsFragSpecTest()
 {
     mMwtWin = new MwtWinDll.MolecularWeightCalculator();
 }