/// <summary> /// Constructor. /// </summary> public InputAnalysisInfo() { Files = new List<InputFile>(); BaselineFile = null; Database = new InputDatabase(); FactorFile = null; }
/// <summary> /// Constructor. /// </summary> public InputAnalysisInfo() { Files = new List <InputFile>(); BaselineFile = null; Database = new InputDatabase(); FactorFile = null; }
/// <summary> /// Loads a mass tag database. /// </summary> /// <param name="databaseDefinition"></param> /// <param name="options">Loading options.</param> /// <returns>The mass tag database.</returns> public static IMtdbLoader Create(InputDatabase databaseDefinition, MassTagDatabaseOptions options) { IMtdbLoader loader = null; switch (databaseDefinition.DatabaseFormat) { case MassTagDatabaseFormat.SkipAlignment: loader = new DriftTimeTextFileDatabaseLoader(databaseDefinition.LocalPath); break; case MassTagDatabaseFormat.MassTagSystemSql: loader = new MtsMassTagDatabaseLoader(databaseDefinition.DatabaseName, databaseDefinition.DatabaseServer, options); break; case MassTagDatabaseFormat.Sqlite: loader = new SQLiteMassTagDatabaseLoader(databaseDefinition.LocalPath, options); break; case MassTagDatabaseFormat.MtdbCreator: loader = new MtdbCreatorDatabaseLoader(databaseDefinition.LocalPath); break; case MassTagDatabaseFormat.DelimitedTextFile: loader = new MetaSampleDatbaseLoader(databaseDefinition.LocalPath, options); break; } return loader; }
/// <summary> /// Constructor. /// </summary> public AnalysisMetaData() { Datasets = new ObservableCollection<DatasetInformation>(); //new List<DatasetInformation>(); InputFileDefinition = null; ParameterFile = null; FactorTreeNode = null; Database = new InputDatabase(MassTagDatabaseFormat.None); }
/// <summary> /// Loads a mass tag database. /// </summary> /// <param name="databaseDefinition"></param> /// <param name="options">Loading options.</param> /// <returns>The mass tag database.</returns> public static MassTagDatabase LoadMassTagDatabase(InputDatabase databaseDefinition, MassTagDatabaseOptions options) { var loader = Create(databaseDefinition, options); if (loader == null) { throw new NullReferenceException("The type of mass tag database format is not supported: " + databaseDefinition.DatabaseFormat); } return loader.LoadDatabase(); }
public void TestLocalMtdbLoader(string path, MassTagDatabaseFormat format) { var input = new InputDatabase { DatabaseFormat = format, LocalPath = path }; var options = new MassTagDatabaseOptions(); var loader = MtdbLoaderFactory.Create(input, options); Assert.NotNull(loader); var database = loader.LoadDatabase(); Assert.NotNull(database); Assert.Greater(database.MassTags.Count, 100); }
public void TestLocalMtdbLoader(string path, MassTagDatabaseFormat format, int expectedNumberOfTargets) { var input = new InputDatabase { DatabaseFormat = format, LocalPath = path }; var options = new MassTagDatabaseOptions(); var loader = MtdbLoaderFactory.Create(input, options); Assert.NotNull(loader); var database = loader.LoadDatabase(); Assert.NotNull(database); Assert.AreEqual(database.MassTags.Count, expectedNumberOfTargets); }
public DmsDatabaseServerViewModel(InputDatabase server) { m_server = server; }
/// <summary> /// Handles the definitions of data rows. /// </summary> /// <param name="sender"></param> /// <param name="args"></param> public void HandleDataRow(object sender, MageDataEventArgs args) { if (!args.DataAvailable) { return; } var database = new InputDatabase(); database.DatabaseName = args.Fields[m_databaseNameColumn].ToString(); database.DatabaseServer = args.Fields[m_serverNameColumn].ToString(); database.Description = args.Fields[m_description].ToString(); database.Organism = args.Fields[m_organism].ToString(); database.Jobs = Convert.ToInt32(args.Fields[m_msmsJobs]); m_databases.Add(database); }
/// <summary> /// The main entry point for the application. /// </summary> static int Main(string[] args) { var handle = System.Diagnostics.Process.GetCurrentProcess().MainWindowHandle; SetConsoleMode(handle, ENABLE_EXTENDED_FLAGS); var clusterIdMap = new Dictionary<int, UMCClusterLight>(); try { if (args.Length < 2) { Console.WriteLine("MultiAlignSTACRunner crosstabDirectory databasePath outputName"); Console.WriteLine("\tThe cross-tab file will be named similar to the database path"); return 1; } // Setup the analysis processing Logger.PrintMessage("Find all datasets", true); var directoryPath = args[0].Replace("\r","").Replace("\n",""); var databasePath = args[1].Replace("\r","").Replace("\n",""); var name = args[2].Replace("\r","").Replace("\n",""); var files = Directory.GetFiles(directoryPath, "*.csv"); Logger.PrintMessage("Creating Log File"); var loggerPath = AnalysisPathUtils.BuildLogPath(Path.GetDirectoryName(name), Path.GetFileNameWithoutExtension(name)); Logger.LogPath = loggerPath; Logger.PrintMessage("Saving Log Data to: " + loggerPath); Logger.PrintMessage(string.Format("Creating STAC"), true); // Hardcode bad, but per discussions with OHSU var stac = new STACAdapter<UMCClusterLight> { Options = new FeatureMatcherParameters { UserTolerances = { MassTolerancePPM = 25, NETTolerance = .035, DriftTimeTolerance = 3 }, UseDriftTime = true } }; var clusterFilteringOptions = new FilteringOptions(); WriteOptionsToLogFile(clusterFilteringOptions); WriteOptionsToLogFile(stac.Options); // Read the cluster data var allClusters = new List<UMCClusterLight>(); var clusterId = 0; foreach (var file in files) { var filename = Path.GetFileName(file); Logger.PrintMessage(string.Format("Reading {0}", filename)); const string chargeString = "charge"; if (filename == null) continue; if (!filename.Contains(chargeString)) continue; // Read each file. var start = DateTime.Now; var xname = filename.Replace("_", ""); // ReSharper disable once StringIndexOfIsCultureSpecific.1 var indexOfChargeString = xname.IndexOf(chargeString); var charge = Convert.ToInt32(xname.Substring(indexOfChargeString + chargeString.Length, 1)); var clusters = ReadClusters(file, clusterFilteringOptions); var end = DateTime.Now; Logger.PrintMessage(string.Format("\tReading Took {0:.00} seconds", end.Subtract(start).TotalSeconds)); foreach (var cluster in clusters) { clusterIdMap.Add(clusterId, cluster); cluster.Id = clusterId++; cluster.ChargeState = charge; } allClusters.AddRange(clusters); } // Load the database Logger.PrintMessage(string.Format("Loading Mass Tag Database: {0}", Path.GetFileNameWithoutExtension(databasePath))); var options = new MassTagDatabaseOptions(); var databaseDefinition = new InputDatabase { DatabaseFormat = MassTagDatabaseFormat.Sqlite, LocalPath = databasePath }; var database = MtdbLoaderFactory.LoadMassTagDatabase(databaseDefinition, options); // Run stac try { Logger.PrintMessage("Matching clusters to peptides in mass tag database."); var matches = stac.PerformPeakMatching(allClusters, database); Logger.PrintMessage(string.Format("Writing Results To {0}", name)); var duplicateMatches = new Dictionary<int, Dictionary<int, FeatureMatchLight<UMCClusterLight, MassTagLight>>>(); foreach (var match in matches) { if (!duplicateMatches.ContainsKey(match.Observed.Id)) duplicateMatches.Add(match.Observed.Id, new Dictionary<int, FeatureMatchLight<UMCClusterLight, MassTagLight>>()); if (!duplicateMatches[match.Observed.Id].ContainsKey(match.Target.Id)) duplicateMatches[match.Observed.Id].Add(match.Target.Id, match); } WriteClusterData(name, duplicateMatches, clusterIdMap); Logger.PrintMessage("ANALYSIS SUCCESS"); return 0; } catch (Exception ex) { Logger.PrintMessage("Unhandled Error: " + ex.Message); var innerEx = ex.InnerException; while (innerEx != null) { Logger.PrintMessage("Inner Exception: " + innerEx.Message); innerEx = innerEx.InnerException; } Logger.PrintMessage("Stack: " + ex.StackTrace); Logger.PrintMessage(""); Logger.PrintMessage("ANALYSIS FAILED"); return 1; } } catch (Exception ex) { Logger.PrintMessage("Unhandled Error: " + ex.Message, true); var innerEx = ex.InnerException; while (innerEx != null) { Logger.PrintMessage("Inner Exception: " + innerEx.Message); innerEx = innerEx.InnerException; } Logger.PrintMessage("Stack: " + ex.StackTrace, true); Logger.PrintMessage(""); Logger.PrintMessage("ANALYSIS FAILED"); return 1; } }
/// <summary> /// Adds a database to the collection /// </summary> /// <param name="server"></param> public void AddDatabase(InputDatabase server) { var viewModel = new DmsDatabaseServerViewModel(server); Databases.Add(viewModel); FilteredDatabases.Add(viewModel); BuildOrganismsList(Databases); }