Ejemplo n.º 1
0
        static void WiffToSQLite()
        {
            string wiffPath   = @"C:\Work\primaqdev\testdata\C2 Sol SWATH4.wiff";
            string mzLitePath = Path.Combine(Path.GetDirectoryName(wiffPath), Path.GetFileNameWithoutExtension(wiffPath) + ".mzlite");
            string runID      = "sample=0";

            if (File.Exists(mzLitePath))
            {
                File.Delete(mzLitePath);
            }

            using (IMzLiteDataReader reader = new WiffFileReader(wiffPath))
                using (ITransactionScope inTxn = reader.BeginTransaction())
                    using (MzLiteSQL writer = new MzLiteSQL(mzLitePath))
                        using (ITransactionScope outTxn = writer.BeginTransaction())
                        {
                            foreach (var ms in reader.ReadMassSpectra(runID))
                            {
                                var peaks    = reader.ReadSpectrumPeaks(ms.ID);
                                var clonedMS = MzLiteJson.JsonCloneModelItem("#1", ms);
                                writer.Insert(runID, clonedMS, peaks);
                                break;
                            }

                            foreach (var ms in writer.ReadMassSpectra(runID))
                            {
                                var peaks = writer.ReadSpectrumPeaks(ms.ID);
                                var ms1   = writer.ReadMassSpectrum(ms.ID);
                                break;
                            }

                            outTxn.Commit();
                        }
        }
Ejemplo n.º 2
0
        static void SQLite()
        {
            string mzLitePath = @"C:\Work\primaqdev\testdata\test.mzlite";

            using (var writer = new MzLiteSQL(mzLitePath))
                using (var txn = writer.BeginTransaction())
                {
                }
        }
Ejemplo n.º 3
0
        static void SQLite()
        {
            string mzLitePath = @"C:\Work\primaqdev\testdata\test.mzlite";
            string runID      = "run_1";

            using (var reader = new MzLiteSQL(mzLitePath))
                using (ITransactionScope txn = reader.BeginTransaction())
                {
                    foreach (var ms in reader.ReadMassSpectra(runID))
                    {
                        var peaks = reader.ReadSpectrumPeaks(ms.ID);
                        Console.Out.WriteLine(ms.ID);
                    }
                }
        }
Ejemplo n.º 4
0
        static void WiffToSQLite()
        {
            string wiffPath   = @"C:\Work\primaqdev\testdata\Für Alex\20160212_MS_DHpsan006.wiff";
            string mzLitePath = Path.Combine(Path.GetDirectoryName(wiffPath), Path.GetFileNameWithoutExtension(wiffPath) + ".mzlite");
            string runID      = "sample=0";
            int    msLevel;

            if (File.Exists(mzLitePath))
            {
                File.Delete(mzLitePath);
            }

            using (IMzLiteDataReader reader = new WiffFileReader(wiffPath))
                using (ITransactionScope inTxn = reader.BeginTransaction())
                    using (MzLiteSQL writer = new MzLiteSQL(mzLitePath))
                        using (ITransactionScope outTxn = writer.BeginTransaction())
                        {
                            foreach (var ms in reader.ReadMassSpectra(runID))
                            {
                                if (ms.TryGetMsLevel(out msLevel) && msLevel != 1)
                                {
                                    continue;
                                }

                                var peaks = reader.ReadSpectrumPeaks(ms.ID);
                                //var clonedMS = MzLiteJson.JsonCloneModelItem("#1", ms);
                                //var max = peaks.Peaks.GroupBy(x => x.Intensity);

                                writer.Insert(runID, ms, peaks);
                                //break;
                            }

                            //foreach (var ms in writer.ReadMassSpectra(runID))
                            //{
                            //    var peaks = writer.ReadSpectrumPeaks(ms.ID);
                            //    var ms1 = writer.ReadMassSpectrum(ms.ID);
                            //    break;
                            //}

                            outTxn.Commit();
                        }
        }