public BafFileReader(string bafFilePath) { if (string.IsNullOrWhiteSpace(bafFilePath)) { throw new ArgumentNullException("bafFilePath"); } if (!File.Exists(bafFilePath)) { throw new FileNotFoundException("Baf file not exists."); } this.bafFilePath = bafFilePath; try { sqlFilePath = Baf2SqlWrapper.GetSQLiteCacheFilename(bafFilePath); // First argument = 1, ignore contents of Calibrator.ami (if it exists) baf2SqlHandle = Baf2SqlWrapper.baf2sql_array_open_storage(1, bafFilePath); if (baf2SqlHandle == 0) { Baf2SqlWrapper.ThrowLastBaf2SqlError(); } linq2BafSql = new Linq2BafSql(sqlFilePath); model = MzLiteJson.HandleExternalModelFile(this, GetModelFilePath()); supportedVariables = SupportedVariablesCollection.ReadSupportedVariables(linq2BafSql); } catch (Exception ex) { throw new MzLiteIOException(ex.Message, ex); } }
public static SpectrumVariableCollection ReadSpectrumVariables(Linq2BafSql linq2BafSql, UInt64?spectrumId) { IEnumerable <BafSqlPerSpectrumVariable> variables = linq2BafSql.GetPerSpectrumVariables(linq2BafSql.Core, spectrumId); var col = new SpectrumVariableCollection(); foreach (var v in variables) { col.Add(v); } return(col); }
public static SupportedVariablesCollection ReadSupportedVariables(Linq2BafSql linq2BafSql) { var variables = linq2BafSql .SupportedVariables .ToArray() .Where(x => x.Variable.HasValue && string.IsNullOrWhiteSpace(x.PermanentName) == false); var col = new SupportedVariablesCollection(); foreach (var item in variables) { col.Add(item); } return(col); }