예제 #1
0
        /// <summary>
        /// writes the annotations to the current database file
        /// </summary>
        public void Write(DataStructures.GlobalCache cache)
        {
            // write the header
            _blockStream.WriteHeader(_header);

            // write out each of our arrays
            WriteItems(cache.RegulatoryElements);
            WriteItems(cache.Genes);
            WriteItems(cache.Introns);
            WriteItems(cache.MicroRnas);
            WriteItems(cache.PeptideSeqs);

            // write our transcripts
            WriteTranscripts(cache);
        }
예제 #2
0
        /// <summary>
        /// writes out each transcript in the cache
        /// </summary>
        private void WriteTranscripts(DataStructures.GlobalCache cache)
        {
            if (cache.Transcripts == null)
            {
                _writer.WriteOpt(0);
            }
            else
            {
                // create index dictionaries for each data type
                var geneIndices     = CreateIndex(cache.Genes);
                var intronIndices   = CreateIndex(cache.Introns);
                var microRnaIndices = CreateIndex(cache.MicroRnas);
                var peptideIndices  = CreateIndex(cache.PeptideSeqs);

                // write the transcripts
                _writer.WriteOpt(cache.Transcripts.Length);
                foreach (var transcript in cache.Transcripts)
                {
                    transcript.Write(_writer, geneIndices, intronIndices, microRnaIndices, peptideIndices);
                }
            }

            _writer.Write(CacheConstants.GuardInt);
        }