/// <summary> /// If the object has already been loaded, it returns the typed, parsed object. If the object has not yet been loaded, it returns a base AssetsObject with unparsed data so that it's faster to write and doesn't pull in all the pointer refs /// </summary> public AssetsObject GetObjectForWrite() { if (_object != null) { return(_object); } lock (ParentFile) { using (var reader = ParentFile.GetReaderAtDataOffset()) { return(new AssetsObject(this, reader)); } } }
public DissociationType GetDissociationType() { if (_dissociationType == DissociationType.UnKnown) { if (ParentFile.IsOpen) { _dissociationType = ParentFile.GetDissociationType(SpectrumNumber); } else { throw new ArgumentException("The parent data file is closed"); } } return(_dissociationType); }
public virtual int GetPrecursorCharge() { if (_precursorCharge == 0) { if (ParentFile.IsOpen) { _precursorCharge = ParentFile.GetPrecusorCharge(SpectrumNumber, MsnOrder); } else { throw new ArgumentException("The parent data file is closed"); } } return(_precursorCharge); }
public DoubleRange GetIsolationRange() { if (_isolationRange == null) { if (ParentFile.IsOpen) { _isolationRange = ParentFile.GetIsolationRange(SpectrumNumber); } else { throw new ArgumentException("The parent data file is closed"); } } return(_isolationRange); }
public double GetPrecursorMz() { if (double.IsNaN(_precursorMz)) { if (ParentFile.IsOpen) { _precursorMz = ParentFile.GetPrecursorMz(SpectrumNumber, MsnOrder); } else { throw new ArgumentException("The parent data file is closed"); } } return(_precursorMz); }
public virtual double GetInjectionTime() { if (_injectionTime >= 0) { return(_injectionTime); } if (ParentFile.IsOpen) { _injectionTime = ParentFile.GetInjectionTime(SpectrumNumber); } else { throw new ArgumentException("The parent data file is closed"); } return(_injectionTime); }
public virtual int GetParentSpectrumNumber() { if (_parentScanNumber >= 0) { return(_parentScanNumber); } if (ParentFile.IsOpen) { _parentScanNumber = ParentFile.GetParentSpectrumNumber(SpectrumNumber); } else { throw new ArgumentException("The parent data file is closed"); } return(_parentScanNumber); }
public void StoreChanges() { byte[] Data = ParentFile.GetFileData(); Helpers.WriteString(ref Data, Offset, _Name, 8); Helpers.Overwrite32(ref Data, Offset + 0x08, _Parameters); Helpers.Overwrite32(ref Data, Offset + 0x0C, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.X), 0)); Helpers.Overwrite32(ref Data, Offset + 0x10, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Y), 0)); Helpers.Overwrite32(ref Data, Offset + 0x14, BitConverter.ToUInt32(BitConverter.GetBytes(_Position.Z), 0)); Helpers.Overwrite16(ref Data, Offset + 0x18, (ushort)(_Rotation.X * 182.04444444444444f)); Helpers.Overwrite16(ref Data, Offset + 0x1A, (ushort)(_Rotation.Y * 182.04444444444444f)); Helpers.Overwrite16(ref Data, Offset + 0x1C, (ushort)(_Rotation.Z * 182.04444444444444f)); Helpers.Overwrite16(ref Data, Offset + 0x1E, _Unknown); ParentFile.SetFileData(Data); }
private void LoadObject() { lock (ParentFile) { using (var reader = ParentFile.GetReaderAtDataOffset()) { try { _object = (T)Activator.CreateInstance(typeof(T), this, reader); } catch (System.MissingMethodException) { // Try with bool param _object = (T)Activator.CreateInstance(typeof(T), this, reader, false); } } } }
public override int GetHashCode() { return(ParentFile.GetHashCode() ^ SpectrumNumber); }
// TODO: kill DX80s/SWs? public ZipArchive GetZipArchive() { return(new(ParentFile.GetLumpStream(Paklump))); }
protected AirdInfo buildBasicInfo() { AirdInfo airdInfo = new AirdInfo(); List <DomainsCore.Aird.Software> softwares = new List <DomainsCore.Aird.Software>(); List <ParentFile> parentFiles = new List <ParentFile>(); //Basic Job Info airdInfo.airdPath = jobInfo.airdFilePath; airdInfo.fileSize = fileSize; airdInfo.createDate = new DateTime(); airdInfo.type = jobInfo.type; airdInfo.totalScanCount = msd.run.spectrumList.size(); airdInfo.creator = jobInfo.jobParams.creator; airdInfo.activator = activator; airdInfo.energy = energy; airdInfo.rtUnit = rtUnit; airdInfo.msType = msType; airdInfo.polarity = polarity; //Scan index and window range info airdInfo.rangeList = ranges; //Block index airdInfo.indexList = indexList; //Instrument Info List <Instrument> instruments = new List <Instrument>(); foreach (InstrumentConfiguration ic in msd.instrumentConfigurationList) { Instrument instrument = new Instrument(); //仪器设备信息 if (jobInfo.format.Equals("WIFF")) { instrument.manufacturer = "SCIEX"; } if (jobInfo.format.Equals("RAW")) { instrument.manufacturer = "THERMO"; } //设备信息在不同的源文件格式中取法不同,有些是在instrumentConfigurationList中获取,有些是在paramGroups获取,因此出现了以下比较丑陋的写法 if (ic.cvParams.Count != 0) { foreach (CVParam cv in ic.cvParams) { featuresMap.Add(cv.name, cv.value); } instrument.model = ic.cvParams[0].name; } else if (msd.paramGroups.Count != 0) { foreach (ParamGroup pg in msd.paramGroups) { if (pg.cvParams.Count != 0) { foreach (CVParam cv in pg.cvParams) { if (!featuresMap.ContainsKey(cv.name)) { featuresMap.Add(cv.name, cv.value.ToString()); } } instrument.model = pg.cvParams[0].name; } } } foreach (Component component in ic.componentList) { switch (component.type) { case ComponentType.ComponentType_Analyzer: foreach (CVParam cv in component.cvParams) { instrument.analyzer.Add(cv.name); } break; case ComponentType.ComponentType_Source: foreach (CVParam cv in component.cvParams) { instrument.source.Add(cv.name); } break; case ComponentType.ComponentType_Detector: foreach (CVParam cv in component.cvParams) { instrument.detector.Add(cv.name); } break; } } instruments.Add(instrument); } airdInfo.instruments = instruments; //Software Info foreach (Software soft in msd.softwareList) { DomainsCore.Aird.Software software = new DomainsCore.Aird.Software(); software.name = soft.id; software.version = soft.version; softwares.Add(software); } DomainsCore.Aird.Software airdPro = new DomainsCore.Aird.Software(); airdPro.name = SoftwareInfo.NAME; airdPro.version = SoftwareInfo.VERSION; airdPro.type = "DataFormatConversion"; softwares.Add(airdPro); airdInfo.softwares = softwares; //Parent Files Info foreach (SourceFile sf in msd.fileDescription.sourceFiles) { ParentFile file = new ParentFile(); file.name = sf.name; file.location = sf.location; file.formatType = sf.id; parentFiles.Add(file); } airdInfo.parentFiles = parentFiles; //Compressor Info List <Compressor> coms = new List <Compressor>(); //mz compressor Compressor mzCompressor = new Compressor(); if (jobInfo.jobParams.useStackZDPD()) { mzCompressor.addMethod(Compressor.METHOD_STACK); mzCompressor.digit = jobInfo.jobParams.digit; } mzCompressor.addMethod(Compressor.METHOD_PFOR); mzCompressor.addMethod(Compressor.METHOD_ZLIB); mzCompressor.target = Compressor.TARGET_MZ; mzCompressor.precision = (int)(Math.Ceiling(1 / jobInfo.jobParams.mzPrecision)); coms.Add(mzCompressor); //intensity compressor Compressor intCompressor = new Compressor(); if (jobInfo.jobParams.useStackZDPD()) { intCompressor.addMethod(Compressor.METHOD_STACK); intCompressor.digit = jobInfo.jobParams.digit; } if (jobInfo.jobParams.log2) { intCompressor.addMethod(Compressor.METHOD_LOG10); intCompressor.addMethod(Compressor.METHOD_ZLIB); } else { intCompressor.addMethod(Compressor.METHOD_ZLIB); } intCompressor.target = Compressor.TARGET_INTENSITY; intCompressor.precision = 10; //intensity默认精确到小数点后1位 coms.Add(intCompressor); airdInfo.compressors = coms; airdInfo.ignoreZeroIntensityPoint = jobInfo.jobParams.ignoreZeroIntensity; //Features Info featuresMap.Add(Features.raw_id, msd.id); featuresMap.Add(Features.ignore_zero_intensity, jobInfo.jobParams.ignoreZeroIntensity); featuresMap.Add(Features.source_file_format, jobInfo.format); featuresMap.Add(Features.byte_order, ByteOrder.LITTLE_ENDIAN); featuresMap.Add(Features.aird_algorithm, jobInfo.jobParams.getAirdAlgorithmStr()); airdInfo.features = FeaturesUtil.toString(featuresMap); airdInfo.version = SoftwareInfo.VERSION; airdInfo.versionCode = SoftwareInfo.VERSION_CODE; return(airdInfo); }