/// <summary> /// Constructor - basic initialization /// </summary> /// <param name="createTranslator">If the default CV list should be used for the file</param> public IdentDataObj(bool createTranslator = true) { Id = null; Name = null; Version = "1.1.0"; CreationDateSpecified = false; CreationDate = DateTime.Now; //this.CvTranslator = new CVTranslator(); // Create a generic translator by default; must be re-mapped when reading a file CvTranslator = null; CVList = new IdentDataList <CVInfo>(1); if (createTranslator) { //this.CvTranslator = new CVTranslator(); // Create a generic translator by default; must be re-mapped when reading a file DefaultCV(); // Create a generic translator by default; must be re-mapped when reading a file } AnalysisSoftwareList = new IdentDataList <AnalysisSoftwareObj>(1); _provider = null; AuditCollection = new IdentDataList <AbstractContactObj>(1); AnalysisSampleCollection = new IdentDataList <SampleObj>(1); _sequenceCollection = null; _analysisCollection = null; _analysisProtocolCollection = null; _dataCollection = null; BibliographicReferences = new IdentDataList <BibliographicReferenceObj>(1); }
/// <summary> /// Set the default CV lists for CV term reference and mapping /// </summary> public void DefaultCV() { CVList = new IdentDataList <CVInfo>(); foreach (var cv in CV.CV.CVInfoList) { if (cv.Id.ToLower() == "pato") { continue; } var newcv = new CVInfo { FullName = cv.Name, Id = cv.Id, URI = cv.URI, Version = cv.Version }; CVList.Add(newcv); } CvTranslator = new CVTranslator(CVList); }
/// <summary> /// Create an IdentDataObj directly from an MzIdentMLType object - fully cascades for the entire contents of /// MzIdentMLType /// </summary> /// <param name="mzid"></param> public IdentDataObj(MzIdentMLType mzid) { Id = mzid.id; Name = mzid.name; Version = mzid.version; _creationDate = mzid.creationDate; CreationDateSpecified = mzid.creationDateSpecified; CvTranslator = new CVTranslator(); _cvList = null; _analysisSoftwareList = null; _provider = null; _auditCollection = null; _analysisSampleCollection = null; _sequenceCollection = null; _analysisCollection = null; _analysisProtocolCollection = null; _dataCollection = null; _bibliographicReferences = null; CVList = new IdentDataList <CVInfo>(1); BibliographicReferences = new IdentDataList <BibliographicReferenceObj>(1); AuditCollection = new IdentDataList <AbstractContactObj>(1); AnalysisSampleCollection = new IdentDataList <SampleObj>(1); AnalysisSoftwareList = new IdentDataList <AnalysisSoftwareObj>(1); // Referenced by anything using CV/User params if (mzid.cvList?.Count > 0) { CVList.AddRange(mzid.cvList, cv => new CVInfo(cv, this)); CvTranslator = new CVTranslator(_cvList); } // Referenced by nothing if (mzid.BibliographicReference?.Count > 0) { BibliographicReferences.AddRange(mzid.BibliographicReference, br => new BibliographicReferenceObj(br, this)); } // Referenced by anything using organization, person, contactRoleInfo - SampleInfo, ProviderInfo, AnalysisSoftwareInfo if (mzid.AuditCollection?.Count > 0) { AuditCollection.AddRange(mzid.AuditCollection, ac => { if (ac is PersonType p) { return(new PersonObj(p, this)); } if (ac is OrganizationType o) { return(new OrganizationObj(o, this)); } return(null); }); } // Referenced by anything using SampleInfo: SubSample, SpectrumIdentificationItem if (mzid.AnalysisSampleCollection?.Count > 0) { AnalysisSampleCollection.AddRange(mzid.AnalysisSampleCollection, asc => new SampleObj(asc, this)); } // Referenced by ProviderInfo, ProteinDetectionProtocol, SpectrumIdentificationProtocol, references AbstractContactInfo through ContactRoleInfo if (mzid.AnalysisSoftwareList?.Count > 0) { AnalysisSoftwareList.AddRange(mzid.AnalysisSoftwareList, asl => new AnalysisSoftwareObj(asl, this)); } // Referenced by nothing, references AnalysisSoftwareInfo if (mzid.Provider != null) { _provider = new ProviderObj(mzid.Provider, this); } // Referenced by SpectrumIdentification, ProteinDetection, SpectrumIdentificationItem, PeptideEvidence, references AnalysisSoftwareInfo if (mzid.AnalysisProtocolCollection != null) { _analysisProtocolCollection = new AnalysisProtocolCollectionObj(mzid.AnalysisProtocolCollection, this); } // InputsInfo referenced by DBSequence, SpectrumIdentification.SearchDatabaseRefInfo, SpectrumIdentificationResult, SpectrumIdentification.InputSpectraRef if (mzid.DataCollection != null) { //this._dataCollection = new DataCollection(mzid.DataCollection, this); _dataCollection = new DataCollectionObj { Inputs = new InputsObj(mzid.DataCollection.Inputs, this) }; } // Referenced by SpectrumIdentificationItem, ProteinDetectionHypothesis, PeptideHypothesis // References InputsInfo.DBSequence, AnalysisProtocolCollection.SoftwareIdentificationProtocol.DatabaseTranslation.TranslationTable if (mzid.SequenceCollection != null) { _sequenceCollection = new SequenceCollectionObj(mzid.SequenceCollection, this); } // AnalysisData referenced by SpectrumIdentification, InputSpectrumIdentifications, ProteinDetection, references Peptides, PeptideEvidence, SampleInfo, MassTable, if (mzid.DataCollection != null && _dataCollection != null) { _dataCollection.AnalysisData = new AnalysisDataObj(mzid.DataCollection.AnalysisData, this); } // References SpectrumIdentificationProtocol, SpectrumIdentificationList, SpectraData, SearchDatabaseInfo, ProteinDetectionList, ProteinDetectionProtocol if (mzid.AnalysisCollection != null) { _analysisCollection = new AnalysisCollectionObj(mzid.AnalysisCollection, this); } // Reduce memory footprint by removing IdentDataList IdMaps that are created during the translation process SequenceCollection?.DBSequences?.RemoveIdMap(); SequenceCollection?.PeptideEvidences?.RemoveIdMap(); SequenceCollection?.Peptides?.RemoveIdMap(); }
/// <summary> /// Create an IdentDataObj directly from an MzIdentMLType object - fully cascades for the entire contents of /// MzIdentMLType /// </summary> /// <param name="mzid"></param> public IdentDataObj(MzIdentMLType mzid) { Id = mzid.id; Name = mzid.name; Version = mzid.version; _creationDate = mzid.creationDate; CreationDateSpecified = mzid.creationDateSpecified; CvTranslator = new CVTranslator(); _cvList = null; _analysisSoftwareList = null; _provider = null; _auditCollection = null; _analysisSampleCollection = null; _sequenceCollection = null; _analysisCollection = null; _analysisProtocolCollection = null; _dataCollection = null; _bibliographicReferences = null; // Referenced by anything using CV/User params if (mzid.cvList != null && mzid.cvList.Count > 0) { CVList = new IdentDataList <CVInfo>(); foreach (var cv in mzid.cvList) { CVList.Add(new CVInfo(cv, this)); } CvTranslator = new CVTranslator(_cvList); } // Referenced by nothing if (mzid.BibliographicReference != null && mzid.BibliographicReference.Count > 0) { BibliographicReferences = new IdentDataList <BibliographicReferenceObj>(); foreach (var br in mzid.BibliographicReference) { BibliographicReferences.Add(new BibliographicReferenceObj(br, this)); } } // Referenced by anything using organization, person, contactRoleInfo - SampleInfo, ProviderInfo, AnalysisSoftwareInfo if (mzid.AuditCollection != null && mzid.AuditCollection.Count > 0) { AuditCollection = new IdentDataList <AbstractContactObj>(); foreach (var ac in mzid.AuditCollection) { if (ac is PersonType) { AuditCollection.Add(new PersonObj(ac as PersonType, this)); } else if (ac is OrganizationType) { AuditCollection.Add(new OrganizationObj(ac as OrganizationType, this)); } } } // Referenced by anything using SampleInfo: SubSample, SpectrumIdentificationItem if (mzid.AnalysisSampleCollection != null && mzid.AnalysisSampleCollection.Count > 0) { AnalysisSampleCollection = new IdentDataList <SampleObj>(); foreach (var asc in mzid.AnalysisSampleCollection) { AnalysisSampleCollection.Add(new SampleObj(asc, this)); } } // Referenced by ProviderInfo, ProteinDetectionProtocol, SpectrumIdentificationProtocol, references AbstractContactInfo through ContactRoleInfo if (mzid.AnalysisSoftwareList != null && mzid.AnalysisSoftwareList.Count > 0) { AnalysisSoftwareList = new IdentDataList <AnalysisSoftwareObj>(); foreach (var asl in mzid.AnalysisSoftwareList) { AnalysisSoftwareList.Add(new AnalysisSoftwareObj(asl, this)); } } // Referenced by nothing, references AnalysisSoftwareInfo if (mzid.Provider != null) { _provider = new ProviderObj(mzid.Provider, this); } // Referenced by SpectrumIdentification, ProteinDetection, SpectrumIdentificationItem, PeptideEvidence, references AnalysisSoftwareInfo if (mzid.AnalysisProtocolCollection != null) { _analysisProtocolCollection = new AnalysisProtocolCollectionObj(mzid.AnalysisProtocolCollection, this); } // InputsInfo referenced by DBSequence, SpectrumIdentification.SearchDatabaseRefInfo, SpectrumIdentificationResult, SpectrumIdentification.InputSpectraRef if (mzid.DataCollection != null) { //this._dataCollection = new DataCollection(mzid.DataCollection, this); _dataCollection = new DataCollectionObj { Inputs = new InputsObj(mzid.DataCollection.Inputs, this) }; } // Referenced by SpectrumIdentificationItem, ProteinDetectionHypothesis, PeptideHypothesis // References InputsInfo.DBSequence, AnalysisProtocolCollection.SoftwareIdentificationProtocol.DatabaseTranslation.TranslationTable if (mzid.SequenceCollection != null) { _sequenceCollection = new SequenceCollectionObj(mzid.SequenceCollection, this); } // AnalysisData referenced by SpectrumIdentification, InputSpectrumIdentifications, ProteinDetection, references Peptides, PeptideEvidence, SampleInfo, MassTable, if (mzid.DataCollection != null) { _dataCollection.AnalysisData = new AnalysisDataObj(mzid.DataCollection.AnalysisData, this); } // References SpectrumIdentificationProtocol, SpectrumIdentificationList, SpectraData, SeqrchDatabaseInfo, ProteinDetectionList, ProteinDetectionProtocol if (mzid.AnalysisCollection != null) { _analysisCollection = new AnalysisCollectionObj(mzid.AnalysisCollection, this); } }