Example #1
0
        public void WriteProteinDatabase(string fastaFilePath, string name = "", string releaseDate = "")
        {
            if (CurrentStage != Stage.SearchSummary)
            {
                throw new ArgumentException("You must be in the Search Summary stage to write protein databases");
            }

            _writer.WriteStartElement("search_database");
            _writer.WriteAttributeString("seq_type", "AA");
            _writer.WriteAttributeString("local_path", fastaFilePath);

            name = (string.IsNullOrEmpty(name)) ? Path.GetFileNameWithoutExtension(fastaFilePath) : name;
            _writer.WriteAttributeString("database_name", name);

            if (!string.IsNullOrEmpty(releaseDate))
            {
                _writer.WriteAttributeString("database_release_date", releaseDate);
            }

            int entries = FastaReader.NumberOfEntries(fastaFilePath);

            _writer.WriteAttributeString("size_in_db_entries", entries.ToString());

            _writer.WriteEndElement(); // search_database
        }