Example #1
0
        /// <summary>
        /// creates the global database
        /// </summary>
        public void CreateTranscriptCacheFile(string outputPrefix)
        {
            if (!_hasData)
            {
                throw new GeneralException("Data was not loaded before running CreateTranscriptCacheFile");
            }

            Console.Write("- creating transcript cache file... ");
            var createBenchmark = new Benchmark();

            var globalOutputPath = CacheConstants.TranscriptPath(outputPrefix);

            var customHeader = new GlobalCustomHeader(_transcriptReader.Header.VepReleaseTicks,
                                                      _transcriptReader.Header.VepVersion);

            var header = new FileHeader(CacheConstants.Identifier, CacheConstants.SchemaVersion,
                                        CacheConstants.DataVersion, _transcriptReader.Header.TranscriptSource, _currentTimeTicks, _transcriptReader.Header.GenomeAssembly, customHeader);

            var genes = ConvertGenes();

            using (var writer = new GlobalCacheWriter(globalOutputPath, header))
            {
                var cache = new VD.GlobalCache(header, _transcripts.ToArray(), _regulatoryElements.ToArray(),
                                               genes, _introns.ToArray(), _microRnas.ToArray(), _peptideSeqs.ToArray());

                writer.Write(cache);
            }

            Console.WriteLine("{0}", Benchmark.ToHumanReadable(createBenchmark.GetElapsedTime()));
        }
Example #2
0
        public static void WriteTranscriptCache(GlobalCache cache, string outputStub, List <string> outputFiles)
        {
            var outputPath = outputStub + ".ndb" + TempCacheExt;

            outputFiles.Add(outputPath);

            using (var writer = new GlobalCacheWriter(outputPath, (FileHeader)cache.Header))
            {
                writer.Write(cache);
            }
        }
Example #3
0
        public void Combine()
        {
            using (var reader1 = new GlobalCacheReader(_cachePath1))
                using (var reader2 = new GlobalCacheReader(_cachePath2))
                {
                    var cache1 = reader1.Read();
                    var cache2 = reader2.Read();

                    //todo: hardcoding the combined custom header, note that the date is March 2016 on the vep website but we useds to say 2016-04-29
                    var customHeader = new GlobalCustomHeader(DateTime.Parse("2016-04-29").Ticks, 84);

                    var header = new FileHeader(CacheConstants.Identifier, CacheConstants.SchemaVersion,
                                                CacheConstants.DataVersion, TranscriptDataSource.BothRefSeqAndEnsembl, DateTime.Now.Ticks, reader1.FileHeader.GenomeAssembly, customHeader);

                    CombinePredictionsCaches();

                    using (var writer = new GlobalCacheWriter(_outputCachePath, header))
                    {
                        List <RegulatoryElement> combinedRegElements;
                        List <Gene>           combinedGenes;
                        List <SimpleInterval> combinedIntrons;
                        List <SimpleInterval> combinedMirnas;
                        List <string>         combinedPeptides;
                        var combinedTranscripts = GetCombinedCacheElements(cache1, cache2, out combinedRegElements, out combinedGenes, out combinedIntrons, out combinedMirnas, out combinedPeptides);

                        var combinedCache = new GlobalCache(header, combinedTranscripts.ToArray(),
                                                            combinedRegElements.ToArray(),
                                                            combinedGenes.ToArray(),
                                                            combinedIntrons.ToArray(),
                                                            combinedMirnas.ToArray(),
                                                            combinedPeptides.ToArray()
                                                            );

                        Console.WriteLine("Writing combined cache...");
                        writer.Write(combinedCache);
                        Console.WriteLine("Done");
                    }
                }
        }