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(); } }
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); } } }