Beispiel #1
0
        public void mzidTest()
        {
            XmlSerializer _indexedSerializer = new XmlSerializer(typeof(mzIdentML.Generated.MzIdentMLType));
            var           _mzid = new mzIdentML.Generated.MzIdentMLType();

            _mzid.DataCollection = new mzIdentML.Generated.DataCollectionType();
            _mzid.DataCollection.AnalysisData = new mzIdentML.Generated.AnalysisDataType();
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList    = new mzIdentML.Generated.SpectrumIdentificationListType[1];
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0] = new mzIdentML.Generated.SpectrumIdentificationListType();
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult               = new mzIdentML.Generated.SpectrumIdentificationResultType[1];
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0]            = new mzIdentML.Generated.SpectrumIdentificationResultType();
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0].spectrumID = "spectrum 2";
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0].SpectrumIdentificationItem    = new mzIdentML.Generated.SpectrumIdentificationItemType[1];
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0].SpectrumIdentificationItem[0] = new mzIdentML.Generated.SpectrumIdentificationItemType();
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0].SpectrumIdentificationItem[0].experimentalMassToCharge        = 1134.2609130203 + 0.000001 * 1134.2609130203 + 0.000001;
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0].SpectrumIdentificationItem[0].calculatedMassToCharge          = 1134.26091302033;
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0].SpectrumIdentificationItem[0].calculatedMassToChargeSpecified = true;
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0].SpectrumIdentificationItem[0].chargeState      = 3;
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0].SpectrumIdentificationItem[0].cvParam          = new mzIdentML.Generated.CVParamType[1];
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0].SpectrumIdentificationItem[0].cvParam[0]       = new mzIdentML.Generated.CVParamType();
            _mzid.DataCollection.AnalysisData.SpectrumIdentificationList[0].SpectrumIdentificationResult[0].SpectrumIdentificationItem[0].cvParam[0].value = 100.ToString();

            _mzid.SequenceCollection = new mzIdentML.Generated.SequenceCollectionType();
            _mzid.SequenceCollection.PeptideEvidence            = new mzIdentML.Generated.PeptideEvidenceType[1];
            _mzid.SequenceCollection.PeptideEvidence[0]         = new mzIdentML.Generated.PeptideEvidenceType();
            _mzid.SequenceCollection.PeptideEvidence[0].isDecoy = false;
            _mzid.SequenceCollection.Peptide    = new mzIdentML.Generated.PeptideType[1];
            _mzid.SequenceCollection.Peptide[0] = new mzIdentML.Generated.PeptideType();
            _mzid.SequenceCollection.Peptide[0].PeptideSequence = "GPEAPPPALPAGAPPPCTAVTSDHLNSLLGNILR";
            _mzid.SequenceCollection.Peptide[0].Modification    = new mzIdentML.Generated.ModificationType[1];
            _mzid.SequenceCollection.Peptide[0].Modification[0] = new mzIdentML.Generated.ModificationType();
            _mzid.SequenceCollection.Peptide[0].Modification[0].locationSpecified = true;
            _mzid.SequenceCollection.Peptide[0].Modification[0].location          = 17;
            _mzid.SequenceCollection.Peptide[0].Modification[0].monoisotopicMassDeltaSpecified = true;
            _mzid.SequenceCollection.Peptide[0].Modification[0].monoisotopicMassDelta          = 57.02146373;
            _mzid.SequenceCollection.Peptide[0].Modification[0].cvParam              = new mzIdentML.Generated.CVParamType[1];
            _mzid.SequenceCollection.Peptide[0].Modification[0].cvParam[0]           = new mzIdentML.Generated.CVParamType();
            _mzid.SequenceCollection.Peptide[0].Modification[0].cvParam[0].accession = "UNIMOD:4";
            _mzid.SequenceCollection.Peptide[0].Modification[0].cvParam[0].name      = "Carbamidomethyl";
            _mzid.SequenceCollection.Peptide[0].Modification[0].cvParam[0].cvRef     = "UNIMOD";
            TextWriter writer = new StreamWriter("myIdentifications.mzid");

            _indexedSerializer.Serialize(writer, _mzid);
            writer.Close();

            var identifications = new MzidIdentifications("myIdentifications.mzid");

            Assert.AreEqual(1134.26091302033, identifications.calculatedMassToCharge(0));
            Assert.AreEqual(3, identifications.chargeState(0));
            Assert.AreEqual(1, identifications.Count);
            Assert.AreEqual(1134.26091302033 + 0.000001 * 1134.2609130203 + 0.000001, identifications.experimentalMassToCharge(0), 1e-10);
            Assert.IsFalse(identifications.isDecoy(0));
            Assert.AreEqual("UNIMOD:4", identifications.modificationAcession(0, 0));
            Assert.AreEqual("UNIMOD", identifications.modificationDictionary(0, 0));
            Assert.AreEqual(17, identifications.modificationLocation(0, 0));
            Assert.AreEqual(2, identifications.ms2spectrumIndex(0));
            Assert.AreEqual(1, identifications.NumModifications(0));
            Assert.AreEqual("GPEAPPPALPAGAPPPCTAVTSDHLNSLLGNILR", identifications.PeptideSequenceWithoutModifications(0));
        }