private static ExitCodes ProgramExecution() { var referenceProvider = new ReferenceSequenceProvider(FileUtilities.GetReadStream(_compressedReference)); TranscriptCacheData transcriptData; using (var transcriptCacheReader = new TranscriptCacheReader(FileUtilities.GetReadStream(CacheConstants.TranscriptPath(_transcriptCachePrefix)))) { transcriptData = transcriptCacheReader.Read(referenceProvider.RefIndexToChromosome); } var spliceIntervals = SpliceUtilities.GetSpliceIntervals(referenceProvider, transcriptData); var nirEnstToGeneSymbols = SpliceUtilities.GetEnstToGeneSymbols(referenceProvider, transcriptData); Dictionary <string, string> spliceAiEnstToGeneSymbols; using (var reader = new StreamReader(GZipUtilities.GetAppropriateReadStream(_geneInfoFile))) { spliceAiEnstToGeneSymbols = SpliceUtilities.GetSpliceAiGeneSymbols(reader); } var spliceAiToNirvanaGeneSymbols = SpliceUtilities.GetSymbolMapping(spliceAiEnstToGeneSymbols, nirEnstToGeneSymbols); Console.WriteLine($"Mapped {spliceAiToNirvanaGeneSymbols.Count} spliceAI gene symbols to Nirvana gene symbols (out of {spliceAiEnstToGeneSymbols.Count})"); var version = DataSourceVersionReader.GetSourceVersion(_inputFile + ".version"); string outFileName = $"{version.Name}_{version.Version}"; using (var spliceAiParser = new SpliceAiParser( GZipUtilities.GetAppropriateReadStream(_inputFile), referenceProvider, spliceIntervals, spliceAiToNirvanaGeneSymbols)) using (var nsaStream = FileUtilities.GetCreateStream(Path.Combine(_outputDirectory, outFileName + SaCommon.SaFileSuffix))) using (var indexStream = FileUtilities.GetCreateStream(Path.Combine(_outputDirectory, outFileName + SaCommon.SaFileSuffix + SaCommon.IndexSufix))) using (var nsaWriter = new NsaWriter(nsaStream, indexStream, version, referenceProvider, SaCommon.SpliceAiTag, true, true, SaCommon.SchemaVersion, false)) { nsaWriter.Write(spliceAiParser.GetItems()); } Console.WriteLine($"Total number of entries from Splice AI: {SpliceAiParser.Count}"); return(ExitCodes.Success); }
private static ExitCodes ProgramExecution() { var referenceProvider = new ReferenceSequenceProvider(FileUtilities.GetReadStream(_compressedReference)); TranscriptCacheData transcriptData; using (var transcriptCacheReader = new TranscriptCacheReader(FileUtilities.GetReadStream(CacheConstants.TranscriptPath(_transcriptCachePrefix)))) { transcriptData = transcriptCacheReader.Read(referenceProvider.RefIndexToChromosome); } var spliceIntervals = SpliceUtilities.GetSpliceIntervals(referenceProvider, transcriptData); var nirvanaGeneForest = SpliceUtilities.GetGeneForest(transcriptData); Console.WriteLine("Loaded transcripts and generated splice intervals."); Dictionary <string, List <string> > geneSymbolSynonyms; using (var geneInfoParser = new GeneInfoParser(GZipUtilities.GetAppropriateStreamReader(_geneInfoFile))) { geneSymbolSynonyms = geneInfoParser.GetGeneSymbolSynonyms(); } Console.WriteLine("Loaded gene symbol synonyms"); var version = DataSourceVersionReader.GetSourceVersion(_inputFile + ".version"); string outFileName = $"{version.Name}_{version.Version}"; using (var spliceAiParser = new SpliceAiParser( GZipUtilities.GetAppropriateReadStream(_inputFile), referenceProvider, spliceIntervals, nirvanaGeneForest, geneSymbolSynonyms)) using (var nsaStream = FileUtilities.GetCreateStream(Path.Combine(_outputDirectory, outFileName + SaCommon.SaFileSuffix))) using (var indexStream = FileUtilities.GetCreateStream(Path.Combine(_outputDirectory, outFileName + SaCommon.SaFileSuffix + SaCommon.IndexSufix))) { var nsaWriter = new NsaWriter(new ExtendedBinaryWriter(nsaStream), new ExtendedBinaryWriter(indexStream), version, referenceProvider, SaCommon.SpliceAiTag, true, true, SaCommon.SchemaVersion, false); nsaWriter.Write(spliceAiParser.GetItems()); } Console.WriteLine($"Total number of entries from Splice AI: {SpliceAiParser.Count}"); return(ExitCodes.Success); }