Example #1
0
        /// <summary>
        /// Writes current data to a mzid file
        /// </summary>
        /// <param name="xml">
        /// A <see cref="System.String"/> with the output file name
        /// </param>
        public void Save(string xml)
        {
            Data.creationDate = DateTime.UtcNow;

            // CommonOntology
            Data.cvList = ListOntology.ToArray();

            // AnalysisSoftwareList
            Data.AnalysisSoftwareList = ListSW.ToArray();

            // Provider
            Data.Provider = Provider;

            // AuditCollection
            Data.AuditCollection              = new FuGECollectionAuditCollectionType();
            Data.AuditCollection.Person       = ListPeople.ToArray();
            Data.AuditCollection.Organization = ListOrganizations.ToArray();

            // SequenceCollection
            SequenceCollectionType seq = new SequenceCollectionType();

            seq.DBSequence          = ListProteins.ToArray();
            seq.Peptide             = ListPeptides.ToArray();
            Data.SequenceCollection = seq;

            // Serialization
            XmlSerializer serializer = new XmlSerializer(typeof(PSIPIMainmzIdentMLType));
            TextWriter    writer     = new StreamWriter(xml);

            serializer.Serialize(writer, Data);
            writer.Close();

            System.GC.Collect();
        }
Example #2
0
        /// <summary>
        /// Writes current data to a mzid file
        /// </summary>
        /// <param name="xml">
        /// A <see cref="System.String"/> with the output file name
        /// </param>
        public void Save(string xml)
        {
            Data.creationDate = DateTime.UtcNow;

            // AnalysisSoftwareList
            Data.AnalysisSoftwareList = ListSW.ToArray();

            // AuditCollection
            List <AbstractContactType> audit = new List <AbstractContactType>();

            audit.AddRange(ListOrganizations);
            audit.AddRange(ListPeople);
            Data.AuditCollection = audit.ToArray();

            // SequenceCollection
            SequenceCollectionType seq = new SequenceCollectionType();

            seq.DBSequence          = ListProteins.ToArray();
            seq.Peptide             = ListPeptides.ToArray();
            seq.PeptideEvidence     = ListEvidences.ToArray();
            Data.SequenceCollection = seq;

            // Serialization
            XmlSerializer serializer = new XmlSerializer(typeof(MzIdentMLType));
            TextWriter    writer     = new StreamWriter(xml);

            serializer.Serialize(writer, Data);
            writer.Close();
            //Data.SaveToFile( xml );

            System.GC.Collect();
        }